2023-07-26 03:06:05 +00:00
|
|
|
syntax = "v1"
|
|
|
|
|
|
|
|
info (
|
2023-08-04 08:50:01 +00:00
|
|
|
title: "支付模块"
|
|
|
|
desc: "支付相关"
|
2023-07-26 03:06:05 +00:00
|
|
|
author: ""
|
|
|
|
email: ""
|
|
|
|
)
|
|
|
|
|
|
|
|
import "basic.api"
|
|
|
|
|
|
|
|
service pay {
|
|
|
|
|
|
|
|
@handler OrderPaymentIntentHandler
|
|
|
|
post /api/pay/payment-intent(OrderPaymentIntentReq) returns (response);
|
2023-07-26 11:23:16 +00:00
|
|
|
|
2023-07-28 11:03:36 +00:00
|
|
|
@handler OrderRefundHandler
|
|
|
|
post /api/pay/refund(OrderRefundReq) returns (response);
|
|
|
|
|
2023-07-26 11:23:16 +00:00
|
|
|
@handler StripeWebhookHandler
|
2023-07-28 03:15:42 +00:00
|
|
|
post /api/pay/stripe-webhook(StripeWebhookReq) returns (response);
|
2023-07-28 11:03:36 +00:00
|
|
|
|
2023-07-26 03:06:05 +00:00
|
|
|
}
|
|
|
|
|
2023-07-28 11:03:36 +00:00
|
|
|
// 退款
|
|
|
|
type (
|
|
|
|
OrderRefundReq struct{}
|
|
|
|
OrderRefundRes struct{}
|
|
|
|
)
|
|
|
|
|
2023-07-26 03:06:05 +00:00
|
|
|
// 生成预付款
|
|
|
|
type (
|
|
|
|
OrderPaymentIntentReq {
|
|
|
|
Sn string `form:"sn"` //订单编号
|
|
|
|
DeliveryMethod int64 `form:"delivery_method"` //发货方式
|
|
|
|
AddressId int64 `form:"address_id"` //地址id
|
|
|
|
PayMethod int64 `form:"pay_method"` //支付方式
|
|
|
|
}
|
|
|
|
OrderPaymentIntentRes {
|
2023-07-28 03:15:42 +00:00
|
|
|
RedirectUrl string `json:"redirect_url"`
|
|
|
|
ClientSecret string `json:"clientSecret"`
|
2023-07-26 03:06:05 +00:00
|
|
|
}
|
2023-07-26 11:23:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// StripeWebhook支付通知
|
|
|
|
type (
|
|
|
|
StripeWebhookReq {
|
2023-07-28 03:15:42 +00:00
|
|
|
Payload []byte `json:"base_byte_slice,optional"`
|
|
|
|
StripeSignature string `json:"Stripe-Signature"`
|
2023-07-28 11:03:36 +00:00
|
|
|
RemoteAddr string `json:"remote_addr"`
|
2023-07-26 11:23:16 +00:00
|
|
|
}
|
2023-07-26 03:06:05 +00:00
|
|
|
)
|