Skip to content

Commit e3808a0

Browse files
committed
暂存
1 parent 5445734 commit e3808a0

15 files changed

+24
-48
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ 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
1514
alipay_pay_request.payment_notify_url = "https://www.yourNotifyUrl.com/notify"

com/alipay/ams/api/request/pay/entry_code_payment_request.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
from com.alipay.ams.api.model.amount import Amount
5+
from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants
56
from com.alipay.ams.api.model.payment_factor import PaymentFactor
67
from com.alipay.ams.api.model.payment_method import PaymentMethod
78
from com.alipay.ams.api.model.product_code_type import ProductCodeType
@@ -12,9 +13,7 @@ class EntryCodePaymentRequest(AlipayPayRequest):
1213

1314
def __init__(self, payment_request_id, order, currency, amount_in_cents, payment_notify_url=None,
1415
payment_redirect_url=None, payment_expiry_time=None):
15-
super(AlipayPayRequest, self).__init__()
16-
self.path = '/ams/api/v1/payments/pay'
17-
16+
super(AlipayPayRequest, self).__init__(AntomPathConstants.PAYMENT_PATH)
1817
self.product_code = ProductCodeType.IN_STORE_PAYMENT
1918
self.payment_amount = Amount(currency, amount_in_cents)
2019

com/alipay/ams/api/request/pay/order_code_payment_request.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
from com.alipay.ams.api.model.amount import Amount
5+
from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants
56
from com.alipay.ams.api.model.payment_factor import PaymentFactor
67
from com.alipay.ams.api.model.payment_method import PaymentMethod
78
from com.alipay.ams.api.model.product_code_type import ProductCodeType
@@ -12,9 +13,7 @@ class OrderCodePaymentRequest(AlipayPayRequest):
1213

1314
def __init__(self, payment_request_id, order, currency, amount_in_cents, payment_notify_url=None,
1415
payment_expiry_time=None):
15-
super(AlipayPayRequest, self).__init__()
16-
self.path = '/ams/api/v1/payments/pay'
17-
16+
super(AlipayPayRequest, self).__init__(AntomPathConstants.PAYMENT_PATH)
1817
self.product_code = ProductCodeType.IN_STORE_PAYMENT
1918
self.payment_amount = Amount(currency, amount_in_cents)
2019

com/alipay/ams/api/request/pay/user_presented_code_payment_request.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
from com.alipay.ams.api.model.amount import Amount
5+
from com.alipay.ams.api.model.antom_path_constants import AntomPathConstants
56
from com.alipay.ams.api.model.payment_factor import PaymentFactor
67
from com.alipay.ams.api.model.payment_method import PaymentMethod
78
from com.alipay.ams.api.model.product_code_type import ProductCodeType
@@ -12,9 +13,7 @@ class UserPresentedCodePaymentRequest(AlipayPayRequest):
1213

1314
def __init__(self, payment_request_id, order, currency, amount_in_cents, payment_code, payment_notify_url=None,
1415
payment_expiry_time=None):
15-
super(AlipayPayRequest, self).__init__()
16-
self.path = '/ams/api/v1/payments/pay'
17-
16+
super(AlipayPayRequest, self).__init__(AntomPathConstants.PAYMENT_PATH)
1817
self.product_code = ProductCodeType.IN_STORE_PAYMENT
1918
self.payment_amount = Amount(currency, amount_in_cents)
2019

example/auth.py

Lines changed: 0 additions & 4 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,7 +63,6 @@ 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"
6966
alipay_auth_consult_request.auth_redirect_url = "https://www.yourRedirectUrl.com/?param1=567&param2=123"
7067
alipay_auth_consult_request.auth_state = "663A8FA9-D836-56EE-8AA1-dd1F6F6811f989DC7"
7168
alipay_auth_consult_request.customer_belongs_to = CustomerBelongsTo.ALIPAY_CN
@@ -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='https://www.yourNotifyUrl.com')
5151

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

example/marketplace_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def createPayout():
238238
transfer_to_detail.payment_method = payment_method1
239239
transfer_to_detail.transfer_to_currency = "BRL"
240240
transfer_to_detail.purpose_code = "GSD"
241-
transfer_to_detail.transfer_notify_url = "http://www.yourNotifyUrl.com"
241+
transfer_to_detail.transfer_notify_url = "https://www.yourNotifyUrl.com"
242242
alipay_create_payout_request.transfer_to_detail = transfer_to_detail
243243

244244
rsp_body = default_alipay_client.execute(alipay_create_payout_request)
@@ -269,7 +269,7 @@ def createTransfer():
269269
transfer_to_detail.payment_method = payment_method1
270270
transfer_to_detail.transfer_to_currency = "BRL"
271271
transfer_to_detail.purpose_code = "GSD"
272-
transfer_to_detail.transfer_notify_url = "http://www.yourNotifyUrl.com"
272+
transfer_to_detail.transfer_notify_url = "https://www.yourNotifyUrl.com"
273273
alipay_create_transfer_request.transfer_to_detail = transfer_to_detail
274274

275275
rsp_body = default_alipay_client.execute(alipay_create_transfer_request)

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='https://www.yourNotifyUrl.com')
4646

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

example/payment.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ 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"
@@ -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

0 commit comments

Comments
 (0)