diff --git a/service/repositories/order.go b/service/repositories/order.go index 44b968d7..87157211 100644 --- a/service/repositories/order.go +++ b/service/repositories/order.go @@ -45,11 +45,12 @@ type ( } PayInfo struct { - PayMethod string `json:"pay_method"` // 交易方式 - PayTime time.Time `json:"pay_time"` // 支付时间 - Status gmodel.PayStatus `json:"status"` // 当前状态 - StatusLink []gmodel.PayStatus `json:"status_link"` // 状态链路 - TradeNo string `json:"trade_no"` // 支付交易号 + PayMethod string `json:"pay_method"` // 支付方式 + PaymentMethod string `json:"payment_method"` // 交易方式 + PayTime time.Time `json:"pay_time"` // 支付时间 + Status gmodel.PayStatus `json:"status"` // 当前状态 + StatusLink []gmodel.PayStatus `json:"status_link"` // 状态链路 + TradeNo string `json:"trade_no"` // 支付交易号 } OrderAddress struct { @@ -182,13 +183,14 @@ func (d *defaultOrder) PaymentSuccessful(ctx context.Context, in *PaymentSuccess var payAmount int64 var payTitle string var payTime time.Time + var paymentMethod string - var paymentMethod int64 = 1 + var payMethod int64 = 1 if in.PaymentMethod == "stripe" { - paymentMethod = 1 + payMethod = 1 } if in.PaymentMethod == "paypal" { - paymentMethod = 2 + payMethod = 2 } if in.Charge != nil { @@ -220,6 +222,9 @@ func (d *defaultOrder) PaymentSuccessful(ctx context.Context, in *PaymentSuccess brand = string(charge.PaymentMethodDetails.Card.Brand) } } + if charge.PaymentMethodDetails.Type != "" { + paymentMethod = string(charge.PaymentMethodDetails.Type) + } } if charge.Currency != "" { currency = string(charge.Currency) @@ -253,7 +258,8 @@ func (d *defaultOrder) PaymentSuccessful(ctx context.Context, in *PaymentSuccess var payStatusLink []gmodel.PayStatus var orderAmount = make(map[string]interface{}) var payInfo PayInfo - payInfo.PayMethod = in.PaymentMethod + payInfo.PayMethod = paymentMethod + payInfo.PaymentMethod = in.PaymentMethod payInfo.PayTime = payTime payInfo.TradeNo = tradeSn // 当前状态 @@ -362,7 +368,7 @@ func (d *defaultOrder) PaymentSuccessful(ctx context.Context, in *PaymentSuccess TradeSn: &tradeSn, PayAmount: &payAmount, PayStatus: &payStatus, - PaymentMethod: &paymentMethod, + PaymentMethod: &payMethod, PayStage: &payStageInt, CardSn: &card, CardBrand: &brand,