Ver a proveniência

更新

tags/v1.6.1^2
huangjiajun há 1 ano
ascendente
cometimento
14ea57f9ee
2 ficheiros alterados com 103 adições e 6 eliminações
  1. +93
    -0
      md/alipay.go
  2. +10
    -6
      pay/alipay.go

+ 93
- 0
md/alipay.go Ver ficheiro

@@ -74,3 +74,96 @@ type ZhimaCreditPayafteruseCreditbizorderFinish struct {
} `json:"zhima_credit_payafteruse_creditbizorder_finish_response"`
Sign string `json:"sign"`
}
type AlipayTradePay struct {
AlipayTradePayResponse struct {
Code string `json:"code"`
Msg string `json:"msg"`
TradeNo string `json:"trade_no"`
OutTradeNo string `json:"out_trade_no"`
OpenId string `json:"open_id"`
BuyerLogonId string `json:"buyer_logon_id"`
TransPayRate string `json:"trans_pay_rate"`
TotalAmount float64 `json:"total_amount"`
TransCurrency string `json:"trans_currency"`
SettleCurrency string `json:"settle_currency"`
SettleAmount string `json:"settle_amount"`
PayCurrency string `json:"pay_currency"`
PayAmount string `json:"pay_amount"`
SettleTransRate string `json:"settle_trans_rate"`
ReceiptAmount string `json:"receipt_amount"`
BuyerPayAmount float64 `json:"buyer_pay_amount"`
PointAmount float64 `json:"point_amount"`
InvoiceAmount float64 `json:"invoice_amount"`
GmtPayment string `json:"gmt_payment"`
FundBillList []struct {
FundChannel string `json:"fund_channel"`
BankCode string `json:"bank_code"`
Amount int `json:"amount"`
RealAmount float64 `json:"real_amount"`
FundType string `json:"fund_type"`
} `json:"fund_bill_list"`
CardBalance float64 `json:"card_balance"`
StoreName string `json:"store_name"`
DiscountGoodsDetail string `json:"discount_goods_detail"`
BuyerUserId string `json:"buyer_user_id"`
AsyncPaymentMode string `json:"async_payment_mode"`
VoucherDetailList []struct {
Id string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Amount int `json:"amount"`
MerchantContribute int `json:"merchant_contribute"`
OtherContribute int `json:"other_contribute"`
Memo string `json:"memo"`
TemplateId string `json:"template_id"`
OtherContributeDetail []struct {
ContributeType string `json:"contribute_type"`
ContributeAmount int `json:"contribute_amount"`
} `json:"other_contribute_detail"`
PurchaseBuyerContribute float64 `json:"purchase_buyer_contribute"`
PurchaseMerchantContribute float64 `json:"purchase_merchant_contribute"`
PurchaseAntContribute float64 `json:"purchase_ant_contribute"`
} `json:"voucher_detail_list"`
AdvanceAmount string `json:"advance_amount"`
AuthTradePayMode string `json:"auth_trade_pay_mode"`
ChargeAmount string `json:"charge_amount"`
ChargeFlags string `json:"charge_flags"`
SettlementId string `json:"settlement_id"`
BusinessParams string `json:"business_params"`
BuyerUserType string `json:"buyer_user_type"`
MdiscountAmount string `json:"mdiscount_amount"`
DiscountAmount string `json:"discount_amount"`
BuyerUserName string `json:"buyer_user_name"`
ReceiptCurrencyType string `json:"receipt_currency_type"`
CreditPayMode string `json:"credit_pay_mode"`
CreditBizOrderId string `json:"credit_biz_order_id"`
EnterprisePayInfo struct {
IsUseEnterprisePay bool `json:"is_use_enterprise_pay"`
InvoiceAmount int `json:"invoice_amount"`
BizInfo string `json:"biz_info"`
} `json:"enterprise_pay_info"`
CanTurnToAppPay string `json:"can_turn_to_app_pay"`
HybAmount string `json:"hyb_amount"`
BkagentRespInfo struct {
BindtrxId string `json:"bindtrx_id"`
BindclrissrId string `json:"bindclrissr_id"`
BindpyeracctbkId string `json:"bindpyeracctbk_id"`
BkpyeruserCode string `json:"bkpyeruser_code"`
EstterLocation string `json:"estter_location"`
} `json:"bkagent_resp_info"`
ChargeInfoList struct {
ChargeFee float64 `json:"charge_fee"`
OriginalChargeFee float64 `json:"original_charge_fee"`
SwitchFeeRate string `json:"switch_fee_rate"`
IsRatingOnTradeReceiver string `json:"is_rating_on_trade_receiver"`
IsRatingOnSwitch string `json:"is_rating_on_switch"`
ChargeType string `json:"charge_type"`
SubFeeDetailList []struct {
ChargeFee float64 `json:"charge_fee"`
OriginalChargeFee float64 `json:"original_charge_fee"`
SwitchFeeRate string `json:"switch_fee_rate"`
} `json:"sub_fee_detail_list"`
} `json:"charge_info_list"`
} `json:"alipay_trade_pay_response"`
Sign string `json:"sign"`
}

+ 10
- 6
pay/alipay.go Ver ficheiro

@@ -223,13 +223,13 @@ func AlipayFundTransUniTransfer(args map[string]string) (*md.AlipayFundTransUniT
}

//扣款
func AlipayTradePay(args map[string]string) {
func AlipayTradePay(args map[string]string) (*md.AlipayTradePay, error) {
client := Comm(args)
if args["notify_url"] != "" {
client.NotifyUrl = args["notify_url"]
}
if client == nil {
return
return nil, errors.New("获取失败")
}
//请求参数
bm := make(gopay.BodyMap)
@@ -247,10 +247,14 @@ func AlipayTradePay(args map[string]string) {
bz.Set("subject", args["subject"])
bz.Set("extend_params", extendParams)
})
var aliPsp = ""
PostAliPayAPISelfV2(client, bm, "alipay.trade.pay", &aliPsp)

return
var aliPsp md.AlipayTradePay
v2, err := PostAliPayAPISelfV2(client, bm, "alipay.trade.pay", &aliPsp)
if err != nil {
xlog.Error(err)
return nil, err
}
res := v2.(*md.AlipayTradePay)
return res, nil
}
func AlipayTradeQuery(args map[string]string) (*md.AlipayFundTransUniTransfer, error) {
client := Comm(args)


Carregando…
Cancelar
Guardar