paddle-python-sdk 1.2.2__py3-none-any.whl → 1.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- examples/adjustments.py +69 -0
- paddle_billing/Client.py +1 -1
- paddle_billing/Entities/Adjustment.py +3 -0
- paddle_billing/Entities/Shared/AdjustmentActionType.py +6 -0
- paddle_billing/Entities/Shared/CurrencyCode.py +1 -0
- paddle_billing/Entities/Shared/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Adjustment.py +3 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentActionType.py +6 -0
- paddle_billing/Notifications/Entities/Shared/CurrencyCode.py +1 -0
- paddle_billing/Notifications/Entities/Shared/__init__.py +1 -0
- paddle_billing/Resources/Adjustments/Operations/CreateAdjustment.py +45 -2
- {paddle_python_sdk-1.2.2.dist-info → paddle_python_sdk-1.3.1.dist-info}/METADATA +1 -1
- {paddle_python_sdk-1.2.2.dist-info → paddle_python_sdk-1.3.1.dist-info}/RECORD +17 -14
- tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py +73 -1
- {paddle_python_sdk-1.2.2.dist-info → paddle_python_sdk-1.3.1.dist-info}/LICENSE +0 -0
- {paddle_python_sdk-1.2.2.dist-info → paddle_python_sdk-1.3.1.dist-info}/WHEEL +0 -0
- {paddle_python_sdk-1.2.2.dist-info → paddle_python_sdk-1.3.1.dist-info}/top_level.txt +0 -0
examples/adjustments.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
from logging import getLogger
|
|
2
|
+
from os import getenv
|
|
3
|
+
from sys import exit # You should use classes/functions that returns instead of exits
|
|
4
|
+
|
|
5
|
+
from paddle_billing import Client, Environment, Options
|
|
6
|
+
|
|
7
|
+
from paddle_billing.Entities.Shared import (
|
|
8
|
+
Action,
|
|
9
|
+
AdjustmentType,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
from paddle_billing.Exceptions.ApiError import ApiError
|
|
13
|
+
|
|
14
|
+
from paddle_billing.Resources.Adjustments.Operations import CreateAdjustment, CreateAdjustmentItem
|
|
15
|
+
|
|
16
|
+
log = getLogger("my_app")
|
|
17
|
+
|
|
18
|
+
# Verify your Paddle API key was provided by a PADDLE_SECRET_API_KEY environment variable
|
|
19
|
+
# It is strongly advised that you do not include secrets in your source code
|
|
20
|
+
# Use environment variables, and/or secrets management like Vault to obtain your secrets
|
|
21
|
+
api_key: str = getenv("PADDLE_SECRET_API_KEY", None)
|
|
22
|
+
if not api_key:
|
|
23
|
+
raise ValueError("You must provide the PADDLE_SECRET_API_KEY in your environment variables")
|
|
24
|
+
|
|
25
|
+
transaction_id: str = getenv("PADDLE_TRANSACTION_ID", None)
|
|
26
|
+
transaction_item_id: str = getenv("PADDLE_TRANSACTION_ITEM_ID", None)
|
|
27
|
+
full_adjustment_transaction_id: str = getenv("PADDLE_FULL_ADJUSTMENT_TRANSACTION_ID", None)
|
|
28
|
+
|
|
29
|
+
# Determine the environment, defaulting to sandbox
|
|
30
|
+
environment = Environment(getenv("PADDLE_ENVIRONMENT", "sandbox"))
|
|
31
|
+
|
|
32
|
+
# Initialize the Paddle client
|
|
33
|
+
paddle = Client(api_key, options=Options(environment), logger=log)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# ┌───
|
|
37
|
+
# │ Create Partial Adjustment │
|
|
38
|
+
# └───────────────────────────┘
|
|
39
|
+
try:
|
|
40
|
+
partial_adjustment = paddle.adjustments.create(
|
|
41
|
+
CreateAdjustment.partial(
|
|
42
|
+
Action.Refund,
|
|
43
|
+
[CreateAdjustmentItem(transaction_item_id, AdjustmentType.Partial, "100")],
|
|
44
|
+
"error",
|
|
45
|
+
transaction_id,
|
|
46
|
+
)
|
|
47
|
+
)
|
|
48
|
+
except ApiError as error:
|
|
49
|
+
print(error)
|
|
50
|
+
exit(1)
|
|
51
|
+
|
|
52
|
+
print(f"Partial Adjustment '{partial_adjustment.id}'")
|
|
53
|
+
|
|
54
|
+
# ┌───
|
|
55
|
+
# │ Create Full Adjustment │
|
|
56
|
+
# └────────────────────────┘
|
|
57
|
+
try:
|
|
58
|
+
full_adjustment = paddle.adjustments.create(
|
|
59
|
+
CreateAdjustment.full(
|
|
60
|
+
Action.Refund,
|
|
61
|
+
"error",
|
|
62
|
+
full_adjustment_transaction_id,
|
|
63
|
+
)
|
|
64
|
+
)
|
|
65
|
+
except ApiError as error:
|
|
66
|
+
print(error)
|
|
67
|
+
exit(1)
|
|
68
|
+
|
|
69
|
+
print(f"Full Adjustment '{full_adjustment.id}'")
|
paddle_billing/Client.py
CHANGED
|
@@ -204,7 +204,7 @@ class Client:
|
|
|
204
204
|
"Authorization": f"Bearer {self.__api_key}",
|
|
205
205
|
"Content-Type": "application/json",
|
|
206
206
|
"Paddle-Version": str(self.use_api_version),
|
|
207
|
-
"User-Agent": "PaddleSDK/python 1.
|
|
207
|
+
"User-Agent": "PaddleSDK/python 1.3.1",
|
|
208
208
|
}
|
|
209
209
|
)
|
|
210
210
|
|
|
@@ -6,6 +6,7 @@ from paddle_billing.Entities.Entity import Entity
|
|
|
6
6
|
from paddle_billing.Entities.Adjustments import AdjustmentItem, AdjustmentTaxRatesUsed
|
|
7
7
|
from paddle_billing.Entities.Shared import (
|
|
8
8
|
Action,
|
|
9
|
+
AdjustmentActionType,
|
|
9
10
|
AdjustmentStatus,
|
|
10
11
|
CurrencyCode,
|
|
11
12
|
PayoutTotalsAdjustment,
|
|
@@ -30,6 +31,7 @@ class Adjustment(Entity):
|
|
|
30
31
|
created_at: datetime
|
|
31
32
|
updated_at: datetime | None
|
|
32
33
|
tax_rates_used: list[AdjustmentTaxRatesUsed]
|
|
34
|
+
type: AdjustmentActionType
|
|
33
35
|
|
|
34
36
|
@staticmethod
|
|
35
37
|
def from_dict(data: dict) -> Adjustment:
|
|
@@ -51,4 +53,5 @@ class Adjustment(Entity):
|
|
|
51
53
|
),
|
|
52
54
|
updated_at=datetime.fromisoformat(data["updated_at"]) if data.get("updated_at") else None,
|
|
53
55
|
tax_rates_used=[AdjustmentTaxRatesUsed.from_dict(item) for item in data["tax_rates_used"]],
|
|
56
|
+
type=AdjustmentActionType(data["type"]),
|
|
54
57
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from paddle_billing.Entities.Shared.Action import Action
|
|
2
2
|
from paddle_billing.Entities.Shared.AddressPreview import AddressPreview
|
|
3
|
+
from paddle_billing.Entities.Shared.AdjustmentActionType import AdjustmentActionType
|
|
3
4
|
from paddle_billing.Entities.Shared.AdjustmentItemTotals import AdjustmentItemTotals
|
|
4
5
|
from paddle_billing.Entities.Shared.AdjustmentStatus import AdjustmentStatus
|
|
5
6
|
from paddle_billing.Entities.Shared.AdjustmentTotals import AdjustmentTotals
|
|
@@ -6,6 +6,7 @@ from paddle_billing.Notifications.Entities.Adjustments import AdjustmentItem, Ad
|
|
|
6
6
|
from paddle_billing.Notifications.Entities.Entity import Entity
|
|
7
7
|
from paddle_billing.Notifications.Entities.Shared import (
|
|
8
8
|
Action,
|
|
9
|
+
AdjustmentActionType,
|
|
9
10
|
AdjustmentStatus,
|
|
10
11
|
CurrencyCode,
|
|
11
12
|
PayoutTotalsAdjustment,
|
|
@@ -30,6 +31,7 @@ class Adjustment(Entity):
|
|
|
30
31
|
created_at: datetime
|
|
31
32
|
updated_at: datetime | None
|
|
32
33
|
tax_rates_used: list[AdjustmentTaxRatesUsed] | None
|
|
34
|
+
type: AdjustmentActionType | None
|
|
33
35
|
|
|
34
36
|
@staticmethod
|
|
35
37
|
def from_dict(data: dict) -> Adjustment:
|
|
@@ -55,4 +57,5 @@ class Adjustment(Entity):
|
|
|
55
57
|
if data.get("tax_rates_used")
|
|
56
58
|
else None
|
|
57
59
|
),
|
|
60
|
+
type=AdjustmentActionType(data["type"]) if data.get("type") else None,
|
|
58
61
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from paddle_billing.Notifications.Entities.Shared.Action import Action
|
|
2
2
|
from paddle_billing.Notifications.Entities.Shared.AddressPreview import AddressPreview
|
|
3
|
+
from paddle_billing.Notifications.Entities.Shared.AdjustmentActionType import AdjustmentActionType
|
|
3
4
|
from paddle_billing.Notifications.Entities.Shared.AdjustmentItemTotals import AdjustmentItemTotals
|
|
4
5
|
from paddle_billing.Notifications.Entities.Shared.AdjustmentStatus import AdjustmentStatus
|
|
5
6
|
from paddle_billing.Notifications.Entities.Shared.AdjustmentTotals import AdjustmentTotals
|
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
|
|
3
|
+
from paddle_billing.Undefined import Undefined
|
|
4
|
+
|
|
3
5
|
from paddle_billing.Operation import Operation
|
|
4
6
|
|
|
5
|
-
from paddle_billing.Entities.Shared import Action
|
|
7
|
+
from paddle_billing.Entities.Shared import Action, AdjustmentActionType
|
|
6
8
|
|
|
7
9
|
from paddle_billing.Resources.Adjustments.Operations import CreateAdjustmentItem
|
|
8
10
|
|
|
11
|
+
from paddle_billing.Exceptions.SdkExceptions.InvalidArgumentException import InvalidArgumentException
|
|
12
|
+
|
|
9
13
|
|
|
10
14
|
@dataclass
|
|
11
15
|
class CreateAdjustment(Operation):
|
|
12
16
|
action: Action
|
|
13
|
-
items: list[CreateAdjustmentItem]
|
|
17
|
+
items: list[CreateAdjustmentItem] | None | Undefined
|
|
14
18
|
reason: str
|
|
15
19
|
transaction_id: str
|
|
20
|
+
type: AdjustmentActionType | Undefined = Undefined()
|
|
21
|
+
|
|
22
|
+
def __post_init__(self):
|
|
23
|
+
if self.type != AdjustmentActionType.Full and (
|
|
24
|
+
self.items is None or isinstance(self.items, Undefined) or len(self.items) == 0
|
|
25
|
+
):
|
|
26
|
+
raise InvalidArgumentException.array_is_empty("items")
|
|
27
|
+
|
|
28
|
+
if self.type == AdjustmentActionType.Full and isinstance(self.items, list):
|
|
29
|
+
raise InvalidArgumentException("items are not allowed when the adjustment type is full")
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def full(
|
|
33
|
+
action: Action,
|
|
34
|
+
reason: str,
|
|
35
|
+
transaction_id: str,
|
|
36
|
+
) -> "CreateAdjustment":
|
|
37
|
+
return CreateAdjustment(
|
|
38
|
+
action=action,
|
|
39
|
+
reason=reason,
|
|
40
|
+
transaction_id=transaction_id,
|
|
41
|
+
items=Undefined(),
|
|
42
|
+
type=AdjustmentActionType.Full,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
@staticmethod
|
|
46
|
+
def partial(
|
|
47
|
+
action: Action,
|
|
48
|
+
items: list[CreateAdjustmentItem],
|
|
49
|
+
reason: str,
|
|
50
|
+
transaction_id: str,
|
|
51
|
+
) -> "CreateAdjustment":
|
|
52
|
+
return CreateAdjustment(
|
|
53
|
+
action=action,
|
|
54
|
+
reason=reason,
|
|
55
|
+
transaction_id=transaction_id,
|
|
56
|
+
items=items,
|
|
57
|
+
type=AdjustmentActionType.Partial,
|
|
58
|
+
)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
examples/adjustments.py,sha256=8g8dJ1248rAVbhxIcqF5ri8p3DZSaJDKsuSa3BJZR6E,2277
|
|
2
3
|
examples/catalog_management.py,sha256=r4R9PcdhfEQt3lzfYqhefvwFsXiQXJrUqb6_7ZEOLcE,5071
|
|
3
4
|
examples/event_polling.py,sha256=580dg_8CFrSCA89Mr1ny4V1gtB3-hk-LfePTbI7DT5w,2173
|
|
4
5
|
examples/get_products.py,sha256=4V7ZG1SH6Oxojufbtzm_TMySw4cOBMQ99mgQK_hlwFQ,1875
|
|
5
6
|
examples/logger.py,sha256=AxmQmMrsM0ZqMIUnh6iARiczL4S4F9OqQcOu-67owNg,1042
|
|
6
7
|
examples/webhook_verification.py,sha256=qkNscNdNZUAgxEIk83tCiljN2VmfePZ_k8zTliKz2QY,1205
|
|
7
|
-
paddle_billing/Client.py,sha256=
|
|
8
|
+
paddle_billing/Client.py,sha256=PEu-mUviKeCeVVLmMBN-ctOPoV4jTE5MOGEOMHa2j2I,8787
|
|
8
9
|
paddle_billing/EnumStringify.py,sha256=iDvKULZat3jx9A-_PhvoN6CbFGf2pyxrQeYZxqX9n8M,48
|
|
9
10
|
paddle_billing/Environment.py,sha256=sY4nrJUwlTugsZKncieAnvfCojqCcKWi4X7rFzjFeSQ,417
|
|
10
11
|
paddle_billing/FiltersNone.py,sha256=HxjE6RJb7sy6txphpZSrCTQZt1Ua0XpIz8NDLHC43zo,268
|
|
@@ -18,7 +19,7 @@ paddle_billing/ResponseParser.py,sha256=DbbEnVLflzzKiulbtb56Rx7FLEx9Vxe08p1RQRXa
|
|
|
18
19
|
paddle_billing/Undefined.py,sha256=NJKVAEGbTBDfnfaAS6Vn_pSHmHDGbIS277gVScuB2A8,26
|
|
19
20
|
paddle_billing/__init__.py,sha256=x-mRXflhzomHZamB-g1HflsqW2WSYDo-PpPkhyPlAWA,178
|
|
20
21
|
paddle_billing/Entities/Address.py,sha256=KPnvFIN9S-DX-Y72x9WZScLV-s5vur1Wn1QT2YsS3KI,1500
|
|
21
|
-
paddle_billing/Entities/Adjustment.py,sha256=
|
|
22
|
+
paddle_billing/Entities/Adjustment.py,sha256=5d9DXhyahb8tlRe5ywMI0ueq5kfGkfbpO__mVemlcp8,2100
|
|
22
23
|
paddle_billing/Entities/AdjustmentCreditNote.py,sha256=nMXkYk4hDyxv4Oaw0iFgslmgMksGwFyoH2wQXiVchOs,305
|
|
23
24
|
paddle_billing/Entities/Business.py,sha256=wlnAd_lC0Fuw7_BHKZGHt8q-aeLYO6MjO92EYedRnmo,1331
|
|
24
25
|
paddle_billing/Entities/CreditBalance.py,sha256=aGCsfSf-qZl6kVTfHd41_1raiNuI29picji-bj7-lvg,673
|
|
@@ -111,6 +112,7 @@ paddle_billing/Entities/Reports/TransactionsReportType.py,sha256=VKn2CZa3Mt5wR_-
|
|
|
111
112
|
paddle_billing/Entities/Reports/__init__.py,sha256=HxyQ6jPYo-057y2qlXZvK8MaTmc0oUUQZcoIXccvZXQ,726
|
|
112
113
|
paddle_billing/Entities/Shared/Action.py,sha256=GVwkNqyEcF2_v1UEqDKEpbBXf3PBt13b_1dj6jMdDjQ,395
|
|
113
114
|
paddle_billing/Entities/Shared/AddressPreview.py,sha256=euGQdQf-7MeU28G8Qhj9hXgv-Y3GJVaANXhMMvQQctY,448
|
|
115
|
+
paddle_billing/Entities/Shared/AdjustmentActionType.py,sha256=kfOQzshaUDQ9_lNuQxekJqTD16QzkOODGMF95xJB468,238
|
|
114
116
|
paddle_billing/Entities/Shared/AdjustmentItemTotals.py,sha256=88S7A6g-7JONORGNxfingyCcbbMXaPfwWuU9Jt7P9Vc,378
|
|
115
117
|
paddle_billing/Entities/Shared/AdjustmentStatus.py,sha256=6ceGNm9gl5Kc_hI2-lHQr8eAVwWutet3suWYumnX3Q0,343
|
|
116
118
|
paddle_billing/Entities/Shared/AdjustmentTotals.py,sha256=Bok5-aMrD0l21b4aRFdEtS0ui9T3wSTlqY0Px2WNmiI,630
|
|
@@ -123,7 +125,7 @@ paddle_billing/Entities/Shared/Checkout.py,sha256=Oj2ALDCQjnJGRNVYc9W7HQoiIrWDtp
|
|
|
123
125
|
paddle_billing/Entities/Shared/CollectionMode.py,sha256=43DG8O6Pg2ul63XoNqu9YGcz8Jc_q44nY-xz_uM9O1g,228
|
|
124
126
|
paddle_billing/Entities/Shared/Contacts.py,sha256=sJhbHv7I9IlRvKvpVTY3FHL_ymDIEUxjX_fFhzcaa60,288
|
|
125
127
|
paddle_billing/Entities/Shared/CountryCode.py,sha256=Eh47RWJqmZZZcKEKCWu0XcSymJW1Or16MDzVDJJUHCI,6780
|
|
126
|
-
paddle_billing/Entities/Shared/CurrencyCode.py,sha256=
|
|
128
|
+
paddle_billing/Entities/Shared/CurrencyCode.py,sha256=5ablxR7hYNVAcTeWI3eHZSooUIs1O6S_SB-cTzLvV5g,1132
|
|
127
129
|
paddle_billing/Entities/Shared/CurrencyCodeAdjustments.py,sha256=m8-iseUCadmz_EBTzjVIU1Yx30OFHkXnmjR5yPsCO1E,280
|
|
128
130
|
paddle_billing/Entities/Shared/CurrencyCodePayouts.py,sha256=wHigKKmh1iyxmp_1G-iFGjFurduPZ4x7V3TeOkmVBPA,654
|
|
129
131
|
paddle_billing/Entities/Shared/CustomData.py,sha256=USQ2gsJtJhYU19FRHvX0YJFnRSnT8sM20lsQedE-9nA,192
|
|
@@ -165,7 +167,7 @@ paddle_billing/Entities/Shared/TransactionTotals.py,sha256=gJJigGiALHRS9TkY_VoM7
|
|
|
165
167
|
paddle_billing/Entities/Shared/TransactionTotalsAdjusted.py,sha256=1Wd25MnlECJsriuanamLriPENy2deS9dFHmAG3uCE3Y,745
|
|
166
168
|
paddle_billing/Entities/Shared/UnitPriceOverride.py,sha256=-Y1GQXjP9S3j6_4d4Uz96Wz1ITMM2sktQIWz3tIzvyw,545
|
|
167
169
|
paddle_billing/Entities/Shared/UnitTotals.py,sha256=tCqi2TRsNCwnWNznmKf_bELptCbjdBkNwYkJjHyhhi0,405
|
|
168
|
-
paddle_billing/Entities/Shared/__init__.py,sha256=
|
|
170
|
+
paddle_billing/Entities/Shared/__init__.py,sha256=TRt4DWyrVx7z-lAL4QsHvsBW6OlvzKIfzVUOqQk3fSI,4110
|
|
169
171
|
paddle_billing/Entities/Subscriptions/SubscriptionAdjustmentItem.py,sha256=a0QNBmdL2CAbrqkQicwqtIT_1p7Wn_SEK9cSUIJy4qQ,758
|
|
170
172
|
paddle_billing/Entities/Subscriptions/SubscriptionAdjustmentPreview.py,sha256=vd1fXc9X0IecddOkMxNivHgU0C2-2cGV37iVqotrcds,725
|
|
171
173
|
paddle_billing/Entities/Subscriptions/SubscriptionCharge.py,sha256=toASyrKTGeZ7X0ppmjinFGO5MeaeZWINEK8vyerzDDo,428
|
|
@@ -219,7 +221,7 @@ paddle_billing/Notifications/Secret.py,sha256=VMMQ3BriR7KBbw6g8UeqAhUFZ_Xd8c5Pmo
|
|
|
219
221
|
paddle_billing/Notifications/Verifier.py,sha256=EcHcWNEiRsajWqmRT264eQrRvOC-iUVp0OuKdR0YqNE,2261
|
|
220
222
|
paddle_billing/Notifications/__init__.py,sha256=u0yxQqSC_2cDNN50osbyxQjhWIBagWokE_31MyoDFok,187
|
|
221
223
|
paddle_billing/Notifications/Entities/Address.py,sha256=DC_pXvRoZk0ce3SpBWmc2itCec0abXPVp61FWL5qhN0,1560
|
|
222
|
-
paddle_billing/Notifications/Entities/Adjustment.py,sha256=
|
|
224
|
+
paddle_billing/Notifications/Entities/Adjustment.py,sha256=Gws36peXBSW_KghYgQ1-E8cZz-rL3v5X92nd3MHqOBA,2290
|
|
223
225
|
paddle_billing/Notifications/Entities/Business.py,sha256=Xgd0W5VdD4wn7QGRbCaViorC-wFTpdqAdR-CauteSGo,1467
|
|
224
226
|
paddle_billing/Notifications/Entities/Customer.py,sha256=06ZXKUu8BsWMtrmL29xwTWZ_H3PeZCVKbD_W7QVBD2E,1193
|
|
225
227
|
paddle_billing/Notifications/Entities/DateTime.py,sha256=iJLwbDZwmfHW2TgE8HRPpkw_xZBrwZyVhFaQnKJENu8,1459
|
|
@@ -256,6 +258,7 @@ paddle_billing/Notifications/Entities/Reports/ReportType.py,sha256=354leHuhaJey0
|
|
|
256
258
|
paddle_billing/Notifications/Entities/Reports/__init__.py,sha256=P8Hjjl6taxwiCdquAjUkAGyTVBUfqVGn-nrFFJZ4C9s,440
|
|
257
259
|
paddle_billing/Notifications/Entities/Shared/Action.py,sha256=GVwkNqyEcF2_v1UEqDKEpbBXf3PBt13b_1dj6jMdDjQ,395
|
|
258
260
|
paddle_billing/Notifications/Entities/Shared/AddressPreview.py,sha256=ouLBR_6QNiahjTyqhoSXGnUC-k4K_MBJhDFT9db7SiQ,462
|
|
261
|
+
paddle_billing/Notifications/Entities/Shared/AdjustmentActionType.py,sha256=kfOQzshaUDQ9_lNuQxekJqTD16QzkOODGMF95xJB468,238
|
|
259
262
|
paddle_billing/Notifications/Entities/Shared/AdjustmentItemTotals.py,sha256=88S7A6g-7JONORGNxfingyCcbbMXaPfwWuU9Jt7P9Vc,378
|
|
260
263
|
paddle_billing/Notifications/Entities/Shared/AdjustmentStatus.py,sha256=6ceGNm9gl5Kc_hI2-lHQr8eAVwWutet3suWYumnX3Q0,343
|
|
261
264
|
paddle_billing/Notifications/Entities/Shared/AdjustmentTotals.py,sha256=Bz3XD9GIdvZxDRSOl8Kxesw6sGZ-oCyeHRlLujcj5jo,644
|
|
@@ -267,7 +270,7 @@ paddle_billing/Notifications/Entities/Shared/ChargebackFee.py,sha256=uj5mmmDgxeh
|
|
|
267
270
|
paddle_billing/Notifications/Entities/Shared/Checkout.py,sha256=Oj2ALDCQjnJGRNVYc9W7HQoiIrWDtp7V8_KeEFJdJpE,225
|
|
268
271
|
paddle_billing/Notifications/Entities/Shared/CollectionMode.py,sha256=43DG8O6Pg2ul63XoNqu9YGcz8Jc_q44nY-xz_uM9O1g,228
|
|
269
272
|
paddle_billing/Notifications/Entities/Shared/CountryCode.py,sha256=Eh47RWJqmZZZcKEKCWu0XcSymJW1Or16MDzVDJJUHCI,6780
|
|
270
|
-
paddle_billing/Notifications/Entities/Shared/CurrencyCode.py,sha256=
|
|
273
|
+
paddle_billing/Notifications/Entities/Shared/CurrencyCode.py,sha256=5ablxR7hYNVAcTeWI3eHZSooUIs1O6S_SB-cTzLvV5g,1132
|
|
271
274
|
paddle_billing/Notifications/Entities/Shared/CurrencyCodeAdjustments.py,sha256=m8-iseUCadmz_EBTzjVIU1Yx30OFHkXnmjR5yPsCO1E,280
|
|
272
275
|
paddle_billing/Notifications/Entities/Shared/CurrencyCodePayouts.py,sha256=wHigKKmh1iyxmp_1G-iFGjFurduPZ4x7V3TeOkmVBPA,654
|
|
273
276
|
paddle_billing/Notifications/Entities/Shared/CustomData.py,sha256=RJaYeGLzDs-TFkr8qy-sl-Knf_4EWeQDpKhy_R0lqzM,170
|
|
@@ -303,7 +306,7 @@ paddle_billing/Notifications/Entities/Shared/TransactionTotals.py,sha256=GzsNxcN
|
|
|
303
306
|
paddle_billing/Notifications/Entities/Shared/TransactionTotalsAdjusted.py,sha256=sZdgI-OGmVmRuMUmcNsd0bhTGB2RzcZCrQofxfuCmUw,759
|
|
304
307
|
paddle_billing/Notifications/Entities/Shared/UnitPriceOverride.py,sha256=fLiujCD9KQPgRLN9LVRUmYEFtWuodJPmTFlVEYQO4fA,573
|
|
305
308
|
paddle_billing/Notifications/Entities/Shared/UnitTotals.py,sha256=tCqi2TRsNCwnWNznmKf_bELptCbjdBkNwYkJjHyhhi0,405
|
|
306
|
-
paddle_billing/Notifications/Entities/Shared/__init__.py,sha256=
|
|
309
|
+
paddle_billing/Notifications/Entities/Shared/__init__.py,sha256=oAsLCrxlafoqWTzFfXDzo-OcOIbUjdCLoFGfxhKrjfI,4377
|
|
307
310
|
paddle_billing/Notifications/Entities/Subscriptions/SubscriptionAdjustmentItem.py,sha256=aED3Eq_OIWuR9RynjvVxa6LhuF6yYDfdpmRB9kiXbTg,730
|
|
308
311
|
paddle_billing/Notifications/Entities/Subscriptions/SubscriptionCharge.py,sha256=RZ9TkL9UckSUJ8stglrI_Ri71sy_-AZmbsTx2790sXQ,442
|
|
309
312
|
paddle_billing/Notifications/Entities/Subscriptions/SubscriptionCredit.py,sha256=v1R271DEZz8emuvxlpTPpNNR68Ye9OgFjoGSczQSs-0,442
|
|
@@ -376,7 +379,7 @@ paddle_billing/Resources/Addresses/Operations/UpdateAddress.py,sha256=KAfzB1QZN8
|
|
|
376
379
|
paddle_billing/Resources/Addresses/Operations/__init__.py,sha256=NETa0mlWt-0bX_zLVMg_iujy35-jurRN9xf9H2vvhMY,258
|
|
377
380
|
paddle_billing/Resources/Adjustments/AdjustmentsClient.py,sha256=dGPIUA6swO8eGnXbDjuyKRcYqgQef-Lt2PuUy8aO_ig,1619
|
|
378
381
|
paddle_billing/Resources/Adjustments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
379
|
-
paddle_billing/Resources/Adjustments/Operations/CreateAdjustment.py,sha256=
|
|
382
|
+
paddle_billing/Resources/Adjustments/Operations/CreateAdjustment.py,sha256=pCLmMjDwPVG2H1ozJJ1xeI2KU9XRu-qNHQ7lu5VCSKk,1796
|
|
380
383
|
paddle_billing/Resources/Adjustments/Operations/GetCreditNote.py,sha256=RHaiTwWntvUiz9LbaWxFaqiiLr-Ad09269c0fFSp8uY,458
|
|
381
384
|
paddle_billing/Resources/Adjustments/Operations/ListAdjustments.py,sha256=zoRhi6JjpPsBwtLk1LE2JdPIpKpZr3raqBQ-OziqD7E,2513
|
|
382
385
|
paddle_billing/Resources/Adjustments/Operations/__init__.py,sha256=d-_YAnzxO9ksBhkRbLUFCZItCTmLXPILAevC-SRDr8s,395
|
|
@@ -546,7 +549,7 @@ tests/Functional/Resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
546
549
|
tests/Functional/Resources/Addresses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
547
550
|
tests/Functional/Resources/Addresses/test_AddressesClient.py,sha256=mxiSJgvegEpuqKeNMZeSlujih5XLVvRZ5Hw8J_J0Jhk,16204
|
|
548
551
|
tests/Functional/Resources/Adjustments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
549
|
-
tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py,sha256=
|
|
552
|
+
tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py,sha256=5pfezgaaiz0fykofnXWFCZA4sTj7UIhfedj9b0n1fUQ,17332
|
|
550
553
|
tests/Functional/Resources/Businesses/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
551
554
|
tests/Functional/Resources/Businesses/test_BusinessesClient.py,sha256=uUAydFqmXq3snmu--gGVI5nNrpg6oySQM_Ulg9q-G1Q,12727
|
|
552
555
|
tests/Functional/Resources/CustomerPortalSessions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -593,8 +596,8 @@ tests/Utils/ReadsFixture.py,sha256=M3Ot3xHXp_C7vwttna9deLPHBAO8ml2Jb4thhHOJJ38,1
|
|
|
593
596
|
tests/Utils/TestClient.py,sha256=-wc7hJMuR6WC-ukw0c7I59b5-8hj_-nzq__-2M81elg,1453
|
|
594
597
|
tests/Utils/TestLogger.py,sha256=pFO9x711buRmg-8DAqpzIJP_hr21JPty1_ZQRcwoGKk,554
|
|
595
598
|
tests/Utils/__init__.py,sha256=JtqJNPKqbNZ9exlpXlF3yj_9cfylPGlvopjQYi7yYTA,37
|
|
596
|
-
paddle_python_sdk-1.
|
|
597
|
-
paddle_python_sdk-1.
|
|
598
|
-
paddle_python_sdk-1.
|
|
599
|
-
paddle_python_sdk-1.
|
|
600
|
-
paddle_python_sdk-1.
|
|
599
|
+
paddle_python_sdk-1.3.1.dist-info/LICENSE,sha256=e5Sn9mzCdpjnqCLxXpGHNKdYB6JlRSTLhN_CD4WSO6w,10770
|
|
600
|
+
paddle_python_sdk-1.3.1.dist-info/METADATA,sha256=0V_ocFAebYY3Zusx-GgbpXXEZ6PEXvEZKaRSE72m0ZA,7376
|
|
601
|
+
paddle_python_sdk-1.3.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
602
|
+
paddle_python_sdk-1.3.1.dist-info/top_level.txt,sha256=9a07VPng7o5wK8VAXkl6NC30xrNbW9zff_02jHyHi4c,30
|
|
603
|
+
paddle_python_sdk-1.3.1.dist-info/RECORD,,
|
|
@@ -5,7 +5,7 @@ from urllib.parse import unquote
|
|
|
5
5
|
from paddle_billing.Entities.Adjustment import Adjustment, AdjustmentTaxRatesUsed
|
|
6
6
|
from paddle_billing.Entities.Collections import AdjustmentCollection
|
|
7
7
|
from paddle_billing.Entities.AdjustmentCreditNote import AdjustmentCreditNote
|
|
8
|
-
from paddle_billing.Entities.Shared import Action, AdjustmentStatus, AdjustmentType, Disposition
|
|
8
|
+
from paddle_billing.Entities.Shared import Action, AdjustmentActionType, AdjustmentStatus, AdjustmentType, Disposition
|
|
9
9
|
|
|
10
10
|
from paddle_billing.Resources.Adjustments.Operations import (
|
|
11
11
|
CreateAdjustment,
|
|
@@ -15,6 +15,8 @@ from paddle_billing.Resources.Adjustments.Operations import (
|
|
|
15
15
|
)
|
|
16
16
|
from paddle_billing.Resources.Shared.Operations import Pager
|
|
17
17
|
|
|
18
|
+
from paddle_billing.Undefined import Undefined
|
|
19
|
+
|
|
18
20
|
from tests.Utils.ReadsFixture import ReadsFixtures
|
|
19
21
|
|
|
20
22
|
|
|
@@ -49,10 +51,77 @@ class TestAdjustmentsClient:
|
|
|
49
51
|
ReadsFixtures.read_raw_json_fixture("response/full_entity"),
|
|
50
52
|
"/adjustments",
|
|
51
53
|
),
|
|
54
|
+
(
|
|
55
|
+
CreateAdjustment(
|
|
56
|
+
Action.Refund,
|
|
57
|
+
[CreateAdjustmentItem("txnitm_01h8bxryv3065dyh6103p3yg28", AdjustmentType.Partial, "100")],
|
|
58
|
+
"error",
|
|
59
|
+
"txn_01h8bxpvx398a7zbawb77y0kp5",
|
|
60
|
+
AdjustmentActionType.Partial,
|
|
61
|
+
),
|
|
62
|
+
ReadsFixtures.read_raw_json_fixture("request/create_type_partial_with_items"),
|
|
63
|
+
200,
|
|
64
|
+
ReadsFixtures.read_raw_json_fixture("response/minimal_entity"),
|
|
65
|
+
"/adjustments",
|
|
66
|
+
),
|
|
67
|
+
(
|
|
68
|
+
CreateAdjustment.partial(
|
|
69
|
+
Action.Refund,
|
|
70
|
+
[CreateAdjustmentItem("txnitm_01h8bxryv3065dyh6103p3yg28", AdjustmentType.Partial, "100")],
|
|
71
|
+
"error",
|
|
72
|
+
"txn_01h8bxpvx398a7zbawb77y0kp5",
|
|
73
|
+
),
|
|
74
|
+
ReadsFixtures.read_raw_json_fixture("request/create_type_partial_with_items"),
|
|
75
|
+
200,
|
|
76
|
+
ReadsFixtures.read_raw_json_fixture("response/minimal_entity"),
|
|
77
|
+
"/adjustments",
|
|
78
|
+
),
|
|
79
|
+
(
|
|
80
|
+
CreateAdjustment.full(
|
|
81
|
+
Action.Refund,
|
|
82
|
+
"error",
|
|
83
|
+
"txn_01h8bxpvx398a7zbawb77y0kp5",
|
|
84
|
+
),
|
|
85
|
+
ReadsFixtures.read_raw_json_fixture("request/create_type_full_with_no_items"),
|
|
86
|
+
200,
|
|
87
|
+
ReadsFixtures.read_raw_json_fixture("response/minimal_entity"),
|
|
88
|
+
"/adjustments",
|
|
89
|
+
),
|
|
90
|
+
(
|
|
91
|
+
CreateAdjustment(
|
|
92
|
+
Action.Refund,
|
|
93
|
+
None,
|
|
94
|
+
"error",
|
|
95
|
+
"txn_01h8bxpvx398a7zbawb77y0kp5",
|
|
96
|
+
AdjustmentActionType.Full,
|
|
97
|
+
),
|
|
98
|
+
ReadsFixtures.read_raw_json_fixture("request/create_type_full_with_null_items"),
|
|
99
|
+
200,
|
|
100
|
+
ReadsFixtures.read_raw_json_fixture("response/minimal_entity"),
|
|
101
|
+
"/adjustments",
|
|
102
|
+
),
|
|
103
|
+
(
|
|
104
|
+
CreateAdjustment(
|
|
105
|
+
Action.Refund,
|
|
106
|
+
Undefined(),
|
|
107
|
+
"error",
|
|
108
|
+
"txn_01h8bxpvx398a7zbawb77y0kp5",
|
|
109
|
+
AdjustmentActionType.Full,
|
|
110
|
+
),
|
|
111
|
+
ReadsFixtures.read_raw_json_fixture("request/create_type_full_with_no_items"),
|
|
112
|
+
200,
|
|
113
|
+
ReadsFixtures.read_raw_json_fixture("response/minimal_entity"),
|
|
114
|
+
"/adjustments",
|
|
115
|
+
),
|
|
52
116
|
],
|
|
53
117
|
ids=[
|
|
54
118
|
"Create adjustment with basic data",
|
|
55
119
|
"Create adjustment with full data",
|
|
120
|
+
"Create adjustment with basic data with type",
|
|
121
|
+
"Create partial adjustment with items",
|
|
122
|
+
"Create full adjustment with no items",
|
|
123
|
+
"Create full adjustment with None items",
|
|
124
|
+
"Create full adjustment with Undefined items",
|
|
56
125
|
],
|
|
57
126
|
)
|
|
58
127
|
def test_create_adjustment_uses_expected_payload(
|
|
@@ -108,6 +177,9 @@ class TestAdjustmentsClient:
|
|
|
108
177
|
)
|
|
109
178
|
|
|
110
179
|
assert isinstance(response, Adjustment)
|
|
180
|
+
assert isinstance(response.action, Action)
|
|
181
|
+
assert isinstance(response.status, AdjustmentStatus)
|
|
182
|
+
assert isinstance(response.type, AdjustmentActionType)
|
|
111
183
|
|
|
112
184
|
tax_rates_used = response.tax_rates_used[0]
|
|
113
185
|
assert isinstance(tax_rates_used, AdjustmentTaxRatesUsed)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|