蛋蛋星球-制度模式
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

52 行
2.0 KiB

  1. package alipay
  2. import (
  3. "context"
  4. "encoding/json"
  5. "fmt"
  6. "github.com/go-pay/gopay"
  7. )
  8. // zoloz.authentication.smilepay.initialize(刷脸支付初始化)
  9. // 文档地址:https://opendocs.alipay.com/open/2f7c1d5f_zoloz.authentication.smilepay.initialize
  10. func (a *Client) ZolozAuthenticationSmilepayInitialize(ctx context.Context, bm gopay.BodyMap) (aliRsp *ZolozAuthenticationSmilepayInitializeRsp, err error) {
  11. var bs []byte
  12. if bs, err = a.doAliPay(ctx, bm, "zoloz.authentication.smilepay.initialize"); err != nil {
  13. return nil, err
  14. }
  15. aliRsp = new(ZolozAuthenticationSmilepayInitializeRsp)
  16. if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil {
  17. return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs))
  18. }
  19. if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil {
  20. return aliRsp, err
  21. }
  22. signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn)
  23. aliRsp.SignData = signData
  24. return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr)
  25. }
  26. // zoloz.authentication.customer.ftoken.query(查询刷脸结果信息接口)
  27. // 文档地址:https://opendocs.alipay.com/open/c8e4d285_zoloz.authentication.customer.ftoken.query
  28. func (a *Client) ZolozAuthenticationCustomerFtokenQuery(ctx context.Context, bm gopay.BodyMap) (aliRsp *ZolozAuthenticationCustomerFtokenQueryRsp, err error) {
  29. err = bm.CheckEmptyError("ftoken", "biz_type")
  30. if err != nil {
  31. return nil, err
  32. }
  33. var bs []byte
  34. if bs, err = a.doAliPay(ctx, bm, "zoloz.authentication.customer.ftoken.query"); err != nil {
  35. return nil, err
  36. }
  37. aliRsp = new(ZolozAuthenticationCustomerFtokenQueryRsp)
  38. if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil {
  39. return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs))
  40. }
  41. if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil {
  42. return aliRsp, err
  43. }
  44. signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn)
  45. aliRsp.SignData = signData
  46. return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr)
  47. }