@paddle/paddle-node-sdk 3.2.1 → 3.4.0

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.
Files changed (110) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/entities/index.js +1 -0
  3. package/dist/cjs/entities/payment-method/payment-method.js +4 -0
  4. package/dist/cjs/entities/shared/index.js +1 -0
  5. package/dist/cjs/entities/shared/payment-method-details.js +5 -0
  6. package/dist/cjs/entities/shared/payout-totals-adjustment.js +2 -0
  7. package/dist/cjs/entities/shared/south-korea-local-card.js +12 -0
  8. package/dist/cjs/entities/shared/total-adjustments.js +2 -0
  9. package/dist/cjs/entities/shared/transaction-payout-totals-adjusted.js +2 -0
  10. package/dist/cjs/entities/shared/transaction-totals-adjusted.js +2 -0
  11. package/dist/cjs/enums/shared/index.js +1 -0
  12. package/dist/cjs/enums/shared/south-korea-local-card-type.js +2 -0
  13. package/dist/cjs/internal/api/client.js +5 -4
  14. package/dist/cjs/internal/base/base-resource.js +4 -1
  15. package/dist/cjs/internal/base/collection.js +4 -1
  16. package/dist/cjs/internal/errors/generic.js +3 -1
  17. package/dist/cjs/internal/types/response.js +2 -0
  18. package/dist/cjs/notifications/entities/shared/index.js +1 -0
  19. package/dist/cjs/notifications/entities/shared/payment-method-details-notification.js +5 -0
  20. package/dist/cjs/notifications/entities/shared/payout-totals-adjustment-notification.js +2 -0
  21. package/dist/cjs/notifications/entities/shared/south-korea-local-card-notification.js +12 -0
  22. package/dist/cjs/notifications/entities/shared/total-adjustments-notification.js +2 -0
  23. package/dist/cjs/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +2 -0
  24. package/dist/cjs/notifications/entities/shared/transaction-totals-adjusted-notification.js +2 -0
  25. package/dist/cjs/notifications/types/shared/index.js +1 -0
  26. package/dist/cjs/notifications/types/shared/south-korea-local-card-notification-response.js +2 -0
  27. package/dist/cjs/resources/transactions/operations/index.js +1 -0
  28. package/dist/cjs/resources/transactions/operations/non-catalog-discount.js +2 -0
  29. package/dist/cjs/types/shared/index.js +1 -0
  30. package/dist/cjs/types/shared/south-korea-local-card-response.js +2 -0
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/esm/entities/index.js +1 -0
  33. package/dist/esm/entities/payment-method/payment-method.js +5 -1
  34. package/dist/esm/entities/shared/index.js +1 -0
  35. package/dist/esm/entities/shared/payment-method-details.js +5 -0
  36. package/dist/esm/entities/shared/payout-totals-adjustment.js +2 -0
  37. package/dist/esm/entities/shared/south-korea-local-card.js +8 -0
  38. package/dist/esm/entities/shared/total-adjustments.js +2 -0
  39. package/dist/esm/entities/shared/transaction-payout-totals-adjusted.js +2 -0
  40. package/dist/esm/entities/shared/transaction-totals-adjusted.js +2 -0
  41. package/dist/esm/enums/shared/index.js +1 -0
  42. package/dist/esm/enums/shared/south-korea-local-card-type.js +1 -0
  43. package/dist/esm/internal/api/client.js +5 -4
  44. package/dist/esm/internal/base/base-resource.js +4 -1
  45. package/dist/esm/internal/base/collection.js +4 -1
  46. package/dist/esm/internal/errors/generic.js +3 -1
  47. package/dist/esm/internal/types/response.js +1 -1
  48. package/dist/esm/notifications/entities/shared/index.js +1 -0
  49. package/dist/esm/notifications/entities/shared/payment-method-details-notification.js +5 -0
  50. package/dist/esm/notifications/entities/shared/payout-totals-adjustment-notification.js +2 -0
  51. package/dist/esm/notifications/entities/shared/south-korea-local-card-notification.js +8 -0
  52. package/dist/esm/notifications/entities/shared/total-adjustments-notification.js +2 -0
  53. package/dist/esm/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +2 -0
  54. package/dist/esm/notifications/entities/shared/transaction-totals-adjusted-notification.js +2 -0
  55. package/dist/esm/notifications/types/shared/index.js +1 -0
  56. package/dist/esm/notifications/types/shared/south-korea-local-card-notification-response.js +1 -0
  57. package/dist/esm/resources/transactions/operations/index.js +1 -0
  58. package/dist/esm/resources/transactions/operations/non-catalog-discount.js +1 -0
  59. package/dist/esm/types/shared/index.js +1 -0
  60. package/dist/esm/types/shared/south-korea-local-card-response.js +1 -0
  61. package/dist/esm/version.js +1 -1
  62. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  63. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  64. package/dist/tsconfig.types.tsbuildinfo +1 -1
  65. package/dist/types/entities/index.d.ts +2 -1
  66. package/dist/types/entities/payment-method/payment-method.d.ts +2 -1
  67. package/dist/types/entities/shared/index.d.ts +1 -0
  68. package/dist/types/entities/shared/payment-method-details.d.ts +2 -0
  69. package/dist/types/entities/shared/payout-totals-adjustment.d.ts +1 -0
  70. package/dist/types/entities/shared/south-korea-local-card.d.ts +7 -0
  71. package/dist/types/entities/shared/total-adjustments.d.ts +1 -0
  72. package/dist/types/entities/shared/transaction-payout-totals-adjusted.d.ts +1 -0
  73. package/dist/types/entities/shared/transaction-totals-adjusted.d.ts +1 -0
  74. package/dist/types/enums/payment-method/type.d.ts +1 -1
  75. package/dist/types/enums/shared/available-payment-methods.d.ts +1 -1
  76. package/dist/types/enums/shared/index.d.ts +1 -0
  77. package/dist/types/enums/shared/payment-type.d.ts +1 -1
  78. package/dist/types/enums/shared/south-korea-local-card-type.d.ts +1 -0
  79. package/dist/types/internal/errors/generic.d.ts +2 -1
  80. package/dist/types/internal/types/response.d.ts +4 -0
  81. package/dist/types/notifications/entities/shared/index.d.ts +1 -0
  82. package/dist/types/notifications/entities/shared/payment-method-details-notification.d.ts +2 -0
  83. package/dist/types/notifications/entities/shared/payout-totals-adjustment-notification.d.ts +1 -0
  84. package/dist/types/notifications/entities/shared/south-korea-local-card-notification.d.ts +7 -0
  85. package/dist/types/notifications/entities/shared/total-adjustments-notification.d.ts +1 -0
  86. package/dist/types/notifications/entities/shared/transaction-payout-totals-adjusted-notification.d.ts +1 -0
  87. package/dist/types/notifications/entities/shared/transaction-totals-adjusted-notification.d.ts +1 -0
  88. package/dist/types/notifications/types/shared/index.d.ts +1 -0
  89. package/dist/types/notifications/types/shared/payment-method-details.d.ts +2 -0
  90. package/dist/types/notifications/types/shared/payout-totals-adjustment-notification-response.d.ts +1 -0
  91. package/dist/types/notifications/types/shared/south-korea-local-card-notification-response.d.ts +5 -0
  92. package/dist/types/notifications/types/shared/total-adjustments-notification-response.d.ts +1 -0
  93. package/dist/types/notifications/types/shared/transaction-payout-totals-adjusted-notification-response.d.ts +1 -0
  94. package/dist/types/notifications/types/shared/transaction-totals-adjusted-notification-response.d.ts +1 -0
  95. package/dist/types/resources/transactions/operations/create-transaction-request-body.d.ts +2 -0
  96. package/dist/types/resources/transactions/operations/index.d.ts +1 -0
  97. package/dist/types/resources/transactions/operations/non-catalog-discount.d.ts +11 -0
  98. package/dist/types/resources/transactions/operations/transaction-preview-request-body.d.ts +2 -0
  99. package/dist/types/resources/transactions/operations/update-transaction-request-body.d.ts +2 -0
  100. package/dist/types/types/payment-method/payment-method.d.ts +2 -1
  101. package/dist/types/types/shared/custom-data.d.ts +1 -1
  102. package/dist/types/types/shared/index.d.ts +1 -0
  103. package/dist/types/types/shared/payment-method-details.d.ts +2 -0
  104. package/dist/types/types/shared/payout-totals-adjustment-response.d.ts +1 -0
  105. package/dist/types/types/shared/south-korea-local-card-response.d.ts +5 -0
  106. package/dist/types/types/shared/total-adjustments-response.d.ts +1 -0
  107. package/dist/types/types/shared/transaction-payout-totals-adjusted-response.d.ts +1 -0
  108. package/dist/types/types/shared/transaction-totals-adjusted-response.d.ts +1 -0
  109. package/dist/types/version.d.ts +1 -1
  110. package/package.json +1 -1
