Skip to content

Commit 08e82ad

Browse files
committed
pay/createPaymentSession支付接口支持订阅支付能力
1 parent bd28bab commit 08e82ad

File tree

7 files changed

+146
-3
lines changed

7 files changed

+146
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
4+
## 1.4.4 - 2024-04-10
5+
- pay/createPaymentSession支付接口支持订阅支付能力
6+
7+
38
## 1.4.4 - 2024-04-10
49
* [#28](https://github.com/alipay/global-open-sdk-python/pull/28) feature-250410
510
- Antom 印度渠道接入AMS拒付相关接口的标准变更

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
```
22
Language:Python
33
Python version:2.7+
4-
Releass ^1.4.4
4+
Releass ^1.4.5
55
Copyright:Ant financial services group
66
```
77

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import json
2+
3+
from com.alipay.ams.api.model.period_rule import PeriodRule
4+
from com.alipay.ams.api.model.trial import Trial
5+
6+
7+
class SubscriptionInfo(object):
8+
def __init__(self):
9+
self.__subscription_description = None # type: str
10+
self.__subscription_start_time = None # type: str
11+
self.__subscription_end_time = None # type: str
12+
self.__period_rule = None # type: PeriodRule
13+
self.__trials = None # type: list: Trial
14+
self.__subscription_notify_url = None # type: str
15+
self.__subscription_expiry_time = None # type: str
16+
17+
@property
18+
def subscription_description(self):
19+
return self.__subscription_description
20+
21+
@subscription_description.setter
22+
def subscription_description(self, value):
23+
self.__subscription_description = value
24+
25+
@property
26+
def subscription_start_time(self):
27+
return self.__subscription_start_time
28+
29+
@subscription_start_time.setter
30+
def subscription_start_time(self, value):
31+
self.__subscription_start_time = value
32+
33+
@property
34+
def subscription_end_time(self):
35+
return self.__subscription_end_time
36+
37+
@subscription_end_time.setter
38+
def subscription_end_time(self, value):
39+
self.__subscription_end_time = value
40+
41+
@property
42+
def period_rule(self):
43+
return self.__period_rule
44+
45+
@period_rule.setter
46+
def period_rule(self, value):
47+
self.__period_rule = value
48+
49+
@property
50+
def trials(self):
51+
return self.__trials
52+
53+
@trials.setter
54+
def trials(self, value):
55+
self.__trials = value
56+
57+
@property
58+
def subscription_notify_url(self):
59+
return self.__subscription_notify_url
60+
61+
@subscription_notify_url.setter
62+
def subscription_notify_url(self, value):
63+
self.__subscription_notify_url = value
64+
65+
@property
66+
def subscription_expiry_time(self):
67+
return self.__subscription_expiry_time
68+
69+
@subscription_expiry_time.setter
70+
def subscription_expiry_time(self, value):
71+
self.__subscription_expiry_time = value
72+
def to_ams_json(self):
73+
json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3)
74+
return json_str
75+
76+
def __to_ams_dict(self):
77+
params = dict()
78+
if self.__subscription_description is not None:
79+
params['subscriptionDescription'] = self.__subscription_description
80+
if self.__subscription_start_time is not None:
81+
params['subscriptionStartTime'] = self.__subscription_start_time
82+
if self.__subscription_end_time is not None:
83+
params['subscriptionEndTime'] = self.__subscription_end_time
84+
if self.__period_rule is not None:
85+
params['periodRule'] = self.__period_rule
86+
if self.__trials is not None:
87+
params['trials'] = self.__trials
88+
if self.__subscription_notify_url is not None:
89+
params['subscriptionNotifyUrl'] = self.__subscription_notify_url
90+
if self.__subscription_expiry_time is not None:
91+
params['subscriptionExpiryTime'] = self.__subscription_expiry_time
92+
93+
return params

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from com.alipay.ams.api.model.payment_method import PaymentMethod
1010
from com.alipay.ams.api.model.product_code_type import ProductCodeType
1111
from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy
12+
from com.alipay.ams.api.model.subscription_info import SubscriptionInfo
1213
from com.alipay.ams.api.request.alipay_request import AlipayRequest
1314

