From 1a6668566afe123c7c685794abadbfe4fd5cabda Mon Sep 17 00:00:00 2001 From: Jerry <85411418@qq.com> Date: Sun, 30 Jun 2024 17:02:19 +0800 Subject: [PATCH] v1.5.103 --- alipay/marketing_voucher.go | 116 ++++++++++++++++++++++++++++++++++++ alipay/model_market.go | 100 +++++++++++++++++++++++++++++++ release_note.txt | 11 +++- 3 files changed, 225 insertions(+), 2 deletions(-) diff --git a/alipay/marketing_voucher.go b/alipay/marketing_voucher.go index 837c9098..fdacb38e 100644 --- a/alipay/marketing_voucher.go +++ b/alipay/marketing_voucher.go @@ -170,3 +170,119 @@ func (a *Client) MarketingActivityVoucherStop(ctx context.Context, bm gopay.Body aliRsp.SignData = signData return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) } + +// alipay.marketing.activity.ordervoucher.create(创建商家券活动) +// 文档地址:https://opendocs.alipay.com/open/7ad3a7bf_alipay.marketing.activity.ordervoucher.create +func (a *Client) MarketingActivityOrderVoucherCreate(ctx context.Context, bm gopay.BodyMap) (aliRsp *MarketingActivityOrderVoucherCreateRsp, err error) { + err = bm.CheckEmptyError("out_biz_no", "activity_base_info", "merchant_access_mode", "voucher_send_mode_info", + "voucher_deduct_info", "voucher_available_scope_info", "voucher_use_rule_info", "voucher_customer_guide_info", "voucher_display_pattern_info") + if err != nil { + return nil, err + } + var bs []byte + if bs, err = a.doAliPay(ctx, bm, "alipay.marketing.activity.ordervoucher.create"); err != nil { + return nil, err + } + aliRsp = new(MarketingActivityOrderVoucherCreateRsp) + if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil { + return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs)) + } + if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil { + return aliRsp, err + } + signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn) + aliRsp.SignData = signData + return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) +} + +// alipay.marketing.activity.ordervoucher.codedeposit(同步商家券券码) +// 文档地址:https://opendocs.alipay.com/open/7ed0450d_alipay.marketing.activity.ordervoucher.codedeposit +func (a *Client) MarketingActivityOrderVoucherCodeDeposit(ctx context.Context, bm gopay.BodyMap) (aliRsp *MarketingActivityOrderVoucherCodeDepositRsp, err error) { + err = bm.CheckEmptyError("out_biz_no", "activity_id", "merchant_access_mode", "voucher_codes") + if err != nil { + return nil, err + } + var bs []byte + if bs, err = a.doAliPay(ctx, bm, "alipay.marketing.activity.ordervoucher.codedeposit"); err != nil { + return nil, err + } + aliRsp = new(MarketingActivityOrderVoucherCodeDepositRsp) + if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil { + return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs)) + } + if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil { + return aliRsp, err + } + signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn) + aliRsp.SignData = signData + return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) +} + +// alipay.marketing.activity.ordervoucher.modify(修改商家券活动基本信息) +// 文档地址:https://opendocs.alipay.com/open/528f83f6_alipay.marketing.activity.ordervoucher.modify +func (a *Client) MarketingActivityOrderVoucherModify(ctx context.Context, bm gopay.BodyMap) (aliRsp *MarketingActivityOrderVoucherModifyRsp, err error) { + err = bm.CheckEmptyError("out_biz_no", "activity_id", "merchant_access_mode", "activity_base_info") + if err != nil { + return nil, err + } + var bs []byte + if bs, err = a.doAliPay(ctx, bm, "alipay.marketing.activity.ordervoucher.modify"); err != nil { + return nil, err + } + aliRsp = new(MarketingActivityOrderVoucherModifyRsp) + if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil { + return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs)) + } + if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil { + return aliRsp, err + } + signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn) + aliRsp.SignData = signData + return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) +} + +// alipay.marketing.activity.ordervoucher.stop(停止商家券活动) +// 文档地址:https://opendocs.alipay.com/open/16803efe_alipay.marketing.activity.ordervoucher.stop +func (a *Client) MarketingActivityOrderVoucherStop(ctx context.Context, bm gopay.BodyMap) (aliRsp *MarketingActivityOrderVoucherStopRsp, err error) { + err = bm.CheckEmptyError("out_biz_no", "activity_id", "merchant_access_mode") + if err != nil { + return nil, err + } + var bs []byte + if bs, err = a.doAliPay(ctx, bm, "alipay.marketing.activity.ordervoucher.stop"); err != nil { + return nil, err + } + aliRsp = new(MarketingActivityOrderVoucherStopRsp) + if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil { + return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs)) + } + if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil { + return aliRsp, err + } + signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn) + aliRsp.SignData = signData + return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) +} + +// alipay.marketing.activity.ordervoucher.append(修改商家券活动发券数量上限) +// 文档地址:https://opendocs.alipay.com/open/4e2acff5_alipay.marketing.activity.ordervoucher.append +func (a *Client) MarketingActivityOrderVoucherAppend(ctx context.Context, bm gopay.BodyMap) (aliRsp *MarketingActivityOrderVoucherAppendRsp, err error) { + err = bm.CheckEmptyError("out_biz_no", "activity_id", "merchant_access_mode", "voucher_quantity") + if err != nil { + return nil, err + } + var bs []byte + if bs, err = a.doAliPay(ctx, bm, "alipay.marketing.activity.ordervoucher.append"); err != nil { + return nil, err + } + aliRsp = new(MarketingActivityOrderVoucherAppendRsp) + if err = json.Unmarshal(bs, aliRsp); err != nil || aliRsp.Response == nil { + return nil, fmt.Errorf("[%w], bytes: %s", gopay.UnmarshalErr, string(bs)) + } + if err = bizErrCheck(aliRsp.Response.ErrorResponse); err != nil { + return aliRsp, err + } + signData, signDataErr := a.getSignData(bs, aliRsp.AlipayCertSn) + aliRsp.SignData = signData + return aliRsp, a.autoVerifySignByCert(aliRsp.Sign, signData, signDataErr) +} diff --git a/alipay/model_market.go b/alipay/model_market.go index 3329e75d..14ab47f3 100644 --- a/alipay/model_market.go +++ b/alipay/model_market.go @@ -175,6 +175,41 @@ type MarketingCampaignOrderVoucherConsultRsp struct { Sign string `json:"sign"` } +type MarketingActivityOrderVoucherCreateRsp struct { + Response *MarketingActivityOrderVoucherCreate `json:"alipay_marketing_activity_ordervoucher_create_response"` + AlipayCertSn string `json:"alipay_cert_sn,omitempty"` + SignData string `json:"-"` + Sign string `json:"sign"` +} + +type MarketingActivityOrderVoucherCodeDepositRsp struct { + Response *MarketingActivityOrderVoucherCodeDeposit `json:"alipay_marketing_activity_ordervoucher_codedeposit_response"` + AlipayCertSn string `json:"alipay_cert_sn,omitempty"` + SignData string `json:"-"` + Sign string `json:"sign"` +} + +type MarketingActivityOrderVoucherModifyRsp struct { + Response *MarketingActivityOrderVoucherModify `json:"alipay_marketing_activity_ordervoucher_modify_response"` + AlipayCertSn string `json:"alipay_cert_sn,omitempty"` + SignData string `json:"-"` + Sign string `json:"sign"` +} + +type MarketingActivityOrderVoucherStopRsp struct { + Response *MarketingActivityOrderVoucherStop `json:"alipay_marketing_activity_ordervoucher_stop_response"` + AlipayCertSn string `json:"alipay_cert_sn,omitempty"` + SignData string `json:"-"` + Sign string `json:"sign"` +} + +type MarketingActivityOrderVoucherAppendRsp struct { + Response *MarketingActivityOrderVoucherAppend `json:"alipay_marketing_activity_ordervoucher_append_response"` + AlipayCertSn string `json:"alipay_cert_sn,omitempty"` + SignData string `json:"-"` + Sign string `json:"sign"` +} + // =========================================================分割========================================================= type MarketingCampaignCashCreate struct { @@ -765,3 +800,68 @@ type ItemConsult struct { PromoAmount string `json:"promo_amount"` PromoCount string `json:"promo_count"` } + +type MarketingActivityOrderVoucherCreate struct { + ErrorResponse + ActivityId string `json:"activity_id"` + VoucherAvailableScopeResultInfo *VoucherAvailableScopeResultInfo `json:"voucher_available_scope_result_info"` +} + +type VoucherAvailableScopeResultInfo struct { + VoucherAvailableGeographyScopeResultInfo *VoucherAvailableGeographyScopeResultInfo `json:"voucher_available_geography_scope_result_info"` +} + +type VoucherAvailableGeographyScopeResultInfo struct { + AvailableGeographyShopResultInfo *AvailableGeographyShopResultInfo `json:"available_geography_shop_result_info"` +} + +type AvailableGeographyShopResultInfo struct { + SuccessAvailableShopIds []string `json:"success_available_shop_ids"` + FailAvailableShopInfos []*FailAvailableShopInfo `json:"fail_available_shop_infos"` + AvailableGeographyAllShopResultInfo *AvailableGeographyAllShopResultInfo `json:"available_geography_all_shop_result_info"` +} + +type FailAvailableShopInfo struct { + ShopId string `json:"shop_id"` + FailReasons []string `json:"fail_reasons"` + FailMessage string `json:"fail_message"` +} + +type AvailableGeographyAllShopResultInfo struct { + SuccessExcludeShopIds []string `json:"success_exclude_shop_ids"` + FailExcludeShopInfos []*FailExcludeShopInfo `json:"fail_exclude_shop_infos"` +} + +type FailExcludeShopInfo struct { + ShopId string `json:"shop_id"` + RealShopId string `json:"real_shop_id"` + FailReasons []string `json:"fail_reasons"` + FailMessage string `json:"fail_message"` +} + +type MarketingActivityOrderVoucherCodeDeposit struct { + ErrorResponse + SuccessCount int `json:"success_count"` + FailCount int `json:"fail_count"` + SuccessVoucherCodeList []string `json:"success_voucher_code_list"` + FailVoucherCodeDetailList []*FailVoucherCodeDetail `json:"fail_voucher_code_detail_list"` +} + +type FailVoucherCodeDetail struct { + VoucherCode string `json:"voucher_code"` + ErrorCode string `json:"error_code"` + ErrorMsg string `json:"error_msg"` +} + +type MarketingActivityOrderVoucherModify struct { + ErrorResponse + VoucherAvailableScopeResultInfo *VoucherAvailableScopeResultInfo `json:"voucher_available_scope_result_info"` +} + +type MarketingActivityOrderVoucherStop struct { + ErrorResponse +} + +type MarketingActivityOrderVoucherAppend struct { + ErrorResponse +} diff --git a/release_note.txt b/release_note.txt index 21b1631a..c1c1b22c 100644 --- a/release_note.txt +++ b/release_note.txt @@ -1,8 +1,15 @@ 版本号:Release 1.5.103 修改记录: (1) 支付宝:新增 client.PayAppMarketingConsult(),商户前置内容咨询接口。 - (2) 支付宝:新增 - (3) 支付宝:新增 + (2) 支付宝:新增 client.MarketingActivityOrderVoucherCreate(),创建商家券活动接口 + (3) 支付宝:新增 client.MarketingActivityOrderVoucherCodeDeposit(),同步商家券券码接口 + (4) 支付宝:新增 client.MarketingActivityOrderVoucherModify(),修改商家券活动基本信息接口 + (4) 支付宝:新增 client.MarketingActivityOrderVoucherStop(),停止商家券活动接口 + (4) 支付宝:新增 client.MarketingActivityOrderVoucherAppend(),修改商家券活动发券数量上限接口 + (4) 支付宝:新增 + (4) 支付宝:新增 + (4) 支付宝:新增 + (4) 支付宝:新增 (4) 支付宝:新增 版本号:Release 1.5.102