@paddle/paddle-node-sdk 1.0.1 → 1.0.2
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/CHANGELOG.md +12 -0
- package/README.md +21 -1
- package/dist/entities/address/address.d.ts +1 -0
- package/dist/entities/address/address.js +1 -0
- package/dist/entities/business/business.d.ts +1 -0
- package/dist/entities/business/business.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +3 -0
- package/dist/internal/types/config.d.ts +1 -1
- package/dist/notifications/entities/address/address-notification.d.ts +1 -0
- package/dist/notifications/entities/address/address-notification.js +2 -0
- package/dist/notifications/entities/business/business-notification.d.ts +1 -0
- package/dist/notifications/entities/business/business-notification.js +2 -0
- package/dist/notifications/types/address/address-notification-response.d.ts +1 -0
- package/dist/notifications/types/business/business-notification-response.d.ts +1 -0
- package/dist/types/address/address-response.d.ts +1 -0
- package/dist/types/business/business-response.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
7
7
|
Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-node-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools.
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
## 1.0.2 - 2024-03-12
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Exported `ApiError` class for usage in `try/catch` block.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Added `customerId` property to `Address` and `Business` entities, see [related changelog](https://developer.paddle.com/changelog/2024/address-business-webhooks-customer-id?utm_source=dx&utm_medium=paddle-node-sdk).
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
10
22
|
## 1.0.1 - 2024-02-20
|
|
11
23
|
|
|
12
24
|
### Changed
|
package/README.md
CHANGED
|
@@ -206,6 +206,26 @@ const product = await archiveProduct('id')
|
|
|
206
206
|
console.log('Product', product)
|
|
207
207
|
```
|
|
208
208
|
|
|
209
|
+
### Error Handling
|
|
210
|
+
|
|
211
|
+
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.
|
|
212
|
+
|
|
213
|
+
This example shows how to handle an error with the code `conflict`:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
import { ApiError } from '@paddle/paddle-node-sdk'
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
// Call functions from the SDK
|
|
220
|
+
} catch (e: any) {
|
|
221
|
+
// e.code will always follow the error code defined in our documentation
|
|
222
|
+
const paddleApiError = e as ApiError;
|
|
223
|
+
if (paddleApiError.code === 'conflict') {
|
|
224
|
+
// Handle Conflict error
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
209
229
|
## Resources
|
|
210
230
|
|
|
211
231
|
### Webhook signature verification
|
|
@@ -265,4 +285,4 @@ The Node.js SDK has complete feature parity with the Paddle API. All operations
|
|
|
265
285
|
## Learn more
|
|
266
286
|
|
|
267
287
|
- [Paddle API reference](https://developer.paddle.com/api-reference/overview?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
268
|
-
- [Sign up for Paddle Billing](https://login.paddle.com/signup?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
288
|
+
- [Sign up for Paddle Billing](https://login.paddle.com/signup?utm_source=dx&utm_medium=paddle-node-sdk)
|
|
@@ -3,6 +3,7 @@ import { type CountryCode, type Status } from '../../enums';
|
|
|
3
3
|
import { type IAddressResponse } from '../../types';
|
|
4
4
|
export declare class Address {
|
|
5
5
|
readonly id: string;
|
|
6
|
+
readonly customerId: string;
|
|
6
7
|
readonly description: string | null;
|
|
7
8
|
readonly firstLine: string | null;
|
|
8
9
|
readonly secondLine: string | null;
|
|
@@ -5,6 +5,7 @@ const index_1 = require("../index");
|
|
|
5
5
|
class Address {
|
|
6
6
|
constructor(address) {
|
|
7
7
|
this.id = address.id;
|
|
8
|
+
this.customerId = address.customer_id;
|
|
8
9
|
this.description = address.description ? address.description : null;
|
|
9
10
|
this.firstLine = address.first_line ? address.first_line : null;
|
|
10
11
|
this.secondLine = address.second_line ? address.second_line : null;
|
|
@@ -3,6 +3,7 @@ import { type Status } from '../../enums';
|
|
|
3
3
|
import { type IBusinessResponse } from '../../types';
|
|
4
4
|
export declare class Business {
|
|
5
5
|
readonly id: string;
|
|
6
|
+
readonly customerId: string;
|
|
6
7
|
readonly name: string;
|
|
7
8
|
readonly companyNumber: string | null;
|
|
8
9
|
readonly taxIdentifier: string | null;
|
|
@@ -5,6 +5,7 @@ const index_1 = require("../index");
|
|
|
5
5
|
class Business {
|
|
6
6
|
constructor(business) {
|
|
7
7
|
this.id = business.id;
|
|
8
|
+
this.customerId = business.customer_id;
|
|
8
9
|
this.name = business.name;
|
|
9
10
|
this.companyNumber = business.company_number ? business.company_number : null;
|
|
10
11
|
this.taxIdentifier = business.tax_identifier ? business.tax_identifier : null;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,9 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Paddle = exports.SDK_VERSION = exports.Environment = void 0;
|
|
17
|
+
exports.Paddle = exports.SDK_VERSION = exports.ApiError = exports.Environment = void 0;
|
|
18
18
|
var internal_1 = require("./internal");
|
|
19
19
|
Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return internal_1.Environment; } });
|
|
20
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return internal_1.ApiError; } });
|
|
20
21
|
var version_1 = require("./version");
|
|
21
22
|
Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return version_1.SDK_VERSION; } });
|
|
22
23
|
var paddle_1 = require("./paddle");
|
package/dist/internal/index.d.ts
CHANGED
package/dist/internal/index.js
CHANGED
|
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ApiError = void 0;
|
|
17
18
|
__exportStar(require("./api"), exports);
|
|
19
|
+
var generic_1 = require("./errors/generic");
|
|
20
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return generic_1.ApiError; } });
|
|
@@ -3,6 +3,7 @@ import { type CustomData, ImportMeta } from '../../../entities';
|
|
|
3
3
|
import { type IAddressNotificationResponse } from '../../types';
|
|
4
4
|
export declare class AddressNotification {
|
|
5
5
|
readonly id: string;
|
|
6
|
+
readonly customerId: string | null;
|
|
6
7
|
readonly description: string | null;
|
|
7
8
|
readonly firstLine: string | null;
|
|
8
9
|
readonly secondLine: string | null;
|
|
@@ -4,7 +4,9 @@ exports.AddressNotification = void 0;
|
|
|
4
4
|
const entities_1 = require("../../../entities");
|
|
5
5
|
class AddressNotification {
|
|
6
6
|
constructor(address) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.id = address.id;
|
|
9
|
+
this.customerId = (_a = address.customer_id) !== null && _a !== void 0 ? _a : null;
|
|
8
10
|
this.description = address.description ? address.description : null;
|
|
9
11
|
this.firstLine = address.first_line ? address.first_line : null;
|
|
10
12
|
this.secondLine = address.second_line ? address.second_line : null;
|
|
@@ -4,6 +4,7 @@ import { type IBusinessNotificationResponse } from '../../types';
|
|
|
4
4
|
import { type CustomData } from '../../../entities';
|
|
5
5
|
export declare class BusinessNotification {
|
|
6
6
|
readonly id: string;
|
|
7
|
+
readonly customerId: string | null;
|
|
7
8
|
readonly name: string;
|
|
8
9
|
readonly companyNumber: string | null;
|
|
9
10
|
readonly taxIdentifier: string | null;
|
|
@@ -4,7 +4,9 @@ exports.BusinessNotification = void 0;
|
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
class BusinessNotification {
|
|
6
6
|
constructor(business) {
|
|
7
|
+
var _a;
|
|
7
8
|
this.id = business.id;
|
|
9
|
+
this.customerId = (_a = business.customer_id) !== null && _a !== void 0 ? _a : null;
|
|
8
10
|
this.name = business.name;
|
|
9
11
|
this.companyNumber = business.company_number ? business.company_number : null;
|
|
10
12
|
this.taxIdentifier = business.tax_identifier ? business.tax_identifier : null;
|
|
@@ -2,6 +2,7 @@ import { type CountryCode, type Status } from '../../../enums';
|
|
|
2
2
|
import { type ICustomData, type IImportMetaResponse } from '../../../types';
|
|
3
3
|
export interface IAddressNotificationResponse {
|
|
4
4
|
id: string;
|
|
5
|
+
customer_id?: string | null;
|
|
5
6
|
description?: string | null;
|
|
6
7
|
first_line?: string | null;
|
|
7
8
|
second_line?: string | null;
|
|
@@ -3,6 +3,7 @@ import { type Status } from '../../../enums';
|
|
|
3
3
|
import { type ICustomData } from '../../../types';
|
|
4
4
|
export interface IBusinessNotificationResponse {
|
|
5
5
|
id: string;
|
|
6
|
+
customer_id?: string | null;
|
|
6
7
|
name: string;
|
|
7
8
|
company_number?: string | null;
|
|
8
9
|
tax_identifier?: string | null;
|
|
@@ -2,6 +2,7 @@ import { type ICustomData, type IImportMetaResponse } from '../index';
|
|
|
2
2
|
import { type CountryCode, type Status } from '../../enums';
|
|
3
3
|
export interface IAddressResponse {
|
|
4
4
|
id: string;
|
|
5
|
+
customer_id: string;
|
|
5
6
|
description?: string | null;
|
|
6
7
|
first_line?: string | null;
|
|
7
8
|
second_line?: string | null;
|
|
@@ -2,6 +2,7 @@ import { type IBusinessContacts, type ICustomData, type IImportMetaResponse } fr
|
|
|
2
2
|
import { type Status } from '../../enums';
|
|
3
3
|
export interface IBusinessResponse {
|
|
4
4
|
id: string;
|
|
5
|
+
customer_id: string;
|
|
5
6
|
name: string;
|
|
6
7
|
company_number?: string | null;
|
|
7
8
|
tax_identifier?: string | null;
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.2";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paddle/paddle-node-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|