Skip to content

Commit 9b9d197

Browse files
committed
update cr
1 parent 5445734 commit 9b9d197

11 files changed

+13
-38
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ Copyright:Ant financial services group
99
default_alipay_client = DefaultAlipayClient("https://open-na.alipay.com", client_id, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
1010
1111
alipay_pay_request = AlipayPayRequest()
12-
alipay_pay_request.path = "/ams/api/v1/payments/pay"
1312
1413
alipay_pay_request.product_code = ProductCodeType.AGREEMENT_PAYMENT
15-
alipay_pay_request.payment_notify_url = "https://www.yourNotifyUrl.com/notify"
16-
alipay_pay_request.payment_redirect_url = "https://www.yourRedirectUrl.com?param1=sl"
14+
alipay_pay_request.payment_notify_url = "https://www.yourNotifyUrl.com"
15+
alipay_pay_request.payment_redirect_url = "https://www.yourRedirectUrl.com"
1716
alipay_pay_request.payment_request_id = "pay_python_test"
1817
1918
payment_method = PaymentMethod()

example/auth.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def apply_token(authCode):
2727
# 申请token
2828
alipay_auth_apply_token_request = AlipayAuthApplyTokenRequest()
2929

30-
alipay_auth_apply_token_request.path = '/ams/api/v1/authorizations/applyToken'
3130
alipay_auth_apply_token_request.grant_type = GrantType.AUTHORIZATION_CODE
3231
alipay_auth_apply_token_request.customer_belongs_to = "ALIPAY_CN"
3332
alipay_auth_apply_token_request.merchant_region = "SG"
@@ -48,7 +47,6 @@ def query_token():
4847

4948
# 查询token
5049
alipay_auth_query_token_request = AlipayAuthQueryTokenRequest()
51-
alipay_auth_query_token_request.path = '/ams/api/v1/authorizations/query'
5250
alipay_auth_query_token_request.access_token = "2020042910435415881282340824710273532915573saFBMrdXVH"
5351

5452
rsp_body = default_alipay_client.execute(alipay_auth_query_token_request)
@@ -65,8 +63,7 @@ def auth_consult():
6563
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
6664

6765
alipay_auth_consult_request = AlipayAuthConsultRequest()
68-
alipay_auth_consult_request.path = "/ams/api/v1/authorizations/consult"
69-
alipay_auth_consult_request.auth_redirect_url = "https://www.yourRedirectUrl.com/?param1=567&param2=123"
66+
alipay_auth_consult_request.auth_redirect_url = "https://www.yourRedirectUrl.com"
7067
alipay_auth_consult_request.auth_state = "663A8FA9-D836-56EE-8AA1-dd1F6F6811f989DC7"
7168
alipay_auth_consult_request.customer_belongs_to = CustomerBelongsTo.ALIPAY_CN
7269
alipay_auth_consult_request.auth_client_id = "SM_0001"
@@ -94,7 +91,6 @@ def revoke_token(accessToken):
9491
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY,
9592
ALIPAY_PUBLIC_KEY)
9693
alipay_revoke_token_request = AlipayAuthRevokeTokenRequest()
97-
alipay_revoke_token_request.path = "/ams/api/v1/authorizations/revoke"
9894
alipay_revoke_token_request.access_token = accessToken
9995

10096
rsp_body = default_alipay_client.execute(alipay_revoke_token_request)

example/customsDeclare.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
def declare(paymentId):
2020
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
2121
alipayCustomsDeclareRequest = AlipayCustomsDeclareRequest()
22-
alipayCustomsDeclareRequest.path = "/ams/api/v1/customs/declare"
2322
alipayCustomsDeclareRequest.declaration_request_id = "declaration_test_00001"
2423
alipayCustomsDeclareRequest.payment_id = paymentId
2524
alipayCustomsDeclareRequest.declaration_amount = Amount("CNY", 100)
@@ -56,7 +55,6 @@ def inquiryDeclaration(declarationRequestIds):
5655
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY,
5756
ALIPAY_PUBLIC_KEY)
5857
alipayCustomsQueryRequest = AlipayCustomsQueryRequest()
59-
alipayCustomsQueryRequest.path = "/ams/api/v1/customs/inquiryDeclarationRequests"
6058
alipayCustomsQueryRequest.declaration_request_ids = declarationRequestIds
6159

6260
rsp_body = default_alipay_client.execute(alipayCustomsQueryRequest)

