Skip to content

Commit

Permalink
v1.5.103
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink committed Jun 30, 2024
1 parent 9646edb commit 1a66685
Show file tree
Hide file tree
Showing 3 changed files with 225 additions and 2 deletions.
116 changes: 116 additions & 0 deletions alipay/marketing_voucher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
100 changes: 100 additions & 0 deletions alipay/model_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
11 changes: 9 additions & 2 deletions release_note.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 1a66685

Please sign in to comment.