Skip to content

Commit e00574b

Browse files
feat: Added support for retained_fee in adjustment totals (#190)
1 parent 4ef73a1 commit e00574b

32 files changed

+94
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ adding additional type guards.
2525
### Added
2626

2727
- Added support for new payment methods `blik`, `mb_way`, `pix` and `upi`. See [related changelog](https://developer.paddle.com/changelog/2025/blik-mbway-payment-methods).
28+
- Support `retained_fee` field on totals objects to show the fees retained by Paddle for the adjustment.
2829

2930
### Changed
3031

src/__tests__/mocks/notifications/adjustment-created.mock.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,28 @@ export const AdjustmentCreatedMock: IEventsResponse<IAdjustmentResponse> = {
2727
type: 'partial',
2828
reason: 'error',
2929
status: 'pending_approval',
30-
totals: { fee: '5', tax: '8', total: '100', earnings: '87', subtotal: '92', currency_code: 'USD' },
30+
totals: {
31+
fee: '5',
32+
tax: '8',
33+
total: '100',
34+
earnings: '87',
35+
subtotal: '92',
36+
currency_code: 'USD',
37+
retained_fee: '2',
38+
},
3139
created_at: '2023-08-21T14:08:43.297512Z',
3240
updated_at: '0001-01-01T00:00:00Z',
3341
customer_id: 'ctm_01h8441jn5pcwrfhwh78jqt8hk',
3442
currency_code: 'USD',
35-
payout_totals: { fee: '5', tax: '8', total: '100', earnings: '87', subtotal: '92', currency_code: 'USD' },
43+
payout_totals: {
44+
fee: '5',
45+
tax: '8',
46+
total: '100',
47+
earnings: '87',
48+
subtotal: '92',
49+
currency_code: 'USD',
50+
retained_fee: '2',
51+
},
3652
transaction_id: 'txn_01h8bxpvx398a7zbawb77y0kp5',
3753
subscription_id: 'sub_01h8bxswamxysj44zt5n48njwh',
3854
credit_applied_to_balance: true,
@@ -70,6 +86,7 @@ export const AdjustmentCreatedMockExpectation = {
7086
subtotal: '92',
7187
tax: '8',
7288
total: '100',
89+
retainedFee: '2',
7390
},
7491
reason: 'error',
7592
status: 'pending_approval',
@@ -81,6 +98,7 @@ export const AdjustmentCreatedMockExpectation = {
8198
subtotal: '92',
8299
tax: '8',
83100
total: '100',
101+
retainedFee: '2',
84102
},
85103
transactionId: 'txn_01h8bxpvx398a7zbawb77y0kp5',
86104
updatedAt: '0001-01-01T00:00:00Z',

src/__tests__/mocks/notifications/adjustment-updated.mock.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,28 @@ export const AdjustmentUpdatedMock: IEventsResponse<IAdjustmentResponse> = {
2727
type: 'partial',
2828
reason: 'error',
2929
status: 'approved',
30-
totals: { fee: '5', tax: '8', total: '100', earnings: '87', subtotal: '92', currency_code: 'USD' },
30+
totals: {
31+
fee: '5',
32+
tax: '8',
33+
total: '100',
34+
earnings: '87',
35+
subtotal: '92',
36+
currency_code: 'USD',
37+
retained_fee: '2',
38+
},
3139
created_at: '2023-08-21T14:08:43.297512Z',
3240
updated_at: '2023-08-21T14:10:08.42549Z',
3341
customer_id: 'ctm_01h8441jn5pcwrfhwh78jqt8hk',
3442
currency_code: 'USD',
35-
payout_totals: { fee: '5', tax: '8', total: '100', earnings: '87', subtotal: '92', currency_code: 'USD' },
43+
payout_totals: {
44+
fee: '5',
45+
tax: '8',
46+
total: '100',
47+
earnings: '87',
48+
subtotal: '92',
49+
currency_code: 'USD',
50+
retained_fee: '2',
51+
},
3652
transaction_id: 'txn_01h8bxpvx398a7zbawb77y0kp5',
3753
subscription_id: 'sub_01h8bxswamxysj44zt5n48njwh',
3854
credit_applied_to_balance: true,
@@ -70,6 +86,7 @@ export const AdjustmentUpdatedMockExpectation = {
7086
subtotal: '92',
7187
tax: '8',
7288
total: '100',
89+
retainedFee: '2',
7390
},
7491
reason: 'error',
7592
status: 'approved',
@@ -81,6 +98,7 @@ export const AdjustmentUpdatedMockExpectation = {
8198
subtotal: '92',
8299
tax: '8',
83100
total: '100',
101+
retainedFee: '2',
84102
},
85103
transactionId: 'txn_01h8bxpvx398a7zbawb77y0kp5',
86104
updatedAt: '2023-08-21T14:10:08.42549Z',

src/__tests__/mocks/notifications/transaction-billed.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export const TransactionBilledMock: IEventsResponse<ITransactionNotificationResp
160160
subtotal: '1319900',
161161
grand_total: '1437041',
162162
currency_code: 'USD',
163+
retained_fee: '2',
163164
},
164165
adjusted_payout_totals: null,
165166
},
@@ -225,6 +226,7 @@ export const TransactionBilledMockExpectation = {
225226
subtotal: '1319900',
226227
tax: '117141',
227228
total: '1437041',
229+
retainedFee: '2',
228230
},
229231
lineItems: [
230232
{

src/__tests__/mocks/notifications/transaction-canceled.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export const TransactionCanceledMock: IEventsResponse<ITransactionNotificationRe
160160
subtotal: '1319900',
161161
grand_total: '1437041',
162162
currency_code: 'USD',
163+
retained_fee: '2',
163164
},
164165
adjusted_payout_totals: null,
165166
},
@@ -225,6 +226,7 @@ export const TransactionCanceledMockExpectation = {
225226
subtotal: '1319900',
226227
tax: '117141',
227228
total: '1437041',
229+
retainedFee: '2',
228230
},
229231
lineItems: [
230232
{

src/__tests__/mocks/notifications/transaction-completed.mock.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export const TransactionCompletedMock: IEventsResponse<ITransactionNotificationR
173173
subtotal: '59900',
174174
grand_total: '65215',
175175
currency_code: 'USD',
176+
retained_fee: '2',
176177
},
177178
adjusted_payout_totals: {
178179
fee: '3311',
@@ -183,6 +184,7 @@ export const TransactionCompletedMock: IEventsResponse<ITransactionNotificationR
183184
currency_code: 'USD',
184185
chargeback_fee: { amount: '0', original: null },
185186
exchange_rate: '1',
187+
retained_fee: '2',
186188
},
187189
},
188190
checkout: {
@@ -265,6 +267,7 @@ export const TransactionCompletedMockExpectation = {
265267
tax: '5315',
266268
total: '65215',
267269
exchangeRate: '1',
270+
retainedFee: '2',
268271
},
269272
adjustedTotals: {
270273
currencyCode: 'USD',
@@ -274,6 +277,7 @@ export const TransactionCompletedMockExpectation = {
274277
subtotal: '59900',
275278
tax: '5315',
276279
total: '65215',
280+
retainedFee: '2',
277281
},
278282
lineItems: [
279283
{

src/__tests__/mocks/notifications/transaction-paid.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export const TransactionPaidMock: IEventsResponse<ITransactionNotificationRespon
8989
earnings: '69226',
9090
subtotal: '74900',
9191
currency_code: 'GBP',
92+
retained_fee: '2',
9293
},
9394
line_items: [
9495
{
@@ -220,6 +221,7 @@ export const TransactionPaidMockExpectation = {
220221
subtotal: '74900',
221222
tax: '14980',
222223
total: '89880',
224+
retainedFee: '2',
223225
},
224226
lineItems: [
225227
{

src/__tests__/mocks/notifications/transaction-past-due.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export const TransactionPastDueMock: IEventsResponse<ITransactionNotificationRes
122122
subtotal: '40000',
123123
grand_total: '43549',
124124
currency_code: 'USD',
125+
retained_fee: '2',
125126
},
126127
adjusted_payout_totals: null,
127128
},
@@ -191,6 +192,7 @@ export const TransactionPastDueMockExpectation = {
191192
subtotal: '40000',
192193
tax: '3549',
193194
total: '43549',
195+
retainedFee: '2',
194196
},
195197
lineItems: [
196198
{

src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ export const TransactionPaymentFailedMock: IEventsResponse<ITransactionNotificat
160160
subtotal: '59900',
161161
grand_total: '65215',
162162
currency_code: 'USD',
163+
retained_fee: '2',
163164
},
164165
adjusted_payout_totals: null,
165166
},
@@ -226,6 +227,7 @@ export const TransactionPaymentFailedMockExpectation = {
226227
subtotal: '59900',
227228
tax: '5315',
228229
total: '65215',
230+
retainedFee: '2',
229231
},
230232
lineItems: [
231233
{

src/__tests__/mocks/notifications/transaction-ready.mock.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export const TransactionReadyMock: IEventsResponse<ITransactionNotificationRespo
159159
subtotal: '59900',
160160
grand_total: '65215',
161161
currency_code: 'USD',
162+
retained_fee: '2',
162163
},
163164
adjusted_payout_totals: null,
164165
},
@@ -210,6 +211,7 @@ export const TransactionReadyMockExpectation = {
210211
subtotal: '59900',
211212
tax: '5315',
212213
total: '65215',
214+
retainedFee: '2',
213215
},
214216
lineItems: [
215217
{

0 commit comments

Comments
 (0)