example/entry_code_payment_request_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_entry_code(self):
4747
order.env.user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 NebulaSDK/1.8.100112 Nebula PSDType(1) AlipayDefined(nt:4G,ws:320|504|2.0) AliApp(AP/10.1.32.600) AlipayClient/10.1.32.600 Alipay Language/zh-Hans AlipayConnect"
4848

4949
orderCodeReq = EntryCodePaymentRequest(payment_request_id=int(time.time()), order=order, currency="USD",
50-
amount_in_cents=1231, payment_notify_url='http://yourNotifyUrl.com/test')
50+
amount_in_cents=1231, payment_notify_url='http://yourNotifyUrl.com')
5151

5252
body = orderCodeReq.to_ams_json()
5353
# print(body)

example/order_code_payment_request_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def test_order_code(self):
4242
order.merchant = merchant
4343

4444
orderCodeReq = OrderCodePaymentRequest(payment_request_id=int(time.time()), order=order, currency="USD",
45-
amount_in_cents=1231, payment_notify_url='http://yourNotifyUrl.com/test')
45+
amount_in_cents=1231, payment_notify_url='http://yourNotifyUrl.com')
4646

4747
body = orderCodeReq.to_ams_json()
4848
# print(body)

example/payment.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ def pay():
4545
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
4646

4747
alipay_pay_request = AlipayPayRequest()
48-
# alipay_pay_request.path = "/ams/api/v1/payments/pay"
4948

5049
alipay_pay_request.product_code = ProductCodeType.CASHIER_PAYMENT
5150
alipay_pay_request.payment_notify_url = "https://www.yourNotifyUrl.com"
52-
alipay_pay_request.payment_redirect_url = "https://www.yourRedirectUrl.com?param1=sl"
51+
alipay_pay_request.payment_redirect_url = "https://www.yourRedirectUrl.com"
5352
alipay_pay_request.payment_request_id = "pay_python_test" + str(uuid.uuid4())
5453
payment_method = PaymentMethod()
5554
payment_method.payment_method_type = "ALIPAY_CN"
@@ -112,7 +111,6 @@ def pay():
112111
def pay_consult():
113112
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
114113
pay_consult_request = AlipayPayConsultRequest()
115-
pay_consult_request.path = "/ams/api/v1/payments/consult"
116114
pay_consult_request.product_code = ProductCodeType.CASHIER_PAYMENT
117115
# pay_consult_request.customer_id = "123441"
118116
pay_consult_request.user_region = "SG"
@@ -150,7 +148,6 @@ def pay_cancel(paymentId):
150148
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
151149

152150
alipay_pay_cancel_request = AlipayPayCancelRequest()
153-
alipay_pay_cancel_request.path = "/ams/api/v1/payments/cancel"
154151
alipay_pay_cancel_request.payment_id = paymentId
155152

156153
rsp_body = default_alipay_client.execute(alipay_pay_cancel_request)
@@ -167,7 +164,6 @@ def pay_query(paymenId):
167164
default_alipay_client = DefaultAlipayClient(GATEWAY_HOST, CLIENT_ID, MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
168165

169166
alipay_pay_query_request = AlipayPayQueryRequest()
170-
alipay_pay_query_request.path = "/ams/api/v1/payments/inquiryPayment"
171167
alipay_pay_query_request.payment_id = paymenId
172168

173169
rsp_body = default_alipay_client.execute(alipay_pay_query_request)
@@ -186,7 +182,6 @@ def capture(paymentId):
186182
ALIPAY_PUBLIC_KEY)
187183

188184
alipay_capture_request = AlipayCaptureRequest()
189-
alipay_capture_request.path = "/ams/api/v1/payments/capture"
190185
alipay_capture_request.payment_id = paymentId
191186
alipay_capture_request.capture_request_id = "python_capture_test_01"
192187
alipay_capture_request.is_last_capture = "true"
@@ -211,7 +206,6 @@ def refund(paymentId):
211206
ALIPAY_PUBLIC_KEY)
212207

213208
alipay_refund_request = AlipayRefundRequest()
214-
alipay_refund_request.path = "/ams/api/v1/payments/refund"
215209
alipay_refund_request.refund_request_id = "python_test_refund_1212"
216210
alipay_refund_request.payment_id = paymentId
217211

@@ -235,7 +229,6 @@ def inqueryRefund(paymentRefundRequestId):
235229
ALIPAY_PUBLIC_KEY)
236230

237231
alipay_inquery_refund_request = AlipayRefundQueryRequest()
238-
alipay_inquery_refund_request.path = "/ams/api/v1/payments/inquiryRefund"
239232
alipay_inquery_refund_request.refund_request_id = paymentRefundRequestId
240233

