From 93264aee753f64b52021029f9a5a86a0c5212911 Mon Sep 17 00:00:00 2001 From: Dan Billson Date: Thu, 12 Dec 2024 11:32:32 +0000 Subject: [PATCH 1/6] feat: add VND currency support --- src/enums/shared/currency-code.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/enums/shared/currency-code.ts b/src/enums/shared/currency-code.ts index f5584d9..f7cbd4e 100644 --- a/src/enums/shared/currency-code.ts +++ b/src/enums/shared/currency-code.ts @@ -3,6 +3,7 @@ * Do not make changes to this file. * Changes may be overwritten as part of auto-generation. */ + export type CurrencyCode = | 'USD' | 'EUR' @@ -33,4 +34,5 @@ export type CurrencyCode = | 'TRY' | 'TWD' | 'UAH' + | 'VND' | 'ZAR'; From 56f7378d28b3fd1dffff2b5ab41d77cc712f1a4f Mon Sep 17 00:00:00 2001 From: Dan Billson Date: Thu, 12 Dec 2024 15:41:48 +0000 Subject: [PATCH 2/6] feat: add adjustment type --- .../notifications/adjustment-created.mock.ts | 2 ++ .../notifications/adjustment-updated.mock.ts | 2 ++ .../mocks/resources/adjustments.mock.ts | 1 + src/entities/adjustment/adjustment-item.ts | 4 ++-- src/entities/adjustment/adjustment.ts | 9 ++++++++- .../next-transaction-adjustment-item.ts | 4 ++-- .../transaction/transaction-adjustment-item.ts | 4 ++-- src/enums/adjustment/adjustment-item-type.ts | 7 +++++++ src/enums/adjustment/adjustment-type.ts | 2 +- src/enums/adjustment/index.ts | 5 +++-- .../adjustment/adjustment-item-notification.ts | 4 ++-- .../adjustment/adjustment-notification.ts | 9 ++++++++- .../adjustment-item-notification-response.ts | 4 ++-- .../adjustment-notification-response.ts | 8 +++++++- .../operations/create-adjustment-request-body.ts | 16 +++++++++++++--- src/types/adjustment/adjustment-item-response.ts | 4 ++-- src/types/adjustment/adjustment-response.ts | 8 +++++++- .../transaction-adjustment-item-response.ts | 4 ++-- 18 files changed, 73 insertions(+), 24 deletions(-) create mode 100644 src/enums/adjustment/adjustment-item-type.ts diff --git a/src/__tests__/mocks/notifications/adjustment-created.mock.ts b/src/__tests__/mocks/notifications/adjustment-created.mock.ts index 2ab6c82..8992022 100644 --- a/src/__tests__/mocks/notifications/adjustment-created.mock.ts +++ b/src/__tests__/mocks/notifications/adjustment-created.mock.ts @@ -24,6 +24,7 @@ export const AdjustmentCreatedMock: IEventsResponse = { }, ], action: 'refund', + type: 'partial', reason: 'error', status: 'pending_approval', totals: { fee: '5', tax: '8', total: '100', earnings: '87', subtotal: '92', currency_code: 'USD' }, @@ -41,6 +42,7 @@ export const AdjustmentCreatedMock: IEventsResponse = { export const AdjustmentCreatedMockExpectation = { data: { action: 'refund', + type: 'partial', createdAt: '2023-08-21T14:08:43.297512Z', creditAppliedToBalance: true, currencyCode: 'USD', diff --git a/src/__tests__/mocks/notifications/adjustment-updated.mock.ts b/src/__tests__/mocks/notifications/adjustment-updated.mock.ts index 0a74ec7..07821dc 100644 --- a/src/__tests__/mocks/notifications/adjustment-updated.mock.ts +++ b/src/__tests__/mocks/notifications/adjustment-updated.mock.ts @@ -24,6 +24,7 @@ export const AdjustmentUpdatedMock: IEventsResponse = { }, ], action: 'refund', + type: 'partial', reason: 'error', status: 'approved', totals: { fee: '5', tax: '8', total: '100', earnings: '87', subtotal: '92', currency_code: 'USD' }, @@ -41,6 +42,7 @@ export const AdjustmentUpdatedMock: IEventsResponse = { export const AdjustmentUpdatedMockExpectation = { data: { action: 'refund', + type: 'partial', createdAt: '2023-08-21T14:08:43.297512Z', creditAppliedToBalance: true, currencyCode: 'USD', diff --git a/src/__tests__/mocks/resources/adjustments.mock.ts b/src/__tests__/mocks/resources/adjustments.mock.ts index 7785e06..f6dea5f 100644 --- a/src/__tests__/mocks/resources/adjustments.mock.ts +++ b/src/__tests__/mocks/resources/adjustments.mock.ts @@ -36,6 +36,7 @@ export const CreateAdjustmentExpectation = { export const AdjustmentMock: IAdjustmentResponse = { action: 'credit', + type: 'partial', items: [ { amount: '1000', diff --git a/src/entities/adjustment/adjustment-item.ts b/src/entities/adjustment/adjustment-item.ts index 48ebad7..44bb727 100644 --- a/src/entities/adjustment/adjustment-item.ts +++ b/src/entities/adjustment/adjustment-item.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentType } from '../../enums/index.js'; +import { type AdjustmentItemType } from '../../enums/index.js'; import { AdjustmentProration } from './adjustment-proration.js'; import { AdjustmentItemTotals } from './adjustment-item-totals.js'; import { type IAdjustmentItemResponse } from '../../types/index.js'; @@ -12,7 +12,7 @@ import { type IAdjustmentItemResponse } from '../../types/index.js'; export class AdjustmentItem { public readonly id: string; public readonly itemId: string; - public readonly type: AdjustmentType; + public readonly type: AdjustmentItemType; public readonly amount: string | null; public readonly proration: AdjustmentProration | null; public readonly totals: AdjustmentItemTotals | null; diff --git a/src/entities/adjustment/adjustment.ts b/src/entities/adjustment/adjustment.ts index b3f5f9e..040e658 100644 --- a/src/entities/adjustment/adjustment.ts +++ b/src/entities/adjustment/adjustment.ts @@ -4,7 +4,12 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../enums/index.js'; +import { + type AdjustmentType, + type AdjustmentAction, + type AdjustmentStatus, + type CurrencyCode, +} from '../../enums/index.js'; import { AdjustmentItem } from './adjustment-item.js'; import { PayoutTotalsAdjustment, TotalAdjustments } from '../shared/index.js'; import { type IAdjustmentResponse } from '../../types/index.js'; @@ -12,6 +17,7 @@ import { type IAdjustmentResponse } from '../../types/index.js'; export class Adjustment { public readonly id: string; public readonly action: AdjustmentAction; + public readonly type: AdjustmentType; public readonly transactionId: string; public readonly subscriptionId: string | null; public readonly customerId: string; @@ -28,6 +34,7 @@ export class Adjustment { constructor(adjustment: IAdjustmentResponse) { this.id = adjustment.id; this.action = adjustment.action; + this.type = adjustment.type; this.transactionId = adjustment.transaction_id; this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null; this.customerId = adjustment.customer_id; diff --git a/src/entities/subscription/next-transaction-adjustment-item.ts b/src/entities/subscription/next-transaction-adjustment-item.ts index 68076b6..e8655d1 100644 --- a/src/entities/subscription/next-transaction-adjustment-item.ts +++ b/src/entities/subscription/next-transaction-adjustment-item.ts @@ -4,13 +4,13 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentType } from '../../enums/index.js'; +import { type AdjustmentItemType } from '../../enums/index.js'; import { AdjustmentItemTotals, AdjustmentProration } from '../adjustment/index.js'; import { type IAdjustmentItemResponse } from '../../types/index.js'; export class NextTransactionAdjustmentItem { public readonly itemId: string; - public readonly type: AdjustmentType; + public readonly type: AdjustmentItemType; public readonly amount: string | null; public readonly proration: AdjustmentProration | null; public readonly totals: AdjustmentItemTotals | null; diff --git a/src/entities/transaction/transaction-adjustment-item.ts b/src/entities/transaction/transaction-adjustment-item.ts index 95a7953..60be1c0 100644 --- a/src/entities/transaction/transaction-adjustment-item.ts +++ b/src/entities/transaction/transaction-adjustment-item.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentType } from '../../enums/index.js'; +import { type AdjustmentItemType } from '../../enums/index.js'; import { TransactionProration } from './transaction-proration.js'; import { AdjustmentItemTotals } from '../adjustment/index.js'; import { type ITransactionAdjustmentItemResponse } from '../../types/index.js'; @@ -12,7 +12,7 @@ import { type ITransactionAdjustmentItemResponse } from '../../types/index.js'; export class TransactionAdjustmentItem { public readonly id: string | null; public readonly itemId: string; - public readonly type: AdjustmentType; + public readonly type: AdjustmentItemType; public readonly amount: string | null; public readonly proration: TransactionProration | null; public readonly totals: AdjustmentItemTotals | null; diff --git a/src/enums/adjustment/adjustment-item-type.ts b/src/enums/adjustment/adjustment-item-type.ts new file mode 100644 index 0000000..5078a8c --- /dev/null +++ b/src/enums/adjustment/adjustment-item-type.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export type AdjustmentItemType = 'full' | 'partial' | 'tax' | 'proration'; diff --git a/src/enums/adjustment/adjustment-type.ts b/src/enums/adjustment/adjustment-type.ts index 7bfdeb1..2374da0 100644 --- a/src/enums/adjustment/adjustment-type.ts +++ b/src/enums/adjustment/adjustment-type.ts @@ -4,4 +4,4 @@ * Changes may be overwritten as part of auto-generation. */ -export type AdjustmentType = 'full' | 'partial' | 'tax' | 'proration'; +export type AdjustmentType = 'full' | 'partial'; diff --git a/src/enums/adjustment/index.ts b/src/enums/adjustment/index.ts index b8b20a7..0cc3f78 100644 --- a/src/enums/adjustment/index.ts +++ b/src/enums/adjustment/index.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -export * from './adjustment-type.js'; -export * from './adjustment-currency-code.js'; export * from './adjustment-action.js'; +export * from './adjustment-currency-code.js'; +export * from './adjustment-item-type.js'; export * from './adjustment-status.js'; +export * from './adjustment-type.js'; diff --git a/src/notifications/entities/adjustment/adjustment-item-notification.ts b/src/notifications/entities/adjustment/adjustment-item-notification.ts index ab79f35..7165a34 100644 --- a/src/notifications/entities/adjustment/adjustment-item-notification.ts +++ b/src/notifications/entities/adjustment/adjustment-item-notification.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentType } from '../../../enums/index.js'; +import { type AdjustmentItemType } from '../../../enums/index.js'; import { AdjustmentProrationNotification } from './adjustment-proration-notification.js'; import { AdjustmentItemTotalsNotification } from './adjustment-item-totals-notification.js'; import { type IAdjustmentItemNotificationResponse } from '../../types/index.js'; @@ -12,7 +12,7 @@ import { type IAdjustmentItemNotificationResponse } from '../../types/index.js'; export class AdjustmentItemNotification { public readonly id: string; public readonly itemId: string; - public readonly type: AdjustmentType; + public readonly type: AdjustmentItemType; public readonly amount: string | null; public readonly proration: AdjustmentProrationNotification | null; public readonly totals: AdjustmentItemTotalsNotification | null; diff --git a/src/notifications/entities/adjustment/adjustment-notification.ts b/src/notifications/entities/adjustment/adjustment-notification.ts index 7716679..aee2d31 100644 --- a/src/notifications/entities/adjustment/adjustment-notification.ts +++ b/src/notifications/entities/adjustment/adjustment-notification.ts @@ -4,7 +4,12 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums/index.js'; +import { + type AdjustmentType, + type AdjustmentAction, + type AdjustmentStatus, + type CurrencyCode, +} from '../../../enums/index.js'; import { AdjustmentItemNotification } from './adjustment-item-notification.js'; import { PayoutTotalsAdjustmentNotification, TotalAdjustmentsNotification } from '../shared/index.js'; import { type IAdjustmentNotificationResponse } from '../../types/index.js'; @@ -12,6 +17,7 @@ import { type IAdjustmentNotificationResponse } from '../../types/index.js'; export class AdjustmentNotification { public readonly id: string; public readonly action: AdjustmentAction; + public readonly type: AdjustmentType; public readonly transactionId: string; public readonly subscriptionId: string | null; public readonly customerId: string; @@ -28,6 +34,7 @@ export class AdjustmentNotification { constructor(adjustment: IAdjustmentNotificationResponse) { this.id = adjustment.id; this.action = adjustment.action; + this.type = adjustment.type; this.transactionId = adjustment.transaction_id; this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null; this.customerId = adjustment.customer_id; diff --git a/src/notifications/types/adjustment/adjustment-item-notification-response.ts b/src/notifications/types/adjustment/adjustment-item-notification-response.ts index adf9662..45193e3 100644 --- a/src/notifications/types/adjustment/adjustment-item-notification-response.ts +++ b/src/notifications/types/adjustment/adjustment-item-notification-response.ts @@ -5,13 +5,13 @@ */ import { type IAdjustmentsProrationNotificationResponse } from './adjustments-proration-notification-response.js'; -import { type AdjustmentType } from '../../../enums/index.js'; +import { type AdjustmentItemType } from '../../../enums/index.js'; import { type IAdjustmentItemTotalsNotificationResponse } from './adjustment-totals-notification-response.js'; export interface IAdjustmentItemNotificationResponse { id: string; item_id: string; - type: AdjustmentType; + type: AdjustmentItemType; amount?: string | null; proration?: IAdjustmentsProrationNotificationResponse | null; totals?: IAdjustmentItemTotalsNotificationResponse | null; diff --git a/src/notifications/types/adjustment/adjustment-notification-response.ts b/src/notifications/types/adjustment/adjustment-notification-response.ts index ece16f1..82bffb2 100644 --- a/src/notifications/types/adjustment/adjustment-notification-response.ts +++ b/src/notifications/types/adjustment/adjustment-notification-response.ts @@ -4,7 +4,12 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums/index.js'; +import { + type AdjustmentType, + type AdjustmentAction, + type AdjustmentStatus, + type CurrencyCode, +} from '../../../enums/index.js'; import { type IAdjustmentItemNotificationResponse } from './adjustment-item-notification-response.js'; import { type IPayoutTotalsAdjustmentNotificationResponse, @@ -14,6 +19,7 @@ import { export interface IAdjustmentNotificationResponse { id: string; action: AdjustmentAction; + type: AdjustmentType; transaction_id: string; subscription_id?: string | null; customer_id: string; diff --git a/src/resources/adjustments/operations/create-adjustment-request-body.ts b/src/resources/adjustments/operations/create-adjustment-request-body.ts index 40c7b65..1fb57f4 100644 --- a/src/resources/adjustments/operations/create-adjustment-request-body.ts +++ b/src/resources/adjustments/operations/create-adjustment-request-body.ts @@ -4,17 +4,27 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentAction, type AdjustmentType } from '../../../enums/index.js'; +import { type AdjustmentAction, type AdjustmentItemType } from '../../../enums/index.js'; export interface CreateAdjustmentLineItem { amount: string | null; itemId: string; - type: AdjustmentType; + type: AdjustmentItemType; } -export interface CreateAdjustmentRequestBody { +interface CreatePartialAdjustmentRequestBody { action: AdjustmentAction; items: CreateAdjustmentLineItem[]; reason: string; transactionId: string; + type?: 'partial'; } + +interface CreateFullAdjustmentRequestBody { + action: AdjustmentAction; + reason: string; + transactionId: string; + type?: 'full'; +} + +export type CreateAdjustmentRequestBody = CreatePartialAdjustmentRequestBody | CreateFullAdjustmentRequestBody; diff --git a/src/types/adjustment/adjustment-item-response.ts b/src/types/adjustment/adjustment-item-response.ts index 70bf967..002ef30 100644 --- a/src/types/adjustment/adjustment-item-response.ts +++ b/src/types/adjustment/adjustment-item-response.ts @@ -4,14 +4,14 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentType } from '../../enums/index.js'; +import { type AdjustmentItemType } from '../../enums/index.js'; import { type IAdjustmentsProrationResponse } from './adjustments-proration-response.js'; import { type IAdjustmentItemTotals } from '../shared/index.js'; export interface IAdjustmentItemResponse { id: string; item_id: string; - type: AdjustmentType; + type: AdjustmentItemType; amount?: string | null; proration?: IAdjustmentsProrationResponse | null; totals?: IAdjustmentItemTotals | null; diff --git a/src/types/adjustment/adjustment-response.ts b/src/types/adjustment/adjustment-response.ts index 1ab56b1..cab774b 100644 --- a/src/types/adjustment/adjustment-response.ts +++ b/src/types/adjustment/adjustment-response.ts @@ -4,13 +4,19 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../enums/index.js'; +import { + type AdjustmentType, + type AdjustmentAction, + type AdjustmentStatus, + type CurrencyCode, +} from '../../enums/index.js'; import { type IAdjustmentItemResponse } from './adjustment-item-response.js'; import { type IPayoutTotalsAdjustmentResponse, type ITotalAdjustmentsResponse } from '../shared/index.js'; export interface IAdjustmentResponse { id: string; action: AdjustmentAction; + type: AdjustmentType; transaction_id: string; subscription_id?: string | null; customer_id: string; diff --git a/src/types/transaction/transaction-adjustment-item-response.ts b/src/types/transaction/transaction-adjustment-item-response.ts index 3a362c8..3c209b4 100644 --- a/src/types/transaction/transaction-adjustment-item-response.ts +++ b/src/types/transaction/transaction-adjustment-item-response.ts @@ -4,14 +4,14 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentType } from '../../enums/index.js'; +import { type AdjustmentItemType } from '../../enums/index.js'; import { type ITransactionProrationResponse } from './transaction-proration-response.js'; import { type IAdjustmentItemTotals } from '../shared/index.js'; export interface ITransactionAdjustmentItemResponse { id?: string | null; item_id: string; - type: AdjustmentType; + type: AdjustmentItemType; amount?: string | null; proration?: ITransactionProrationResponse | null; totals?: IAdjustmentItemTotals | null; From dd27cf000a3fcf53c9014360225be6fc197809de Mon Sep 17 00:00:00 2001 From: Dan Billson Date: Fri, 13 Dec 2024 10:03:15 +0000 Subject: [PATCH 3/6] chore: bump version --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dcc498..c9832ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,13 @@ 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. +## 2.2.0 - 2024-12-12 + +### Added + +- `VND` (Vietnamese dong) as new currency +- Added `adjustment.type` which is either `partial` which should include `items` or `full` where `items` are not required + ## 2.1.3 - 2024-11-29 ### Changed diff --git a/package.json b/package.json index eedaf66..ddef835 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paddle/paddle-node-sdk", - "version": "2.1.3", + "version": "2.2.0", "description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.", "main": "dist/cjs/index.cjs.node.js", "module": "dist/esm/index.esm.node.js", From 9dfcfbe666bee40fa65a360ddf678135c8e21b47 Mon Sep 17 00:00:00 2001 From: Dan Billson Date: Fri, 13 Dec 2024 12:25:45 +0000 Subject: [PATCH 4/6] chore: rename adjustment type --- src/entities/adjustment/adjustment-item.ts | 4 ++-- src/entities/adjustment/adjustment.ts | 4 ++-- src/entities/subscription/next-transaction-adjustment-item.ts | 4 ++-- src/entities/transaction/transaction-adjustment-item.ts | 4 ++-- src/enums/adjustment/adjustment-item-type.ts | 2 +- src/enums/adjustment/adjustment-type.ts | 2 +- .../entities/adjustment/adjustment-item-notification.ts | 4 ++-- .../entities/adjustment/adjustment-notification.ts | 4 ++-- .../types/adjustment/adjustment-item-notification-response.ts | 4 ++-- .../types/adjustment/adjustment-notification-response.ts | 4 ++-- .../adjustments/operations/create-adjustment-request-body.ts | 4 ++-- src/types/adjustment/adjustment-item-response.ts | 4 ++-- src/types/adjustment/adjustment-response.ts | 4 ++-- src/types/transaction/transaction-adjustment-item-response.ts | 4 ++-- 14 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/entities/adjustment/adjustment-item.ts b/src/entities/adjustment/adjustment-item.ts index 44bb727..48ebad7 100644 --- a/src/entities/adjustment/adjustment-item.ts +++ b/src/entities/adjustment/adjustment-item.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentItemType } from '../../enums/index.js'; +import { type AdjustmentType } from '../../enums/index.js'; import { AdjustmentProration } from './adjustment-proration.js'; import { AdjustmentItemTotals } from './adjustment-item-totals.js'; import { type IAdjustmentItemResponse } from '../../types/index.js'; @@ -12,7 +12,7 @@ import { type IAdjustmentItemResponse } from '../../types/index.js'; export class AdjustmentItem { public readonly id: string; public readonly itemId: string; - public readonly type: AdjustmentItemType; + public readonly type: AdjustmentType; public readonly amount: string | null; public readonly proration: AdjustmentProration | null; public readonly totals: AdjustmentItemTotals | null; diff --git a/src/entities/adjustment/adjustment.ts b/src/entities/adjustment/adjustment.ts index 040e658..002736e 100644 --- a/src/entities/adjustment/adjustment.ts +++ b/src/entities/adjustment/adjustment.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentType, + type AdjustmentTransactionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -17,7 +17,7 @@ import { type IAdjustmentResponse } from '../../types/index.js'; export class Adjustment { public readonly id: string; public readonly action: AdjustmentAction; - public readonly type: AdjustmentType; + public readonly type: AdjustmentTransactionType; public readonly transactionId: string; public readonly subscriptionId: string | null; public readonly customerId: string; diff --git a/src/entities/subscription/next-transaction-adjustment-item.ts b/src/entities/subscription/next-transaction-adjustment-item.ts index e8655d1..68076b6 100644 --- a/src/entities/subscription/next-transaction-adjustment-item.ts +++ b/src/entities/subscription/next-transaction-adjustment-item.ts @@ -4,13 +4,13 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentItemType } from '../../enums/index.js'; +import { type AdjustmentType } from '../../enums/index.js'; import { AdjustmentItemTotals, AdjustmentProration } from '../adjustment/index.js'; import { type IAdjustmentItemResponse } from '../../types/index.js'; export class NextTransactionAdjustmentItem { public readonly itemId: string; - public readonly type: AdjustmentItemType; + public readonly type: AdjustmentType; public readonly amount: string | null; public readonly proration: AdjustmentProration | null; public readonly totals: AdjustmentItemTotals | null; diff --git a/src/entities/transaction/transaction-adjustment-item.ts b/src/entities/transaction/transaction-adjustment-item.ts index 60be1c0..95a7953 100644 --- a/src/entities/transaction/transaction-adjustment-item.ts +++ b/src/entities/transaction/transaction-adjustment-item.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentItemType } from '../../enums/index.js'; +import { type AdjustmentType } from '../../enums/index.js'; import { TransactionProration } from './transaction-proration.js'; import { AdjustmentItemTotals } from '../adjustment/index.js'; import { type ITransactionAdjustmentItemResponse } from '../../types/index.js'; @@ -12,7 +12,7 @@ import { type ITransactionAdjustmentItemResponse } from '../../types/index.js'; export class TransactionAdjustmentItem { public readonly id: string | null; public readonly itemId: string; - public readonly type: AdjustmentItemType; + public readonly type: AdjustmentType; public readonly amount: string | null; public readonly proration: TransactionProration | null; public readonly totals: AdjustmentItemTotals | null; diff --git a/src/enums/adjustment/adjustment-item-type.ts b/src/enums/adjustment/adjustment-item-type.ts index 5078a8c..7bfdeb1 100644 --- a/src/enums/adjustment/adjustment-item-type.ts +++ b/src/enums/adjustment/adjustment-item-type.ts @@ -4,4 +4,4 @@ * Changes may be overwritten as part of auto-generation. */ -export type AdjustmentItemType = 'full' | 'partial' | 'tax' | 'proration'; +export type AdjustmentType = 'full' | 'partial' | 'tax' | 'proration'; diff --git a/src/enums/adjustment/adjustment-type.ts b/src/enums/adjustment/adjustment-type.ts index 2374da0..8bb51f5 100644 --- a/src/enums/adjustment/adjustment-type.ts +++ b/src/enums/adjustment/adjustment-type.ts @@ -4,4 +4,4 @@ * Changes may be overwritten as part of auto-generation. */ -export type AdjustmentType = 'full' | 'partial'; +export type AdjustmentTransactionType = 'full' | 'partial'; diff --git a/src/notifications/entities/adjustment/adjustment-item-notification.ts b/src/notifications/entities/adjustment/adjustment-item-notification.ts index 7165a34..ab79f35 100644 --- a/src/notifications/entities/adjustment/adjustment-item-notification.ts +++ b/src/notifications/entities/adjustment/adjustment-item-notification.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentItemType } from '../../../enums/index.js'; +import { type AdjustmentType } from '../../../enums/index.js'; import { AdjustmentProrationNotification } from './adjustment-proration-notification.js'; import { AdjustmentItemTotalsNotification } from './adjustment-item-totals-notification.js'; import { type IAdjustmentItemNotificationResponse } from '../../types/index.js'; @@ -12,7 +12,7 @@ import { type IAdjustmentItemNotificationResponse } from '../../types/index.js'; export class AdjustmentItemNotification { public readonly id: string; public readonly itemId: string; - public readonly type: AdjustmentItemType; + public readonly type: AdjustmentType; public readonly amount: string | null; public readonly proration: AdjustmentProrationNotification | null; public readonly totals: AdjustmentItemTotalsNotification | null; diff --git a/src/notifications/entities/adjustment/adjustment-notification.ts b/src/notifications/entities/adjustment/adjustment-notification.ts index aee2d31..3a95655 100644 --- a/src/notifications/entities/adjustment/adjustment-notification.ts +++ b/src/notifications/entities/adjustment/adjustment-notification.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentType, + type AdjustmentTransactionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -17,7 +17,7 @@ import { type IAdjustmentNotificationResponse } from '../../types/index.js'; export class AdjustmentNotification { public readonly id: string; public readonly action: AdjustmentAction; - public readonly type: AdjustmentType; + public readonly type: AdjustmentTransactionType; public readonly transactionId: string; public readonly subscriptionId: string | null; public readonly customerId: string; diff --git a/src/notifications/types/adjustment/adjustment-item-notification-response.ts b/src/notifications/types/adjustment/adjustment-item-notification-response.ts index 45193e3..adf9662 100644 --- a/src/notifications/types/adjustment/adjustment-item-notification-response.ts +++ b/src/notifications/types/adjustment/adjustment-item-notification-response.ts @@ -5,13 +5,13 @@ */ import { type IAdjustmentsProrationNotificationResponse } from './adjustments-proration-notification-response.js'; -import { type AdjustmentItemType } from '../../../enums/index.js'; +import { type AdjustmentType } from '../../../enums/index.js'; import { type IAdjustmentItemTotalsNotificationResponse } from './adjustment-totals-notification-response.js'; export interface IAdjustmentItemNotificationResponse { id: string; item_id: string; - type: AdjustmentItemType; + type: AdjustmentType; amount?: string | null; proration?: IAdjustmentsProrationNotificationResponse | null; totals?: IAdjustmentItemTotalsNotificationResponse | null; diff --git a/src/notifications/types/adjustment/adjustment-notification-response.ts b/src/notifications/types/adjustment/adjustment-notification-response.ts index 82bffb2..001832a 100644 --- a/src/notifications/types/adjustment/adjustment-notification-response.ts +++ b/src/notifications/types/adjustment/adjustment-notification-response.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentType, + type AdjustmentTransactionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -19,7 +19,7 @@ import { export interface IAdjustmentNotificationResponse { id: string; action: AdjustmentAction; - type: AdjustmentType; + type: AdjustmentTransactionType; transaction_id: string; subscription_id?: string | null; customer_id: string; diff --git a/src/resources/adjustments/operations/create-adjustment-request-body.ts b/src/resources/adjustments/operations/create-adjustment-request-body.ts index 1fb57f4..c0c7c44 100644 --- a/src/resources/adjustments/operations/create-adjustment-request-body.ts +++ b/src/resources/adjustments/operations/create-adjustment-request-body.ts @@ -4,12 +4,12 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentAction, type AdjustmentItemType } from '../../../enums/index.js'; +import { type AdjustmentAction, type AdjustmentType } from '../../../enums/index.js'; export interface CreateAdjustmentLineItem { amount: string | null; itemId: string; - type: AdjustmentItemType; + type: AdjustmentType; } interface CreatePartialAdjustmentRequestBody { diff --git a/src/types/adjustment/adjustment-item-response.ts b/src/types/adjustment/adjustment-item-response.ts index 002ef30..70bf967 100644 --- a/src/types/adjustment/adjustment-item-response.ts +++ b/src/types/adjustment/adjustment-item-response.ts @@ -4,14 +4,14 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentItemType } from '../../enums/index.js'; +import { type AdjustmentType } from '../../enums/index.js'; import { type IAdjustmentsProrationResponse } from './adjustments-proration-response.js'; import { type IAdjustmentItemTotals } from '../shared/index.js'; export interface IAdjustmentItemResponse { id: string; item_id: string; - type: AdjustmentItemType; + type: AdjustmentType; amount?: string | null; proration?: IAdjustmentsProrationResponse | null; totals?: IAdjustmentItemTotals | null; diff --git a/src/types/adjustment/adjustment-response.ts b/src/types/adjustment/adjustment-response.ts index cab774b..2580ff4 100644 --- a/src/types/adjustment/adjustment-response.ts +++ b/src/types/adjustment/adjustment-response.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentType, + type AdjustmentTransactionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -16,7 +16,7 @@ import { type IPayoutTotalsAdjustmentResponse, type ITotalAdjustmentsResponse } export interface IAdjustmentResponse { id: string; action: AdjustmentAction; - type: AdjustmentType; + type: AdjustmentTransactionType; transaction_id: string; subscription_id?: string | null; customer_id: string; diff --git a/src/types/transaction/transaction-adjustment-item-response.ts b/src/types/transaction/transaction-adjustment-item-response.ts index 3c209b4..3a362c8 100644 --- a/src/types/transaction/transaction-adjustment-item-response.ts +++ b/src/types/transaction/transaction-adjustment-item-response.ts @@ -4,14 +4,14 @@ * Changes may be overwritten as part of auto-generation. */ -import { type AdjustmentItemType } from '../../enums/index.js'; +import { type AdjustmentType } from '../../enums/index.js'; import { type ITransactionProrationResponse } from './transaction-proration-response.js'; import { type IAdjustmentItemTotals } from '../shared/index.js'; export interface ITransactionAdjustmentItemResponse { id?: string | null; item_id: string; - type: AdjustmentItemType; + type: AdjustmentType; amount?: string | null; proration?: ITransactionProrationResponse | null; totals?: IAdjustmentItemTotals | null; From 7884120d36fa5143e065665150a99d8cd1574dd6 Mon Sep 17 00:00:00 2001 From: Dan Billson Date: Fri, 13 Dec 2024 14:13:11 +0000 Subject: [PATCH 5/6] chore: rename adjustment.type to be AdjustmentActionType --- src/entities/adjustment/adjustment.ts | 4 ++-- src/enums/adjustment/adjustment-type.ts | 2 +- .../entities/adjustment/adjustment-notification.ts | 4 ++-- .../types/adjustment/adjustment-notification-response.ts | 4 ++-- src/types/adjustment/adjustment-response.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/entities/adjustment/adjustment.ts b/src/entities/adjustment/adjustment.ts index 002736e..260f353 100644 --- a/src/entities/adjustment/adjustment.ts +++ b/src/entities/adjustment/adjustment.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentTransactionType, + type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -17,7 +17,7 @@ import { type IAdjustmentResponse } from '../../types/index.js'; export class Adjustment { public readonly id: string; public readonly action: AdjustmentAction; - public readonly type: AdjustmentTransactionType; + public readonly type: AdjustmentActionType; public readonly transactionId: string; public readonly subscriptionId: string | null; public readonly customerId: string; diff --git a/src/enums/adjustment/adjustment-type.ts b/src/enums/adjustment/adjustment-type.ts index 8bb51f5..032973c 100644 --- a/src/enums/adjustment/adjustment-type.ts +++ b/src/enums/adjustment/adjustment-type.ts @@ -4,4 +4,4 @@ * Changes may be overwritten as part of auto-generation. */ -export type AdjustmentTransactionType = 'full' | 'partial'; +export type AdjustmentActionType = 'full' | 'partial'; diff --git a/src/notifications/entities/adjustment/adjustment-notification.ts b/src/notifications/entities/adjustment/adjustment-notification.ts index 3a95655..4463c00 100644 --- a/src/notifications/entities/adjustment/adjustment-notification.ts +++ b/src/notifications/entities/adjustment/adjustment-notification.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentTransactionType, + type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -17,7 +17,7 @@ import { type IAdjustmentNotificationResponse } from '../../types/index.js'; export class AdjustmentNotification { public readonly id: string; public readonly action: AdjustmentAction; - public readonly type: AdjustmentTransactionType; + public readonly type: AdjustmentActionType; public readonly transactionId: string; public readonly subscriptionId: string | null; public readonly customerId: string; diff --git a/src/notifications/types/adjustment/adjustment-notification-response.ts b/src/notifications/types/adjustment/adjustment-notification-response.ts index 001832a..5e612a8 100644 --- a/src/notifications/types/adjustment/adjustment-notification-response.ts +++ b/src/notifications/types/adjustment/adjustment-notification-response.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentTransactionType, + type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -19,7 +19,7 @@ import { export interface IAdjustmentNotificationResponse { id: string; action: AdjustmentAction; - type: AdjustmentTransactionType; + type: AdjustmentActionType; transaction_id: string; subscription_id?: string | null; customer_id: string; diff --git a/src/types/adjustment/adjustment-response.ts b/src/types/adjustment/adjustment-response.ts index 2580ff4..80775d0 100644 --- a/src/types/adjustment/adjustment-response.ts +++ b/src/types/adjustment/adjustment-response.ts @@ -5,7 +5,7 @@ */ import { - type AdjustmentTransactionType, + type AdjustmentActionType, type AdjustmentAction, type AdjustmentStatus, type CurrencyCode, @@ -16,7 +16,7 @@ import { type IPayoutTotalsAdjustmentResponse, type ITotalAdjustmentsResponse } export interface IAdjustmentResponse { id: string; action: AdjustmentAction; - type: AdjustmentTransactionType; + type: AdjustmentActionType; transaction_id: string; subscription_id?: string | null; customer_id: string; From a98e0d23c525cde60b9c45114ed71618edb33ebb Mon Sep 17 00:00:00 2001 From: Dan Billson Date: Fri, 13 Dec 2024 15:55:48 +0000 Subject: [PATCH 6/6] chore: rename adjustment type filenames --- .../{adjustment-item-type.ts => adjustment-action-type.ts} | 2 +- src/enums/adjustment/adjustment-type.ts | 2 +- src/enums/adjustment/index.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/enums/adjustment/{adjustment-item-type.ts => adjustment-action-type.ts} (65%) diff --git a/src/enums/adjustment/adjustment-item-type.ts b/src/enums/adjustment/adjustment-action-type.ts similarity index 65% rename from src/enums/adjustment/adjustment-item-type.ts rename to src/enums/adjustment/adjustment-action-type.ts index 7bfdeb1..032973c 100644 --- a/src/enums/adjustment/adjustment-item-type.ts +++ b/src/enums/adjustment/adjustment-action-type.ts @@ -4,4 +4,4 @@ * Changes may be overwritten as part of auto-generation. */ -export type AdjustmentType = 'full' | 'partial' | 'tax' | 'proration'; +export type AdjustmentActionType = 'full' | 'partial'; diff --git a/src/enums/adjustment/adjustment-type.ts b/src/enums/adjustment/adjustment-type.ts index 032973c..7bfdeb1 100644 --- a/src/enums/adjustment/adjustment-type.ts +++ b/src/enums/adjustment/adjustment-type.ts @@ -4,4 +4,4 @@ * Changes may be overwritten as part of auto-generation. */ -export type AdjustmentActionType = 'full' | 'partial'; +export type AdjustmentType = 'full' | 'partial' | 'tax' | 'proration'; diff --git a/src/enums/adjustment/index.ts b/src/enums/adjustment/index.ts index 0cc3f78..8493e76 100644 --- a/src/enums/adjustment/index.ts +++ b/src/enums/adjustment/index.ts @@ -4,8 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ +export * from './adjustment-action-type.js'; export * from './adjustment-action.js'; export * from './adjustment-currency-code.js'; -export * from './adjustment-item-type.js'; export * from './adjustment-status.js'; export * from './adjustment-type.js';