@@ -33,7 +33,7 @@ func (comp *Client) JSAPITransaction(ctx context.Context, params *request.Reques
33
33
result := & response.ResponseUnitfy {}
34
34
35
35
endpoint := "/v3/pay/transactions/jsapi"
36
- _ , err := comp .PayTransaction (ctx , endpoint , params , result )
36
+ _ , err := comp .PayTransaction (ctx , endpoint , params , result , true )
37
37
return result , err
38
38
}
39
39
@@ -44,7 +44,7 @@ func (comp *Client) TransactionApp(ctx context.Context, params *request.RequestA
44
44
result := & response.ResponseUnitfy {}
45
45
46
46
endpoint := "/v3/pay/transactions/app"
47
- _ , err := comp .PayTransaction (ctx , endpoint , params , result )
47
+ _ , err := comp .PayTransaction (ctx , endpoint , params , result , true )
48
48
49
49
return result , err
50
50
}
@@ -56,7 +56,7 @@ func (comp *Client) TransactionH5(ctx context.Context, params *request.RequestH5
56
56
result := & response.ResponseH5URL {}
57
57
58
58
endpoint := "/v3/pay/transactions/h5"
59
- _ , err := comp .PayTransaction (ctx , endpoint , params , result )
59
+ _ , err := comp .PayTransaction (ctx , endpoint , params , result , true )
60
60
return result , err
61
61
}
62
62
@@ -67,7 +67,7 @@ func (comp *Client) TransactionNative(ctx context.Context, params *request.Reque
67
67
result := & response.ResponseCodeURL {}
68
68
69
69
endpoint := "/v3/pay/transactions/native"
70
- _ , err := comp .PayTransaction (ctx , endpoint , params , result )
70
+ _ , err := comp .PayTransaction (ctx , endpoint , params , result , true )
71
71
72
72
return result , err
73
73
}
@@ -79,19 +79,31 @@ func (comp *Client) TransactionAppCombine(ctx context.Context, params *request.R
79
79
result := & response.ResponseUnitfy {}
80
80
81
81
endpoint := "/v3/combine-transactions/app"
82
- _ , err := comp .PayTransaction (ctx , endpoint , params , result )
82
+ _ , err := comp .PayTransaction (ctx , endpoint , params , result , true )
83
83
84
84
return result , err
85
85
}
86
86
87
- func (comp * Client ) PayTransaction (ctx context.Context , entryPoint string , params request.Prepay , result interface {}) (interface {}, error ) {
87
+ // 付款码支付
88
+ // https://pay.weixin.qq.com/docs/merchant/apis/code-payment-v3/direct/code-pay.html
89
+ func (comp * Client ) TransactionCodePay (ctx context.Context , params * request.RequestCodePay ) (* response.ResponseCodePayResult , error ) {
90
+
91
+ result := & response.ResponseCodePayResult {}
92
+
93
+ endpoint := "/v3/pay/transactions/codepay"
94
+ _ , err := comp .PayTransaction (ctx , endpoint , params , result , false )
95
+
96
+ return result , err
97
+ }
98
+
99
+ func (comp * Client ) PayTransaction (ctx context.Context , entryPoint string , params request.Prepay , result interface {}, needNotify bool ) (interface {}, error ) {
88
100
config := comp .App .GetConfig ()
89
101
90
102
if params .GetAppID () == "" {
91
103
appID := config .GetString ("app_id" , "" )
92
104
params .SetAppID (appID )
93
105
}
94
- if params .GetNotifyUrl () == "" {
106
+ if params .GetNotifyUrl () == "" && needNotify {
95
107
url := config .GetString ("notify_url" , "" )
96
108
params .SetNotifyUrl (url )
97
109
}
0 commit comments