Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
fbd7578058 | |||
cee52be722 | |||
fb8bac623c | |||
69beac21ff | |||
736975ed2e | |||
7af00f999b | |||
7ee27e263b | |||
26ed034734 | |||
2131894c7f | |||
df3ad7fd57 | |||
191011fa53 | |||
|
817db127a8 | ||
e869c22742 |
8729
api/payment/payment.pb.go
Normal file
8729
api/payment/payment.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
743
api/payment/payment.proto
Normal file
743
api/payment/payment.proto
Normal file
@ -0,0 +1,743 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
package payment;
|
||||||
|
|
||||||
|
option go_package = "./payment";
|
||||||
|
|
||||||
|
//import "pb/descriptor.proto";
|
||||||
|
service Payment{
|
||||||
|
|
||||||
|
// 统一渠道支付
|
||||||
|
rpc CreatePay(CreatePayRequest) returns (CreatePayResponse); // 创建支付
|
||||||
|
rpc NotifyPay(NotifyPayRequest) returns (NotifyPayResponse); // 支付回调
|
||||||
|
rpc QueryPayByOutTradeNo(PayQueryRequest) returns (PayQueryResponse);// 根据外部流水号和来源,查看付款信息
|
||||||
|
rpc QueryExportPay(ExportPayRequest) returns (ExportPayResponse); // 导出数据报表
|
||||||
|
rpc CreateRefund(CreateRefundRequest) returns (CreateRefundResponse); // 发起退款,暂定公共
|
||||||
|
|
||||||
|
rpc StripeGermanyWebhook(GetCheckoutWebhookRequest) returns(GetCheckoutWebhookResponse){};// stripe支付回调, 德国账号
|
||||||
|
|
||||||
|
rpc AliCommonWebhook(NotifyPayRequest) returns (NotifyPayResponse){}; // 支付宝支付回调,通用
|
||||||
|
|
||||||
|
rpc WechatFengLianWebhook(NotifyPayRequest) returns (NotifyPayResponse){}; // 微信支付回调,丰链
|
||||||
|
rpc AntomWebhook(AntomNotifyPayRequest) returns (AntomNotifyPayResponse){}; // Antom支付回调
|
||||||
|
rpc QueryAntomPayByCheckoutSessionId(AntomPayQueryRequest) returns (AntomPayQueryResponse){}; // 根据checkoutSessionIds查询支付情况
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ========== 下面的暂时没用
|
||||||
|
|
||||||
|
|
||||||
|
// stripe支付
|
||||||
|
rpc CreateStripeCheckoutSession(CreateStripeCheckoutSessionRequest) returns (CreateStripeCheckoutSessionResponse){}; // 创建支付会话链接
|
||||||
|
// rpc CommonCheckoutWebhook(GetCheckoutWebhookRequest) returns(GetCheckoutWebhookResponse){}; // 支付回调,通用
|
||||||
|
|
||||||
|
// 支付宝支付
|
||||||
|
rpc AliWapPay(AliWapPayRequest) returns (AliWapPayResponse) {}; // ali网页支付
|
||||||
|
rpc AliAppPay(AliAppPayRequest) returns (AliAppPayResponse) {}; // aliApp支付
|
||||||
|
rpc AliNativePay(AliNativePayRequest) returns (AliNativePayResponse) {}; // aliApp当面支付
|
||||||
|
rpc AliPcWabPay(AliPcWabPayRequest) returns (AliPcWabPayResponse) {}; // ali电脑网页支付
|
||||||
|
rpc AliReFund(AliReFundRequest) returns (AliReFundResponse) {}; // ali退款
|
||||||
|
rpc AliNotify(AliNotifyRequest) returns (AliNotifyResponse) {}; // ali回调
|
||||||
|
rpc AliQueryByOutTradeNo(AliQueryByOutTradeNoRequest) returns (AliQueryByOutTradeNoResponse) {}; // ali查询订单
|
||||||
|
rpc AliRefundQueryByOutTradeNo(AliRefundQueryByOutTradeNoRequest) returns (AliRefundQueryByOutTradeNoResponse) {}; // ali查询退款订单
|
||||||
|
|
||||||
|
// 微信支付
|
||||||
|
rpc WechatJsApiPay(WechatJsApiPayRequest) returns (WechatJsApiPayResponse) {}; // jsapi 本地支付订单保存+微信支付平台预支付订单生成
|
||||||
|
rpc WechatJsApiQueryByOutTradeNo(WechatJsApiQueryByOutTradeNoRequest) returns (WechatJsApiQueryByOutTradeNoResponse) {}; // 通过outTrandeNo 获取 微信 jsapi 支付订单状态
|
||||||
|
rpc GetPayByOutTradeNo(GetPayByOutTradeNoRequest) returns (GetPayByOutTradeNoResponse) {}; // 通过outTrandeNo 查询支付的id
|
||||||
|
rpc WechatJsApiRefunds(WechatJsApiRefundsRequest) returns (WechatJsApiRefundsResponse) {}; //
|
||||||
|
rpc SetPayOk(WechatPayOkRequest) returns (CommonResponse) {}; //
|
||||||
|
rpc WechatAppPay(WechatAppPayRequest) returns (WechatAppPayResponse) {}; // app 本地支付订单保存+微信支付平台预支付订单生成
|
||||||
|
rpc WechatAppQueryByOutTradeNo(WechatAppQueryByOutTradeNoRequest) returns (WechatAppQueryByOutTradeNoResponse) {}; // 通过outTrandeNo 获取 微信 App 支付订单状态
|
||||||
|
rpc WechatNativePay(WechatNativePayRequest) returns (WechatNativePayResponse) {}; // native 本地支付订单保存+微信付款链接生成
|
||||||
|
rpc WechatNativeQueryByOutTradeNo(WechatNativeQueryByOutTradeNoRequest) returns (WechatNativeQueryByOutTradeNoResponse) {}; // 通过outTrandeNo 获取 微信 App 支付订单状态
|
||||||
|
rpc WechatRefundQueryByOutRefundNo(WechatRefundQueryByOutRefundNoRequest) returns (WechatRefundQueryByOutRefundNoResponse) {}; // wx查询退款订单
|
||||||
|
rpc WechatH5Pay(WechatH5PayRequest) returns (WechatH5PayResponse) {}; // H5 本地支付订单保存+微信支付平台预支付订单生成
|
||||||
|
rpc WechatH5QueryByOutTradeNo(WechatH5QueryByOutTradeNoRequest) returns (WechatH5QueryByOutTradeNoResponse) {}; // 通过outTrandeNo 获取 微信 H5 支付订单状态
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
message AntomPayQueryRequest {
|
||||||
|
repeated string checkoutSessionIds = 1 [json_name = "checkoutSessionIds"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AntomPayQueryResponse {
|
||||||
|
repeated PaymentOrderInfo infos = 1 [json_name = "infos"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AntomNotifyPayRequest {
|
||||||
|
string notifyType = 1 [json_name = "notifyType"];
|
||||||
|
string requestId = 2 [json_name = "requestId"];
|
||||||
|
string paymentId = 3 [json_name = "paymentId"];
|
||||||
|
string paymentTime = 4 [json_name = "paymentTime"];
|
||||||
|
string resultStatus = 5 [json_name = "resultStatus"];
|
||||||
|
string resultMessage = 6 [json_name = "resultMessage"];
|
||||||
|
string channelCode = 7 [json_name = "channelCode"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AntomNotifyPayResponse {
|
||||||
|
string status = 1 [json_name = "status"];
|
||||||
|
string outTradeNo = 2 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreatePayRequest {
|
||||||
|
string postUrl = 1 [json_name = "postUrl"]; // 请求接口
|
||||||
|
string subject = 2 [json_name = "subject"]; // 订单标题
|
||||||
|
string productUUID = 3 [json_name = "productUUID"]; // 商品uid
|
||||||
|
string productName = 4 [json_name = "productName"]; // 商品名称
|
||||||
|
string productImg = 5 [json_name = "productImg"]; // 商品图像
|
||||||
|
string productDescription = 6 [json_name = "productDescription"]; // 商品描述
|
||||||
|
|
||||||
|
string quitUrl = 7 [json_name = "quitUrl"]; // 退出url
|
||||||
|
string notifyUrl = 8 [json_name = "notifyUrl"]; // 回调url
|
||||||
|
string returnUrl = 9 [json_name = "returnUrl"]; // 返回url
|
||||||
|
|
||||||
|
string outTradeNo = 10 [json_name = "outTradeNo"]; // 外部流水号
|
||||||
|
string channelTradeNo = 11 [json_name = "channelTradeNo"]; // 渠道流水号
|
||||||
|
string checkSessionId = 12 [json_name = "checkSessionId"]; // stripe的支付会话id
|
||||||
|
|
||||||
|
int64 amount = 13 [json_name = "amount"]; // 金额
|
||||||
|
string currency = 14 [json_name = "currency"]; // 币种
|
||||||
|
|
||||||
|
string payee = 15 [json_name = "payee"]; // 收款方
|
||||||
|
string channelType = 16 [json_name = "channelType"]; // 支付渠道 alipay-支付宝 wxpay-微信 stripe-Stripe支付
|
||||||
|
string platform = 17 [json_name = "platform"]; // 支付具体来源,是app还是h5还是jsapi还是wap
|
||||||
|
string domain = 18 [json_name = "domain"]; // 使用平台
|
||||||
|
string businessType = 19 [json_name = "businessType"]; // 业务类型,用来确认mq发送
|
||||||
|
|
||||||
|
string language = 20 [json_name = "language"]; // 语言,国际化
|
||||||
|
string clientIp = 21 [json_name = "clientIp"];
|
||||||
|
|
||||||
|
string openID = 22 [json_name = "openID"]; // 微信的参数
|
||||||
|
int32 timeExpire = 23 [json_name = "timeExpire"]; // 微信的参数
|
||||||
|
string locale = 24 [json_name = "locale"]; // stripe参数,区域,跟页面国际化有关
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreatePayResponse {
|
||||||
|
string url = 1 [json_name = "url"];
|
||||||
|
string logRecordID = 2 [json_name = "log_record_ID"];
|
||||||
|
string msg = 3 [json_name="msg"];
|
||||||
|
|
||||||
|
string appid = 4 [json_name = "appid"];
|
||||||
|
string timeStamp = 5 [json_name = "timeStamp"];
|
||||||
|
string package = 6 [json_name = "package"];
|
||||||
|
string signType = 7 [json_name = "signType"];
|
||||||
|
string nonceStr = 8 [json_name = "nonceStr"];
|
||||||
|
string paySign = 9 [json_name = "paySign"];
|
||||||
|
string prepayId = 10 [json_name = "prepayId"];
|
||||||
|
string partnerId = 11 [json_name = "partnerId"];
|
||||||
|
|
||||||
|
string checkoutSessionId = 12 [json_name = "checkoutSessionId"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateRefundRequest {
|
||||||
|
string postUrl = 1 [json_name = "postUrl"]; // 请求接口
|
||||||
|
string subject = 2 [json_name = "subject"]; // 订单标题
|
||||||
|
string productUUID = 3 [json_name = "productUUID"]; // 商品uid
|
||||||
|
string outTradeNo = 4 [json_name = "outTradeNo"]; // 外部流水号
|
||||||
|
string channelTradeNo = 5 [json_name = "channelTradeNo"]; // 渠道流水号
|
||||||
|
string checkSessionId = 6 [json_name = "checkSessionId"]; // stripe的支付会话id
|
||||||
|
int64 refundAmount = 7 [json_name = "refundAmount"]; // 退款金额
|
||||||
|
string currency = 8 [json_name = "currency"]; // 币种
|
||||||
|
string payee = 9 [json_name = "payee"]; // 收款方
|
||||||
|
string channelType = 10 [json_name = "channelType"]; // 支付渠道 alipay-支付宝 wxpay-微信 stripe-Stripe支付
|
||||||
|
string platform = 11 [json_name = "platform"]; // 支付具体来源,是app还是h5还是jsapi还是wap
|
||||||
|
string domain = 12 [json_name = "domain"]; // 使用平台
|
||||||
|
string businessType = 13 [json_name = "businessType"]; // 业务类型,用来确认mq发送
|
||||||
|
string language = 14 [json_name = "language"]; // 语言,国际化
|
||||||
|
string clientIp = 15 [json_name = "clientIp"];
|
||||||
|
string openID = 16 [json_name = "openID"]; // 微信的参数
|
||||||
|
int64 creatorId = 17 [json_name = "creatorId"]; // 创建人id
|
||||||
|
string creatorName = 18 [json_name = "creatorName"]; // 创建人名称
|
||||||
|
string refundReason = 19 [json_name = "refundReason"]; // 退款理由
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateRefundResponse {
|
||||||
|
int64 code = 1 [json_name = "code"];
|
||||||
|
string msg = 2 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message NotifyPayRequest {
|
||||||
|
string postUrl = 1; // 请求接口
|
||||||
|
HttpRequest http_request = 2;
|
||||||
|
string rawQuery = 3 [json_name="raw_query"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message NotifyPayResponse {
|
||||||
|
string msg = 1;
|
||||||
|
string outTradeNo = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message HttpRequest {
|
||||||
|
string method = 1;
|
||||||
|
string url = 2;
|
||||||
|
map<string, string> headers = 3;
|
||||||
|
bytes body = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommonMsg{
|
||||||
|
string msg = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message EmptyRequest{}
|
||||||
|
|
||||||
|
message CreateStripeCheckoutSessionRequest {
|
||||||
|
string productUUID = 1 [json_name = "productUUID"];
|
||||||
|
string productName = 2 [json_name = "productName"];
|
||||||
|
int64 productQuantity = 3 [json_name = "productQuantity"];
|
||||||
|
int64 productAllPrice = 4 [json_name = "productAllPrice"];
|
||||||
|
string productDescription = 5 [json_name = "productDescription"];
|
||||||
|
string productImageUrl = 6 [json_name = "productImageUrl"];
|
||||||
|
string productPriceCurrency = 7 [json_name = "productPriceCurrency"];
|
||||||
|
string createrID = 8 [json_name = "createrID"];
|
||||||
|
string createrName = 9 [json_name = "createrName"];
|
||||||
|
string domain = 10 [json_name = "domain"];
|
||||||
|
string successUrl = 11 [json_name = "successUrl"];
|
||||||
|
string cancelUrl = 12 [json_name = "cancelUrl"];
|
||||||
|
string outTradeNo = 13 [json_name = "outTradeNo"];
|
||||||
|
string locale = 14 [json_name = "locale"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message CreateStripeCheckoutSessionResponse {
|
||||||
|
string checkoutSessionId = 1 [json_name = "checkoutSessionId"];
|
||||||
|
string checkoutSessionUrl = 2 [json_name = "checkoutSessionUrl"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCheckoutWebhookRequest {
|
||||||
|
string postUrl = 1; // 请求接口
|
||||||
|
string type = 2; // 事件类型,例如"payment_intent.succeeded"
|
||||||
|
string payload = 3; // 事件的原始JSON payload
|
||||||
|
string signature = 4; // Stripe-Signature头的值,用于验证事件
|
||||||
|
string webhookKey = 5; // Webhook密钥
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetCheckoutWebhookResponse {
|
||||||
|
bool success = 1; // 处理是否成功
|
||||||
|
string message = 2; // 可选的处理消息
|
||||||
|
string outTradeNo = 3 [json_name = "outTradeNo"];
|
||||||
|
string paymentIntentStatus = 4 [json_name = "paymentIntentStatus"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetStripePaymentIntentInfoRequest {
|
||||||
|
string checkoutSessionId = 1 [json_name = "checkoutSessionId"];
|
||||||
|
string createrID = 2 [json_name = "createrID"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetStripePaymentIntentInfoResponse {
|
||||||
|
string checkoutSessionId = 1 [json_name = "checkoutSessionId"];
|
||||||
|
string checkoutSessionStatus = 2 [json_name = "checkoutSessionStatus"];
|
||||||
|
string paymentIntentId = 3 [json_name = "paymentIntentId"];
|
||||||
|
string paymentIntentCreated = 4 [json_name = "paymentIntentCreated"];
|
||||||
|
string paymentIntentStatus = 5 [json_name = "paymentIntentStatus"];
|
||||||
|
string chargeId = 6 [json_name = "chargeId"];
|
||||||
|
int64 payPrice = 7 [json_name = "payPrice"];
|
||||||
|
string payExchangeRate = 8 [json_name = "payExchangeRate"];
|
||||||
|
string payCurrency = 9 [json_name = "payCurrency"];
|
||||||
|
string accountCurrency = 10 [json_name = "accountCurrency"];
|
||||||
|
int64 afterRatePayPrice = 11 [json_name = "afterRatePayPrice"];
|
||||||
|
int64 payHandingFee = 12 [json_name = "payHandingFee"];
|
||||||
|
int64 afterRatePayNetAmount = 13 [json_name = "afterRatePayNetAmount"];
|
||||||
|
string customerId = 14 [json_name = "customerId"];
|
||||||
|
int64 refundPrice = 15 [json_name = "refundPrice"];
|
||||||
|
string outTradeNo = 16 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetRefundInfoRequest {
|
||||||
|
string refundId = 1 [json_name = "refundId"];
|
||||||
|
string createrID = 2 [json_name = "createrID"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetRefundInfoResponse {
|
||||||
|
string refundStatus = 1 [json_name = "refundStatus"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliWapPayRequest {
|
||||||
|
string subject = 1 [json_name = "subject"];
|
||||||
|
string productCode = 2 [json_name = "product_code"];
|
||||||
|
string outTradeNo = 3 [json_name = "out_trade_no"];
|
||||||
|
string quitUrl = 4 [json_name = "quit_url"];
|
||||||
|
string notifyUrl = 5 [json_name = "notify_url"];
|
||||||
|
string returnUrl = 6 [json_name = "return_url"];
|
||||||
|
int32 totalAmount = 7 [json_name = "total_amount"];
|
||||||
|
int32 timeExpire = 8 [json_name = "time_expire"];
|
||||||
|
string domain = 9 ;
|
||||||
|
string platform = 10 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliWapPayResponse {
|
||||||
|
string url = 1 [json_name = "url"];
|
||||||
|
string logRecordID = 2 [json_name = "log_record_ID"];
|
||||||
|
string msg = 3 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliAppPayRequest {
|
||||||
|
string subject = 1 [json_name = "subject"];
|
||||||
|
string productCode = 2 [json_name = "product_code"];
|
||||||
|
string outTradeNo = 3 [json_name = "out_trade_no"];
|
||||||
|
string quitUrl = 4 [json_name = "quit_url"];
|
||||||
|
string notifyUrl = 5 [json_name = "notify_url"];
|
||||||
|
string returnUrl = 6 [json_name = "return_url"];
|
||||||
|
string totalAmount = 7 [json_name = "total_amount"];
|
||||||
|
int32 timeExpire = 8 [json_name = "time_expire"];
|
||||||
|
string domain = 9 ;
|
||||||
|
string platform = 10 ;
|
||||||
|
int32 payType = 11 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliAppPayResponse {
|
||||||
|
string url = 1 [json_name = "url"];
|
||||||
|
string logRecordID = 2 [json_name = "log_record_ID"];
|
||||||
|
string msg = 3 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliNativePayRequest {
|
||||||
|
string subject = 1 [json_name = "subject"];
|
||||||
|
string outTradeNo = 2 [json_name = "out_trade_no"];
|
||||||
|
string notifyUrl = 3 [json_name = "notify_url"];
|
||||||
|
int32 totalAmount = 4 [json_name = "total_amount"];
|
||||||
|
int32 timeExpire = 5 [json_name = "time_expire"];
|
||||||
|
string domain = 6 [json_name = "domain"];
|
||||||
|
string platform = 7 [json_name = "platform"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliNativePayResponse {
|
||||||
|
string url = 1 [json_name = "url"];
|
||||||
|
string msg = 2 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliPcWabPayRequest {
|
||||||
|
string subject = 1 [json_name = "subject"];
|
||||||
|
string outTradeNo = 2 [json_name = "out_trade_no"];
|
||||||
|
string notifyUrl = 3 [json_name = "notify_url"];
|
||||||
|
int32 totalAmount = 4 [json_name = "total_amount"];
|
||||||
|
int32 timeExpire = 5 [json_name = "time_expire"];
|
||||||
|
string domain = 6 [json_name = "domain"];
|
||||||
|
string platform = 7 [json_name = "platform"];
|
||||||
|
string quitUrl = 8 [json_name = "quit_url"];
|
||||||
|
string returnUrl = 9 [json_name = "return_url"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliPcWabPayResponse {
|
||||||
|
string pageRedirectionData = 1 [json_name = "page_redirection_data"];
|
||||||
|
string msg = 2 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliReFundRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "out_trade_no"];
|
||||||
|
int32 totalAmount = 2 [json_name = "total_amount"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliReFundResponse {
|
||||||
|
string tradeNo = 1 [json_name = "trade_no"];
|
||||||
|
string outTradeNo = 2 [json_name = "out_trade_no"];
|
||||||
|
string buyer_logon_id = 3 [json_name = "buyer_logon_id"];
|
||||||
|
string refund_fee = 4 [json_name = "refund_fee"];
|
||||||
|
string msg = 5 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliNotifyRequest {
|
||||||
|
string rawQuery = 1 [json_name="raw_query"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliNotifyResponse {
|
||||||
|
string notifyTime = 1 [json_name="notify_time"];
|
||||||
|
string notifyType = 2 [json_name="notify_type"];
|
||||||
|
string notifyId = 3 [json_name="notify_id"];
|
||||||
|
string appId = 4 [json_name="app_id"];
|
||||||
|
string version = 5 [json_name="version"];
|
||||||
|
string signType = 6 [json_name="sign_type"];
|
||||||
|
string sign = 7 [json_name="sign"];
|
||||||
|
string tradeNo = 8 [json_name="trade_no"];
|
||||||
|
string outTradeNo = 9 [json_name="out_trade_no"] ;
|
||||||
|
string buyerLogonId = 10 [json_name="buyer_logon_id"] ;
|
||||||
|
string buyerId = 11 [json_name="buyer_id"] ;
|
||||||
|
string tradeStatus = 12 [json_name="trade_status"] ;
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliQueryByOutTradeNoRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliQueryByOutTradeNoResponse {
|
||||||
|
string tradeNo = 1 [json_name = "trade_no"];
|
||||||
|
string outTradeNo = 2 [json_name = "out_trade_no"];
|
||||||
|
string buyerLogonId = 3 [json_name = "buyer_logon_id"];
|
||||||
|
string tradeStatus = 4 [json_name = "trade_status"];
|
||||||
|
string totalAmount = 5 [json_name = "total_amount"];
|
||||||
|
string buyerUserID = 6 [json_name = "buyer_user_id"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliRefundQueryByOutTradeNoRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message AliRefundQueryByOutTradeNoResponse {
|
||||||
|
string tradeNo = 1 [json_name = "trade_no"];
|
||||||
|
string outTradeNo = 2 [json_name = "out_trade_no"];
|
||||||
|
string out_request_no = 3 [json_name = "out_request_no"];
|
||||||
|
string total_amount = 4 [json_name = "total_amount"];
|
||||||
|
string refund_amount = 5 [json_name = "refund_amount"];
|
||||||
|
string refund_status = 6 [json_name = "refund_status"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatJsApiPayRequest {
|
||||||
|
string Description = 1 [json_name = "description"];
|
||||||
|
string OutTradeNo = 2 [json_name = "outTradeNo"];
|
||||||
|
int64 Cent = 3 [json_name = "cent"];
|
||||||
|
string OpenID = 4 [json_name = "openID"];
|
||||||
|
string NotifyUrl = 5 [json_name = "notifyUrl"];
|
||||||
|
string AppID = 6 [json_name = "appID"];
|
||||||
|
string ClientIP = 7 [json_name = "ClientIP"];
|
||||||
|
uint32 recordId = 9 ;
|
||||||
|
string domain = 10 ;
|
||||||
|
string platform = 11 ;
|
||||||
|
string scene = 12 ;
|
||||||
|
int32 timeExpire = 13 [json_name = "time_expire"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message WechatJsApiPayResponse {
|
||||||
|
string Appid = 1 [json_name = "appid"];
|
||||||
|
string TimeStamp = 2 [json_name = "timeStamp"];
|
||||||
|
string Package = 3 [json_name = "package"];
|
||||||
|
string SignType = 4 [json_name = "signType"];
|
||||||
|
string NonceStr = 5 [json_name = "nonceStr"];
|
||||||
|
string PaySign = 6 [json_name = "paySign"];
|
||||||
|
string PrepayId = 7 [json_name = "prepayId"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatAppPayResponse {
|
||||||
|
string Appid = 1 [json_name = "appid"];
|
||||||
|
string TimeStamp = 2 [json_name = "timeStamp"];
|
||||||
|
string Package = 3 [json_name = "package"];
|
||||||
|
string SignType = 4 [json_name = "signType"];
|
||||||
|
string NonceStr = 5 [json_name = "nonceStr"];
|
||||||
|
string PaySign = 6 [json_name = "paySign"];
|
||||||
|
string PrepayId = 7 [json_name = "prepayId"];
|
||||||
|
string PartnerId = 8 [json_name = "partnerId"];
|
||||||
|
string msg = 9 [json_name="msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatJsApiQueryByOutTradeNoRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatJsApiQueryByOutTradeNoResponse {
|
||||||
|
string appID = 1 [json_name = "appID"];
|
||||||
|
string mchID = 2 [json_name = "mch_id"];
|
||||||
|
string outTradeNo = 3 [json_name = "out_trade_no"];
|
||||||
|
string transactionId = 4 [json_name = "transaction_id"];
|
||||||
|
string tradeType = 5 [json_name = "trade_type"];
|
||||||
|
string tradeState = 6 [json_name = "trade_state"];
|
||||||
|
string bankType = 7 [json_name = "bank_ype"];
|
||||||
|
string successTime = 8 [json_name = "success_time"];
|
||||||
|
string openID = 9 [json_name = "open_id"];
|
||||||
|
int32 total = 10 [json_name = "total"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatAppQueryByOutTradeNoRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatAppQueryByOutTradeNoResponse {
|
||||||
|
string appID = 1 [json_name = "appID"];// 服务提供商的应用ID
|
||||||
|
string mchID = 2 [json_name = "mch_id"];// 服务商商户ID
|
||||||
|
// string subAppId = 3 [json_name = "sub_appid"]; // 子应用ID
|
||||||
|
// string subMchId = 4 [json_name = "sub_mchid"];// 子商户ID
|
||||||
|
string outTradeNo = 5 [json_name = "out_trade_no"];// 订单号
|
||||||
|
string transactionId = 6 [json_name = "transaction_id"];// 微信交易ID
|
||||||
|
string tradeType = 7 [json_name = "trade_type"];// 交易类型
|
||||||
|
string tradeState = 8 [json_name = "trade_state"];// 交易状态
|
||||||
|
string tradeStateDesc = 9 [json_name = "trade_state_desc"]; // 交易状态描述
|
||||||
|
string bankType = 10 [json_name = "bank_type"]; // 银行类型
|
||||||
|
string attach = 11 [json_name = "attach"]; // 附加数据
|
||||||
|
string successTime = 12 [json_name = "success_time"];// 支付成功时间
|
||||||
|
|
||||||
|
message Payer {// 付款人信息
|
||||||
|
string openid = 1 [json_name = "openid"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message Amount {// 金额信息
|
||||||
|
int64 total = 1 [json_name = "total"];// 总金额
|
||||||
|
int64 payerTotal = 2 [json_name = "payer_total"];// 付款人支付的金额
|
||||||
|
string currency = 3 [json_name = "currency"];// 货币类型
|
||||||
|
string payerCurrency = 4 [json_name = "payer_currency"];// 付款人货币类型
|
||||||
|
}
|
||||||
|
|
||||||
|
message PromotionDetail {// 促销详情
|
||||||
|
string couponId = 1 [json_name = "coupon_id"];// 优惠券ID
|
||||||
|
string name = 2 [json_name = "name"];// 名称
|
||||||
|
string scope = 3 [json_name = "scope"];// 范围
|
||||||
|
string type = 4 [json_name = "type"];// 类型
|
||||||
|
int64 amount = 5 [json_name = "amount"];// 金额
|
||||||
|
string stockId = 6 [json_name = "stock_id"];// 库存ID
|
||||||
|
int64 wechatpayContribute = 7 [json_name = "wechatpay_contribute"];// 微信支付贡献的金额
|
||||||
|
int64 merchantContribute = 8 [json_name = "merchant_contribute"];// 商户贡献的金额
|
||||||
|
int64 otherContribute = 9 [json_name = "other_contribute"];// 其他贡献的金额
|
||||||
|
string currency = 10 [json_name = "currency"];// 货币类型
|
||||||
|
}
|
||||||
|
// 包含促销详情列表
|
||||||
|
repeated PromotionDetail promotionDetail = 13 [json_name = "promotion_detail"];
|
||||||
|
// 付款人信息
|
||||||
|
Payer payer = 14;
|
||||||
|
// 金额信息
|
||||||
|
Amount amount = 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message GetPayByOutTradeNoRequest {
|
||||||
|
string OutTradeNo = 4 [json_name = "OutTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message GetPayByOutTradeNoResponse {
|
||||||
|
string outTradeNo = 1 ;
|
||||||
|
uint32 recordId = 2 ;
|
||||||
|
string cent = 3 ;
|
||||||
|
string platform = 4 ;
|
||||||
|
string domain = 5 ;
|
||||||
|
string scene = 6 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatJsApiRefundsResponse {
|
||||||
|
string RefundId = 1 [json_name = "RefundId"];
|
||||||
|
string OutRefundNo = 2 [json_name = "OutRefundNo"];
|
||||||
|
string TransactionId = 3 [json_name = "TransactionId"];
|
||||||
|
string OutTradeNo = 4 [json_name = "OutTradeNo"];
|
||||||
|
string SuccessTime = 5 [json_name = "SuccessTime"];
|
||||||
|
string CreateTime = 6 [json_name = "CreateTime"];
|
||||||
|
string Status = 7 [json_name = "Status"];
|
||||||
|
string Amount = 8 [json_name = "Amount"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message WechatNativePayRequest {
|
||||||
|
string description = 1 [json_name = "description"];
|
||||||
|
string outTradeNo = 2 [json_name = "outTradeNo"];
|
||||||
|
int32 cent = 3 [json_name = "cent"];
|
||||||
|
string notifyUrl = 5 [json_name = "notifyUrl"];
|
||||||
|
string appID = 6 [json_name = "appID"];
|
||||||
|
string clientIP = 7 [json_name = "ClientIP"];
|
||||||
|
uint32 recordId = 8 ;
|
||||||
|
string domain = 9 ;
|
||||||
|
string platform = 10 ;
|
||||||
|
string scene = 11 ;
|
||||||
|
int32 timeExpire = 12 [json_name = "time_expire"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatNativePayResponse {
|
||||||
|
string codeUrl = 1 [json_name = "code_url"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatNativeQueryByOutTradeNoRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatRefundQueryByOutRefundNoRequest {
|
||||||
|
string outRefundNo = 1 [json_name = "out_refund_no"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatRefundQueryByOutRefundNoResponse {
|
||||||
|
string refundId = 1 [json_name = "refund_id"];
|
||||||
|
string outRefundNo = 2 [json_name = "out_refund_no"];
|
||||||
|
string transactionId = 3 [json_name = "transaction_id"];
|
||||||
|
string outTradeNo = 4 [json_name = "out_trade_no"];
|
||||||
|
string channel = 5 [json_name = "channel"];
|
||||||
|
string userReceivedAccount = 6 [json_name = "user_received_account"];
|
||||||
|
string successTime = 7 [json_name = "success_time"];
|
||||||
|
string createTime = 8 [json_name = "create_time"];
|
||||||
|
string status = 9 [json_name = "status"];
|
||||||
|
int32 total = 10 [json_name = "total"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatNativeQueryByOutTradeNoResponse {
|
||||||
|
string appID = 1 [json_name = "appID"];
|
||||||
|
string mchID = 2 [json_name = "mch_id"];
|
||||||
|
string outTradeNo = 3 [json_name = "out_trade_no"];
|
||||||
|
string transactionId = 4 [json_name = "transaction_id"];
|
||||||
|
string tradeType = 5 [json_name = "trade_type"];
|
||||||
|
string tradeState = 6 [json_name = "trade_state"];
|
||||||
|
string bankType = 7 [json_name = "bank_ype"];
|
||||||
|
string successTime = 8 [json_name = "success_time"];
|
||||||
|
string openID = 9 [json_name = "open_id"];
|
||||||
|
int32 total = 10 [json_name = "total"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatAppPayRequest {
|
||||||
|
string Description = 1 [json_name = "description"];
|
||||||
|
string OutTradeNo = 2 [json_name = "outTradeNo"];
|
||||||
|
int64 Cent = 3 [json_name = "cent"];
|
||||||
|
string OpenID = 4 [json_name = "openID"];
|
||||||
|
string NotifyUrl = 5 [json_name = "notifyUrl"];
|
||||||
|
string AppID = 6 [json_name = "appID"];
|
||||||
|
string ClientIP = 7 [json_name = "ClientIP"];
|
||||||
|
uint32 recordId = 9 ;
|
||||||
|
string domain = 10 ;
|
||||||
|
string platform = 11 ;
|
||||||
|
string scene = 12 ;
|
||||||
|
int32 timeExpire = 13 [json_name = "time_expire"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatJsApiRefundsRequest {
|
||||||
|
string Reason = 1 [json_name = "Reason"];
|
||||||
|
string OutTradeNo = 2 [json_name = "OutTradeNo"];
|
||||||
|
string OutRefundNo = 3 [json_name = "OutRefundNo"];
|
||||||
|
string NotifyUrl = 4 [json_name = "NotifyUrl"];
|
||||||
|
int64 Cent = 5 [json_name = "Cent"];
|
||||||
|
string OpenID = 6 [json_name = "OpenID"];
|
||||||
|
int64 Total =7[json_name = "Total"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
message WechatH5PayRequest {
|
||||||
|
string Description = 1 [json_name = "description"];
|
||||||
|
string OutTradeNo = 2 [json_name = "outTradeNo"];
|
||||||
|
int64 Cent = 3 [json_name = "cent"];
|
||||||
|
string OpenID = 4 [json_name = "openID"];
|
||||||
|
string NotifyUrl = 5 [json_name = "notifyUrl"];
|
||||||
|
string AppID = 6 [json_name = "appID"];
|
||||||
|
string ClientIP = 7 [json_name = "ClientIP"];
|
||||||
|
uint32 recordId = 9 ;
|
||||||
|
string domain = 10 ;
|
||||||
|
string platform = 11 ;
|
||||||
|
string scene = 12 ;
|
||||||
|
int32 timeExpire = 13 [json_name = "time_expire"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatH5PayResponse {
|
||||||
|
string h5Url = 1 [json_name = "h5_url"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatH5QueryByOutTradeNoRequest {
|
||||||
|
string outTradeNo = 1 [json_name = "outTradeNo"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatH5QueryByOutTradeNoResponse {
|
||||||
|
string appID = 1 [json_name = "appID"];
|
||||||
|
string mchID = 2 [json_name = "mch_id"];
|
||||||
|
string outTradeNo = 3 [json_name = "out_trade_no"];
|
||||||
|
string transactionId = 4 [json_name = "transaction_id"];
|
||||||
|
string tradeType = 5 [json_name = "trade_type"];
|
||||||
|
string tradeState = 6 [json_name = "trade_state"];
|
||||||
|
string tradeStateDesc = 7 [json_name = "trade_state_desc"];
|
||||||
|
string bankType = 8 [json_name = "bank_ype"];
|
||||||
|
string successTime = 9 [json_name = "success_time"];
|
||||||
|
string openID = 10 [json_name = "open_id"];
|
||||||
|
int32 total = 11 [json_name = "total"];
|
||||||
|
}
|
||||||
|
|
||||||
|
message WechatPayOkRequest {
|
||||||
|
string outTradeNo = 1 ;
|
||||||
|
string body = 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CommonResponse {
|
||||||
|
bool Success = 1 [json_name = "success"];
|
||||||
|
uint32 ID = 2 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PayQueryRequest {
|
||||||
|
string payType = 1;
|
||||||
|
string outTradeNo = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PayQueryResponse {
|
||||||
|
repeated PaymentOrderInfo infos = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message PaymentOrderInfo {
|
||||||
|
int64 id = 1;
|
||||||
|
string createdAt = 2;
|
||||||
|
string updatedAt = 3;
|
||||||
|
string outTradeNo = 4; // 外部流水号
|
||||||
|
string channelTradeNo = 5; // 渠道流水号
|
||||||
|
int64 amount = 6; // 用户支付总金额
|
||||||
|
string currency = 7; // 币种
|
||||||
|
string status = 8;
|
||||||
|
string payTime = 9;
|
||||||
|
string refundTime = 10;
|
||||||
|
string payee = 11;
|
||||||
|
string channelType = 12; // 支付渠道 alipay-支付宝 wxpay-微信 stripe-Stripe支付
|
||||||
|
string platform = 13; // 支付具体来源,是app还是h5还是jsapi还是wap
|
||||||
|
string domain = 14; // 使用平台
|
||||||
|
string businessType = 15; // 业务类型,用来确认mq发送
|
||||||
|
int64 logId = 16;
|
||||||
|
string checkSessionId = 17;
|
||||||
|
string productUUID = 18;
|
||||||
|
string productName = 19;
|
||||||
|
string productImg = 20;
|
||||||
|
string productDescription = 21;
|
||||||
|
int64 fee = 22; // 手续费
|
||||||
|
int64 netIncome = 23; // 净收入【允许退款的最大金额】
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExportPayRequest {
|
||||||
|
string startTime = 1; // 开始时间
|
||||||
|
string endTime = 2; // 结束时间
|
||||||
|
string reportType = 3;
|
||||||
|
string reportRangeNum = 4; // 年月
|
||||||
|
string channelType = 5; // 交易渠道
|
||||||
|
string currency = 6;
|
||||||
|
string sortBy = 7; // 时间排序asc,desc
|
||||||
|
}
|
||||||
|
|
||||||
|
message ExportPayResponse {
|
||||||
|
string reportType = 1; // 日报 月报
|
||||||
|
int32 orderNum = 2; // 成功交易的订单数
|
||||||
|
repeated Overview overview = 3; // 总览
|
||||||
|
repeated ChannelIncome channelIncomes = 4; // 渠道交易情况
|
||||||
|
repeated BusinessInfo businessInfos = 5; // 业务交易情况
|
||||||
|
repeated OrderDetail orderDetails = 6; // sheet2,订单详情
|
||||||
|
}
|
||||||
|
|
||||||
|
message OrderDetail {
|
||||||
|
int64 paymentOrderId = 1;
|
||||||
|
string createdAt = 2;
|
||||||
|
string updatedAt = 3;
|
||||||
|
string outTradeNo = 4; // 外部流水号
|
||||||
|
string channelTradeNo = 5; // 渠道流水号
|
||||||
|
string currency = 6; // 币种
|
||||||
|
int64 payAmount = 7; // 付款金额
|
||||||
|
int64 fee = 8; // 手续费
|
||||||
|
int64 netIncome = 9; // 净收入
|
||||||
|
string status = 10;
|
||||||
|
string payTime = 11;
|
||||||
|
string channelType = 12; // 支付渠道 alipay-支付宝 wxpay-微信 stripe-Stripe支付
|
||||||
|
string platform = 13; // 支付具体来源,是app还是h5还是jsapi还是wap
|
||||||
|
string domain = 14; // 使用平台
|
||||||
|
string businessType = 15; // 业务类型,用来确认mq发送
|
||||||
|
int64 logId = 16;
|
||||||
|
string checkSessionId = 17;
|
||||||
|
string productUUID = 18;
|
||||||
|
string productName = 19;
|
||||||
|
string productImg = 20;
|
||||||
|
string productDescription = 21;
|
||||||
|
}
|
||||||
|
|
||||||
|
message BusinessInfo {
|
||||||
|
string BusinessName = 1; // 业务名称
|
||||||
|
string currency = 2; // 交易币种
|
||||||
|
int32 orderNum = 3; // 成功交易的订单数
|
||||||
|
int64 totalIncome = 4; // 总收入
|
||||||
|
int64 totalFee = 5; // 总手续费
|
||||||
|
int64 totalRefundAmount = 6; // 总退款费
|
||||||
|
int64 netIncome = 7; // 净收入
|
||||||
|
}
|
||||||
|
|
||||||
|
message Overview {
|
||||||
|
string currency = 1; // 交易币种
|
||||||
|
int32 orderNum = 2; // 成功交易的订单数
|
||||||
|
int64 totalIncome = 3; // 总收入
|
||||||
|
int64 totalFee = 4; // 总手续费
|
||||||
|
int64 totalRefundAmount = 5; // 总退款费
|
||||||
|
int64 netIncome = 6; // 净收入
|
||||||
|
}
|
||||||
|
|
||||||
|
message ChannelIncome {
|
||||||
|
string channelType = 1; // 交易渠道
|
||||||
|
string currency = 2; // 交易币种
|
||||||
|
int32 orderNum = 3; // 成功交易的订单数
|
||||||
|
int64 totalIncome = 4; // 总收入
|
||||||
|
int64 totalFee = 5; // 总手续费
|
||||||
|
int64 totalRefundAmount = 6; // 总退款费
|
||||||
|
int64 netIncome = 7; // 净收入
|
||||||
|
}
|
301
api/payment/payment.validator.pb.go
Normal file
301
api/payment/payment.validator.pb.go
Normal file
@ -0,0 +1,301 @@
|
|||||||
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||||
|
// source: pb/payment.proto
|
||||||
|
|
||||||
|
package payment
|
||||||
|
|
||||||
|
import (
|
||||||
|
fmt "fmt"
|
||||||
|
proto "github.com/golang/protobuf/proto"
|
||||||
|
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||||
|
math "math"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Reference imports to suppress errors if they are not otherwise used.
|
||||||
|
var _ = proto.Marshal
|
||||||
|
var _ = fmt.Errorf
|
||||||
|
var _ = math.Inf
|
||||||
|
|
||||||
|
func (this *AntomPayQueryRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AntomPayQueryResponse) Validate() error {
|
||||||
|
for _, item := range this.Infos {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Infos", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AntomNotifyPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AntomNotifyPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreatePayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreatePayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreateRefundRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreateRefundResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *NotifyPayRequest) Validate() error {
|
||||||
|
if this.HttpRequest != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.HttpRequest); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("HttpRequest", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *NotifyPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *HttpRequest) Validate() error {
|
||||||
|
// Validation of proto3 map<> fields is unsupported.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CommonMsg) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *EmptyRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreateStripeCheckoutSessionRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CreateStripeCheckoutSessionResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetCheckoutWebhookRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetCheckoutWebhookResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetStripePaymentIntentInfoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetStripePaymentIntentInfoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetRefundInfoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetRefundInfoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliWapPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliWapPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliAppPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliAppPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliNativePayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliNativePayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliPcWabPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliPcWabPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliReFundRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliReFundResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliNotifyRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliNotifyResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliQueryByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliQueryByOutTradeNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliRefundQueryByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *AliRefundQueryByOutTradeNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatJsApiPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatJsApiPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppPayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatJsApiQueryByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatJsApiQueryByOutTradeNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppQueryByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppQueryByOutTradeNoResponse) Validate() error {
|
||||||
|
for _, item := range this.PromotionDetail {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("PromotionDetail", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.Payer != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Payer); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Payer", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if this.Amount != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.Amount); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Amount", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppQueryByOutTradeNoResponse_Payer) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppQueryByOutTradeNoResponse_Amount) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppQueryByOutTradeNoResponse_PromotionDetail) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetPayByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *GetPayByOutTradeNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatJsApiRefundsResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatNativePayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatNativePayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatNativeQueryByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatRefundQueryByOutRefundNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatRefundQueryByOutRefundNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatNativeQueryByOutTradeNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatAppPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatJsApiRefundsRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatH5PayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatH5PayResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatH5QueryByOutTradeNoRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatH5QueryByOutTradeNoResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *WechatPayOkRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CommonResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *PayQueryRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *PayQueryResponse) Validate() error {
|
||||||
|
for _, item := range this.Infos {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Infos", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *PaymentOrderInfo) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ExportPayRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ExportPayResponse) Validate() error {
|
||||||
|
for _, item := range this.Overview {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("Overview", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range this.ChannelIncomes {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("ChannelIncomes", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range this.BusinessInfos {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("BusinessInfos", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, item := range this.OrderDetails {
|
||||||
|
if item != nil {
|
||||||
|
if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil {
|
||||||
|
return github_com_mwitkow_go_proto_validators.FieldError("OrderDetails", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *OrderDetail) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *BusinessInfo) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *Overview) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *ChannelIncome) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
1505
api/payment/payment_triple.pb.go
Normal file
1505
api/payment/payment_triple.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -28,3 +28,9 @@ dubbo:
|
|||||||
retries: 3
|
retries: 3
|
||||||
interface: com.fontree.microservices.common.micro.account
|
interface: com.fontree.microservices.common.micro.account
|
||||||
# filter: echo,metrics,token,accesslog,sign,tps,generic_service,execute,pshutdown,auth,fonValidateFilter
|
# filter: echo,metrics,token,accesslog,sign,tps,generic_service,execute,pshutdown,auth,fonValidateFilter
|
||||||
|
PaymentClientImpl:
|
||||||
|
interface: com.fontree.microservices.common.payment # must be compatible with grpc or dubbo-java
|
||||||
|
filter: cshutdown,sign,auth
|
||||||
|
params:
|
||||||
|
.accessKeyId: "Paymentksl"
|
||||||
|
.secretAccessKey: "BSDY-FDF1-Fontree_payment"
|
||||||
|
@ -26,3 +26,11 @@ dubbo:
|
|||||||
protocol: tri
|
protocol: tri
|
||||||
retries: 0
|
retries: 0
|
||||||
interface: com.fontree.microservices.common.micro.account
|
interface: com.fontree.microservices.common.micro.account
|
||||||
|
PaymentCentClientImpl:
|
||||||
|
protocol: tri
|
||||||
|
retries: 0
|
||||||
|
interface: com.fontree.microservices.common.payment.cent # must be compatible with grpc or dubbo-java
|
||||||
|
# filter: cshutdown,sign,auth
|
||||||
|
params:
|
||||||
|
.accessKeyId: "Paymentksl"
|
||||||
|
.secretAccessKey: "BSDY-FDF1-Fontree_payment"
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
func BundleOrderRouter(r *gin.RouterGroup) {
|
func BundleOrderRouter(r *gin.RouterGroup) {
|
||||||
|
|
||||||
r.POST("/stripe-pay/callback", bundle.StripeCheckoutSessionWebhook)
|
r.POST("/stripe-pay/callback", bundle.StripeCheckoutSessionWebhook)
|
||||||
|
r.POST("/antom/callback", bundle.AntomWebhook) // Antom回调
|
||||||
|
|
||||||
bundleOrderRoute := r.Group("bundle-order")
|
bundleOrderRoute := r.Group("bundle-order")
|
||||||
bundleOrderRoute.Use(middleware.CheckLogin(service.AccountProvider))
|
bundleOrderRoute.Use(middleware.CheckLogin(service.AccountProvider))
|
||||||
@ -29,7 +30,8 @@ func BundleOrderRouter(r *gin.RouterGroup) {
|
|||||||
bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail)
|
bundleOrderAppRoute.POST("order-detail", bundle.OrderRecordsDetail)
|
||||||
|
|
||||||
// stripe
|
// stripe
|
||||||
bundleOrderAppRoute.POST("create-stripe-pay", bundle.CreateStripeCheckoutSession)
|
//bundleOrderAppRoute.POST("create-stripe-pay", bundle.CreateStripeCheckoutSession) // stripe支付
|
||||||
|
bundleOrderAppRoute.POST("create-stripe-pay", bundle.CreateAntomPay) // Antom国际支付
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -283,10 +283,10 @@ func OrderRecordsDetail(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/*// 获取 用户信息
|
// 获取 用户信息
|
||||||
userInfo := login.GetUserInfoFromC(c)
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
|
|
||||||
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)*/
|
req.CustomerID = strconv.FormatUint(userInfo.ID, 10)
|
||||||
|
|
||||||
res, err := service.BundleProvider.OrderRecordsDetail(context.Background(), &req)
|
res, err := service.BundleProvider.OrderRecordsDetail(context.Background(), &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,10 +2,12 @@ package bundle
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/api/bundle"
|
"fonchain-fiee/api/bundle"
|
||||||
"fonchain-fiee/api/order"
|
"fonchain-fiee/api/order"
|
||||||
|
"fonchain-fiee/api/payment"
|
||||||
"fonchain-fiee/pkg/config"
|
"fonchain-fiee/pkg/config"
|
||||||
"fonchain-fiee/pkg/model/login"
|
"fonchain-fiee/pkg/model/login"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
@ -127,6 +129,131 @@ func CreateStripeCheckoutSession(c *gin.Context) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateAntomPay(c *gin.Context) {
|
||||||
|
var req order.CreateStripeCheckoutSessionRequest
|
||||||
|
|
||||||
|
if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取 用户信息
|
||||||
|
userInfo := login.GetUserInfoFromC(c)
|
||||||
|
|
||||||
|
// 检查 订单信息
|
||||||
|
detail, detailErr := service.BundleProvider.OrderRecordsDetail(context.Background(), &bundle.OrderRecordsDetailRequest{
|
||||||
|
OrderNo: req.OutTradeNo,
|
||||||
|
})
|
||||||
|
|
||||||
|
if detailErr != nil {
|
||||||
|
service.Error(c, detailErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("detail.OrderRecord.CustomerID :", detail.OrderRecord.CustomerID)
|
||||||
|
|
||||||
|
// 判断 是否是 本人操作
|
||||||
|
if strconv.FormatUint(userInfo.ID, 10) != detail.OrderRecord.CustomerID {
|
||||||
|
service.Error(c, errors.New(common.NotMatchOrderInfo))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("detail.OrderRecord.TotalAmount :", detail.OrderRecord.TotalAmount)
|
||||||
|
fmt.Println("req.ProductAllPrice :", req.ProductAllPrice)
|
||||||
|
fmt.Println("detail.OrderRecord.TotalAmount*100 :", detail.OrderRecord.TotalAmount*100)
|
||||||
|
|
||||||
|
//金额校验
|
||||||
|
orderAmountInCents := int64(math.Round(float64(detail.OrderRecord.TotalAmount * 100)))
|
||||||
|
reqAmountInCents := int64(math.Round(float64(req.ProductAllPrice)))
|
||||||
|
if orderAmountInCents != reqAmountInCents {
|
||||||
|
fmt.Println("111111111111111111111111111111111111")
|
||||||
|
service.Error(c, errors.New(common.InvalidOrderAmount))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("detail.OrderRecord.Status :", detail.OrderRecord.Status)
|
||||||
|
fmt.Println("detail.OrderRecord.CheckoutSessionId :", detail.OrderRecord.CheckoutSessionId)
|
||||||
|
fmt.Println("detail.OrderRecord.PayTime :", detail.OrderRecord.PayTime)
|
||||||
|
|
||||||
|
// 如果 当前订单 是 已签未支付 且 存在 checkoutSessionId 需要 查询 支付结果
|
||||||
|
if detail.OrderRecord.Status == bundleModel.OrderSigned && detail.OrderRecord.CheckoutSessionId != "" && detail.OrderRecord.PayTime == "" {
|
||||||
|
// 查询支付结果
|
||||||
|
stripeInfosRes, stripeInfosErr := service.PaymentProvider.QueryAntomPayByCheckoutSessionId(context.Background(), &payment.AntomPayQueryRequest{
|
||||||
|
CheckoutSessionIds: []string{detail.OrderRecord.CheckoutSessionId},
|
||||||
|
})
|
||||||
|
|
||||||
|
if stripeInfosErr != nil {
|
||||||
|
service.Error(c, errors.New(common.ErrorQueryStripeInfo))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if stripeInfosRes != nil && len(stripeInfosRes.Infos) > 0 {
|
||||||
|
for _, info := range stripeInfosRes.Infos {
|
||||||
|
if info.OutTradeNo == detail.OrderRecord.OrderNo && info.Status == "paid" {
|
||||||
|
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||||
|
Uuid: detail.OrderRecord.Uuid,
|
||||||
|
Status: bundleModel.OrderPaid,
|
||||||
|
PayTime: common.GetBeijingTime(),
|
||||||
|
})
|
||||||
|
fmt.Println("detail.OrderRecord.Uuid :", detail.OrderRecord.Uuid)
|
||||||
|
if updateOrderRecordErr != nil {
|
||||||
|
service.Error(c, detailErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
service.Success(c, &service.Response{
|
||||||
|
Msg: common.HadPay,
|
||||||
|
Code: 0,
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var antomReq payment.CreatePayRequest
|
||||||
|
antomReq.Payee = "Antom"
|
||||||
|
antomReq.Platform = "antom"
|
||||||
|
antomReq.ChannelType = "antom"
|
||||||
|
antomReq.ProductDescription = req.ProductDescription
|
||||||
|
antomReq.BusinessType = "useless"
|
||||||
|
antomReq.Domain = "fiee"
|
||||||
|
antomReq.Amount = req.ProductAllPrice
|
||||||
|
antomReq.Currency = req.ProductPriceCurrency
|
||||||
|
antomReq.OutTradeNo = req.OutTradeNo
|
||||||
|
antomReq.ReturnUrl = req.SuccessUrl
|
||||||
|
|
||||||
|
//调用微服务获取支付地址
|
||||||
|
result, err := service.PaymentProvider.CreatePay(context.Background(), &antomReq)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("result.CheckoutSessionId :", result.CheckoutSessionId)
|
||||||
|
fmt.Println("result.Url :", result.Url)
|
||||||
|
|
||||||
|
//更新订单状态
|
||||||
|
_, updateOrderRecordErr := service.BundleProvider.UpdateOrderRecord(context.Background(), &bundle.OrderRecord{
|
||||||
|
Uuid: detail.OrderRecord.Uuid,
|
||||||
|
CheckoutSessionId: result.CheckoutSessionId,
|
||||||
|
CheckoutSessionUrl: result.Url,
|
||||||
|
})
|
||||||
|
fmt.Println("=====================================")
|
||||||
|
resp := &order.CreateStripeCheckoutSessionResponse{}
|
||||||
|
resp.CheckoutSessionUrl = result.Url
|
||||||
|
resp.CheckoutSessionId = result.CheckoutSessionId
|
||||||
|
fmt.Println("resp:", resp)
|
||||||
|
|
||||||
|
if updateOrderRecordErr != nil {
|
||||||
|
fmt.Println("有更新报错:", updateOrderRecordErr)
|
||||||
|
service.Error(c, updateOrderRecordErr)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
service.Success(c, resp)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func StripeCheckoutSessionWebhook(c *gin.Context) {
|
func StripeCheckoutSessionWebhook(c *gin.Context) {
|
||||||
var req order.GetCheckoutWebhookRequest
|
var req order.GetCheckoutWebhookRequest
|
||||||
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, int64(65536))
|
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, int64(65536))
|
||||||
@ -160,3 +287,82 @@ func StripeCheckoutSessionWebhook(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
service.Success(c)
|
service.Success(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func AntomWebhook(c *gin.Context) {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
data, err := io.ReadAll(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将数据转换为字符串形式并记录日志(如果数据过大则不记录)
|
||||||
|
dataStr := string(data)
|
||||||
|
fmt.Println("================ Antom回调参数:", dataStr)
|
||||||
|
|
||||||
|
// 将读取到的数据解析为 map[string]interface{}
|
||||||
|
var reqMap map[string]interface{}
|
||||||
|
if err := json.Unmarshal(data, &reqMap); err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 提取需要的字段
|
||||||
|
notifyType, _ := reqMap["notifyType"].(string)
|
||||||
|
resultMap, resultExists := reqMap["result"].(map[string]interface{})
|
||||||
|
if !resultExists {
|
||||||
|
service.Error(c, errors.New("result 字段不存在或类型错误"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
requestId, _ := reqMap["paymentRequestId"].(string)
|
||||||
|
paymentId, _ := reqMap["paymentId"].(string)
|
||||||
|
paymentTime, _ := reqMap["paymentTime"].(string)
|
||||||
|
|
||||||
|
// 提取 result 字段中的子字段
|
||||||
|
resultStatus, _ := resultMap["resultStatus"].(string)
|
||||||
|
resultMessage, _ := resultMap["resultMessage"].(string)
|
||||||
|
|
||||||
|
// 打印提取的字段(可以根据需要处理)
|
||||||
|
fmt.Println("通知类型:", notifyType)
|
||||||
|
fmt.Println("订单号:", requestId)
|
||||||
|
fmt.Println("支付ID:", paymentId)
|
||||||
|
fmt.Println("支付时间:", paymentTime)
|
||||||
|
fmt.Println("支付结果状态:", resultStatus)
|
||||||
|
fmt.Println("支付结果消息:", resultMessage)
|
||||||
|
/*
|
||||||
|
* S: 当 notifyType 为PAYMENT_RESULT时,表示支付成功;当 notifyType 为PAYMENT_PENDING时,表示支付处理中。
|
||||||
|
* F: 表示支付失败。
|
||||||
|
* */
|
||||||
|
params := &payment.AntomNotifyPayRequest{
|
||||||
|
NotifyType: notifyType,
|
||||||
|
RequestId: requestId,
|
||||||
|
PaymentId: paymentId,
|
||||||
|
PaymentTime: paymentTime,
|
||||||
|
ResultStatus: resultStatus,
|
||||||
|
ResultMessage: resultMessage,
|
||||||
|
ChannelCode: "Antom", // fiee对应payment的渠道码
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := service.PaymentProvider.AntomWebhook(c, params)
|
||||||
|
if err != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Println("resp.Status:", resp.Status)
|
||||||
|
if resp.Status == "paid" {
|
||||||
|
//支付成功
|
||||||
|
_, updateStatusErr := service.BundleProvider.UpdateOrderRecordByOrderNo(context.Background(), &bundle.OrderRecord{
|
||||||
|
OrderNo: resp.OutTradeNo,
|
||||||
|
PayTime: common.GetBeijingTime(),
|
||||||
|
Status: bundleModel.OrderPaid,
|
||||||
|
})
|
||||||
|
if updateStatusErr != nil {
|
||||||
|
service.Error(c, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
service.Success(c)
|
||||||
|
}
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"fonchain-fiee/api/account"
|
"fonchain-fiee/api/account"
|
||||||
"fonchain-fiee/api/bundle"
|
"fonchain-fiee/api/bundle"
|
||||||
"fonchain-fiee/api/order"
|
"fonchain-fiee/api/order"
|
||||||
|
"fonchain-fiee/api/payment"
|
||||||
pkConfig "fonchain-fiee/pkg/config"
|
pkConfig "fonchain-fiee/pkg/config"
|
||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
@ -16,11 +17,13 @@ var AccountProvider = new(account.AccountClientImpl)
|
|||||||
|
|
||||||
var BundleProvider = new(bundle.BundleClientImpl)
|
var BundleProvider = new(bundle.BundleClientImpl)
|
||||||
var OrderProvider = new(order.OrderClientImpl)
|
var OrderProvider = new(order.OrderClientImpl)
|
||||||
|
var PaymentProvider = new(payment.PaymentClientImpl)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
config.SetConsumerService(BundleProvider)
|
config.SetConsumerService(BundleProvider)
|
||||||
config.SetConsumerService(OrderProvider)
|
config.SetConsumerService(OrderProvider)
|
||||||
config.SetConsumerService(AccountProvider)
|
config.SetConsumerService(AccountProvider)
|
||||||
|
config.SetConsumerService(PaymentProvider)
|
||||||
|
|
||||||
if err := config.Load(); err != nil {
|
if err := config.Load(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user