@@ -209,7 +209,7 @@ func (a *Client) UserCertifyOpenQuery(ctx context.Context, bm gopay.BodyMap) (al
209
209
210
210
// alipay.user.agreement.page.sign(支付宝个人协议页面签约接口)
211
211
// 文档地址:https://opendocs.alipay.com/open/8bccfa0b_alipay.user.agreement.page.sign
212
- func (a * Client ) UserAgreementPageSign (ctx context.Context , bm gopay.BodyMap ) (ret string , err error ) {
212
+ func (a * Client ) UserAgreementPageSign (ctx context.Context , bm gopay.BodyMap ) (pageRedirectionData string , err error ) {
213
213
err = bm .CheckEmptyError ("personal_product_code" )
214
214
if err != nil {
215
215
return gopay .NULL , err
@@ -221,27 +221,43 @@ func (a *Client) UserAgreementPageSign(ctx context.Context, bm gopay.BodyMap) (r
221
221
return string (bs ), nil
222
222
}
223
223
224
- // alipay.user.agreement.page.sign(APP 支付宝个人协议页面签约接口)
225
- // 文档地址:https://opendocs.alipay.com/open/00a05b 通过 App 唤起支付宝的签约页面
224
+ // alipay.user.agreement.page.sign(支付宝个人协议页面签约接口) - PC转二维码唤起签约页
225
+ // 文档地址:https://opendocs.alipay.com/open/08ayiq?pathHash=a2d4e097#PC%E8%BD%AC%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%94%A4%E8%B5%B7%E7%AD%BE%E7%BA%A6%E9%A1%B5
226
+ func (a * Client ) UserAgreementPageSignInQRCode (ctx context.Context , bm gopay.BodyMap ) (qrcode string , err error ) {
227
+ err = bm .CheckEmptyError ("personal_product_code" , "access_params" )
228
+ if err != nil {
229
+ return gopay .NULL , err
230
+ }
231
+ var bs []byte
232
+ if bs , err = a .doAliPay (ctx , bm , "alipay.user.agreement.page.sign" ); err != nil {
233
+ return "" , err
234
+ }
235
+ // 该链接里面的 APPID 为固定值,不可修改
236
+ // 生成唤起客户端。把signParams使用 UTF-8 字符集整体做一次 encode
237
+ qrcode = "alipays://platformapi/startapp?appId=60000157&appClearTop=false&startMultApp=YES&sign_params=" + url .QueryEscape (string (bs ))
238
+ return qrcode , nil
239
+ }
240
+
241
+ // Deprecated
242
+ // 后续会删除,请使用 UserAgreementPageSignInQRCode() 替代
226
243
func (a * Client ) UserAgreementPageSignInApp (ctx context.Context , bm gopay.BodyMap ) (ret string , err error ) {
227
- err = bm .CheckEmptyError ("personal_product_code" )
244
+ err = bm .CheckEmptyError ("personal_product_code" , "access_params" )
228
245
if err != nil {
229
246
return gopay .NULL , err
230
247
}
231
248
232
- var bs string
233
- // 参考官方示例
234
- // PageExecute get方式,生成url
235
- if bs , err = a .PageExecute (ctx , bm , "alipay.user.agreement.page.sign" ); err != nil {
249
+ // 参考官方示例 PageExecute get方式,生成 uri
250
+ uri , err := a .PageExecute (ctx , bm , "alipay.user.agreement.page.sign" )
251
+ if err != nil {
236
252
return "" , err
237
253
}
238
254
239
- // / 生成的url地址去除 http://openapi.alipay.com/gateway.do
255
+ // / 生成的url地址去除 http://openapi.alipay.com/gateway.do?
240
256
replaceUrl := baseUrl + "?"
241
257
if ! a .IsProd {
242
258
replaceUrl = sandboxBaseUrl + "?"
243
259
}
244
- signParams := strings .Replace (bs , replaceUrl , "" , 1 )
260
+ signParams := strings .Replace (uri , replaceUrl , "" , 1 )
245
261
246
262
// 该链接里面的 APPID 为固定值,不可修改)
247
263
// 生成唤起客户端。把signParams使用 UTF-8 字符集整体做一次 encode
0 commit comments