1415

@@ -36,6 +37,7 @@ def __init__(self):
3637
self.__locale = None
3738
self.__available_payment_method = None # type: list[AvailablePaymentMethod]
3839
self.__allowed_payment_method_regions = None # type: list[str]
40+
self.__subscription_info = None # type: SubscriptionInfo
3941

4042
@property
4143
def product_code(self):
@@ -181,6 +183,30 @@ def locale(self):
181183
def locale(self, value):
182184
self.__locale = value
183185

186+
@property
187+
def allowed_payment_method_regions(self):
188+
return self.__allowed_payment_method_regions
189+
190+
@allowed_payment_method_regions.setter
191+
def allowed_payment_method_regions(self, value):
192+
self.__allowed_payment_method_regions = value
193+
194+
@property
195+
def available_payment_method(self):
196+
return self.__available_payment_method
197+
198+
@available_payment_method.setter
199+
def available_payment_method(self, value):
200+
self.__available_payment_method = value
201+
202+
@property
203+
def subscription_info(self):
204+
return self.__subscription_info
205+
206+
@subscription_info.setter
207+
def subscription_info(self, value):
208+
self.__subscription_info = value
209+
184210
def to_ams_json(self):
185211
json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3)
186212
return json_str
@@ -223,4 +249,10 @@ def __to_ams_dict(self):
223249
params['savedPaymentMethods'] = self.saved_payment_methods
224250
if hasattr(self, "locale") and self.locale:
225251
params['locale'] = self.locale
252+
if hasattr(self, "available_payment_method") and self.available_payment_method:
253+
params['availablePaymentMethod'] = self.available_payment_method
254+
if hasattr(self, "allowed_payment_method_regions") and self.allowed_payment_method_regions:
255+
params['allowedPaymentMethodRegions'] = self.allowed_payment_method_regions
256+
if hasattr(self, "subscription_info") and self.subscription_info:
257+
params['subscriptionInfo'] = self.subscription_info
226258
return params

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from com.alipay.ams.api.model.payment_method import PaymentMethod
1313
from com.alipay.ams.api.model.product_code_type import ProductCodeType
1414
from com.alipay.ams.api.model.settlement_strategy import SettlementStrategy
15+
from com.alipay.ams.api.model.subscription_info import SubscriptionInfo
1516
from com.alipay.ams.api.request.alipay_request import AlipayRequest
1617

1718

@@ -39,6 +40,7 @@ def __init__(self):
3940
self.__merchant_account_id = None
4041
self.__user_region = None
4142
self.__credit_pay_plan = None # type: CreditPayPlan
43+
self.__subscription_info = None # type: SubscriptionInfo
4244

4345
@property
4446
def merchant_region(self):
@@ -200,6 +202,14 @@ def credit_pay_plan(self):
200202
def credit_pay_plan(self, value):
201203
self.__credit_pay_plan = value
202204

205+
@property
206+
def subscription_info(self):
207+
return self.__subscription_info
208+
209+
@subscription_info.setter
210+
def subscription_info(self, value):
211+
self.__subscription_info = value
212+
203213
def to_ams_json(self):
204214
json_str = json.dumps(obj=self.__to_ams_dict(), default=lambda o: o.to_ams_dict(), indent=3)
205215
return json_str
@@ -266,4 +276,7 @@ def __to_ams_dict(self):
266276
if hasattr(self, "credit_pay_plan") and self.credit_pay_plan:
267277
params['creditPayPlan'] = self.credit_pay_plan
268278

279+
if hasattr(self, "subscription_info") and self.subscription_info:
280+
params['subscriptionInfo'] = self.subscription_info
281+
269282
return params

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = global-alipay-sdk-python
3-
version = 1.4.4
3+
version = 1.4.5
44

55
[options]
66
packages = find:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
AUTHOR = "guodong.wzj"
1313
AUTHOR_EMAIL = "[email protected]"
1414
URL = "https://github.com/alipay/global-open-sdk-python"
15-
VERSION = "1.4.4"
15+
VERSION = "1.4.5"
1616
'''
1717
only python2 need enum34、pytz
1818
'''

0 commit comments

Comments
 (0)