Skip to content

Commit 735e4ed

Browse files
author
伊昂
committed
feat: 新增修改签约协议
1 parent 43ba129 commit 735e4ed

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

agreement.go

+8
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ func (this *AliPay) AliPayAgreementUnsign(param AliPayAgreementUnsign) (results
1515
err = this.doRequest("POST", param, results)
1616
return results, err
1717
}
18+
19+
// AgreementModify https://docs.open.alipay.com/api_2/alipay.user.agreement.executionplan.modify
20+
// 修改协议接口alipay.user.agreement.executionplan.modify
21+
func (this *AliPay) AliPayAgreementModify(param AliPayAgreementModify) (results *AliPayAgreementModifyResponse, err error) {
22+
results = &AliPayAgreementModifyResponse{}
23+
err = this.doRequest("POST", param, results)
24+
return results, err
25+
}

agreement_type.go

+54-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type AliPayAgreementUnsign struct {
7676
AlipayUserId string `json:"alipay_user_id"` // 用户的支付宝账号对应 的支付宝唯一用户号,以 2088 开头的 16 位纯数字 组成
7777
AlipayLogonId string `json:"alipay_logon_id"` // 用户的支付宝登录账号,支持邮箱或手机号码格式。本参数与alipay_user_id 不可同时为空,若都填写,则以alipay_user_id 为准
7878
ExternalAgreementNo string `json:"external_agreement_no"` // 萌推系统内部的 contract_code
79-
79+
AgreementNo string `json:"agreement_no"` // 支付宝系统中用以唯一标识用户签约记录的编号(用户签约成功后的协议号),如果传了该参数,其他参数会被忽略
8080
}
8181

8282
func (this AliPayAgreementUnsign) APIName() string {
@@ -99,8 +99,10 @@ func (this AliPayAgreementUnsign) ExtJSONParamValue() string {
9999

100100
type AliPayAgreementUnsignResponse struct {
101101
AlipayUserAgreementUnsignResponse struct {
102-
Code string `json:"code"`
103-
Msg string `json:"msg"`
102+
Code string `json:"code"`
103+
Msg string `json:"msg"`
104+
SubCode string `json:"sub_code"`
105+
SubMsg string `json:"sub_msg"`
104106
} `json:"alipay_user_agreement_unsign_response"`
105107
Sign string `json:"sign"`
106108
Body string `json:"-"` // 返回内容原文,主要是为了记录日志
@@ -115,3 +117,52 @@ func (this *AliPayAgreementUnsignResponse) IsSuccess() bool {
115117
func (this *AliPayAgreementUnsignResponse) SetOriginBody(body string) {
116118
this.Body = body
117119
}
120+
121+
////////////////////////////////////////////////////////////////////////////////
122+
// https://docs.open.alipay.com/api_2/alipay.user.agreement.executionplan.modify
123+
// 支付宝个人代扣协议修改接口
124+
type AliPayAgreementModify struct {
125+
AgreementNo string `json:"agreement_no"` // 支付宝系统中用以唯一标识用户签约记录的编号(用户签约成功后的协议号),如果传了该参数,其他参数会被忽略
126+
DeductTime string `json:"deduct_time"` // 商户下一次扣款时间
127+
Memo string `json:"memo"` // 具体修改原因
128+
}
129+
130+
func (this AliPayAgreementModify) APIName() string {
131+
return "alipay.user.agreement.executionplan.modify"
132+
}
133+
134+
func (this AliPayAgreementModify) Params() map[string]string {
135+
var m = make(map[string]string)
136+
return m
137+
}
138+
139+
func (this AliPayAgreementModify) ExtJSONParamName() string {
140+
return "biz_content"
141+
}
142+
143+
func (this AliPayAgreementModify) ExtJSONParamValue() string {
144+
return marshal(this)
145+
}
146+
147+
type AliPayAgreementModifyResponse struct {
148+
AlipayUserAgreementExecutionplanModifyResponse struct {
149+
Code string `json:"code"`
150+
Msg string `json:"msg"`
151+
SubCode string `json:"sub_code"`
152+
SubMsg string `json:"sub_msg"`
153+
AgreementNo string `json:"agreement_no"`
154+
DeductTime string `json:"deduct_time"`
155+
} `json:"alipay_user_agreement_executionplan_modify_response"`
156+
Sign string `json:"sign"`
157+
Body string `json:"-"` // 返回内容原文,主要是为了记录日志
158+
}
159+
160+
func (this *AliPayAgreementModifyResponse) IsSuccess() bool {
161+
if this.AlipayUserAgreementExecutionplanModifyResponse.Code == K_SUCCESS_CODE {
162+
return true
163+
}
164+
return false
165+
}
166+
func (this *AliPayAgreementModifyResponse) SetOriginBody(body string) {
167+
this.Body = body
168+
}

0 commit comments

Comments
 (0)