@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.
- package/README.md +1 -1
- package/dist/cjs/entities/index.js +1 -0
- package/dist/cjs/entities/payment-method/payment-method.js +4 -0
- package/dist/cjs/entities/shared/index.js +1 -0
- package/dist/cjs/entities/shared/payment-method-details.js +5 -0
- package/dist/cjs/entities/shared/payout-totals-adjustment.js +2 -0
- package/dist/cjs/entities/shared/south-korea-local-card.js +12 -0
- package/dist/cjs/entities/shared/total-adjustments.js +2 -0
- package/dist/cjs/entities/shared/transaction-payout-totals-adjusted.js +2 -0
- package/dist/cjs/entities/shared/transaction-totals-adjusted.js +2 -0
- package/dist/cjs/enums/shared/index.js +1 -0
- package/dist/cjs/enums/shared/south-korea-local-card-type.js +2 -0
- package/dist/cjs/internal/api/client.js +5 -4
- package/dist/cjs/internal/base/base-resource.js +4 -1
- package/dist/cjs/internal/base/collection.js +4 -1
- package/dist/cjs/internal/errors/generic.js +3 -1
- package/dist/cjs/internal/types/response.js +2 -0
- package/dist/cjs/notifications/entities/shared/index.js +1 -0
- package/dist/cjs/notifications/entities/shared/payment-method-details-notification.js +5 -0
- package/dist/cjs/notifications/entities/shared/payout-totals-adjustment-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/south-korea-local-card-notification.js +12 -0
- package/dist/cjs/notifications/entities/shared/total-adjustments-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/transaction-totals-adjusted-notification.js +2 -0
- package/dist/cjs/notifications/types/shared/index.js +1 -0
- package/dist/cjs/notifications/types/shared/south-korea-local-card-notification-response.js +2 -0
- package/dist/cjs/resources/transactions/operations/index.js +1 -0
- package/dist/cjs/resources/transactions/operations/non-catalog-discount.js +2 -0
- package/dist/cjs/types/shared/index.js +1 -0
- package/dist/cjs/types/shared/south-korea-local-card-response.js +2 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/entities/index.js +1 -0
- package/dist/esm/entities/payment-method/payment-method.js +5 -1
- package/dist/esm/entities/shared/index.js +1 -0
- package/dist/esm/entities/shared/payment-method-details.js +5 -0
- package/dist/esm/entities/shared/payout-totals-adjustment.js +2 -0
- package/dist/esm/entities/shared/south-korea-local-card.js +8 -0
- package/dist/esm/entities/shared/total-adjustments.js +2 -0
- package/dist/esm/entities/shared/transaction-payout-totals-adjusted.js +2 -0
- package/dist/esm/entities/shared/transaction-totals-adjusted.js +2 -0
- package/dist/esm/enums/shared/index.js +1 -0
- package/dist/esm/enums/shared/south-korea-local-card-type.js +1 -0
- package/dist/esm/internal/api/client.js +5 -4
- package/dist/esm/internal/base/base-resource.js +4 -1
- package/dist/esm/internal/base/collection.js +4 -1
- package/dist/esm/internal/errors/generic.js +3 -1
- package/dist/esm/internal/types/response.js +1 -1
- package/dist/esm/notifications/entities/shared/index.js +1 -0
- package/dist/esm/notifications/entities/shared/payment-method-details-notification.js +5 -0
- package/dist/esm/notifications/entities/shared/payout-totals-adjustment-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/south-korea-local-card-notification.js +8 -0
- package/dist/esm/notifications/entities/shared/total-adjustments-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/transaction-totals-adjusted-notification.js +2 -0
- package/dist/esm/notifications/types/shared/index.js +1 -0
- package/dist/esm/notifications/types/shared/south-korea-local-card-notification-response.js +1 -0
- package/dist/esm/resources/transactions/operations/index.js +1 -0
- package/dist/esm/resources/transactions/operations/non-catalog-discount.js +1 -0
- package/dist/esm/types/shared/index.js +1 -0
- package/dist/esm/types/shared/south-korea-local-card-response.js +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/entities/index.d.ts +2 -1
- package/dist/types/entities/payment-method/payment-method.d.ts +2 -1
- package/dist/types/entities/shared/index.d.ts +1 -0
- package/dist/types/entities/shared/payment-method-details.d.ts +2 -0
- package/dist/types/entities/shared/payout-totals-adjustment.d.ts +1 -0
- package/dist/types/entities/shared/south-korea-local-card.d.ts +7 -0
- package/dist/types/entities/shared/total-adjustments.d.ts +1 -0
- package/dist/types/entities/shared/transaction-payout-totals-adjusted.d.ts +1 -0
- package/dist/types/entities/shared/transaction-totals-adjusted.d.ts +1 -0
- package/dist/types/enums/payment-method/type.d.ts +1 -1
- package/dist/types/enums/shared/available-payment-methods.d.ts +1 -1
- package/dist/types/enums/shared/index.d.ts +1 -0
- package/dist/types/enums/shared/payment-type.d.ts +1 -1
- package/dist/types/enums/shared/south-korea-local-card-type.d.ts +1 -0
- package/dist/types/internal/errors/generic.d.ts +2 -1
- package/dist/types/internal/types/response.d.ts +4 -0
- package/dist/types/notifications/entities/shared/index.d.ts +1 -0
- package/dist/types/notifications/entities/shared/payment-method-details-notification.d.ts +2 -0
- package/dist/types/notifications/entities/shared/payout-totals-adjustment-notification.d.ts +1 -0
- package/dist/types/notifications/entities/shared/south-korea-local-card-notification.d.ts +7 -0
- package/dist/types/notifications/entities/shared/total-adjustments-notification.d.ts +1 -0
- package/dist/types/notifications/entities/shared/transaction-payout-totals-adjusted-notification.d.ts +1 -0
- package/dist/types/notifications/entities/shared/transaction-totals-adjusted-notification.d.ts +1 -0
- package/dist/types/notifications/types/shared/index.d.ts +1 -0
- package/dist/types/notifications/types/shared/payment-method-details.d.ts +2 -0
- package/dist/types/notifications/types/shared/payout-totals-adjustment-notification-response.d.ts +1 -0
- package/dist/types/notifications/types/shared/south-korea-local-card-notification-response.d.ts +5 -0
- package/dist/types/notifications/types/shared/total-adjustments-notification-response.d.ts +1 -0
- package/dist/types/notifications/types/shared/transaction-payout-totals-adjusted-notification-response.d.ts +1 -0
- package/dist/types/notifications/types/shared/transaction-totals-adjusted-notification-response.d.ts +1 -0
- package/dist/types/resources/transactions/operations/create-transaction-request-body.d.ts +2 -0
- package/dist/types/resources/transactions/operations/index.d.ts +1 -0
- package/dist/types/resources/transactions/operations/non-catalog-discount.d.ts +11 -0
- package/dist/types/resources/transactions/operations/transaction-preview-request-body.d.ts +2 -0
- package/dist/types/resources/transactions/operations/update-transaction-request-body.d.ts +2 -0
- package/dist/types/types/payment-method/payment-method.d.ts +2 -1
- package/dist/types/types/shared/custom-data.d.ts +1 -1
- package/dist/types/types/shared/index.d.ts +1 -0
- package/dist/types/types/shared/payment-method-details.d.ts +2 -0
- package/dist/types/types/shared/payout-totals-adjustment-response.d.ts +1 -0
- package/dist/types/types/shared/south-korea-local-card-response.d.ts +5 -0
- package/dist/types/types/shared/total-adjustments-response.d.ts +1 -0
- package/dist/types/types/shared/transaction-payout-totals-adjusted-response.d.ts +1 -0
- package/dist/types/types/shared/transaction-totals-adjusted-response.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- 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);
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -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;
|
package/dist/cjs/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js
CHANGED
|
@@ -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);
|
|
@@ -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);
|
|
@@ -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);
|
package/dist/cjs/version.js
CHANGED
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
}
|