@paddle/paddle-node-sdk 0.3.0 → 0.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/CHANGELOG.md CHANGED
@@ -8,6 +8,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
 
9
9
  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.
10
10
 
11
+ ## 0.4.0 - 2024-02-14
12
+
13
+ ### Added
14
+
15
+ - Added `availablePaymentMethods` as an `include` Parameter to all transaction operations.
16
+ - Added `importMeta` to Subscription webhooks.
17
+
18
+ ### Changed
19
+
20
+ - Filter customers by email address in `customers.list()` operation, see [related changelog](https://developer.paddle.com/changelog/2024/filter-customers-email?utm_source=dx&utm_medium=paddle-node-sdk).
21
+ - New payment method ID field for transaction payments, see [related changelog](https://developer.paddle.com/changelog/2024/payment-method-paddle-id?utm_source=dx&utm_medium=paddle-node-sdk).
22
+
23
+ ### Fixed
24
+
25
+ - Fixed `effective_from` enum in Resume subscription operations.
26
+
27
+ ### Deprecated
28
+
29
+ - Deprecated `storedPaymentMethodId` from transaction payments in favour of `paymentMethodId` field.
30
+
31
+ ---
32
+
11
33
  ## 0.3.0 - 2024-01-11
12
34
 
13
35
  ### Changed
@@ -3,6 +3,7 @@ import { PaymentMethodDetails } from '../index';
3
3
  import { type PaymentAttemptStatus, type ErrorCode } from '../../enums';
4
4
  export declare class TransactionPaymentAttempt {
5
5
  readonly paymentAttemptId: string;
6
+ readonly paymentMethodId: string;
6
7
  readonly storedPaymentMethodId: string;
7
8
  readonly amount: string;
8
9
  readonly status: PaymentAttemptStatus;
@@ -5,6 +5,7 @@ const index_1 = require("../index");
5
5
  class TransactionPaymentAttempt {
6
6
  constructor(transactionPaymentAttempt) {
7
7
  this.paymentAttemptId = transactionPaymentAttempt.payment_attempt_id;
8
+ this.paymentMethodId = transactionPaymentAttempt.payment_method_id;
8
9
  this.storedPaymentMethodId = transactionPaymentAttempt.stored_payment_method_id;
9
10
  this.amount = transactionPaymentAttempt.amount;
10
11
  this.status = transactionPaymentAttempt.status;
@@ -1,4 +1,4 @@
1
- import { BillingDetails, type CustomData, SubscriptionDiscount, SubscriptionItem, SubscriptionScheduledChange, SubscriptionTimePeriod, TimePeriod } from '../index';
1
+ import { BillingDetails, type CustomData, ImportMeta, SubscriptionDiscount, SubscriptionItem, SubscriptionScheduledChange, SubscriptionTimePeriod, TimePeriod } from '../index';
2
2
  import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
3
3
  import { type ISubscriptionNotificationResponse } from '../../types';
4
4
  export declare class SubscriptionNotification {
@@ -24,5 +24,6 @@ export declare class SubscriptionNotification {
24
24
  readonly scheduledChange: SubscriptionScheduledChange | null;
25
25
  readonly items: SubscriptionItem[];
26
26
  readonly customData: CustomData | null;
27
+ readonly importMeta: ImportMeta | null;
27
28
  constructor(subscription: ISubscriptionNotificationResponse);
28
29
  }
@@ -30,6 +30,7 @@ class SubscriptionNotification {
30
30
  : null;
31
31
  this.items = subscription.items.map((item) => new index_1.SubscriptionItem(item));
32
32
  this.customData = subscription.custom_data ? subscription.custom_data : null;
33
+ this.importMeta = subscription.import_meta ? new index_1.ImportMeta(subscription.import_meta) : null;
33
34
  }
34
35
  }
35
36
  exports.SubscriptionNotification = SubscriptionNotification;
@@ -1,6 +1,7 @@
1
1
  import { type ITransactionResponse } from '../../types';
2
2
  import { Address, TransactionAdjustment, AdjustmentTotals, BillingDetails, Business, TransactionCheckout, type CustomData, Customer, TransactionDetails, Discount, TransactionItem, TransactionPaymentAttempt, TransactionsTimePeriod } from '../index';
3
3
  import { type CollectionMode, type CurrencyCode, type TransactionStatus, type TransactionOrigin } from '../../enums';
4
+ import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
4
5
  export declare class TransactionIncludes {
5
6
  readonly id: string;
6
7
  readonly status: TransactionStatus;
@@ -30,5 +31,6 @@ export declare class TransactionIncludes {
30
31
  readonly business: Business | null;
31
32
  readonly customer: Customer | null;
32
33
  readonly discount: Discount | null;
34
+ readonly availablePaymentMethods: AvailablePaymentMethod[] | null;
33
35
  constructor(transaction: ITransactionResponse);
34
36
  }
@@ -37,6 +37,7 @@ class TransactionIncludes {
37
37
  this.business = transaction.business ? new index_1.Business(transaction.business) : null;
38
38
  this.customer = transaction.customer ? new index_1.Customer(transaction.customer) : null;
39
39
  this.discount = transaction.discount ? new index_1.Discount(transaction.discount) : null;
40
+ this.availablePaymentMethods = transaction.available_payment_methods ? transaction.available_payment_methods : null;
40
41
  }
41
42
  }
42
43
  exports.TransactionIncludes = TransactionIncludes;
@@ -6,4 +6,5 @@ export interface ListCustomerQueryParameters {
6
6
  perPage?: number;
7
7
  search?: string;
8
8
  status?: Status[];
9
+ email?: string[];
9
10
  }
@@ -1,4 +1,3 @@
1
- import { type SubscriptionEffectiveFrom } from '../../../enums';
2
1
  export interface ResumeSubscription {
3
- effectiveFrom: SubscriptionEffectiveFrom | string;
2
+ effectiveFrom: 'immediately' | string;
4
3
  }
@@ -1,11 +1,11 @@
1
- import { Transaction, TransactionCollection, TransactionIncludes, TransactionInvoicePDF, TransactionPreview } from '../../entities';
1
+ import { TransactionCollection, TransactionIncludes, TransactionInvoicePDF, TransactionPreview } from '../../entities';
2
2
  import { BaseResource } from '../../internal/base';
3
- import { type CreateTransactionQueryParameters, type CreateTransactionRequestBody, type GetTransactionQueryParameters, type ListTransactionQueryParameters, type UpdateTransactionRequestBody, type TransactionPreviewRequestBody } from './operations';
3
+ import { type CreateTransactionQueryParameters, type CreateTransactionRequestBody, type GetTransactionQueryParameters, type ListTransactionQueryParameters, type UpdateTransactionRequestBody, type TransactionPreviewRequestBody, type UpdateTransactionQueryParameters } from './operations';
4
4
  export * from './operations';
5
5
  export declare class TransactionsResource extends BaseResource {
6
6
  list(queryParams?: ListTransactionQueryParameters): TransactionCollection;
7
7
  create(createTransactionParameters: CreateTransactionRequestBody, queryParams?: CreateTransactionQueryParameters): Promise<TransactionIncludes>;
8
- update(transactionId: string, updateTransaction: UpdateTransactionRequestBody): Promise<Transaction>;
8
+ update(transactionId: string, updateTransaction: UpdateTransactionRequestBody, queryParams?: UpdateTransactionQueryParameters): Promise<TransactionIncludes>;
9
9
  get(transactionId: string, queryParams?: GetTransactionQueryParameters): Promise<TransactionIncludes>;
10
10
  getInvoicePDF(transactionId: string): Promise<TransactionInvoicePDF>;
11
11
  preview(previewTransactionParameters: TransactionPreviewRequestBody): Promise<TransactionPreview>;
@@ -48,14 +48,15 @@ class TransactionsResource extends base_1.BaseResource {
48
48
  return new entities_1.TransactionIncludes(data);
49
49
  });
50
50
  }
51
- update(transactionId, updateTransaction) {
51
+ update(transactionId, updateTransaction, queryParams) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
+ const queryParameters = new base_1.QueryParameters(queryParams);
53
54
  const urlWithPathParams = new base_1.PathParameters(TransactionPaths.update, {
54
55
  transaction_id: transactionId,
55
56
  }).deriveUrl();
56
- const response = yield this.client.patch(urlWithPathParams, updateTransaction);
57
+ const response = yield this.client.patch(urlWithPathParams + queryParameters.toQueryString(), updateTransaction);
57
58
  const data = this.handleResponse(response);
58
- return new entities_1.Transaction(data);
59
+ return new entities_1.TransactionIncludes(data);
59
60
  });
60
61
  }
61
62
  get(transactionId, queryParams) {
@@ -1,3 +1,3 @@
1
1
  export interface CreateTransactionQueryParameters {
2
- include?: Array<'address' | 'adjustment' | 'adjustments_totals' | 'business' | 'customer' | 'discount'>;
2
+ include?: Array<'address' | 'adjustment' | 'adjustments_totals' | 'available_payment_methods' | 'business' | 'customer' | 'discount'>;
3
3
  }
@@ -1,5 +1,6 @@
1
1
  export * from './list-transaction-query-parameters';
2
2
  export * from './create-transaction-query-parameters';
3
+ export * from './update-transaction-query-parameters';
3
4
  export * from './create-transaction-request-body';
4
5
  export * from './get-transaction-query-parameters';
5
6
  export * from './update-transaction-request-body';
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./list-transaction-query-parameters"), exports);
18
18
  __exportStar(require("./create-transaction-query-parameters"), exports);
19
+ __exportStar(require("./update-transaction-query-parameters"), exports);
19
20
  __exportStar(require("./create-transaction-request-body"), exports);
20
21
  __exportStar(require("./get-transaction-query-parameters"), exports);
21
22
  __exportStar(require("./update-transaction-request-body"), exports);
@@ -0,0 +1,3 @@
1
+ export interface UpdateTransactionQueryParameters {
2
+ include?: Array<'address' | 'adjustment' | 'adjustments_totals' | 'available_payment_methods' | 'business' | 'customer' | 'discount'>;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,6 +3,7 @@ import { type PaymentAttemptStatus, type ErrorCode } from '../../enums';
3
3
  export interface ITransactionPaymentAttemptResponse {
4
4
  payment_attempt_id: string;
5
5
  stored_payment_method_id: string;
6
+ payment_method_id: string;
6
7
  amount: string;
7
8
  status: PaymentAttemptStatus;
8
9
  error_code?: ErrorCode | null;
@@ -1,4 +1,4 @@
1
- import { type IBillingDetailsResponse, type ICustomData, type INextTransactionResponse, type ISubscriptionDiscountResponse, type ISubscriptionItemResponse, type ISubscriptionScheduledChangeResponse, type ISubscriptionTimePeriodResponse, type ITimePeriod, type ITransactionDetailsPreviewResponse } from '../index';
1
+ import { type IBillingDetailsResponse, type ICustomData, type IImportMetaResponse, type INextTransactionResponse, type ISubscriptionDiscountResponse, type ISubscriptionItemResponse, type ISubscriptionScheduledChangeResponse, type ISubscriptionTimePeriodResponse, type ITimePeriod, type ITransactionDetailsPreviewResponse } from '../index';
2
2
  import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums';
3
3
  export interface ISubscriptionNotificationResponse {
4
4
  id: string;
@@ -23,6 +23,7 @@ export interface ISubscriptionNotificationResponse {
23
23
  scheduled_change?: ISubscriptionScheduledChangeResponse | null;
24
24
  items: ISubscriptionItemResponse[];
25
25
  custom_data?: ICustomData | null;
26
+ import_meta?: IImportMetaResponse | null;
26
27
  next_transaction?: INextTransactionResponse | null;
27
28
  recurring_transaction_details?: ITransactionDetailsPreviewResponse | null;
28
29
  }
@@ -1,5 +1,6 @@
1
1
  import { type ICustomData, type IBillingDetailsResponse, type ITransactionsTimePeriodResponse, type ITransactionItemResponse, type ITransactionDetailsResponse, type ITransactionPaymentAttemptResponse, type ITransactionCheckout, type IAddressResponse, type ITransactionAdjustmentResponse, type IAdjustmentTotalsResponse, type IBusinessResponse, type ICustomerResponse, type IDiscountResponse } from '../index';
2
2
  import { type TransactionStatus, type CurrencyCode, type TransactionOrigin, type CollectionMode } from '../../enums';
3
+ import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods';
3
4
  export interface ITransactionResponse {
4
5
  id: string;
5
6
  status: TransactionStatus;
@@ -29,4 +30,5 @@ export interface ITransactionResponse {
29
30
  business?: IBusinessResponse | null;
30
31
  customer?: ICustomerResponse | null;
31
32
  discount?: IDiscountResponse | null;
33
+ available_payment_methods?: AvailablePaymentMethod[] | null;
32
34
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.3.0";
1
+ export declare const SDK_VERSION = "0.4.0";
package/dist/version.js CHANGED
@@ -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 = '0.3.0';
4
+ exports.SDK_VERSION = '0.4.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
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",