Skip to content

Commit

Permalink
Handled missing unitPriceOverrides in the `subscriptions.getPayment…
Browse files Browse the repository at this point in the history
…MethodChangeTransaction` operation. (#19)
  • Loading branch information
vijayasingam-paddle authored Mar 20, 2024
1 parent a8e934e commit e0943ff
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a

This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.

## 1.2.1 - 2024-03-20

### Fixed

- Handled missing `unitPriceOverrides` in the `subscriptions.getPaymentMethodChangeTransaction` operation.

---

## 1.2.0 - 2024-03-19

### Changed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paddle/paddle-node-sdk",
"version": "1.2.0",
"version": "1.2.1",
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
5 changes: 2 additions & 3 deletions src/entities/price/price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export class Price {
this.trialPeriod = price.trial_period ? new TimePeriod(price.trial_period) : null;
this.taxMode = price.tax_mode;
this.unitPrice = new Money(price.unit_price);
this.unitPriceOverrides = price.unit_price_overrides.map(
(unit_price_override) => new UnitPriceOverride(unit_price_override),
);
this.unitPriceOverrides =
price.unit_price_overrides?.map((unit_price_override) => new UnitPriceOverride(unit_price_override)) ?? [];
this.quantity = new PriceQuantity(price.quantity);
this.status = price.status;
this.createdAt = price.created_at;
Expand Down
7 changes: 4 additions & 3 deletions src/notifications/entities/price/price-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ export class PriceNotification {
this.trialPeriod = price.trial_period ? new TimePeriodNotification(price.trial_period) : null;
this.taxMode = price.tax_mode;
this.unitPrice = new MoneyNotification(price.unit_price);
this.unitPriceOverrides = price.unit_price_overrides.map(
(unit_price_override) => new UnitPriceOverrideNotification(unit_price_override),
);
this.unitPriceOverrides =
price.unit_price_overrides?.map(
(unit_price_override) => new UnitPriceOverrideNotification(unit_price_override),
) ?? [];
this.quantity = new PriceQuantityNotification(price.quantity);
this.status = price.status;
this.createdAt = price.created_at ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface IPriceNotificationResponse {
trial_period?: ITimePeriodNotification | null;
tax_mode: TaxMode;
unit_price: IMoneyNotificationResponse;
unit_price_overrides: IUnitPriceOverrideNotificationResponse[];
unit_price_overrides: IUnitPriceOverrideNotificationResponse[] | null;
quantity: IPriceQuantityNotification;
status: Status;
created_at?: string | null;
Expand Down
2 changes: 1 addition & 1 deletion src/types/price/price-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface IPriceResponse {
trial_period?: ITimePeriod | null;
tax_mode: TaxMode;
unit_price: IMoneyResponse;
unit_price_overrides: IUnitPriceOverrideResponse[];
unit_price_overrides: IUnitPriceOverrideResponse[] | null;
quantity: IPriceQuantity;
status: Status;
created_at: string;
Expand Down

0 comments on commit e0943ff

Please sign in to comment.