241234
rsp_body = default_alipay_client.execute(alipay_inquery_refund_request)
@@ -253,7 +246,6 @@ def createPaymentSession():
253246
ALIPAY_PUBLIC_KEY)
254247

255248
alipay_create_session_request = AlipayCreateSessionRequest()
256-
alipay_create_session_request.path = "/ams/api/v1/payments/createPaymentSession"
257249
alipay_create_session_request.payment_request_id = "python_test_payment_request_id_1212"
258250
alipay_create_session_request.payment_amount = Amount("SGD", "4200")
259251
alipay_create_session_request.product_code = ProductCodeType.CASHIER_PAYMENT

example/registration.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ def register():
3131
alipay_merchant_registration_request = AlipayMerchantRegistrationRequest()
3232
alipay_merchant_registration_request.registration_request_id = "reqId107336691327831097346773_test_111"
3333
alipay_merchant_registration_request.pass_through_info = "{\"acquiringCurrency\":[\"HKD\"],\"settlementType\":\"DOMESTIC_SETTLEMENT\",\"legalRepresentativeName\":\"legalRepresentativeName\"}"
34-
alipay_merchant_registration_request.registration_notify_url = "http://xmock.inc.alipay.net/api/Test/yibeiTest/testPayNotify1.htm"
35-
alipay_merchant_registration_request.path = "/ams/api/v1/merchants/registration"
34+
alipay_merchant_registration_request.registration_notify_url = "https://www.yourNotifyUrl.com"
3635
alipay_merchant_registration_request.product_codes = ["AGREEMENT_PAYMENT"]
3736

3837
merchant_info = MerchantRegistrationInfo()
@@ -122,7 +121,6 @@ def query_info():
122121
default_alipay_client = DefaultAlipayClient("https://open-na.alipay.com", CLIENT_ID, MERCHANT_PRIVATE_KEY,
123122
ALIPAY_PUBLIC_KEY)
124123
alipay_merchant_registration_info_query_request = AlipayMerchantRegistrationInfoQueryRequest()
125-
alipay_merchant_registration_info_query_request.path = "/ams/api/v1/merchants/inquiryRegistrationInfo"
126124

127125
alipay_merchant_registration_info_query_request.reference_merchant_id = "5188122826664900663130"
128126

@@ -141,7 +139,6 @@ def query_registration_status():
141139
default_alipay_client = DefaultAlipayClient("https://open-na.alipay.com", CLIENT_ID,
142140
MERCHANT_PRIVATE_KEY, ALIPAY_PUBLIC_KEY)
143141
alipay_merchant_registration_status_query_request = AlipayMerchantRegistrationStatusQueryRequest()
144-
alipay_merchant_registration_status_query_request.path = "/ams/api/v1/merchants/inquiryRegistrationStatus"
145142

146143
alipay_merchant_registration_status_query_request.reference_merchant_id = "5188122826664900663130"
147144

example/subscription_demo.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
from com.alipay.ams.api.response.subscription.alipay_subscription_create_response import \
2424
AlipaySubscriptionCreateResponse
2525

26-
GATEWAY_HOST = "https://open-sea-global.alipay.com"
27-
CLIENT_ID = "SANDBOX_5YBZ1G2ZHUPS06086"
28-
MERCHANT_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/PqnrI3zdRMIAqIFzOlNkop2o/jMVva22j05W7/Sv78PU7SMmwQGObmw9COcm2nX0N1ix0dlqH2lmXRmoE69hElXcWnDEzcSHpNe1HtM0eWgOLozr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3Db0P+cmSPiYAJG4keh6gHAqJMj4+rKRfDOmQKBgCbdp9jRemCffzpyT/p7CDzLyh7I4nS/xD5SCkyd235PAPZYUG6+wH1+O2cvuY36tfSBybje9Xkxu+CSl8SbS4JaU9KHpTZncV8Cb8l/sDy62zuONPNKmQzl5q063vTtfU8fkJbPT8UFzexzetz9V2fVFaahn/GhL6RGDZHdO5h3AoGALV6PDVsB6VjJtE8RA8Bpsmwl6ytLDiEljFImkzXQzq4/gTz2NJXjKGnUC70pae1Z1OWMHoZWqFgg1YAxVHeFZBqLQ88HwmCwwRjLkUyFxPRlJ7y4V8olBsDY57E1j03MNENaal88bRpvKUoZRTh8HCbk6BV8e6o+2vMf3HUe2Ss="
29-
ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkJIL3C7NSzSQxP1DNK0Grktr5G5bMEj4ndEIBnSyFv8+e6ytS+G1+ch7EdZ4Lt7KYUGoFW1wJKyTS8V5UBMJTWxAkdc2uX3GrQiWbPvReMl3sNa3SC9Kmi8ofVKQdpAt8aZZaTLxmti0YyCh8zUTddE9AOeMZi8xvzC8chcGbfx4FA5meFGkPEBeYfxZgQzCjXnMJ/A2JFeh5g2443pfAq/caoIamcnTcA9qhJCMaqDyXb2pxXmg/VOClhqhaOjj4dnxzYKln1YNJw02SaVT9zjkNJkbY2QzCjEV0NdG/QLCQ/xBkFlDvlJ+nyCiTySqVOuJXGCos1cljMoYJGZLXQIDAQAB"
26+
MERCHANT_PRIVATE_KEY = ""
27+
ALIPAY_PUBLIC_KEY = ""
28+
CLIENT_ID = ""
29+
GATEWAY_HOST = ""
3030

