charging.go 608 B

12345678910111213141516171819202122232425262728
  1. // 收款、代收
  2. package unionpay
  3. import "fmt"
  4. // EntrustCharge 代扣费用
  5. func EntrustCharge(mi *MerchantInfo, oi OrderInfo, ci CustomerInfo) (res ReqRespose, err error) {
  6. var body string
  7. args := newParams(oi, ci)
  8. args.TxnType = "11" // 交易类型, 取值:11
  9. args.TxnSubType = "02" // 交易子类, 取值:02
  10. args.BizType = "000501" // 业务类型 代收产品
  11. args.BackURL = oi.NotifyURL
  12. body, err = args.ToBody(mi, ci)
  13. if err != nil {
  14. return
  15. }
  16. fmt.Println(body)
  17. res, err = post(BaseHost+ReqBackTrans, []byte(body))
  18. if err != nil {
  19. return
  20. }
  21. _, err = res.Ok()
  22. return
  23. }