Skip to content

Commit e43ea21

Browse files
Add grand total tax to payput totals (#210)
* Enhance transaction payout models with grand total tax field * Update CHANGELOG to include grand total tax field in transaction payouts * Remove grand total tax field from transaction payout models and related mocks * Update CHANGELOG to remove `grandTotalTax` from `adjusted_payout_totals` in transaction payouts * Add grand total tax field to transaction models and mocks * Update CHANGELOG to reflect addition of `grandTotalTax` field to `totals`, `adjusted_totals`, and `payout_totals` on transactions. * Add grand total tax field to transaction mocks and expectations across various notification types
1 parent 2d91852 commit e43ea21

25 files changed

+68
-0
lines changed

CHANGELOG.md

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

2727
- Added support for `wechat_pay` payment method.
2828
- Added support for `api_key_exposure.created` event. See [related changelog](https://developer.paddle.com/api-reference/about/api-keys?utm_source=dx&utm_medium=paddle-node-sdk#secret-scanning).
29+
- Added `grandTotalTax` field to `totals`, `adjusted_totals`, and `payout_totals` on transactions. See [related changelog](https://developer.paddle.com/changelog/2026/grand-total-tax-field?utm_source=dx&utm_medium=paddle-node-sdk).
2930

3031
---
3132

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const TransactionBilledMock: IEventsResponse<ITransactionNotificationResp
8484
earnings: null,
8585
subtotal: '1319900',
8686
grand_total: '1437041',
87+
grand_total_tax: '117141',
8788
currency_code: 'USD',
8889
},
8990
line_items: [
@@ -159,6 +160,7 @@ export const TransactionBilledMock: IEventsResponse<ITransactionNotificationResp
159160
earnings: null,
160161
subtotal: '1319900',
161162
grand_total: '1437041',
163+
grand_total_tax: '117141',
162164
currency_code: 'USD',
163165
retained_fee: '2',
164166
},
@@ -223,6 +225,7 @@ export const TransactionBilledMockExpectation = {
223225
earnings: null,
224226
fee: null,
225227
grandTotal: '1437041',
228+
grandTotalTax: '117141',
226229
subtotal: '1319900',
227230
tax: '117141',
228231
total: '1437041',
@@ -350,6 +353,7 @@ export const TransactionBilledMockExpectation = {
350353
earnings: null,
351354
fee: null,
352355
grandTotal: '1437041',
356+
grandTotalTax: '117141',
353357
subtotal: '1319900',
354358
tax: '117141',
355359
total: '1437041',

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const TransactionCanceledMock: IEventsResponse<ITransactionNotificationRe
8484
earnings: null,
8585
subtotal: '1319900',
8686
grand_total: '1437041',
87+
grand_total_tax: '117141',
8788
currency_code: 'USD',
8889
},
8990
line_items: [
@@ -159,6 +160,7 @@ export const TransactionCanceledMock: IEventsResponse<ITransactionNotificationRe
159160
earnings: null,
160161
subtotal: '1319900',
161162
grand_total: '1437041',
163+
grand_total_tax: '117141',
162164
currency_code: 'USD',
163165
retained_fee: '2',
164166
},
@@ -223,6 +225,7 @@ export const TransactionCanceledMockExpectation = {
223225
earnings: null,
224226
fee: null,
225227
grandTotal: '1437041',
228+
grandTotalTax: '117141',
226229
subtotal: '1319900',
227230
tax: '117141',
228231
total: '1437041',
@@ -350,6 +353,7 @@ export const TransactionCanceledMockExpectation = {
350353
earnings: null,
351354
fee: null,
352355
grandTotal: '1437041',
356+
grandTotalTax: '117141',
353357
subtotal: '1319900',
354358
tax: '117141',
355359
total: '1437041',

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const TransactionCompletedMock: IEventsResponse<ITransactionNotificationR
8383
earnings: '56589',
8484
subtotal: '59900',
8585
grand_total: '65215',
86+
grand_total_tax: '5315',
8687
currency_code: 'USD',
8788
},
8889
line_items: [
@@ -158,6 +159,7 @@ export const TransactionCompletedMock: IEventsResponse<ITransactionNotificationR
158159
earnings: '56589',
159160
subtotal: '59900',
160161
grand_total: '65215',
162+
grand_total_tax: '5315',
161163
currency_code: 'USD',
162164
exchange_rate: '1',
163165
fee_rate: '0.05',
@@ -172,6 +174,7 @@ export const TransactionCompletedMock: IEventsResponse<ITransactionNotificationR
172174
earnings: '56589',
173175
subtotal: '59900',
174176
grand_total: '65215',
177+
grand_total_tax: '5315',
175178
currency_code: 'USD',
176179
retained_fee: '2',
177180
},
@@ -276,6 +279,7 @@ export const TransactionCompletedMockExpectation = {
276279
earnings: '56589',
277280
fee: '3311',
278281
grandTotal: '65215',
282+
grandTotalTax: '5315',
279283
subtotal: '59900',
280284
tax: '5315',
281285
total: '65215',
@@ -391,6 +395,7 @@ export const TransactionCompletedMockExpectation = {
391395
earnings: '56589',
392396
fee: '3311',
393397
grandTotal: '65215',
398+
grandTotalTax: '5315',
394399
subtotal: '59900',
395400
tax: '5315',
396401
total: '65215',
@@ -417,6 +422,7 @@ export const TransactionCompletedMockExpectation = {
417422
earnings: '56589',
418423
fee: '3311',
419424
grandTotal: '65215',
425+
grandTotalTax: '5315',
420426
subtotal: '59900',
421427
tax: '5315',
422428
total: '65215',

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export const TransactionCreatedMock: IEventsResponse<ITransactionNotificationRes
9090
earnings: null,
9191
subtotal: '59900',
9292
grand_total: '71880',
93+
grand_total_tax: '11980',
9394
currency_code: 'USD',
9495
},
9596
line_items: [
@@ -320,6 +321,7 @@ export const TransactionCreatedMockExpectation = {
320321
earnings: null,
321322
fee: null,
322323
grandTotal: '71880',
324+
grandTotalTax: '11980',
323325
subtotal: '59900',
324326
tax: '11980',
325327
total: '71880',

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@ export const TransactionPaidMock: IEventsResponse<ITransactionNotificationRespon
8080
subtotal: '74900',
8181
currency_code: 'GBP',
8282
grand_total: '89880',
83+
grand_total_tax: '14980',
8384
},
8485
adjusted_totals: {
8586
fee: '5674',
8687
tax: '14980',
8788
total: '89880',
8889
grand_total: '89880',
90+
grand_total_tax: '14980',
8991
earnings: '69226',
9092
subtotal: '74900',
9193
currency_code: 'GBP',
@@ -219,6 +221,7 @@ export const TransactionPaidMockExpectation = {
219221
earnings: '69226',
220222
fee: '5674',
221223
grandTotal: '89880',
224+
grandTotalTax: '14980',
222225
subtotal: '74900',
223226
tax: '14980',
224227
total: '89880',
@@ -346,6 +349,7 @@ export const TransactionPaidMockExpectation = {
346349
earnings: '69226',
347350
fee: '5674',
348351
grandTotal: '89880',
352+
grandTotalTax: '14980',
349353
subtotal: '74900',
350354
tax: '14980',
351355
total: '89880',

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export const TransactionPastDueMock: IEventsResponse<ITransactionNotificationRes
6666
earnings: null,
6767
subtotal: '40000',
6868
grand_total: '43549',
69+
grand_total_tax: '3549',
6970
currency_code: 'USD',
7071
},
7172
line_items: [
@@ -121,6 +122,7 @@ export const TransactionPastDueMock: IEventsResponse<ITransactionNotificationRes
121122
earnings: null,
122123
subtotal: '40000',
123124
grand_total: '43549',
125+
grand_total_tax: '3549',
124126
currency_code: 'USD',
125127
retained_fee: '2',
126128
},
@@ -190,6 +192,7 @@ export const TransactionPastDueMockExpectation = {
190192
earnings: null,
191193
fee: null,
192194
grandTotal: '43549',
195+
grandTotalTax: '3549',
193196
subtotal: '40000',
194197
tax: '3549',
195198
total: '43549',
@@ -284,6 +287,7 @@ export const TransactionPastDueMockExpectation = {
284287
earnings: null,
285288
fee: null,
286289
grandTotal: '43549',
290+
grandTotalTax: '3549',
287291
subtotal: '40000',
288292
tax: '3549',
289293
total: '43549',

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export const TransactionPaymentFailedMock: IEventsResponse<ITransactionNotificat
8484
earnings: null,
8585
subtotal: '59900',
8686
grand_total: '65215',
87+
grand_total_tax: '5315',
8788
currency_code: 'USD',
8889
},
8990
line_items: [
@@ -159,6 +160,7 @@ export const TransactionPaymentFailedMock: IEventsResponse<ITransactionNotificat
159160
earnings: null,
160161
subtotal: '59900',
161162
grand_total: '65215',
163+
grand_total_tax: '5315',
162164
currency_code: 'USD',
163165
retained_fee: '2',
164166
},
@@ -225,6 +227,7 @@ export const TransactionPaymentFailedMockExpectation = {
225227
earnings: null,
226228
fee: null,
227229
grandTotal: '65215',
230+
grandTotalTax: '5315',
228231
subtotal: '59900',
229232
tax: '5315',
230233
total: '65215',
@@ -352,6 +355,7 @@ export const TransactionPaymentFailedMockExpectation = {
352355
earnings: null,
353356
fee: null,
354357
grandTotal: '65215',
358+
grandTotalTax: '5315',
355359
subtotal: '59900',
356360
tax: '5315',
357361
total: '65215',

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ export const TransactionReadyMock: IEventsResponse<ITransactionNotificationRespo
8383
earnings: null,
8484
subtotal: '59900',
8585
grand_total: '65215',
86+
grand_total_tax: '5315',
8687
currency_code: 'USD',
8788
},
8889
line_items: [
@@ -158,6 +159,7 @@ export const TransactionReadyMock: IEventsResponse<ITransactionNotificationRespo
158159
earnings: null,
159160
subtotal: '59900',
160161
grand_total: '65215',
162+
grand_total_tax: '5315',
161163
currency_code: 'USD',
162164
retained_fee: '2',
163165
},
@@ -208,6 +210,7 @@ export const TransactionReadyMockExpectation = {
208210
earnings: null,
209211
fee: null,
210212
grandTotal: '65215',
213+
grandTotalTax: '5315',
211214
subtotal: '59900',
212215
tax: '5315',
213216
total: '65215',
@@ -335,6 +338,7 @@ export const TransactionReadyMockExpectation = {
335338
earnings: null,
336339
fee: null,
337340
grandTotal: '65215',
341+
grandTotalTax: '5315',
338342
subtotal: '59900',
339343
tax: '5315',
340344
total: '65215',

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export const TransactionRevisedMock: IEventsResponse<ITransactionNotificationRes
119119
earnings: '56589',
120120
subtotal: '59900',
121121
grand_total: '65215',
122+
grand_total_tax: '5315',
122123
currency_code: 'USD',
123124
credit_to_balance: '0',
124125
},
@@ -242,6 +243,7 @@ export const TransactionRevisedMock: IEventsResponse<ITransactionNotificationRes
242243
earnings: '56589',
243244
subtotal: '59900',
244245
grand_total: '65215',
246+
grand_total_tax: '5315',
245247
currency_code: 'USD',
246248
credit_to_balance: '0',
247249
exchange_rate: '0',
@@ -265,6 +267,7 @@ export const TransactionRevisedMock: IEventsResponse<ITransactionNotificationRes
265267
earnings: '56589',
266268
subtotal: '59900',
267269
grand_total: '65215',
270+
grand_total_tax: '5315',
268271
currency_code: 'USD',
269272
retained_fee: '2',
270273
},
@@ -365,6 +368,7 @@ export const TransactionRevisedMockExpectation = {
365368
earnings: '56589',
366369
fee: '3311',
367370
grandTotal: '65215',
371+
grandTotalTax: '5315',
368372
subtotal: '59900',
369373
tax: '5315',
370374
total: '65215',
@@ -492,6 +496,7 @@ export const TransactionRevisedMockExpectation = {
492496
earnings: '56589',
493497
fee: '3311',
494498
grandTotal: '65215',
499+
grandTotalTax: '5315',
495500
subtotal: '59900',
496501
tax: '5315',
497502
total: '65215',
@@ -518,6 +523,7 @@ export const TransactionRevisedMockExpectation = {
518523
earnings: '56589',
519524
fee: '3311',
520525
grandTotal: '65215',
526+
grandTotalTax: '5315',
521527
subtotal: '59900',
522528
tax: '5315',
523529
total: '65215',

0 commit comments

Comments
 (0)