3131

3232
def subscriptionsCreate():
@@ -39,9 +39,6 @@ def subscriptionsCreate():
3939
env.terminal_type = TerminalType.WEB
4040
alipay_subscription_create_request.env = env
4141
alipay_subscription_create_request.payment_amount = Amount("HKD", "100")
42-
#replace with your notify url
43-
#or configur your notify url https://dashboard.alipay.com/global-payments/developers/iNotifyNotification
44-
alipay_subscription_create_request.payment_notification_url = "http://www.yourNotifyUrl.com"
4542

4643
period_rule = PeriodRule()
4744
period_rule.period_type = PeriodType.MONTH
@@ -56,7 +53,6 @@ def subscriptionsCreate():
5653
alipay_subscription_create_request.subscription_start_time = "2024-10-16T00:00:00+08:00"
5754
alipay_subscription_create_request.subscription_end_time = "2024-10-17T17:00:00+08:00"
5855
alipay_subscription_create_request.subscription_expiry_time = "2024-10-18T00:00:00+08:00"
59-
alipay_subscription_create_request.subscription_notification_url = "http://www.yourNotifyUrl.com"
6056

6157
order_info = OrderInfo()
6258
order_info.order_amount = Amount("HKD", "100")

example/user_presented_code_payment_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_upcp(self):
5050

5151
upcpReq = UserPresentedCodePaymentRequest(payment_request_id=int(time.time()), order=order, currency="USD",
5252
amount_in_cents=1231, payment_code='28888888888888888888',
53-
payment_notify_url='http://yourNotifyUrl.com/test')
53+
payment_notify_url='http://yourNotifyUrl.com')
5454

5555
body = upcpReq.to_ams_json()
5656
# print(body)

example/users.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def user_query_info():
2323
ALIPAY_PUBLIC_KEY)
2424

2525
alipay_user_query_info_request = AlipayUserQueryInfoRequest()
26-
alipay_user_query_info_request.path = "/ams/api/v1/users/inquiryUserInfo"
2726
alipay_user_query_info_request.access_token = "2020060417341615912632560749423400649135650RJsliOKYQP"
2827

2928
rsp_body = default_alipay_client.execute(alipay_user_query_info_request)
@@ -40,7 +39,6 @@ def init_authentication():
4039
default_alipay_client = DefaultAlipayClient("https://open-na.alipay.com", CLIENT_ID, MERCHANT_PRIVATE_KEY,
4140
ALIPAY_PUBLIC_KEY)
4241
alipay_init_authentication_request = AlipayInitAuthenticationRequest()
43-
alipay_init_authentication_request.path = "/ams/api/v1/users/initAuthentication"
4442
alipay_init_authentication_request.authentication_channel_type = AuthenticationChannelType.SMS
4543
alipay_init_authentication_request.authentication_request_id = "test_1"
4644
alipay_init_authentication_request.authentication_type = AuthenticationType.OTP
@@ -61,7 +59,6 @@ def verify_authentication():
6159
default_alipay_client = DefaultAlipayClient("https://open-na.alipay.com", CLIENT_ID, MERCHANT_PRIVATE_KEY,
6260
ALIPAY_PUBLIC_KEY)
6361
alipay_verify_authentication_request = AlipayVerifyAuthenticationRequest()
64-
alipay_verify_authentication_request.path = "/ams/api/v1/users/verifyAuthentication"
6562
alipay_verify_authentication_request.authentication_request_id = "test_1"
6663
alipay_verify_authentication_request.authentication_type = AuthenticationType.OTP
6764
alipay_verify_authentication_request.authentication_value = "666"

0 commit comments

Comments
 (0)