Skip to content

Commit 2b65e10

Browse files
fix(Transaction): Marked paymentMethodId as nullable (#44)
1 parent c7688e4 commit 2b65e10

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
1212

1313
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.
1414

15+
## 1.7.0 - 2024-09-18
16+
17+
### Fixed
18+
19+
- Marked `paymentMethodId` as nullable in `TransactionPaymentAttempt` as it can be `null`.
20+
21+
---
22+
1523
## 1.6.0 - 2024-09-16
1624

1725
### Added

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@paddle/paddle-node-sdk",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
55
"main": "./dist/cjs/index.js",
66
"module": "./dist/esm/index.js",

src/entities/shared/transaction-payment-attempt.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { type PaymentAttemptStatus, type ErrorCode } from '../../enums';
1010

1111
export class TransactionPaymentAttempt {
1212
public readonly paymentAttemptId: string;
13-
public readonly paymentMethodId: string;
13+
public readonly paymentMethodId: string | null;
1414
/**
1515
* @deprecated use paymentMethodId instead
1616
*/
@@ -24,7 +24,7 @@ export class TransactionPaymentAttempt {
2424

2525
constructor(transactionPaymentAttempt: ITransactionPaymentAttemptResponse) {
2626
this.paymentAttemptId = transactionPaymentAttempt.payment_attempt_id;
27-
this.paymentMethodId = transactionPaymentAttempt.payment_method_id;
27+
this.paymentMethodId = transactionPaymentAttempt.payment_method_id ?? null;
2828
this.storedPaymentMethodId = transactionPaymentAttempt.stored_payment_method_id;
2929
this.amount = transactionPaymentAttempt.amount;
3030
this.status = transactionPaymentAttempt.status;

src/types/shared/transaction-payment-attempt-response.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface ITransactionPaymentAttemptResponse {
1313
* @deprecated use payment_method_id instead
1414
*/
1515
stored_payment_method_id: string;
16-
payment_method_id: string;
16+
payment_method_id: string | null;
1717
amount: string;
1818
status: PaymentAttemptStatus;
1919
error_code?: ErrorCode | null;

0 commit comments

Comments
 (0)