package/README.md CHANGED
@@ -2091,7 +2091,7 @@ console.log('Archived Business:', archivedBusiness)
2091
2091
 
2092
2092
  ### Error Handling
2093
2093
 
2094
- If a request fails, Paddle returns an `error` object that contains the same information as [errors returned by the API](https://developer.paddle.com/api-reference/about/errors?utm_source=dx&utm_medium=paddle-node-sdk). You can use the `code` attribute to search an error in [the error reference](https://developer.paddle.com/errors/overview?utm_source=dx&utm_medium=paddle-node-sdk) and to handle the error in your app. Validation errors also return an array of `errors` that tell you which fields failed validation.
2094
+ If a request fails, Paddle returns an `error` object that contains the same information as [errors returned by the API](https://developer.paddle.com/api-reference/about/errors?utm_source=dx&utm_medium=paddle-node-sdk). You can use the `code` attribute to search an error in [the error reference](https://developer.paddle.com/errors/overview?utm_source=dx&utm_medium=paddle-node-sdk) and to handle the error in your app. Validation errors also return an array of `errors` that tell you which fields failed validation. The `retryAfter` property will be set for `too_many_requests` errors.
2095
2095
 
2096
2096
  This example shows how to handle an error with the code `conflict`:
2097
2097
 
@@ -29,6 +29,7 @@ __exportStar(require("./discount-group/index.js"), exports);
29
29
  __exportStar(require("./events/index.js"), exports);
30
30
  __exportStar(require("./payment-method/index.js"), exports);
31
31
  __exportStar(require("./payout/index.js"), exports);
32
+ __exportStar(require("./pricing-preview/index.js"), exports);
32
33
  __exportStar(require("./event-types/index.js"), exports);
33
34
  __exportStar(require("./notification-settings/index.js"), exports);
34
35
  __exportStar(require("./notifications/index.js"), exports);
@@ -9,6 +9,7 @@ class PaymentMethod {
9
9
  type;
10
10
  card;
11
11
  paypal;
12
+ southKoreaLocalCard;
12
13
  underlyingDetails;
13
14
  origin;
14
15
  savedAt;
@@ -20,6 +21,9 @@ class PaymentMethod {
20
21
  this.type = paymentMethodResponse.type;
21
22
  this.card = paymentMethodResponse.card ? new index_js_1.PaymentCard(paymentMethodResponse.card) : null;
22
23
  this.paypal = paymentMethodResponse.paypal ? new index_js_1.PayPal(paymentMethodResponse.paypal) : null;
24
+ this.southKoreaLocalCard = paymentMethodResponse.south_korea_local_card
25
+ ? new index_js_1.SouthKoreaLocalCard(paymentMethodResponse.south_korea_local_card)
26
+ : null;
23
27
  this.underlyingDetails = paymentMethodResponse.underlying_details
24
28
  ? new index_js_1.PaymentMethodUnderlyingDetails(paymentMethodResponse.underlying_details)
25
29
  : null;
@@ -39,3 +39,4 @@ __exportStar(require("./simulation-event-request.js"), exports);
39
39
  __exportStar(require("./simulation-event-response.js"), exports);
40
40
  __exportStar(require("./payment-method-underlying-details.js"), exports);
41
41
  __exportStar(require("./korean-market-underlying-details.js"), exports);
42
+ __exportStar(require("./south-korea-local-card.js"), exports);
@@ -3,13 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PaymentMethodDetails = void 0;
4
4
  const payment_card_js_1 = require("./payment-card.js");
5
5
  const payment_method_underlying_details_js_1 = require("./payment-method-underlying-details.js");
6
+ const south_korea_local_card_js_1 = require("./south-korea-local-card.js");
6
7
  class PaymentMethodDetails {
7
8
  type;
8
9
  card;
10
+ southKoreaLocalCard;
9
11
  underlyingDetails;
10
12
  constructor(paymentMethodDetails) {
11
13
  this.type = paymentMethodDetails.type;
12
14
  this.card = paymentMethodDetails.card ? new payment_card_js_1.PaymentCard(paymentMethodDetails.card) : null;
15
+ this.southKoreaLocalCard = paymentMethodDetails.south_korea_local_card
16
+ ? new south_korea_local_card_js_1.SouthKoreaLocalCard(paymentMethodDetails.south_korea_local_card)
17
+ : null;
13
18
  this.underlyingDetails = paymentMethodDetails.underlying_details
14
19
  ? new payment_method_underlying_details_js_1.PaymentMethodUnderlyingDetails(paymentMethodDetails.underlying_details)
15
20
  : null;
@@ -10,6 +10,7 @@ class PayoutTotalsAdjustment {
10
10
  chargebackFee;
11
11
  earnings;
12
12
  currencyCode;
13
+ retainedFee;
13
14
  constructor(payoutTotalsAdjustment) {
14
15
  this.subtotal = payoutTotalsAdjustment.subtotal;
15
16
  this.tax = payoutTotalsAdjustment.tax;
@@ -20,6 +21,7 @@ class PayoutTotalsAdjustment {
20
21
  : null;
21
22
  this.earnings = payoutTotalsAdjustment.earnings;
22
23
  this.currencyCode = payoutTotalsAdjustment.currency_code;
24
+ this.retainedFee = payoutTotalsAdjustment.retained_fee;
23
25
  }
24
26
  }
25
27
  exports.PayoutTotalsAdjustment = PayoutTotalsAdjustment;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SouthKoreaLocalCard = void 0;
4
+ class SouthKoreaLocalCard {
5
+ type;
6
+ last4;
7
+ constructor(southKoreaLocalCard) {
8
+ this.type = southKoreaLocalCard.type;
9
+ this.last4 = southKoreaLocalCard.last4;
10
+ }
11
+ }
12
+ exports.SouthKoreaLocalCard = SouthKoreaLocalCard;
@@ -8,6 +8,7 @@ class TotalAdjustments {
8
8
  fee;
9
9
  earnings;
10
10
  currencyCode;
11
+ retainedFee;
11
12
  constructor(totalAdjustments) {
12
13
  this.subtotal = totalAdjustments.subtotal;
13
14
  this.tax = totalAdjustments.tax;
@@ -15,6 +16,7 @@ class TotalAdjustments {
15
16
  this.fee = totalAdjustments.fee;
16
17
  this.earnings = totalAdjustments.earnings;
17
18
  this.currencyCode = totalAdjustments.currency_code;
19
+ this.retainedFee = totalAdjustments.retained_fee;
18
20
  }
19
21
  }
20
22
  exports.TotalAdjustments = TotalAdjustments;
@@ -11,6 +11,7 @@ class TransactionPayoutTotalsAdjusted {
11
11
  earnings;
12
12
  currencyCode;
13
13
  exchangeRate;
14
+ retainedFee;
14
15
  constructor(transactionPayoutTotalsAdjusted) {
15
16
  this.subtotal = transactionPayoutTotalsAdjusted.subtotal;
16
17
  this.tax = transactionPayoutTotalsAdjusted.tax;
@@ -22,6 +23,7 @@ class TransactionPayoutTotalsAdjusted {
22
23
  this.earnings = transactionPayoutTotalsAdjusted.earnings;
23
24
  this.currencyCode = transactionPayoutTotalsAdjusted.currency_code;
24
25
  this.exchangeRate = transactionPayoutTotalsAdjusted.exchange_rate;
26
+ this.retainedFee = transactionPayoutTotalsAdjusted.retained_fee;
25
27
  }
26
28
  }
27
29
  exports.TransactionPayoutTotalsAdjusted = TransactionPayoutTotalsAdjusted;
@@ -9,6 +9,7 @@ class TransactionTotalsAdjusted {
9
9
  fee;
10
10
  earnings;
11
11
  currencyCode;
12
+ retainedFee;
12
13
  constructor(transactionTotalsAdjusted) {
13
14
  this.subtotal = transactionTotalsAdjusted.subtotal;
14
15
  this.tax = transactionTotalsAdjusted.tax;
@@ -17,6 +18,7 @@ class TransactionTotalsAdjusted {
17
18
  this.fee = transactionTotalsAdjusted.fee ? transactionTotalsAdjusted.fee : null;
18
19
  this.earnings = transactionTotalsAdjusted.earnings ? transactionTotalsAdjusted.earnings : null;
19
20
  this.currencyCode = transactionTotalsAdjusted.currency_code;
21
+ this.retainedFee = transactionTotalsAdjusted.retained_fee;
20
22
  }
21
23
  }
22
24
  exports.TransactionTotalsAdjusted = TransactionTotalsAdjusted;
@@ -31,3 +31,4 @@ __exportStar(require("./catalog-type.js"), exports);
31
31
  __exportStar(require("./available-payment-methods.js"), exports);
32
32
  __exportStar(require("./disposition.js"), exports);
33
33
  __exportStar(require("./korean-market-underlying-payment-method-type.js"), exports);
34
+ __exportStar(require("./south-korea-local-card-type.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,6 +8,7 @@ const log_level_js_1 = require("./log-level.js");
8
8
  const runtime_provider_js_1 = require("../providers/runtime-provider.js");
9
9
  const version_js_1 = require("../../version.js");
10
10
  const case_helpers_js_1 = require("./case-helpers.js");
11
+ const response_js_1 = require("../types/response.js");
11
12
  class Client {
12
13
  apiKey;
13
14
  options;
@@ -51,7 +52,7 @@ class Client {
51
52
  headers,
52
53
  });
53
54
  logger_js_1.Logger.logResponse('GET', logUrl, headers, rawResponse);
54
- return rawResponse.json();
55
+ return { ...(await rawResponse.json()), [response_js_1.rawResponse]: rawResponse };
55
56
  }
56
57
  async post(url, requestBody) {
57
58
  const logUrl = url.split('?')[0];
@@ -63,7 +64,7 @@ class Client {
63
64
  headers,
64
65
  });
65
66
  logger_js_1.Logger.logResponse('POST', logUrl, headers, rawResponse);
66
- return rawResponse.json();
67
+ return { ...(await rawResponse.json()), [response_js_1.rawResponse]: rawResponse };
67
68
  }
68
69
  async patch(url, requestBody) {
69
70
  const logUrl = url.split('?')[0];
@@ -75,7 +76,7 @@ class Client {
75
76
  headers,
76
77
  });
77
78
  logger_js_1.Logger.logResponse('PATCH', logUrl, headers, rawResponse);
78
- return rawResponse.json();
79
+ return { ...(await rawResponse.json()), [response_js_1.rawResponse]: rawResponse };
79
80
  }
80
81
  async delete(url) {
81
82
  const logUrl = url.split('?')[0];
@@ -90,7 +91,7 @@ class Client {
90
91
  return rawResponse;
91
92
  }
92
93
  else {
93
- return rawResponse.json();
94
+ return { ...(await rawResponse.json()), [response_js_1.rawResponse]: rawResponse };
94
95
  }
95
96
  }
96
97
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseResource = void 0;
4
+ const response_js_1 = require("../types/response.js");
4
5
  const generic_js_1 = require("../errors/generic.js");
5
6
  class BaseResource {
6
7
  client;
@@ -9,7 +10,9 @@ class BaseResource {
9
10
  }
10
11
  handleError(error) {
11
12
  if (error.error) {
12
- throw new generic_js_1.ApiError(error.error);
13
+ const retryAfterHeader = error[response_js_1.rawResponse]?.headers.get('Retry-After');
14
+ const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : null;
15
+ throw new generic_js_1.ApiError(error.error, retryAfter);
13
16
  }
14
17
  }
15
18
  handleResponse(response) {
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Collection = void 0;
4
+ const response_js_1 = require("../types/response.js");
4
5
  const generic_js_1 = require("../errors/generic.js");
5
6
  class Collection {
6
7
  client;
@@ -25,7 +26,9 @@ class Collection {
25
26
  const entityResponse = response;
26
27
  const error = response;
27
28
  if (error.error) {
28
- throw new generic_js_1.ApiError(error.error);
29
+ const retryAfterHeader = error[response_js_1.rawResponse]?.headers.get('Retry-After');
30
+ const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : null;
31
+ throw new generic_js_1.ApiError(error.error, retryAfter);
29
32
  }
30
33
  return entityResponse;
31
34
  }
@@ -7,13 +7,15 @@ class ApiError extends Error {
7
7
  detail;
8
8
  documentationUrl;
9
9
  errors;
10
- constructor(errorDetail) {
10
+ retryAfter;
11
+ constructor(errorDetail, retryAfter) {
11
12
  super(errorDetail.detail);
12
13
  this.type = errorDetail.type;
13
14
  this.code = errorDetail.code;
14
15
  this.detail = errorDetail.detail;
15
16
  this.documentationUrl = errorDetail.documentation_url;
16
17
  this.errors = errorDetail.errors ? errorDetail.errors : null;
18
+ this.retryAfter = retryAfter;
17
19
  }
18
20
  }
19
21
  exports.ApiError = ApiError;
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rawResponse = void 0;
4
+ exports.rawResponse = Symbol('raw response');
@@ -36,3 +36,4 @@ __exportStar(require("./payout-totals-adjustment-notification.js"), exports);
36
36
  __exportStar(require("./import-meta-notification.js"), exports);
37
37
  __exportStar(require("./korean-market-underlying-details-notification.js"), exports);
38
38
  __exportStar(require("./payment-method-underlying-details-notification.js"), exports);
39
+ __exportStar(require("./south-korea-local-card-notification.js"), exports);
@@ -3,13 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PaymentMethodDetailsNotification = void 0;
4
4
  const payment_card_notification_js_1 = require("./payment-card-notification.js");
5
5
  const payment_method_underlying_details_notification_js_1 = require("./payment-method-underlying-details-notification.js");
6
+ const south_korea_local_card_notification_js_1 = require("./south-korea-local-card-notification.js");
6
7
  class PaymentMethodDetailsNotification {
7
8
  type;
8
9
  card;
10
+ southKoreaLocalCard;
9
11
  underlyingDetails;
10
12
  constructor(paymentMethodDetails) {
11
13
  this.type = paymentMethodDetails.type;
12
14
  this.card = paymentMethodDetails.card ? new payment_card_notification_js_1.PaymentCardNotification(paymentMethodDetails.card) : null;
15
+ this.southKoreaLocalCard = paymentMethodDetails.south_korea_local_card
16
+ ? new south_korea_local_card_notification_js_1.SouthKoreaLocalCardNotification(paymentMethodDetails.south_korea_local_card)
17
+ : null;
13
18
  this.underlyingDetails = paymentMethodDetails.underlying_details
14
19
  ? new payment_method_underlying_details_notification_js_1.PaymentMethodUnderlyingDetailsNotification(paymentMethodDetails.underlying_details)
15
20
  : null;
@@ -10,6 +10,7 @@ class PayoutTotalsAdjustmentNotification {
10
10
  chargebackFee;
11
11
  earnings;
12
12
  currencyCode;
13
+ retainedFee;
13
14
  constructor(payoutTotalsAdjustment) {
14
15
  this.subtotal = payoutTotalsAdjustment.subtotal;
15
16
  this.tax = payoutTotalsAdjustment.tax;
@@ -20,6 +21,7 @@ class PayoutTotalsAdjustmentNotification {
20
21
  : null;
21
22
  this.earnings = payoutTotalsAdjustment.earnings;
22
23
  this.currencyCode = payoutTotalsAdjustment.currency_code;
24
+ this.retainedFee = payoutTotalsAdjustment.retained_fee;
23
25
  }
24
26
  }
25
27
  exports.PayoutTotalsAdjustmentNotification = PayoutTotalsAdjustmentNotification;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SouthKoreaLocalCardNotification = void 0;
4
+ class SouthKoreaLocalCardNotification {
5
+ type;
6
+ last4;
7
+ constructor(southKoreaLocalCard) {
8
+ this.type = southKoreaLocalCard.type;
9
+ this.last4 = southKoreaLocalCard.last4;
10
+ }
11
+ }
12
+ exports.SouthKoreaLocalCardNotification = SouthKoreaLocalCardNotification;
@@ -8,6 +8,7 @@ class TotalAdjustmentsNotification {
8
8
  fee;
9
9
  earnings;
10
10
  currencyCode;
11
+ retainedFee;
11
12
  constructor(totalAdjustments) {
12
13
  this.subtotal = totalAdjustments.subtotal;
13
14
  this.tax = totalAdjustments.tax;
@@ -15,6 +16,7 @@ class TotalAdjustmentsNotification {
15
16
  this.fee = totalAdjustments.fee;
16
17
  this.earnings = totalAdjustments.earnings;
17
18
  this.currencyCode = totalAdjustments.currency_code;
19
+ this.retainedFee = totalAdjustments.retained_fee;
18
20
  }
19
21
  }
20
22
  exports.TotalAdjustmentsNotification = TotalAdjustmentsNotification;
@@ -11,6 +11,7 @@ class TransactionPayoutTotalsAdjustedNotification {
11
11
  earnings;
12
12
  currencyCode;
13
13
  exchangeRate;
14
+ retainedFee;
14
15
  constructor(transactionPayoutTotalsAdjusted) {
15
16
  this.subtotal = transactionPayoutTotalsAdjusted.subtotal;
16
17
  this.tax = transactionPayoutTotalsAdjusted.tax;
@@ -22,6 +23,7 @@ class TransactionPayoutTotalsAdjustedNotification {
22
23
  this.earnings = transactionPayoutTotalsAdjusted.earnings;
23
24
  this.currencyCode = transactionPayoutTotalsAdjusted.currency_code;
24
25
  this.exchangeRate = transactionPayoutTotalsAdjusted.exchange_rate;
26
+ this.retainedFee = transactionPayoutTotalsAdjusted.retained_fee;
25
27
  }
26
28
  }
27
29
  exports.TransactionPayoutTotalsAdjustedNotification = TransactionPayoutTotalsAdjustedNotification;
@@ -9,6 +9,7 @@ class TransactionTotalsAdjustedNotification {
9
9
  fee;
10
10
  earnings;
11
11
  currencyCode;
12
+ retainedFee;
12
13
  constructor(transactionTotalsAdjusted) {
13
14
  this.subtotal = transactionTotalsAdjusted.subtotal;
14
15
  this.tax = transactionTotalsAdjusted.tax;
@@ -17,6 +18,7 @@ class TransactionTotalsAdjustedNotification {
17
18
  this.fee = transactionTotalsAdjusted.fee ? transactionTotalsAdjusted.fee : null;
18
19
  this.earnings = transactionTotalsAdjusted.earnings ? transactionTotalsAdjusted.earnings : null;
19
20
  this.currencyCode = transactionTotalsAdjusted.currency_code;
21
+ this.retainedFee = transactionTotalsAdjusted.retained_fee;
20
22
  }
21
23
  }
22
24
  exports.TransactionTotalsAdjustedNotification = TransactionTotalsAdjustedNotification;
@@ -38,3 +38,4 @@ __exportStar(require("./payout-totals-adjustment-notification-response.js"), exp
38
38
  __exportStar(require("./import-meta-notification-response.js"), exports);
39
39
  __exportStar(require("./korean-market-underlying-details-notification.js"), exports);
40
40
  __exportStar(require("./payment-method-underlying-details-notification.js"), exports);
41
+ __exportStar(require("./south-korea-local-card-notification-response.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -23,3 +23,4 @@ __exportStar(require("./update-transaction-request-body.js"), exports);
23
23
  __exportStar(require("./transaction-preview-request-body.js"), exports);
24
24
  __exportStar(require("./get-transaction-invoice-pdf-query-parameters.js"), exports);
25
25
  __exportStar(require("./revise-transaction-request-body.js"), exports);
26
+ __exportStar(require("./non-catalog-discount.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -49,3 +49,4 @@ __exportStar(require("./simulation-event-response.js"), exports);
49
49
  __exportStar(require("./simulation-payload.js"), exports);
50
50
  __exportStar(require("./payment-method-underlying-details.js"), exports);
51
51
  __exportStar(require("./korean-market-underlying-details.js"), exports);
52
+ __exportStar(require("./south-korea-local-card-response.js"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '3.2.1';
4
+ exports.SDK_VERSION = '3.4.0';
@@ -13,6 +13,7 @@ export * from './discount-group/index.js';
13
13
  export * from './events/index.js';
14
14
  export * from './payment-method/index.js';
15
15
  export * from './payout/index.js';
16
+ export * from './pricing-preview/index.js';
16
17
  export * from './event-types/index.js';
17
18
  export * from './notification-settings/index.js';
18
19
  export * from './notifications/index.js';
@@ -1,4 +1,4 @@
1
- import { PaymentCard, PaymentMethodUnderlyingDetails, PayPal } from '../shared/index.js';
1
+ import { PaymentCard, PaymentMethodUnderlyingDetails, PayPal, SouthKoreaLocalCard } from '../shared/index.js';
2
2
  export class PaymentMethod {
3
3
  id;
4
4
  customerId;
@@ -6,6 +6,7 @@ export class PaymentMethod {
6
6
  type;
7
7
  card;
8
8
  paypal;
9
+ southKoreaLocalCard;
9
10
  underlyingDetails;
10
11
  origin;
11
12
  savedAt;
@@ -17,6 +18,9 @@ export class PaymentMethod {
17
18
  this.type = paymentMethodResponse.type;
18
19
  this.card = paymentMethodResponse.card ? new PaymentCard(paymentMethodResponse.card) : null;
19
20
  this.paypal = paymentMethodResponse.paypal ? new PayPal(paymentMethodResponse.paypal) : null;
21
+ this.southKoreaLocalCard = paymentMethodResponse.south_korea_local_card
22
+ ? new SouthKoreaLocalCard(paymentMethodResponse.south_korea_local_card)
23
+ : null;
20
24
  this.underlyingDetails = paymentMethodResponse.underlying_details
21
25
  ? new PaymentMethodUnderlyingDetails(paymentMethodResponse.underlying_details)
22
26
  : null;
@@ -23,3 +23,4 @@ export * from './simulation-event-request.js';
23
23
  export * from './simulation-event-response.js';
24
24
  export * from './payment-method-underlying-details.js';
25
25
  export * from './korean-market-underlying-details.js';
26
+ export * from './south-korea-local-card.js';
@@ -1,12 +1,17 @@
1
1
  import { PaymentCard } from './payment-card.js';
2
2
  import { PaymentMethodUnderlyingDetails } from './payment-method-underlying-details.js';
3
+ import { SouthKoreaLocalCard } from './south-korea-local-card.js';
3
4
  export class PaymentMethodDetails {
4
5
  type;
5
6
  card;
7
+ southKoreaLocalCard;
6
8
  underlyingDetails;
7
9
  constructor(paymentMethodDetails) {
8
10
  this.type = paymentMethodDetails.type;
9
11
  this.card = paymentMethodDetails.card ? new PaymentCard(paymentMethodDetails.card) : null;
12
+ this.southKoreaLocalCard = paymentMethodDetails.south_korea_local_card
13
+ ? new SouthKoreaLocalCard(paymentMethodDetails.south_korea_local_card)
14
+ : null;
10
15
  this.underlyingDetails = paymentMethodDetails.underlying_details
11
16
  ? new PaymentMethodUnderlyingDetails(paymentMethodDetails.underlying_details)
12
17
  : null;
@@ -7,6 +7,7 @@ export class PayoutTotalsAdjustment {
7
7
  chargebackFee;
8
8
  earnings;
9
9
  currencyCode;
10
+ retainedFee;
10
11
  constructor(payoutTotalsAdjustment) {
11
12
  this.subtotal = payoutTotalsAdjustment.subtotal;
12
13
  this.tax = payoutTotalsAdjustment.tax;
@@ -17,5 +18,6 @@ export class PayoutTotalsAdjustment {
17
18
  : null;
18
19
  this.earnings = payoutTotalsAdjustment.earnings;
19
20
  this.currencyCode = payoutTotalsAdjustment.currency_code;
21
+ this.retainedFee = payoutTotalsAdjustment.retained_fee;
20
22
  }
21
23
  }
@@ -0,0 +1,8 @@
1
+ export class SouthKoreaLocalCard {
2
+ type;
3
+ last4;
4
+ constructor(southKoreaLocalCard) {
5
+ this.type = southKoreaLocalCard.type;
6
+ this.last4 = southKoreaLocalCard.last4;
7
+ }
8
+ }
@@ -5,6 +5,7 @@ export class TotalAdjustments {
5
5
  fee;
6
6
  earnings;
7
7
  currencyCode;
8
+ retainedFee;
8
9
  constructor(totalAdjustments) {
9
10
  this.subtotal = totalAdjustments.subtotal;
10
11
  this.tax = totalAdjustments.tax;
@@ -12,5 +13,6 @@ export class TotalAdjustments {
12
13
  this.fee = totalAdjustments.fee;
13
14
  this.earnings = totalAdjustments.earnings;
14
15
  this.currencyCode = totalAdjustments.currency_code;
16
+ this.retainedFee = totalAdjustments.retained_fee;
15
17
  }
16
18
  }
@@ -8,6 +8,7 @@ export class TransactionPayoutTotalsAdjusted {
8
8
  earnings;
9
9
  currencyCode;
10
10
  exchangeRate;
11
+ retainedFee;
11
12
  constructor(transactionPayoutTotalsAdjusted) {
12
13
  this.subtotal = transactionPayoutTotalsAdjusted.subtotal;
13
14
  this.tax = transactionPayoutTotalsAdjusted.tax;
@@ -19,5 +20,6 @@ export class TransactionPayoutTotalsAdjusted {
19
20
  this.earnings = transactionPayoutTotalsAdjusted.earnings;
20
21
  this.currencyCode = transactionPayoutTotalsAdjusted.currency_code;
21
22
  this.exchangeRate = transactionPayoutTotalsAdjusted.exchange_rate;
23
+ this.retainedFee = transactionPayoutTotalsAdjusted.retained_fee;
22
24
  }
23
25
  }
@@ -6,6 +6,7 @@ export class TransactionTotalsAdjusted {
6
6
  fee;
7
7
  earnings;
8
8
  currencyCode;
9
+ retainedFee;
9
10
  constructor(transactionTotalsAdjusted) {
10
11
  this.subtotal = transactionTotalsAdjusted.subtotal;
11
12
  this.tax = transactionTotalsAdjusted.tax;
@@ -14,5 +15,6 @@ export class TransactionTotalsAdjusted {
14
15
  this.fee = transactionTotalsAdjusted.fee ? transactionTotalsAdjusted.fee : null;
15
16
  this.earnings = transactionTotalsAdjusted.earnings ? transactionTotalsAdjusted.earnings : null;
16
17
  this.currencyCode = transactionTotalsAdjusted.currency_code;
18
+ this.retainedFee = transactionTotalsAdjusted.retained_fee;
17
19
  }
18
20
  }
@@ -15,3 +15,4 @@ export * from './catalog-type.js';
15
15
  export * from './available-payment-methods.js';
16
16
  export * from './disposition.js';
17
17
  export * from './korean-market-underlying-payment-method-type.js';
18
+ export * from './south-korea-local-card-type.js';
@@ -5,6 +5,7 @@ import { LogLevel } from './log-level.js';
5
5
  import { RuntimeProvider } from '../providers/runtime-provider.js';
6
6
  import { SDK_VERSION } from '../../version.js';
7
7
  import { convertToSnakeCase } from './case-helpers.js';
8
+ import { rawResponse as rawResponseSymbol } from '../types/response.js';
8
9
  export class Client {
9
10
  apiKey;
10
11
  options;
@@ -48,7 +49,7 @@ export class Client {
48
49
  headers,
49
50
  });
50
51
  Logger.logResponse('GET', logUrl, headers, rawResponse);
51
- return rawResponse.json();
52
+ return { ...(await rawResponse.json()), [rawResponseSymbol]: rawResponse };
52
53
  }
53
54
  async post(url, requestBody) {
54
55
  const logUrl = url.split('?')[0];
@@ -60,7 +61,7 @@ export class Client {
60
61
  headers,
61
62
  });
62
63
  Logger.logResponse('POST', logUrl, headers, rawResponse);
63
- return rawResponse.json();
64
+ return { ...(await rawResponse.json()), [rawResponseSymbol]: rawResponse };
64
65
  }
65
66
  async patch(url, requestBody) {
66
67
  const logUrl = url.split('?')[0];
@@ -72,7 +73,7 @@ export class Client {
72
73
  headers,
73
74
  });
74
75
  Logger.logResponse('PATCH', logUrl, headers, rawResponse);
75
- return rawResponse.json();
76
+ return { ...(await rawResponse.json()), [rawResponseSymbol]: rawResponse };
76
77
  }
77
78
  async delete(url) {
78
79
  const logUrl = url.split('?')[0];
@@ -87,7 +88,7 @@ export class Client {
87
88
  return rawResponse;
88
89
  }
89
90
  else {
90
- return rawResponse.json();
91
+ return { ...(await rawResponse.json()), [rawResponseSymbol]: rawResponse };
91
92
  }
92
93
  }
93
94
  }
@@ -1,3 +1,4 @@
1
+ import { rawResponse } from '../types/response.js';
1
2
  import { ApiError } from '../errors/generic.js';
2
3
  export class BaseResource {
3
4
  client;
@@ -6,7 +7,9 @@ export class BaseResource {
6
7
  }
7
8
  handleError(error) {
8
9
  if (error.error) {
9
- throw new ApiError(error.error);
10
+ const retryAfterHeader = error[rawResponse]?.headers.get('Retry-After');
11
+ const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : null;
12
+ throw new ApiError(error.error, retryAfter);
10
13
  }
11
14
  }
12
15
  handleResponse(response) {
@@ -1,3 +1,4 @@
1
+ import { rawResponse } from '../types/response.js';
1
2
  import { ApiError } from '../errors/generic.js';
2
3
  export class Collection {
3
4
  client;
@@ -22,7 +23,9 @@ export class Collection {
22
23
  const entityResponse = response;
23
24
  const error = response;
24
25
  if (error.error) {
25
- throw new ApiError(error.error);
26
+ const retryAfterHeader = error[rawResponse]?.headers.get('Retry-After');
27
+ const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : null;
28
+ throw new ApiError(error.error, retryAfter);
26
29
  }
27
30
  return entityResponse;
28
31
  }