diff --git a/CHANGELOG.md b/CHANGELOG.md index 199653f..c03ac3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 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. +## 0.5.0 - 2024-02-16 + +> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below. + +### Changed + +- We removed the shared entities between API and Notification as we foresee them diverging. No Action required for this change + ## 0.4.0 - 2024-02-14 ### Added diff --git a/package.json b/package.json index e81f5e4..5593dc7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@paddle/paddle-node-sdk", - "version": "0.4.0", + "version": "0.5.0", "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", diff --git a/src/__tests__/mocks/notifications/subscription-activated.mock.ts b/src/__tests__/mocks/notifications/subscription-activated.mock.ts index 595b165..c80c048 100644 --- a/src/__tests__/mocks/notifications/subscription-activated.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-activated.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionActivatedMock: IEventsResponse = { event_id: 'evt_01h7ht60mmw6d4sf4h38g3t4yq', @@ -109,15 +110,22 @@ export const SubscriptionActivatedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -134,15 +142,22 @@ export const SubscriptionActivatedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-canceled.mock.ts b/src/__tests__/mocks/notifications/subscription-canceled.mock.ts index e0038e9..1326232 100644 --- a/src/__tests__/mocks/notifications/subscription-canceled.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-canceled.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionCanceledMock: IEventsResponse = { event_id: 'evt_01h7jk37p1ezj1k5b4kt83t35j', @@ -124,15 +125,22 @@ export const SubscriptionCanceledMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -149,15 +157,22 @@ export const SubscriptionCanceledMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, @@ -174,15 +189,22 @@ export const SubscriptionCanceledMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01gsz95g2zrkagg294kpstx54r', productId: 'pro_01gsz92krfzy3hcx5h5rtgnfwz', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '30000', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-created.mock.ts b/src/__tests__/mocks/notifications/subscription-created.mock.ts index 1c05edd..bcec014 100644 --- a/src/__tests__/mocks/notifications/subscription-created.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-created.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionCreatedMock: IEventsResponse = { event_id: 'evt_01h7ht60jy5hpdv5x8tfsaxje4', @@ -109,15 +110,22 @@ export const SubscriptionCreatedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -134,15 +142,22 @@ export const SubscriptionCreatedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-imported.mock.ts b/src/__tests__/mocks/notifications/subscription-imported.mock.ts index 035b37d..3fdd9f5 100644 --- a/src/__tests__/mocks/notifications/subscription-imported.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-imported.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionImportedMock: IEventsResponse = { event_id: 'evt_01gxwxwnghn8xa7amfwqb0992q', @@ -124,15 +125,22 @@ export const SubscriptionImportedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3600', currencyCode: 'GBP', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -149,15 +157,22 @@ export const SubscriptionImportedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01gsz95g2zrkagg294kpstx54r', productId: 'pro_01gsz92krfzy3hcx5h5rtgnfwz', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '30000', currencyCode: 'GBP', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, @@ -171,15 +186,22 @@ export const SubscriptionImportedMockExpectation = { previouslyBilledAt: '2023-04-13T09:07:04.730931Z', price: { billingCycle: null, + customData: null, description: 'One-time charge', + importMeta: null, + name: null, id: 'pri_01gsz98e27ak2tyhexptwc58yk', productId: 'pro_01gsz97mq9pa4fkyy0wqenepkz', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '23880', currencyCode: 'GBP', }, + unitPriceOverrides: [], }, quantity: 1, recurring: false, diff --git a/src/__tests__/mocks/notifications/subscription-past-due.mock.ts b/src/__tests__/mocks/notifications/subscription-past-due.mock.ts index 2211c90..9fdb535 100644 --- a/src/__tests__/mocks/notifications/subscription-past-due.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-past-due.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionPastDueMock: IEventsResponse = { event_id: 'evt_01h7jagte1wnq80w5bw5gbmrwk', @@ -109,15 +110,22 @@ export const SubscriptionPastDueMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -134,15 +142,22 @@ export const SubscriptionPastDueMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-paused.mock.ts b/src/__tests__/mocks/notifications/subscription-paused.mock.ts index 173c928..3bc34f5 100644 --- a/src/__tests__/mocks/notifications/subscription-paused.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-paused.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionPausedMock: IEventsResponse = { event_id: 'evt_01h7jcst3syp03dk5f0m8h204f', @@ -106,15 +107,22 @@ export const SubscriptionPausedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -131,15 +139,22 @@ export const SubscriptionPausedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-resumed.mock.ts b/src/__tests__/mocks/notifications/subscription-resumed.mock.ts index 1972177..12c76a0 100644 --- a/src/__tests__/mocks/notifications/subscription-resumed.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-resumed.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionResumedMock: IEventsResponse = { event_id: 'evt_01h7je74dkvjc4b2pt8sgsfm7f', @@ -109,15 +110,22 @@ export const SubscriptionResumedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -134,15 +142,22 @@ export const SubscriptionResumedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-trialing.mock.ts b/src/__tests__/mocks/notifications/subscription-trialing.mock.ts index 05f556b..92f2972 100644 --- a/src/__tests__/mocks/notifications/subscription-trialing.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-trialing.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionTrialingMock: IEventsResponse = { event_id: 'evt_01h84cka4p40e737vm1ajb2bc5', @@ -90,18 +91,25 @@ export const SubscriptionTrialingMockExpectation = { frequency: 1, interval: 'year', }, + customData: null, description: 'Annual plan', + importMeta: null, + name: null, id: 'pri_01h84cdy3xatsp16afda2gekzy', productId: 'pro_01h84cd36f900f3wmpdfamgv8w', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: { frequency: 10, interval: 'day', }, + type: null, unitPrice: { amount: '0', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/subscription-updated.mock.ts b/src/__tests__/mocks/notifications/subscription-updated.mock.ts index 44fc216..8311fc7 100644 --- a/src/__tests__/mocks/notifications/subscription-updated.mock.ts +++ b/src/__tests__/mocks/notifications/subscription-updated.mock.ts @@ -4,7 +4,8 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ISubscriptionNotificationResponse } from '../../../notifications'; export const SubscriptionUpdatedMock: IEventsResponse = { event_id: 'evt_01h7j296f40h99m4dcrr6h4as8', @@ -109,15 +110,22 @@ export const SubscriptionUpdatedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (per seat)', id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + importMeta: null, + name: null, productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '3240', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 10, recurring: true, @@ -134,15 +142,22 @@ export const SubscriptionUpdatedMockExpectation = { frequency: 1, interval: 'month', }, + customData: null, description: 'Monthly (recurring addon)', + importMeta: null, + name: null, id: 'pri_01h1vjfevh5etwq3rb416a23h2', productId: 'pro_01h1vjes1y163xfj1rh1tkfb65', + quantity: null, + status: null, taxMode: 'account_setting', trialPeriod: null, + type: null, unitPrice: { amount: '10800', currencyCode: 'USD', }, + unitPriceOverrides: [], }, quantity: 1, recurring: true, diff --git a/src/__tests__/mocks/notifications/transaction-completed.mock.ts b/src/__tests__/mocks/notifications/transaction-completed.mock.ts index 97a66a7..1adce4b 100644 --- a/src/__tests__/mocks/notifications/transaction-completed.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-completed.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionCompletedMock: IEventsResponse = { +export const TransactionCompletedMock: IEventsResponse = { event_id: 'evt_01h8e1jxjnw9ra6zarhnz1a7y1', event_type: 'transaction.completed', occurred_at: '2023-08-22T07:15:45.366122Z', @@ -535,6 +536,7 @@ export const TransactionCompletedMockExpectation = { type: 'card', }, paymentAttemptId: '72d47ad6-d938-4e70-8743-b8678b4ae1b6', + paymentMethodId: null, status: 'captured', storedPaymentMethodId: '7330719b-627c-4bb2-9f83-f34d07ce7d2f', }, @@ -554,6 +556,7 @@ export const TransactionCompletedMockExpectation = { type: 'card', }, paymentAttemptId: '3e575fab-e1f2-4168-9ef7-3dd724f450a0', + paymentMethodId: null, status: 'error', storedPaymentMethodId: '6fd9d503-085a-4af1-a562-f05d7217cdd2', }, diff --git a/src/__tests__/mocks/notifications/transaction-paid.mock.ts b/src/__tests__/mocks/notifications/transaction-paid.mock.ts index bac5c77..a93014c 100644 --- a/src/__tests__/mocks/notifications/transaction-paid.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-paid.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionPaidMock: IEventsResponse = { +export const TransactionPaidMock: IEventsResponse = { data: { id: 'txn_01gxwxqj0rd5m8j1zdhvk05twz', items: [ @@ -450,6 +451,7 @@ export const TransactionPaidMockExpectation = { type: 'card', }, paymentAttemptId: '44d59371-1d3b-4053-8631-7d02be0d1093', + paymentMethodId: null, status: 'captured', storedPaymentMethodId: 'a52e8eff-2a4d-4928-b7c7-980411fd8802', }, diff --git a/src/__tests__/mocks/notifications/transaction-past-due.mock.ts b/src/__tests__/mocks/notifications/transaction-past-due.mock.ts index 036159f..15b2cec 100644 --- a/src/__tests__/mocks/notifications/transaction-past-due.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-past-due.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionPastDueMock: IEventsResponse = { +export const TransactionPastDueMock: IEventsResponse = { event_id: 'evt_01h8e2sys80rn6y8xz31mstgt9', event_type: 'transaction.past_due', occurred_at: '2023-08-22T07:37:04.552638Z', @@ -379,6 +380,7 @@ export const TransactionPastDueMockExpectation = { type: 'card', }, paymentAttemptId: 'b9032892-96e8-4658-a822-c8177c94147e', + paymentMethodId: null, status: 'error', storedPaymentMethodId: '37bb3dd6-aba6-4eb4-8bf0-e1079a3df543', }, diff --git a/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts b/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts index 477119c..51fe703 100644 --- a/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-payment-failed.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionPaymentFailedMock: IEventsResponse = { +export const TransactionPaymentFailedMock: IEventsResponse = { event_id: 'evt_01h8e1exw67n96j6n0h3k2qq5x', event_type: 'transaction.payment_failed', occurred_at: '2023-08-22T07:13:34.599095Z', @@ -480,6 +481,7 @@ export const TransactionPaymentFailedMockExpectation = { type: 'card', }, paymentAttemptId: '3e575fab-e1f2-4168-9ef7-3dd724f450a0', + paymentMethodId: null, status: 'error', storedPaymentMethodId: '6fd9d503-085a-4af1-a562-f05d7217cdd2', }, diff --git a/src/__tests__/mocks/notifications/transaction-ready.mock.ts b/src/__tests__/mocks/notifications/transaction-ready.mock.ts index 3bee5d6..f3ab6f9 100644 --- a/src/__tests__/mocks/notifications/transaction-ready.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-ready.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionReadyMock: IEventsResponse = { +export const TransactionReadyMock: IEventsResponse = { event_id: 'evt_01h8e18cwy7atj440tjms1k8dk', event_type: 'transaction.ready', occurred_at: '2023-08-22T07:10:00.607018Z', diff --git a/src/__tests__/mocks/notifications/transaction-updated.mock.ts b/src/__tests__/mocks/notifications/transaction-updated.mock.ts index 52082bf..3d382b6 100644 --- a/src/__tests__/mocks/notifications/transaction-updated.mock.ts +++ b/src/__tests__/mocks/notifications/transaction-updated.mock.ts @@ -4,9 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { ITransactionNotificationResponse } from '../../../notifications'; -export const TransactionUpdatedMock: IEventsResponse = { +export const TransactionUpdatedMock: IEventsResponse = { event_id: 'evt_01h8e43a7vf4qxy0waredf267h', event_type: 'transaction.updated', occurred_at: '2023-08-22T07:59:39.771451Z', diff --git a/src/__tests__/mocks/resources/subscriptions.mock.ts b/src/__tests__/mocks/resources/subscriptions.mock.ts index 63a78c5..c7bd0d0 100644 --- a/src/__tests__/mocks/resources/subscriptions.mock.ts +++ b/src/__tests__/mocks/resources/subscriptions.mock.ts @@ -121,13 +121,38 @@ export const SubscriptionMock: ISubscriptionResponse = { next_billed_at: '2024-10-12T07:20:50.52Z', trial_dates: { starts_at: '2024-10-12T07:20:50.52Z', ends_at: '2024-10-12T07:20:50.52Z' }, price: { - id: 'pri_01gsz8z1q1n00f12qt82y31smh', - product_id: 'pro_01gsz97mq9pa4fkyy0wqenepkz', - description: 'utor uredo varius tricesimus ago tricesimus adflicto certe assentator adulatio', - billing_cycle: { interval: 'day', frequency: 10 }, - trial_period: { interval: 'day', frequency: 10 }, + id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + product_id: 'pro_01gsz4t5hdjse780zja8vvr7jg', + type: 'standard', + description: 'Monthly (per seat)', + name: 'Monthly (per seat)', tax_mode: 'account_setting', - unit_price: { amount: '1000', currency_code: 'USD' }, + billing_cycle: { + frequency: 1, + interval: 'month', + }, + trial_period: null, + unit_price: { + amount: '3000', + currency_code: 'USD', + }, + unit_price_overrides: [], + custom_data: { + features: { + crm: true, + data_retention: false, + reports: true, + }, + suggested_addons: ['pro_01h1vjes1y163xfj1rh1tkfb65', 'pro_01gsz97mq9pa4fkyy0wqenepkz'], + upgrade_description: + "Move from Basic to Pro to take advantage of advanced reporting and a CRM that's right where you're chatting.", + }, + status: 'active', + quantity: { + minimum: 1, + maximum: 999, + }, + import_meta: null, }, }, ], @@ -330,13 +355,38 @@ export const SubscriptionPreviewMock: ISubscriptionPreviewResponse = { next_billed_at: '2024-10-12T07:20:50.52Z', trial_dates: { starts_at: '2024-10-12T07:20:50.52Z', ends_at: '2024-10-12T07:20:50.52Z' }, price: { - id: 'pri_01gsz8z1q1n00f12qt82y31smh', - product_id: 'pro_01gsz97mq9pa4fkyy0wqenepkz', - description: 'utor uredo varius tricesimus ago tricesimus adflicto certe assentator adulatio', - billing_cycle: { interval: 'day', frequency: 10 }, - trial_period: { interval: 'day', frequency: 10 }, + id: 'pri_01gsz8x8sawmvhz1pv30nge1ke', + product_id: 'pro_01gsz4t5hdjse780zja8vvr7jg', + type: 'standard', + description: 'Monthly (per seat)', + name: 'Monthly (per seat)', tax_mode: 'account_setting', - unit_price: { amount: '1000', currency_code: 'USD' }, + billing_cycle: { + frequency: 1, + interval: 'month', + }, + trial_period: null, + unit_price: { + amount: '3000', + currency_code: 'USD', + }, + unit_price_overrides: [], + custom_data: { + features: { + crm: true, + data_retention: false, + reports: true, + }, + suggested_addons: ['pro_01h1vjes1y163xfj1rh1tkfb65', 'pro_01gsz97mq9pa4fkyy0wqenepkz'], + upgrade_description: + "Move from Basic to Pro to take advantage of advanced reporting and a CRM that's right where you're chatting.", + }, + status: 'active', + quantity: { + minimum: 1, + maximum: 999, + }, + import_meta: null, }, }, ], diff --git a/src/__tests__/mocks/resources/transactions.mock.ts b/src/__tests__/mocks/resources/transactions.mock.ts index 156ef57..fe47d85 100644 --- a/src/__tests__/mocks/resources/transactions.mock.ts +++ b/src/__tests__/mocks/resources/transactions.mock.ts @@ -238,6 +238,7 @@ export const TransactionMock: ITransactionResponse = { payments: [ { payment_attempt_id: '497f776b-851d-4ebf-89ab-8ba0f75d2d6a', + payment_method_id: 'paymtd_01gxwxw8xgmqqzs4vecthdb50f', stored_payment_method_id: '7636e781-3969-49f4-9c77-8226232e28a6', amount: '1050', status: 'authorized', diff --git a/src/entities/price/price.ts b/src/entities/price/price.ts index 8c1d173..fb5f2fa 100644 --- a/src/entities/price/price.ts +++ b/src/entities/price/price.ts @@ -4,40 +4,40 @@ * Changes may be overwritten as part of auto-generation. */ -import { type ICustomData, type ISharedPriceResponse } from '../../types'; -import { TimePeriod, Money, UnitPriceOverride, PriceQuantity, ImportMeta } from '../index'; -import { type TaxMode, type Status, type CatalogType } from '../../enums'; +import { type ICustomData, type IPriceResponse } from '../../types'; +import { ImportMeta, Money, PriceQuantity, TimePeriod, UnitPriceOverride } from '../index'; +import { type CatalogType, type Status, type TaxMode } from '../../enums'; export class Price { public readonly id: string; public readonly productId: string; public readonly description: string; public readonly name: string | null; - public readonly type: CatalogType | null; + public readonly type: CatalogType; public readonly billingCycle: TimePeriod | null; public readonly trialPeriod: TimePeriod | null; public readonly taxMode: TaxMode; - public readonly unitPrice: Money | null; - public readonly unitPriceOverrides: UnitPriceOverride[] | null; - public readonly quantity: PriceQuantity | null; + public readonly unitPrice: Money; + public readonly unitPriceOverrides: UnitPriceOverride[]; + public readonly quantity: PriceQuantity; public readonly status: Status; public readonly customData: ICustomData | null; public readonly importMeta: ImportMeta | null; - constructor(price: ISharedPriceResponse) { + constructor(price: IPriceResponse) { this.id = price.id; this.productId = price.product_id; this.description = price.description; - this.type = price.type ?? null; + this.type = price.type; this.name = price.name ? price.name : null; this.billingCycle = price.billing_cycle ? new TimePeriod(price.billing_cycle) : null; this.trialPeriod = price.trial_period ? new TimePeriod(price.trial_period) : null; this.taxMode = price.tax_mode; - this.unitPrice = price.unit_price ? new Money(price.unit_price) : null; - this.unitPriceOverrides = price.unit_price_overrides - ? price.unit_price_overrides?.map((unit_price_override) => new UnitPriceOverride(unit_price_override)) - : null; - this.quantity = price.quantity ? new PriceQuantity(price.quantity) : null; + this.unitPrice = new Money(price.unit_price); + 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.customData = price.custom_data ? price.custom_data : null; this.importMeta = price.import_meta ? new ImportMeta(price.import_meta) : null; diff --git a/src/entities/pricing-preview/pricing-preview.ts b/src/entities/pricing-preview/pricing-preview.ts index 6c906b8..06dbe48 100644 --- a/src/entities/pricing-preview/pricing-preview.ts +++ b/src/entities/pricing-preview/pricing-preview.ts @@ -4,11 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type CurrencyCode } from '../../enums'; +import { type CurrencyCode, type AvailablePaymentMethod } from '../../enums'; import { type IPricingPreviewResponse } from '../../types'; import { AddressPreview } from '../transaction'; import { PricingPreviewDetails } from './pricing-preview-details'; -import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods'; export class PricingPreview { public readonly customerId: string | null; diff --git a/src/entities/subscription/index.ts b/src/entities/subscription/index.ts index 433e551..b762763 100644 --- a/src/entities/subscription/index.ts +++ b/src/entities/subscription/index.ts @@ -8,7 +8,6 @@ export * from './subscription-discount'; export * from './subscription-time-period'; export * from './subscription-scheduled-change'; export * from './subscription-management'; -export * from './subscription-price'; export * from './subscription-item'; export * from './subscription'; export * from './subscription-collection'; @@ -21,4 +20,3 @@ export * from './subscription-preview-update-summary'; export * from './subscription-preview-summary-result'; export * from './next-transaction-adjustment-preview'; export * from './next-transaction-adjustment-item'; -export * from './subscription-notification'; diff --git a/src/entities/subscription/subscription-item.ts b/src/entities/subscription/subscription-item.ts index b7326ee..d7bc818 100644 --- a/src/entities/subscription/subscription-item.ts +++ b/src/entities/subscription/subscription-item.ts @@ -5,7 +5,7 @@ */ import { type ISubscriptionItemResponse } from '../../types'; -import { SubscriptionPrice, SubscriptionTimePeriod } from '../index'; +import { Price, SubscriptionTimePeriod } from '../index'; import { type SubscriptionItemStatus } from '../../enums'; export class SubscriptionItem { @@ -17,7 +17,7 @@ export class SubscriptionItem { public readonly previouslyBilledAt: string | null; public readonly nextBilledAt: string | null; public readonly trialDates: SubscriptionTimePeriod | null; - public readonly price: SubscriptionPrice | null; + public readonly price: Price | null; constructor(subscriptionItem: ISubscriptionItemResponse) { this.status = subscriptionItem.status; @@ -28,6 +28,6 @@ export class SubscriptionItem { this.previouslyBilledAt = subscriptionItem.previously_billed_at ? subscriptionItem.previously_billed_at : null; this.nextBilledAt = subscriptionItem.next_billed_at ? subscriptionItem.next_billed_at : null; this.trialDates = subscriptionItem.trial_dates ? new SubscriptionTimePeriod(subscriptionItem.trial_dates) : null; - this.price = subscriptionItem.price ? new SubscriptionPrice(subscriptionItem.price) : null; + this.price = subscriptionItem.price ? new Price(subscriptionItem.price) : null; } } diff --git a/src/entities/subscription/subscription-price.ts b/src/entities/subscription/subscription-price.ts deleted file mode 100644 index 9fad082..0000000 --- a/src/entities/subscription/subscription-price.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * ! Autogenerated code ! - * Do not make changes to this file. - * Changes may be overwritten as part of auto-generation. - */ - -import { type ISubscriptionPriceResponse } from '../../types'; -import { TimePeriod, Money } from '../index'; -import { type TaxMode } from '../../enums'; - -export class SubscriptionPrice { - public readonly id: string; - public readonly description: string; - public readonly productId: string; - public readonly billingCycle: TimePeriod | null; - public readonly trialPeriod: TimePeriod | null; - public readonly taxMode: TaxMode; - public readonly unitPrice: Money; - - constructor(subscriptionPrice: ISubscriptionPriceResponse) { - this.id = subscriptionPrice.id; - this.description = subscriptionPrice.description; - this.productId = subscriptionPrice.product_id; - this.billingCycle = subscriptionPrice.billing_cycle ? new TimePeriod(subscriptionPrice.billing_cycle) : null; - this.trialPeriod = subscriptionPrice.trial_period ? new TimePeriod(subscriptionPrice.trial_period) : null; - this.taxMode = subscriptionPrice.tax_mode; - this.unitPrice = new Money(subscriptionPrice.unit_price); - } -} diff --git a/src/entities/transaction/transaction-includes.ts b/src/entities/transaction/transaction-includes.ts index 5b74b86..79948bb 100644 --- a/src/entities/transaction/transaction-includes.ts +++ b/src/entities/transaction/transaction-includes.ts @@ -20,8 +20,13 @@ import { TransactionPaymentAttempt, TransactionsTimePeriod, } from '../index'; -import { type CollectionMode, type CurrencyCode, type TransactionStatus, type TransactionOrigin } from '../../enums'; -import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods'; +import { + type CollectionMode, + type CurrencyCode, + type TransactionStatus, + type TransactionOrigin, + type AvailablePaymentMethod, +} from '../../enums'; export class TransactionIncludes { public readonly id: string; diff --git a/src/entities/transaction/transaction-preview.ts b/src/entities/transaction/transaction-preview.ts index e0a40b2..95a7029 100644 --- a/src/entities/transaction/transaction-preview.ts +++ b/src/entities/transaction/transaction-preview.ts @@ -6,8 +6,7 @@ import { type ITransactionPreviewResponse } from '../../types'; import { AddressPreview, TransactionDetailsPreview, TransactionItemPreview } from '../index'; -import { type CurrencyCode } from '../../enums'; -import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods'; +import { type CurrencyCode, type AvailablePaymentMethod } from '../../enums'; export class TransactionPreview { public readonly customerId: string | null; diff --git a/src/enums/shared/index.ts b/src/enums/shared/index.ts index 151dcb7..b73ea8e 100644 --- a/src/enums/shared/index.ts +++ b/src/enums/shared/index.ts @@ -18,3 +18,4 @@ export * from './payment-attempt-status'; export * from './error-code'; export * from './payment-type'; export * from './catalog-type'; +export * from './available-payment-methods'; diff --git a/src/notifications/entities/address/address-notification.ts b/src/notifications/entities/address/address-notification.ts new file mode 100644 index 0000000..f26fc80 --- /dev/null +++ b/src/notifications/entities/address/address-notification.ts @@ -0,0 +1,40 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ +import { type CountryCode, type Status } from '../../../enums'; +import { type CustomData, ImportMeta } from '../../../entities'; +import { type IAddressNotificationResponse } from '../../types'; + +export class AddressNotification { + public readonly id: string; + public readonly description: string | null; + public readonly firstLine: string | null; + public readonly secondLine: string | null; + public readonly city: string | null; + public readonly postalCode: string | null; + public readonly region: string | null; + public readonly countryCode: CountryCode; + public readonly customData: CustomData | null; + public readonly status: Status; + public readonly createdAt: string; + public readonly updatedAt: string; + public readonly importMeta: ImportMeta | null; + + constructor(address: IAddressNotificationResponse) { + this.id = address.id; + this.description = address.description ? address.description : null; + this.firstLine = address.first_line ? address.first_line : null; + this.secondLine = address.second_line ? address.second_line : null; + this.city = address.city ? address.city : null; + this.postalCode = address.postal_code ? address.postal_code : null; + this.region = address.region ? address.region : null; + this.countryCode = address.country_code; + this.customData = address.custom_data ? address.custom_data : null; + this.status = address.status; + this.createdAt = address.created_at; + this.updatedAt = address.updated_at; + this.importMeta = address.import_meta ? new ImportMeta(address.import_meta) : null; + } +} diff --git a/src/notifications/entities/address/index.ts b/src/notifications/entities/address/index.ts new file mode 100644 index 0000000..528f0db --- /dev/null +++ b/src/notifications/entities/address/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './address-notification'; diff --git a/src/notifications/entities/adjustment/adjustment-item-notification.ts b/src/notifications/entities/adjustment/adjustment-item-notification.ts new file mode 100644 index 0000000..c09bf6e --- /dev/null +++ b/src/notifications/entities/adjustment/adjustment-item-notification.ts @@ -0,0 +1,27 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentItemNotificationResponse } from '../../types'; +import { AdjustmentItemTotalsNotification, AdjustmentProrationNotification } from '../index'; +import { type AdjustmentType } from '../../../enums'; + +export class AdjustmentItemNotification { + public readonly id: string; + public readonly itemId: string; + public readonly type: AdjustmentType; + public readonly amount: string | null; + public readonly proration: AdjustmentProrationNotification | null; + public readonly totals: AdjustmentItemTotalsNotification | null; + + constructor(adjustmentItem: IAdjustmentItemNotificationResponse) { + this.id = adjustmentItem.id; + this.itemId = adjustmentItem.item_id; + this.type = adjustmentItem.type; + this.amount = adjustmentItem.amount ? adjustmentItem.amount : null; + this.proration = adjustmentItem.proration ? new AdjustmentProrationNotification(adjustmentItem.proration) : null; + this.totals = adjustmentItem.totals ? new AdjustmentItemTotalsNotification(adjustmentItem.totals) : null; + } +} diff --git a/src/notifications/entities/adjustment/adjustment-item-totals-notification.ts b/src/notifications/entities/adjustment/adjustment-item-totals-notification.ts new file mode 100644 index 0000000..40623a4 --- /dev/null +++ b/src/notifications/entities/adjustment/adjustment-item-totals-notification.ts @@ -0,0 +1,19 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentItemTotalsNotificationResponse } from '../../types'; + +export class AdjustmentItemTotalsNotification { + public readonly subtotal: string; + public readonly tax: string; + public readonly total: string; + + constructor(adjustmentItemTotals: IAdjustmentItemTotalsNotificationResponse) { + this.subtotal = adjustmentItemTotals.subtotal; + this.tax = adjustmentItemTotals.tax; + this.total = adjustmentItemTotals.total; + } +} diff --git a/src/notifications/entities/adjustment/adjustment-notification.ts b/src/notifications/entities/adjustment/adjustment-notification.ts new file mode 100644 index 0000000..91997eb --- /dev/null +++ b/src/notifications/entities/adjustment/adjustment-notification.ts @@ -0,0 +1,45 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { AdjustmentItemNotification, PayoutTotalsAdjustmentNotification, TotalAdjustmentsNotification } from '../index'; +import { type AdjustmentAction, type AdjustmentStatus, type CurrencyCode } from '../../../enums'; +import { type IAdjustmentNotificationResponse } from '../../types'; + +export class AdjustmentNotification { + public readonly id: string; + public readonly action: AdjustmentAction; + public readonly transactionId: string; + public readonly subscriptionId: string | null; + public readonly customerId: string; + public readonly reason: string; + public readonly creditAppliedToBalance: boolean; + public readonly currencyCode: CurrencyCode; + public readonly status: AdjustmentStatus; + public readonly items: AdjustmentItemNotification[]; + public readonly totals: TotalAdjustmentsNotification; + public readonly payoutTotals: PayoutTotalsAdjustmentNotification | null; + public readonly createdAt: string; + public readonly updatedAt: string; + + constructor(adjustment: IAdjustmentNotificationResponse) { + this.id = adjustment.id; + this.action = adjustment.action; + this.transactionId = adjustment.transaction_id; + this.subscriptionId = adjustment.subscription_id ? adjustment.subscription_id : null; + this.customerId = adjustment.customer_id; + this.reason = adjustment.reason; + this.creditAppliedToBalance = adjustment.credit_applied_to_balance; + this.currencyCode = adjustment.currency_code; + this.status = adjustment.status; + this.items = adjustment.items.map((item) => new AdjustmentItemNotification(item)); + this.totals = new TotalAdjustmentsNotification(adjustment.totals); + this.payoutTotals = adjustment.payout_totals + ? new PayoutTotalsAdjustmentNotification(adjustment.payout_totals) + : null; + this.createdAt = adjustment.created_at; + this.updatedAt = adjustment.updated_at; + } +} diff --git a/src/notifications/entities/adjustment/adjustment-proration-notification.ts b/src/notifications/entities/adjustment/adjustment-proration-notification.ts new file mode 100644 index 0000000..43b511b --- /dev/null +++ b/src/notifications/entities/adjustment/adjustment-proration-notification.ts @@ -0,0 +1,20 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentsProrationNotificationResponse } from '../../types'; +import { AdjustmentTimePeriodNotification } from '../index'; + +export class AdjustmentProrationNotification { + public readonly rate: string; + public readonly billingPeriod: AdjustmentTimePeriodNotification | null; + + constructor(adjustmentsProration: IAdjustmentsProrationNotificationResponse) { + this.rate = adjustmentsProration.rate; + this.billingPeriod = adjustmentsProration.billing_period + ? new AdjustmentTimePeriodNotification(adjustmentsProration.billing_period) + : null; + } +} diff --git a/src/notifications/entities/adjustment/adjustment-time-period-notification.ts b/src/notifications/entities/adjustment/adjustment-time-period-notification.ts new file mode 100644 index 0000000..9e6fe51 --- /dev/null +++ b/src/notifications/entities/adjustment/adjustment-time-period-notification.ts @@ -0,0 +1,17 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentsTimePeriodNotificationResponse } from '../../types'; + +export class AdjustmentTimePeriodNotification { + public readonly startsAt: string; + public readonly endsAt: string; + + constructor(adjustmentsTimePeriod: IAdjustmentsTimePeriodNotificationResponse) { + this.startsAt = adjustmentsTimePeriod.starts_at; + this.endsAt = adjustmentsTimePeriod.ends_at; + } +} diff --git a/src/notifications/entities/adjustment/index.ts b/src/notifications/entities/adjustment/index.ts new file mode 100644 index 0000000..fe586e3 --- /dev/null +++ b/src/notifications/entities/adjustment/index.ts @@ -0,0 +1,11 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './adjustment-time-period-notification'; +export * from './adjustment-proration-notification'; +export * from './adjustment-item-notification'; +export * from './adjustment-item-totals-notification'; +export * from './adjustment-notification'; diff --git a/src/notifications/entities/business/business-notification.ts b/src/notifications/entities/business/business-notification.ts new file mode 100644 index 0000000..a1c8d1d --- /dev/null +++ b/src/notifications/entities/business/business-notification.ts @@ -0,0 +1,36 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { ContactsNotification, ImportMetaNotification } from '../index'; +import { type Status } from '../../../enums'; +import { type IBusinessNotificationResponse } from '../../types'; +import { type CustomData } from '../../../entities'; + +export class BusinessNotification { + public readonly id: string; + public readonly name: string; + public readonly companyNumber: string | null; + public readonly taxIdentifier: string | null; + public readonly status: Status; + public readonly contacts: ContactsNotification[] | null; + public readonly createdAt: string; + public readonly updatedAt: string; + public readonly customData: CustomData | null; + public readonly importMeta: ImportMetaNotification | null; + + constructor(business: IBusinessNotificationResponse) { + this.id = business.id; + this.name = business.name; + this.companyNumber = business.company_number ? business.company_number : null; + this.taxIdentifier = business.tax_identifier ? business.tax_identifier : null; + this.status = business.status; + this.contacts = business.contacts ? business.contacts.map((contact) => new ContactsNotification(contact)) : null; + this.createdAt = business.created_at; + this.updatedAt = business.updated_at; + this.customData = business.custom_data ? business.custom_data : null; + this.importMeta = business.import_meta ? new ImportMetaNotification(business.import_meta) : null; + } +} diff --git a/src/notifications/entities/business/contacts-notification.ts b/src/notifications/entities/business/contacts-notification.ts new file mode 100644 index 0000000..2ff33d9 --- /dev/null +++ b/src/notifications/entities/business/contacts-notification.ts @@ -0,0 +1,16 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ +import { type IBusinessContactsNotification } from '../../types'; + +export class ContactsNotification { + public readonly name: string | null; + public readonly email: string; + + constructor(contacts: IBusinessContactsNotification) { + this.name = contacts.name ? contacts.name : null; + this.email = contacts.email; + } +} diff --git a/src/notifications/entities/business/index.ts b/src/notifications/entities/business/index.ts new file mode 100644 index 0000000..75156e4 --- /dev/null +++ b/src/notifications/entities/business/index.ts @@ -0,0 +1,8 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './contacts-notification'; +export * from './business-notification'; diff --git a/src/notifications/entities/customer/customer-notification.ts b/src/notifications/entities/customer/customer-notification.ts new file mode 100644 index 0000000..fbb113d --- /dev/null +++ b/src/notifications/entities/customer/customer-notification.ts @@ -0,0 +1,36 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { ImportMetaNotification } from '../index'; +import { type Status } from '../../../enums'; +import { type ICustomerNotificationResponse } from '../../types'; +import { type CustomData } from '../../../entities'; + +export class CustomerNotification { + public readonly id: string; + public readonly name: string | null; + public readonly email: string; + public readonly marketingConsent: boolean; + public readonly status: Status; + public readonly customData: CustomData | null; + public readonly locale: string; + public readonly createdAt: string; + public readonly updatedAt: string; + public readonly importMeta: ImportMetaNotification | null; + + constructor(customer: ICustomerNotificationResponse) { + this.id = customer.id; + this.name = customer.name ? customer.name : null; + this.email = customer.email; + this.marketingConsent = customer.marketing_consent; + this.status = customer.status; + this.customData = customer.custom_data ? customer.custom_data : null; + this.locale = customer.locale; + this.createdAt = customer.created_at; + this.updatedAt = customer.updated_at; + this.importMeta = customer.import_meta ? new ImportMetaNotification(customer.import_meta) : null; + } +} diff --git a/src/notifications/entities/customer/index.ts b/src/notifications/entities/customer/index.ts new file mode 100644 index 0000000..a0639cc --- /dev/null +++ b/src/notifications/entities/customer/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './customer-notification'; diff --git a/src/notifications/entities/discount/discount-notification.ts b/src/notifications/entities/discount/discount-notification.ts new file mode 100644 index 0000000..b8afadc --- /dev/null +++ b/src/notifications/entities/discount/discount-notification.ts @@ -0,0 +1,52 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type CurrencyCode, type DiscountStatus, type DiscountType } from '../../../enums'; +import { type IDiscountNotificationResponse } from '../../types'; +import { ImportMetaNotification } from '../index'; +import { type CustomData } from '../../../entities'; + +export class DiscountNotification { + public readonly id: string; + public readonly status: DiscountStatus; + public readonly description: string; + public readonly enabledForCheckout: boolean; + public readonly code: string | null; + public readonly type: DiscountType; + public readonly amount: string; + public readonly currencyCode: CurrencyCode | null; + public readonly recur: boolean; + public readonly maximumRecurringIntervals: number | null; + public readonly usageLimit: number | null; + public readonly restrictTo: string[] | null; + public readonly expiresAt: string | null; + public readonly customData: CustomData | null; + public readonly timesUsed: number | null; + public readonly createdAt: string; + public readonly updatedAt: string; + public readonly importMeta: ImportMetaNotification | null; + + constructor(discount: IDiscountNotificationResponse) { + this.id = discount.id; + this.status = discount.status; + this.description = discount.description; + this.enabledForCheckout = discount.enabled_for_checkout; + this.code = discount.code ? discount.code : null; + this.type = discount.type; + this.amount = discount.amount; + this.currencyCode = discount.currency_code ? discount.currency_code : null; + this.recur = discount.recur; + this.maximumRecurringIntervals = discount.maximum_recurring_intervals ? discount.maximum_recurring_intervals : null; + this.usageLimit = discount.usage_limit ? discount.usage_limit : null; + this.restrictTo = discount.restrict_to ? discount.restrict_to : null; + this.expiresAt = discount.expires_at ? discount.expires_at : null; + this.customData = discount.custom_data ? discount.custom_data : null; + this.timesUsed = discount.times_used ?? null; + this.createdAt = discount.created_at; + this.updatedAt = discount.updated_at; + this.importMeta = discount.import_meta ? new ImportMetaNotification(discount.import_meta) : null; + } +} diff --git a/src/notifications/entities/discount/index.ts b/src/notifications/entities/discount/index.ts new file mode 100644 index 0000000..f68de53 --- /dev/null +++ b/src/notifications/entities/discount/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './discount-notification'; diff --git a/src/notifications/entities/index.ts b/src/notifications/entities/index.ts new file mode 100644 index 0000000..d9837b8 --- /dev/null +++ b/src/notifications/entities/index.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './product'; +export * from './price'; +export * from './transaction'; +export * from './adjustment'; +export * from './customer'; +export * from './business'; +export * from './subscription'; +export * from './address'; +export * from './discount'; +export * from './payout'; +export * from './report'; +export * from './shared'; diff --git a/src/notifications/entities/payout/index.ts b/src/notifications/entities/payout/index.ts new file mode 100644 index 0000000..ccb0bbe --- /dev/null +++ b/src/notifications/entities/payout/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './payout-notification'; diff --git a/src/notifications/entities/payout/payout-notification.ts b/src/notifications/entities/payout/payout-notification.ts new file mode 100644 index 0000000..9d17055 --- /dev/null +++ b/src/notifications/entities/payout/payout-notification.ts @@ -0,0 +1,22 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPayoutNotificationResponse } from '../../types'; +import { type CurrencyCode, type PayoutStatus } from '../../../enums'; + +export class PayoutNotification { + public readonly id: string; + public readonly status: PayoutStatus; + public readonly amount: string; + public readonly currencyCode: CurrencyCode; + + constructor(payout: IPayoutNotificationResponse) { + this.id = payout.id; + this.status = payout.status; + this.amount = payout.amount; + this.currencyCode = payout.currency_code; + } +} diff --git a/src/notifications/entities/price/index.ts b/src/notifications/entities/price/index.ts new file mode 100644 index 0000000..bf5638e --- /dev/null +++ b/src/notifications/entities/price/index.ts @@ -0,0 +1,8 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './price-quantity-notification'; +export * from './price-notification'; diff --git a/src/notifications/entities/price/price-notification.ts b/src/notifications/entities/price/price-notification.ts new file mode 100644 index 0000000..d931fda --- /dev/null +++ b/src/notifications/entities/price/price-notification.ts @@ -0,0 +1,52 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPriceNotificationResponse } from '../../types'; +import { + ImportMetaNotification, + MoneyNotification, + PriceQuantityNotification, + TimePeriodNotification, + UnitPriceOverrideNotification, +} from '../index'; +import { type CatalogType, type Status, type TaxMode } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export class PriceNotification { + public readonly id: string; + public readonly productId: string; + public readonly description: string; + public readonly name: string | null; + public readonly type: CatalogType | null; + public readonly billingCycle: TimePeriodNotification | null; + public readonly trialPeriod: TimePeriodNotification | null; + public readonly taxMode: TaxMode; + public readonly unitPrice: MoneyNotification; + public readonly unitPriceOverrides: UnitPriceOverrideNotification[]; + public readonly quantity: PriceQuantityNotification; + public readonly status: Status; + public readonly customData: ICustomData | null; + public readonly importMeta: ImportMetaNotification | null; + + constructor(price: IPriceNotificationResponse) { + this.id = price.id; + this.productId = price.product_id; + this.description = price.description; + this.type = price.type ? price.type : null; + this.name = price.name ? price.name : null; + this.billingCycle = price.billing_cycle ? new TimePeriodNotification(price.billing_cycle) : null; + 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.quantity = new PriceQuantityNotification(price.quantity); + this.status = price.status; + this.customData = price.custom_data ? price.custom_data : null; + this.importMeta = price.import_meta ? new ImportMetaNotification(price.import_meta) : null; + } +} diff --git a/src/notifications/entities/price/price-quantity-notification.ts b/src/notifications/entities/price/price-quantity-notification.ts new file mode 100644 index 0000000..fc8c437 --- /dev/null +++ b/src/notifications/entities/price/price-quantity-notification.ts @@ -0,0 +1,16 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ +import { type IPriceQuantityNotification } from '../../types'; + +export class PriceQuantityNotification { + public readonly minimum: number; + public readonly maximum: number; + + constructor(priceQuantity: IPriceQuantityNotification) { + this.minimum = priceQuantity.minimum; + this.maximum = priceQuantity.maximum; + } +} diff --git a/src/notifications/entities/product/index.ts b/src/notifications/entities/product/index.ts new file mode 100644 index 0000000..1a643c7 --- /dev/null +++ b/src/notifications/entities/product/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './product-notification'; diff --git a/src/notifications/entities/product/product-notification.ts b/src/notifications/entities/product/product-notification.ts new file mode 100644 index 0000000..e14880d --- /dev/null +++ b/src/notifications/entities/product/product-notification.ts @@ -0,0 +1,36 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ISharedProductNotificationResponse } from '../../types'; +import { ImportMetaNotification } from '../index'; +import { type TaxCategory, type Status, type CatalogType } from '../../../enums'; +import { type CustomData } from '../../../entities'; + +export class ProductNotification { + public readonly id: string; + public readonly name: string; + public readonly type: CatalogType | null; + public readonly description: string | null; + public readonly taxCategory: TaxCategory; + public readonly imageUrl: string | null; + public readonly customData: CustomData | null; + public readonly status: Status; + public readonly createdAt: string; + public readonly importMeta: ImportMetaNotification | null; + + constructor(product: ISharedProductNotificationResponse) { + this.id = product.id; + this.name = product.name; + this.type = product.type ?? null; + this.description = product.description ? product.description : null; + this.taxCategory = product.tax_category; + this.imageUrl = product.image_url ? product.image_url : null; + this.customData = product.custom_data ? product.custom_data : null; + this.status = product.status; + this.createdAt = product.created_at; + this.importMeta = product.import_meta ? new ImportMetaNotification(product.import_meta) : null; + } +} diff --git a/src/notifications/entities/report/index.ts b/src/notifications/entities/report/index.ts new file mode 100644 index 0000000..5bb3203 --- /dev/null +++ b/src/notifications/entities/report/index.ts @@ -0,0 +1,8 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './report-filters-notification'; +export * from './report-notification'; diff --git a/src/notifications/entities/report/report-filters-notification.ts b/src/notifications/entities/report/report-filters-notification.ts new file mode 100644 index 0000000..977dd6a --- /dev/null +++ b/src/notifications/entities/report/report-filters-notification.ts @@ -0,0 +1,20 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IReportFiltersNotification } from '../../types'; +import { type ReportFilterName, type ReportFilterOperator } from '../../../enums'; + +export class ReportFiltersNotification { + public readonly name: ReportFilterName; + public readonly operator: null | ReportFilterOperator; + public readonly value: string[] | string; + + constructor(reportFiltersResponse: IReportFiltersNotification) { + this.name = reportFiltersResponse.name; + this.operator = reportFiltersResponse.operator ?? null; + this.value = reportFiltersResponse.value; + } +} diff --git a/src/notifications/entities/report/report-notification.ts b/src/notifications/entities/report/report-notification.ts new file mode 100644 index 0000000..b015d59 --- /dev/null +++ b/src/notifications/entities/report/report-notification.ts @@ -0,0 +1,29 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { ReportFiltersNotification } from '../index'; +import { type ReportStatus, type ReportType } from '../../../enums'; +import { type IReportNotificationResponse } from '../../types'; + +export class ReportNotification { + public readonly id: string; + public readonly status: ReportStatus; + public readonly rows: number | null; + public readonly type: ReportType; + public readonly filters: ReportFiltersNotification[]; + public readonly expiresAt: string | null; + public readonly createdAt: string; + + constructor(reportResponse: IReportNotificationResponse) { + this.id = reportResponse.id; + this.status = reportResponse.status; + this.rows = reportResponse.rows ?? null; + this.type = reportResponse.type; + this.filters = reportResponse.filters?.map((filter) => new ReportFiltersNotification(filter)); + this.expiresAt = reportResponse.expires_at ?? null; + this.createdAt = reportResponse.created_at; + } +} diff --git a/src/notifications/entities/shared/adjustment-original-amount-notification.ts b/src/notifications/entities/shared/adjustment-original-amount-notification.ts new file mode 100644 index 0000000..5471ccb --- /dev/null +++ b/src/notifications/entities/shared/adjustment-original-amount-notification.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentOriginalAmountNotificationResponse } from '../../types'; +import { type AdjustmentCurrencyCode } from '../../../enums'; + +export class AdjustmentOriginalAmountNotification { + public readonly amount: string; + public readonly currencyCode: AdjustmentCurrencyCode; + + constructor(originalAmount: IAdjustmentOriginalAmountNotificationResponse) { + this.amount = originalAmount.amount; + this.currencyCode = originalAmount.currency_code; + } +} diff --git a/src/notifications/entities/shared/billing-details-notification.ts b/src/notifications/entities/shared/billing-details-notification.ts new file mode 100644 index 0000000..ab55370 --- /dev/null +++ b/src/notifications/entities/shared/billing-details-notification.ts @@ -0,0 +1,22 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IBillingDetailsNotificationResponse } from '../../types'; +import { TimePeriodNotification } from '../index'; + +export class BillingDetailsNotification { + public readonly enableCheckout: boolean | null; + public readonly purchaseOrderNumber: string | null; + public readonly additionalInformation: string | null; + public readonly paymentTerms: TimePeriodNotification; + + constructor(billingDetails: IBillingDetailsNotificationResponse) { + this.enableCheckout = billingDetails.enable_checkout ?? null; + this.purchaseOrderNumber = billingDetails.purchase_order_number ? billingDetails.purchase_order_number : null; + this.additionalInformation = billingDetails.additional_information ? billingDetails.additional_information : null; + this.paymentTerms = new TimePeriodNotification(billingDetails.payment_terms); + } +} diff --git a/src/notifications/entities/shared/chargeback-fee-notification.ts b/src/notifications/entities/shared/chargeback-fee-notification.ts new file mode 100644 index 0000000..1e7da90 --- /dev/null +++ b/src/notifications/entities/shared/chargeback-fee-notification.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IChargebackFeeNotification } from '../../types'; +import { AdjustmentOriginalAmountNotification } from '../index'; + +export class ChargebackFeeNotification { + public readonly amount: string; + public readonly original: AdjustmentOriginalAmountNotification | null; + + constructor(chargebackFee: IChargebackFeeNotification) { + this.amount = chargebackFee.amount; + this.original = chargebackFee.original ? new AdjustmentOriginalAmountNotification(chargebackFee.original) : null; + } +} diff --git a/src/notifications/entities/shared/import-meta-notification.ts b/src/notifications/entities/shared/import-meta-notification.ts new file mode 100644 index 0000000..e81b8c5 --- /dev/null +++ b/src/notifications/entities/shared/import-meta-notification.ts @@ -0,0 +1,17 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IImportMetaNotificationResponse } from '../../types'; + +export class ImportMetaNotification { + public readonly externalId: string | null; + public readonly importedFrom: string; + + constructor(importMeta: IImportMetaNotificationResponse) { + this.externalId = importMeta.external_id ? importMeta.external_id : null; + this.importedFrom = importMeta.imported_from; + } +} diff --git a/src/notifications/entities/shared/index.ts b/src/notifications/entities/shared/index.ts new file mode 100644 index 0000000..69b1e56 --- /dev/null +++ b/src/notifications/entities/shared/index.ts @@ -0,0 +1,26 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './time-period-notification'; +export * from './money-notification'; +export * from './unit-price-override-notification'; +export * from './billing-details-notification'; +export * from './totals-notification'; +export * from './tax-rates-used-notification'; +export * from './transaction-totals-notification'; +export * from './transaction-totals-adjusted-notification'; +export * from './transaction-payout-totals-notification'; +export * from './adjustment-original-amount-notification'; +export * from './chargeback-fee-notification'; +export * from './transaction-payout-totals-adjusted-notification'; +export * from './unit-totals-notification'; +export * from './payment-card-notification'; +export * from './payment-method-details-notification'; +export * from './transaction-payment-attempt-notification'; +export * from './transaction-checkout-notification'; +export * from './total-adjustments-notification'; +export * from './payout-totals-adjustment-notification'; +export * from './import-meta-notification'; diff --git a/src/notifications/entities/shared/money-notification.ts b/src/notifications/entities/shared/money-notification.ts new file mode 100644 index 0000000..6a013f8 --- /dev/null +++ b/src/notifications/entities/shared/money-notification.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IMoneyNotificationResponse } from '../../types'; +import { type CurrencyCode } from '../../../enums'; + +export class MoneyNotification { + public readonly amount: string; + public readonly currencyCode: CurrencyCode; + + constructor(money: IMoneyNotificationResponse) { + this.amount = money.amount; + this.currencyCode = money.currency_code; + } +} diff --git a/src/notifications/entities/shared/payment-card-notification.ts b/src/notifications/entities/shared/payment-card-notification.ts new file mode 100644 index 0000000..cf05998 --- /dev/null +++ b/src/notifications/entities/shared/payment-card-notification.ts @@ -0,0 +1,24 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPaymentCardNotificationResponse } from '../../types'; +import { type PaymentCardType } from '../../../enums'; + +export class PaymentCardNotification { + public readonly type: PaymentCardType; + public readonly last4: string; + public readonly expiryMonth: number; + public readonly expiryYear: number; + public readonly cardholderName: string; + + constructor(paymentCard: IPaymentCardNotificationResponse) { + this.type = paymentCard.type; + this.last4 = paymentCard.last4; + this.expiryMonth = paymentCard.expiry_month; + this.expiryYear = paymentCard.expiry_year; + this.cardholderName = paymentCard.cardholder_name; + } +} diff --git a/src/notifications/entities/shared/payment-method-details-notification.ts b/src/notifications/entities/shared/payment-method-details-notification.ts new file mode 100644 index 0000000..75eda16 --- /dev/null +++ b/src/notifications/entities/shared/payment-method-details-notification.ts @@ -0,0 +1,19 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPaymentMethodDetailsNotification } from '../../types'; +import { type PaymentType } from '../../../enums'; +import { PaymentCardNotification } from './payment-card-notification'; + +export class PaymentMethodDetailsNotification { + public readonly type: PaymentType; + public readonly card: PaymentCardNotification | null; + + constructor(paymentMethodDetails: IPaymentMethodDetailsNotification) { + this.type = paymentMethodDetails.type; + this.card = paymentMethodDetails.card ? new PaymentCardNotification(paymentMethodDetails.card) : null; + } +} diff --git a/src/notifications/entities/shared/payout-totals-adjustment-notification.ts b/src/notifications/entities/shared/payout-totals-adjustment-notification.ts new file mode 100644 index 0000000..ca0453e --- /dev/null +++ b/src/notifications/entities/shared/payout-totals-adjustment-notification.ts @@ -0,0 +1,31 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPayoutTotalsAdjustmentNotificationResponse } from '../../types'; +import { ChargebackFeeNotification } from '../index'; +import { type PayoutCurrencyCode } from '../../../enums'; + +export class PayoutTotalsAdjustmentNotification { + public readonly subtotal: string; + public readonly tax: string; + public readonly total: string; + public readonly fee: string; + public readonly chargebackFee: ChargebackFeeNotification | null; + public readonly earnings: string; + public readonly currencyCode: PayoutCurrencyCode; + + constructor(payoutTotalsAdjustment: IPayoutTotalsAdjustmentNotificationResponse) { + this.subtotal = payoutTotalsAdjustment.subtotal; + this.tax = payoutTotalsAdjustment.tax; + this.total = payoutTotalsAdjustment.total; + this.fee = payoutTotalsAdjustment.fee; + this.chargebackFee = payoutTotalsAdjustment.chargeback_fee + ? new ChargebackFeeNotification(payoutTotalsAdjustment.chargeback_fee) + : null; + this.earnings = payoutTotalsAdjustment.earnings; + this.currencyCode = payoutTotalsAdjustment.currency_code; + } +} diff --git a/src/notifications/entities/shared/tax-rates-used-notification.ts b/src/notifications/entities/shared/tax-rates-used-notification.ts new file mode 100644 index 0000000..bd4ddde --- /dev/null +++ b/src/notifications/entities/shared/tax-rates-used-notification.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITaxRatesUsedNotificationResponse } from '../../types'; +import { TotalsNotification } from '../index'; + +export class TaxRatesUsedNotification { + public readonly taxRate: string; + public readonly totals: TotalsNotification | null; + + constructor(taxRatesUsed: ITaxRatesUsedNotificationResponse) { + this.taxRate = taxRatesUsed.tax_rate; + this.totals = taxRatesUsed.totals ? new TotalsNotification(taxRatesUsed.totals) : null; + } +} diff --git a/src/notifications/entities/shared/time-period-notification.ts b/src/notifications/entities/shared/time-period-notification.ts new file mode 100644 index 0000000..8c9b8d3 --- /dev/null +++ b/src/notifications/entities/shared/time-period-notification.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITimePeriodNotification } from '../../types'; +import { type Interval } from '../../../enums'; + +export class TimePeriodNotification { + public readonly interval: Interval; + public readonly frequency: number; + + constructor(timePeriod: ITimePeriodNotification) { + this.interval = timePeriod.interval; + this.frequency = timePeriod.frequency; + } +} diff --git a/src/notifications/entities/shared/total-adjustments-notification.ts b/src/notifications/entities/shared/total-adjustments-notification.ts new file mode 100644 index 0000000..e16cd59 --- /dev/null +++ b/src/notifications/entities/shared/total-adjustments-notification.ts @@ -0,0 +1,26 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITotalAdjustmentsNotificationResponse } from '../../types'; +import { type CurrencyCode } from '../../../enums'; + +export class TotalAdjustmentsNotification { + public readonly subtotal: string; + public readonly tax: string; + public readonly total: string; + public readonly fee: string; + public readonly earnings: string; + public readonly currencyCode: CurrencyCode; + + constructor(totalAdjustments: ITotalAdjustmentsNotificationResponse) { + this.subtotal = totalAdjustments.subtotal; + this.tax = totalAdjustments.tax; + this.total = totalAdjustments.total; + this.fee = totalAdjustments.fee; + this.earnings = totalAdjustments.earnings; + this.currencyCode = totalAdjustments.currency_code; + } +} diff --git a/src/notifications/entities/shared/totals-notification.ts b/src/notifications/entities/shared/totals-notification.ts new file mode 100644 index 0000000..fb20a0b --- /dev/null +++ b/src/notifications/entities/shared/totals-notification.ts @@ -0,0 +1,21 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITotalsNotification } from '../../types'; + +export class TotalsNotification { + public readonly subtotal: string; + public readonly discount: string; + public readonly tax: string; + public readonly total: string; + + constructor(totals: ITotalsNotification) { + this.subtotal = totals.subtotal; + this.discount = totals.discount; + this.tax = totals.tax; + this.total = totals.total; + } +} diff --git a/src/notifications/entities/shared/transaction-checkout-notification.ts b/src/notifications/entities/shared/transaction-checkout-notification.ts new file mode 100644 index 0000000..8866e1d --- /dev/null +++ b/src/notifications/entities/shared/transaction-checkout-notification.ts @@ -0,0 +1,15 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionCheckoutNotification } from '../../types'; + +export class TransactionCheckoutNotification { + public readonly url: string | null; + + constructor(transactionCheckout: ITransactionCheckoutNotification) { + this.url = transactionCheckout.url ? transactionCheckout.url : null; + } +} diff --git a/src/notifications/entities/shared/transaction-payment-attempt-notification.ts b/src/notifications/entities/shared/transaction-payment-attempt-notification.ts new file mode 100644 index 0000000..d98172f --- /dev/null +++ b/src/notifications/entities/shared/transaction-payment-attempt-notification.ts @@ -0,0 +1,38 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionPaymentAttemptNotificationResponse } from '../../types'; +import { PaymentMethodDetailsNotification } from '../index'; +import { type PaymentAttemptStatus, type ErrorCode } from '../../../enums'; + +export class TransactionPaymentAttemptNotification { + public readonly paymentAttemptId: string; + public readonly paymentMethodId: string | null; + /** + * @deprecated use paymentMethodId instead + */ + public readonly storedPaymentMethodId: string; + public readonly amount: string; + public readonly status: PaymentAttemptStatus; + public readonly errorCode: ErrorCode | null; + public readonly methodDetails: PaymentMethodDetailsNotification | null; + public readonly createdAt: string; + public readonly capturedAt: string | null; + + constructor(transactionPaymentAttempt: ITransactionPaymentAttemptNotificationResponse) { + this.paymentAttemptId = transactionPaymentAttempt.payment_attempt_id; + this.paymentMethodId = transactionPaymentAttempt.payment_method_id ?? null; + this.storedPaymentMethodId = transactionPaymentAttempt.stored_payment_method_id; + this.amount = transactionPaymentAttempt.amount; + this.status = transactionPaymentAttempt.status; + this.errorCode = transactionPaymentAttempt.error_code ? transactionPaymentAttempt.error_code : null; + this.methodDetails = transactionPaymentAttempt.method_details + ? new PaymentMethodDetailsNotification(transactionPaymentAttempt.method_details) + : null; + this.createdAt = transactionPaymentAttempt.created_at; + this.capturedAt = transactionPaymentAttempt.captured_at ? transactionPaymentAttempt.captured_at : null; + } +} diff --git a/src/notifications/entities/shared/transaction-payout-totals-adjusted-notification.ts b/src/notifications/entities/shared/transaction-payout-totals-adjusted-notification.ts new file mode 100644 index 0000000..c4db34c --- /dev/null +++ b/src/notifications/entities/shared/transaction-payout-totals-adjusted-notification.ts @@ -0,0 +1,31 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionPayoutTotalsAdjustedNotificationResponse } from '../../types'; +import { ChargebackFeeNotification } from '../index'; +import { type PayoutCurrencyCode } from '../../../enums'; + +export class TransactionPayoutTotalsAdjustedNotification { + public readonly subtotal: string; + public readonly tax: string; + public readonly total: string; + public readonly fee: string; + public readonly chargebackFee: ChargebackFeeNotification | null; + public readonly earnings: string; + public readonly currencyCode: PayoutCurrencyCode; + + constructor(transactionPayoutTotalsAdjusted: ITransactionPayoutTotalsAdjustedNotificationResponse) { + this.subtotal = transactionPayoutTotalsAdjusted.subtotal; + this.tax = transactionPayoutTotalsAdjusted.tax; + this.total = transactionPayoutTotalsAdjusted.total; + this.fee = transactionPayoutTotalsAdjusted.fee; + this.chargebackFee = transactionPayoutTotalsAdjusted.chargeback_fee + ? new ChargebackFeeNotification(transactionPayoutTotalsAdjusted.chargeback_fee) + : null; + this.earnings = transactionPayoutTotalsAdjusted.earnings; + this.currencyCode = transactionPayoutTotalsAdjusted.currency_code; + } +} diff --git a/src/notifications/entities/shared/transaction-payout-totals-notification.ts b/src/notifications/entities/shared/transaction-payout-totals-notification.ts new file mode 100644 index 0000000..e492c2e --- /dev/null +++ b/src/notifications/entities/shared/transaction-payout-totals-notification.ts @@ -0,0 +1,36 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionPayoutTotalsNotificationResponse } from '../../types'; +import { type PayoutCurrencyCode } from '../../../enums'; + +export class TransactionPayoutTotalsNotification { + public readonly subtotal: string; + public readonly discount: string; + public readonly tax: string; + public readonly total: string; + public readonly credit: string; + public readonly creditToBalance: string; + public readonly balance: string; + public readonly grandTotal: string; + public readonly fee: string; + public readonly earnings: string; + public readonly currencyCode: PayoutCurrencyCode; + + constructor(transactionPayoutTotals: ITransactionPayoutTotalsNotificationResponse) { + this.subtotal = transactionPayoutTotals.subtotal; + this.discount = transactionPayoutTotals.discount; + this.tax = transactionPayoutTotals.tax; + this.total = transactionPayoutTotals.total; + this.credit = transactionPayoutTotals.credit; + this.creditToBalance = transactionPayoutTotals.credit_to_balance; + this.balance = transactionPayoutTotals.balance; + this.grandTotal = transactionPayoutTotals.grand_total; + this.fee = transactionPayoutTotals.fee; + this.earnings = transactionPayoutTotals.earnings; + this.currencyCode = transactionPayoutTotals.currency_code; + } +} diff --git a/src/notifications/entities/shared/transaction-totals-adjusted-notification.ts b/src/notifications/entities/shared/transaction-totals-adjusted-notification.ts new file mode 100644 index 0000000..22edab6 --- /dev/null +++ b/src/notifications/entities/shared/transaction-totals-adjusted-notification.ts @@ -0,0 +1,28 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionTotalsAdjustedNotificationResponse } from '../../types'; +import { type CurrencyCode } from '../../../enums'; + +export class TransactionTotalsAdjustedNotification { + public readonly subtotal: string; + public readonly tax: string; + public readonly total: string; + public readonly grandTotal: string; + public readonly fee: string | null; + public readonly earnings: string | null; + public readonly currencyCode: CurrencyCode; + + constructor(transactionTotalsAdjusted: ITransactionTotalsAdjustedNotificationResponse) { + this.subtotal = transactionTotalsAdjusted.subtotal; + this.tax = transactionTotalsAdjusted.tax; + this.total = transactionTotalsAdjusted.total; + this.grandTotal = transactionTotalsAdjusted.grand_total; + this.fee = transactionTotalsAdjusted.fee ? transactionTotalsAdjusted.fee : null; + this.earnings = transactionTotalsAdjusted.earnings ? transactionTotalsAdjusted.earnings : null; + this.currencyCode = transactionTotalsAdjusted.currency_code; + } +} diff --git a/src/notifications/entities/shared/transaction-totals-notification.ts b/src/notifications/entities/shared/transaction-totals-notification.ts new file mode 100644 index 0000000..ed9eddc --- /dev/null +++ b/src/notifications/entities/shared/transaction-totals-notification.ts @@ -0,0 +1,36 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionTotalsNotificationResponse } from '../../types'; +import { type CurrencyCode } from '../../../enums'; + +export class TransactionTotalsNotification { + public readonly subtotal: string; + public readonly discount: string; + public readonly tax: string; + public readonly total: string; + public readonly credit: string; + public readonly creditToBalance: string; + public readonly balance: string; + public readonly grandTotal: string; + public readonly fee: string | null; + public readonly earnings: string | null; + public readonly currencyCode: CurrencyCode; + + constructor(transactionTotals: ITransactionTotalsNotificationResponse) { + this.subtotal = transactionTotals.subtotal; + this.discount = transactionTotals.discount; + this.tax = transactionTotals.tax; + this.total = transactionTotals.total; + this.credit = transactionTotals.credit; + this.creditToBalance = transactionTotals.credit_to_balance; + this.balance = transactionTotals.balance; + this.grandTotal = transactionTotals.grand_total; + this.fee = transactionTotals.fee ? transactionTotals.fee : null; + this.earnings = transactionTotals.earnings ? transactionTotals.earnings : null; + this.currencyCode = transactionTotals.currency_code; + } +} diff --git a/src/notifications/entities/shared/unit-price-override-notification.ts b/src/notifications/entities/shared/unit-price-override-notification.ts new file mode 100644 index 0000000..bc8b076 --- /dev/null +++ b/src/notifications/entities/shared/unit-price-override-notification.ts @@ -0,0 +1,19 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IUnitPriceOverrideNotificationResponse } from '../../types'; +import { MoneyNotification } from '../index'; +import { type CountryCode } from '../../../enums'; + +export class UnitPriceOverrideNotification { + public readonly countryCodes: CountryCode[]; + public readonly unitPrice: MoneyNotification; + + constructor(unitPriceOverride: IUnitPriceOverrideNotificationResponse) { + this.countryCodes = unitPriceOverride.country_codes; + this.unitPrice = new MoneyNotification(unitPriceOverride.unit_price); + } +} diff --git a/src/notifications/entities/shared/unit-totals-notification.ts b/src/notifications/entities/shared/unit-totals-notification.ts new file mode 100644 index 0000000..8a45738 --- /dev/null +++ b/src/notifications/entities/shared/unit-totals-notification.ts @@ -0,0 +1,21 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IUnitTotalsNotification } from '../../types'; + +export class UnitTotalsNotification { + public readonly subtotal: string; + public readonly discount: string; + public readonly tax: string; + public readonly total: string; + + constructor(unitTotals: IUnitTotalsNotification) { + this.subtotal = unitTotals.subtotal; + this.discount = unitTotals.discount; + this.tax = unitTotals.tax; + this.total = unitTotals.total; + } +} diff --git a/src/notifications/entities/subscription/index.ts b/src/notifications/entities/subscription/index.ts new file mode 100644 index 0000000..9a56c55 --- /dev/null +++ b/src/notifications/entities/subscription/index.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './subscription-discount-notification'; +export * from './subscription-time-period-notification'; +export * from './subscription-scheduled-change-notification'; +export * from './subscription-price-notification'; +export * from './subscription-item-notification'; +export * from './subscription-notification'; diff --git a/src/notifications/entities/subscription/subscription-discount-notification.ts b/src/notifications/entities/subscription/subscription-discount-notification.ts new file mode 100644 index 0000000..9b25c4c --- /dev/null +++ b/src/notifications/entities/subscription/subscription-discount-notification.ts @@ -0,0 +1,19 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ISubscriptionDiscountNotificationResponse } from '../../types'; + +export class SubscriptionDiscountNotification { + public readonly id: string; + public readonly startsAt: string; + public readonly endsAt: string | null; + + constructor(subscriptionDiscount: ISubscriptionDiscountNotificationResponse) { + this.id = subscriptionDiscount.id; + this.startsAt = subscriptionDiscount.starts_at; + this.endsAt = subscriptionDiscount.ends_at ?? null; + } +} diff --git a/src/notifications/entities/subscription/subscription-item-notification.ts b/src/notifications/entities/subscription/subscription-item-notification.ts new file mode 100644 index 0000000..80c2aef --- /dev/null +++ b/src/notifications/entities/subscription/subscription-item-notification.ts @@ -0,0 +1,35 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ISubscriptionItemNotificationResponse } from '../../types'; +import { SubscriptionPriceNotification, SubscriptionTimePeriodNotification } from '../index'; +import { type SubscriptionItemStatus } from '../../../enums'; + +export class SubscriptionItemNotification { + public readonly status: SubscriptionItemStatus; + public readonly quantity: number; + public readonly recurring: boolean; + public readonly createdAt: string; + public readonly updatedAt: string; + public readonly previouslyBilledAt: string | null; + public readonly nextBilledAt: string | null; + public readonly trialDates: SubscriptionTimePeriodNotification | null; + public readonly price: SubscriptionPriceNotification | null; + + constructor(subscriptionItem: ISubscriptionItemNotificationResponse) { + this.status = subscriptionItem.status; + this.quantity = subscriptionItem.quantity; + this.recurring = subscriptionItem.recurring; + this.createdAt = subscriptionItem.created_at; + this.updatedAt = subscriptionItem.updated_at; + this.previouslyBilledAt = subscriptionItem.previously_billed_at ? subscriptionItem.previously_billed_at : null; + this.nextBilledAt = subscriptionItem.next_billed_at ? subscriptionItem.next_billed_at : null; + this.trialDates = subscriptionItem.trial_dates + ? new SubscriptionTimePeriodNotification(subscriptionItem.trial_dates) + : null; + this.price = subscriptionItem.price ? new SubscriptionPriceNotification(subscriptionItem.price) : null; + } +} diff --git a/src/entities/subscription/subscription-notification.ts b/src/notifications/entities/subscription/subscription-notification.ts similarity index 63% rename from src/entities/subscription/subscription-notification.ts rename to src/notifications/entities/subscription/subscription-notification.ts index c74c88d..2c7f5b7 100644 --- a/src/entities/subscription/subscription-notification.ts +++ b/src/notifications/entities/subscription/subscription-notification.ts @@ -5,17 +5,17 @@ */ import { - BillingDetails, - type CustomData, - ImportMeta, - SubscriptionDiscount, - SubscriptionItem, - SubscriptionScheduledChange, - SubscriptionTimePeriod, - TimePeriod, + BillingDetailsNotification, + ImportMetaNotification, + SubscriptionDiscountNotification, + SubscriptionItemNotification, + SubscriptionScheduledChangeNotification, + SubscriptionTimePeriodNotification, + TimePeriodNotification, } from '../index'; -import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums'; +import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../../enums'; import { type ISubscriptionNotificationResponse } from '../../types'; +import { type CustomData } from '../../../entities'; export class SubscriptionNotification { public readonly id: string; @@ -32,15 +32,15 @@ export class SubscriptionNotification { public readonly nextBilledAt: string | null; public readonly pausedAt: string | null; public readonly canceledAt: string | null; - public readonly discount: SubscriptionDiscount | null; + public readonly discount: SubscriptionDiscountNotification | null; public readonly collectionMode: CollectionMode; - public readonly billingDetails: BillingDetails | null; - public readonly currentBillingPeriod: SubscriptionTimePeriod | null; - public readonly billingCycle: TimePeriod; - public readonly scheduledChange: SubscriptionScheduledChange | null; - public readonly items: SubscriptionItem[]; + public readonly billingDetails: BillingDetailsNotification | null; + public readonly currentBillingPeriod: SubscriptionTimePeriodNotification | null; + public readonly billingCycle: TimePeriodNotification; + public readonly scheduledChange: SubscriptionScheduledChangeNotification | null; + public readonly items: SubscriptionItemNotification[]; public readonly customData: CustomData | null; - public readonly importMeta: ImportMeta | null; + public readonly importMeta: ImportMetaNotification | null; constructor(subscription: ISubscriptionNotificationResponse) { this.id = subscription.id; @@ -57,18 +57,20 @@ export class SubscriptionNotification { this.nextBilledAt = subscription.next_billed_at ? subscription.next_billed_at : null; this.pausedAt = subscription.paused_at ? subscription.paused_at : null; this.canceledAt = subscription.canceled_at ? subscription.canceled_at : null; - this.discount = subscription.discount ? new SubscriptionDiscount(subscription.discount) : null; + this.discount = subscription.discount ? new SubscriptionDiscountNotification(subscription.discount) : null; this.collectionMode = subscription.collection_mode; - this.billingDetails = subscription.billing_details ? new BillingDetails(subscription.billing_details) : null; + this.billingDetails = subscription.billing_details + ? new BillingDetailsNotification(subscription.billing_details) + : null; this.currentBillingPeriod = subscription.current_billing_period - ? new SubscriptionTimePeriod(subscription.current_billing_period) + ? new SubscriptionTimePeriodNotification(subscription.current_billing_period) : null; - this.billingCycle = new TimePeriod(subscription.billing_cycle); + this.billingCycle = new TimePeriodNotification(subscription.billing_cycle); this.scheduledChange = subscription.scheduled_change - ? new SubscriptionScheduledChange(subscription.scheduled_change) + ? new SubscriptionScheduledChangeNotification(subscription.scheduled_change) : null; - this.items = subscription.items.map((item) => new SubscriptionItem(item)); + this.items = subscription.items.map((item) => new SubscriptionItemNotification(item)); this.customData = subscription.custom_data ? subscription.custom_data : null; - this.importMeta = subscription.import_meta ? new ImportMeta(subscription.import_meta) : null; + this.importMeta = subscription.import_meta ? new ImportMetaNotification(subscription.import_meta) : null; } } diff --git a/src/notifications/entities/subscription/subscription-price-notification.ts b/src/notifications/entities/subscription/subscription-price-notification.ts new file mode 100644 index 0000000..76dd481 --- /dev/null +++ b/src/notifications/entities/subscription/subscription-price-notification.ts @@ -0,0 +1,52 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ISubscriptionPriceNotificationResponse } from '../../types'; +import { + type ImportMetaNotification, + MoneyNotification, + PriceQuantityNotification, + TimePeriodNotification, + UnitPriceOverrideNotification, +} from '../index'; +import { type CatalogType, type Status, type TaxMode } from '../../../enums'; +import { type CustomData, ImportMeta } from '../../../entities'; + +export class SubscriptionPriceNotification { + public readonly id: string; + public readonly productId: string; + public readonly description: string; + public readonly name: string | null; + public readonly type: CatalogType | null; + public readonly billingCycle: TimePeriodNotification | null; + public readonly trialPeriod: TimePeriodNotification | null; + public readonly taxMode: TaxMode; + public readonly unitPrice: MoneyNotification | null; + public readonly unitPriceOverrides: UnitPriceOverrideNotification[] | null; + public readonly quantity: PriceQuantityNotification | null; + public readonly status: Status | null; + public readonly customData: CustomData | null; + public readonly importMeta: ImportMetaNotification | null; + + constructor(price: ISubscriptionPriceNotificationResponse) { + this.id = price.id; + this.productId = price.product_id; + this.description = price.description; + this.type = price.type ?? null; + this.name = price.name ? price.name : null; + this.billingCycle = price.billing_cycle ? new TimePeriodNotification(price.billing_cycle) : null; + this.trialPeriod = price.trial_period ? new TimePeriodNotification(price.trial_period) : null; + this.taxMode = price.tax_mode; + this.unitPrice = price.unit_price ? new MoneyNotification(price.unit_price) : null; + this.unitPriceOverrides = price.unit_price_overrides + ? price.unit_price_overrides.map((unit_price_override) => new UnitPriceOverrideNotification(unit_price_override)) + : []; + this.quantity = price.quantity ? new PriceQuantityNotification(price.quantity) : null; + this.status = price.status ?? null; + this.customData = price.custom_data ? price.custom_data : null; + this.importMeta = price.import_meta ? new ImportMeta(price.import_meta) : null; + } +} diff --git a/src/notifications/entities/subscription/subscription-scheduled-change-notification.ts b/src/notifications/entities/subscription/subscription-scheduled-change-notification.ts new file mode 100644 index 0000000..415f9ff --- /dev/null +++ b/src/notifications/entities/subscription/subscription-scheduled-change-notification.ts @@ -0,0 +1,20 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ISubscriptionScheduledChangeNotificationResponse } from '../../types'; +import { type ScheduledChangeAction } from '../../../enums'; + +export class SubscriptionScheduledChangeNotification { + public readonly action: ScheduledChangeAction; + public readonly effectiveAt: string; + public readonly resumeAt: string | null; + + constructor(subscriptionScheduledChange: ISubscriptionScheduledChangeNotificationResponse) { + this.action = subscriptionScheduledChange.action; + this.effectiveAt = subscriptionScheduledChange.effective_at; + this.resumeAt = subscriptionScheduledChange.resume_at ? subscriptionScheduledChange.resume_at : null; + } +} diff --git a/src/notifications/entities/subscription/subscription-time-period-notification.ts b/src/notifications/entities/subscription/subscription-time-period-notification.ts new file mode 100644 index 0000000..4c9c9ea --- /dev/null +++ b/src/notifications/entities/subscription/subscription-time-period-notification.ts @@ -0,0 +1,17 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ISubscriptionTimePeriodNotificationResponse } from '../../types'; + +export class SubscriptionTimePeriodNotification { + public readonly startsAt: string; + public readonly endsAt: string; + + constructor(subscriptionTimePeriod: ISubscriptionTimePeriodNotificationResponse) { + this.startsAt = subscriptionTimePeriod.starts_at; + this.endsAt = subscriptionTimePeriod.ends_at; + } +} diff --git a/src/notifications/entities/transaction/index.ts b/src/notifications/entities/transaction/index.ts new file mode 100644 index 0000000..619c9f5 --- /dev/null +++ b/src/notifications/entities/transaction/index.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './transactions-time-period-notification'; +export * from './transaction-proration-notification'; +export * from './transaction-item-notification'; +export * from './transaction-line-item-notification'; +export * from './transaction-details-notification'; +export * from './transaction-notification'; diff --git a/src/notifications/entities/transaction/transaction-details-notification.ts b/src/notifications/entities/transaction/transaction-details-notification.ts new file mode 100644 index 0000000..7e57351 --- /dev/null +++ b/src/notifications/entities/transaction/transaction-details-notification.ts @@ -0,0 +1,41 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionDetailsNotificationResponse } from '../../types'; +import { + TaxRatesUsedNotification, + TransactionTotalsNotification, + TransactionTotalsAdjustedNotification, + TransactionPayoutTotalsNotification, + TransactionPayoutTotalsAdjustedNotification, + TransactionLineItemNotification, +} from '../index'; + +export class TransactionDetailsNotification { + public readonly taxRatesUsed: TaxRatesUsedNotification[]; + public readonly totals: TransactionTotalsNotification | null; + public readonly adjustedTotals: TransactionTotalsAdjustedNotification | null; + public readonly payoutTotals: TransactionPayoutTotalsNotification | null; + public readonly adjustedPayoutTotals: TransactionPayoutTotalsAdjustedNotification | null; + public readonly lineItems: TransactionLineItemNotification[]; + + constructor(transactionDetails: ITransactionDetailsNotificationResponse) { + this.taxRatesUsed = transactionDetails.tax_rates_used.map( + (tax_rates_used) => new TaxRatesUsedNotification(tax_rates_used), + ); + this.totals = transactionDetails.totals ? new TransactionTotalsNotification(transactionDetails.totals) : null; + this.adjustedTotals = transactionDetails.adjusted_totals + ? new TransactionTotalsAdjustedNotification(transactionDetails.adjusted_totals) + : null; + this.payoutTotals = transactionDetails.payout_totals + ? new TransactionPayoutTotalsNotification(transactionDetails.payout_totals) + : null; + this.adjustedPayoutTotals = transactionDetails.adjusted_payout_totals + ? new TransactionPayoutTotalsAdjustedNotification(transactionDetails.adjusted_payout_totals) + : null; + this.lineItems = transactionDetails.line_items.map((line_item) => new TransactionLineItemNotification(line_item)); + } +} diff --git a/src/notifications/entities/transaction/transaction-item-notification.ts b/src/notifications/entities/transaction/transaction-item-notification.ts new file mode 100644 index 0000000..b786ea9 --- /dev/null +++ b/src/notifications/entities/transaction/transaction-item-notification.ts @@ -0,0 +1,20 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionItemNotificationResponse } from '../../types'; +import { PriceNotification, TransactionProrationNotification } from '../index'; + +export class TransactionItemNotification { + public readonly price: PriceNotification | null; + public readonly quantity: number; + public readonly proration: TransactionProrationNotification | null; + + constructor(transactionItem: ITransactionItemNotificationResponse) { + this.price = transactionItem.price ? new PriceNotification(transactionItem.price) : null; + this.quantity = transactionItem.quantity; + this.proration = transactionItem.proration ? new TransactionProrationNotification(transactionItem.proration) : null; + } +} diff --git a/src/notifications/entities/transaction/transaction-line-item-notification.ts b/src/notifications/entities/transaction/transaction-line-item-notification.ts new file mode 100644 index 0000000..cea871f --- /dev/null +++ b/src/notifications/entities/transaction/transaction-line-item-notification.ts @@ -0,0 +1,39 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionLineItemNotificationResponse } from '../../types'; +import { + TransactionProrationNotification, + UnitTotalsNotification, + TotalsNotification, + ProductNotification, +} from '../index'; + +export class TransactionLineItemNotification { + public readonly id: string; + public readonly priceId: string; + public readonly quantity: number; + public readonly proration: TransactionProrationNotification | null; + public readonly taxRate: string; + public readonly unitTotals: UnitTotalsNotification | null; + public readonly totals: TotalsNotification | null; + public readonly product: ProductNotification | null; + + constructor(transactionLineItem: ITransactionLineItemNotificationResponse) { + this.id = transactionLineItem.id; + this.priceId = transactionLineItem.price_id; + this.quantity = transactionLineItem.quantity; + this.proration = transactionLineItem.proration + ? new TransactionProrationNotification(transactionLineItem.proration) + : null; + this.taxRate = transactionLineItem.tax_rate; + this.unitTotals = transactionLineItem.unit_totals + ? new UnitTotalsNotification(transactionLineItem.unit_totals) + : null; + this.totals = transactionLineItem.totals ? new TotalsNotification(transactionLineItem.totals) : null; + this.product = transactionLineItem.product ? new ProductNotification(transactionLineItem.product) : null; + } +} diff --git a/src/notifications/entities/transaction/transaction-notification.ts b/src/notifications/entities/transaction/transaction-notification.ts new file mode 100644 index 0000000..5e6609b --- /dev/null +++ b/src/notifications/entities/transaction/transaction-notification.ts @@ -0,0 +1,71 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + BillingDetailsNotification, + TransactionsTimePeriodNotification, + TransactionItemNotification, + TransactionDetailsNotification, + TransactionPaymentAttemptNotification, + TransactionCheckoutNotification, +} from '../index'; +import { type TransactionStatus, type CurrencyCode, type TransactionOrigin, type CollectionMode } from '../../../enums'; +import { type ITransactionNotificationResponse } from '../../types'; +import { type CustomData } from '../../../entities'; + +export class TransactionNotification { + public readonly id: string; + public readonly status: TransactionStatus; + public readonly customerId: string | null; + public readonly addressId: string | null; + public readonly businessId: string | null; + public readonly customData: CustomData | null; + public readonly currencyCode: CurrencyCode; + public readonly origin: TransactionOrigin; + public readonly subscriptionId: string | null; + public readonly invoiceId: string | null; + public readonly invoiceNumber: string | null; + public readonly collectionMode: CollectionMode; + public readonly discountId: string | null; + public readonly billingDetails: BillingDetailsNotification | null; + public readonly billingPeriod: TransactionsTimePeriodNotification | null; + public readonly items: TransactionItemNotification[]; + public readonly details: TransactionDetailsNotification | null; + public readonly payments: TransactionPaymentAttemptNotification[]; + public readonly checkout: TransactionCheckoutNotification | null; + public readonly createdAt: string; + public readonly updatedAt: string; + public readonly billedAt: string | null; + + constructor(transaction: ITransactionNotificationResponse) { + this.id = transaction.id; + this.status = transaction.status; + this.customerId = transaction.customer_id ? transaction.customer_id : null; + this.addressId = transaction.address_id ? transaction.address_id : null; + this.businessId = transaction.business_id ? transaction.business_id : null; + this.customData = transaction.custom_data ? transaction.custom_data : null; + this.currencyCode = transaction.currency_code; + this.origin = transaction.origin; + this.subscriptionId = transaction.subscription_id ? transaction.subscription_id : null; + this.invoiceId = transaction.invoice_id ? transaction.invoice_id : null; + this.invoiceNumber = transaction.invoice_number ? transaction.invoice_number : null; + this.collectionMode = transaction.collection_mode; + this.discountId = transaction.discount_id ? transaction.discount_id : null; + this.billingDetails = transaction.billing_details + ? new BillingDetailsNotification(transaction.billing_details) + : null; + this.billingPeriod = transaction.billing_period + ? new TransactionsTimePeriodNotification(transaction.billing_period) + : null; + this.items = transaction.items.map((item) => new TransactionItemNotification(item)); + this.details = transaction.details ? new TransactionDetailsNotification(transaction.details) : null; + this.payments = transaction.payments.map((payment) => new TransactionPaymentAttemptNotification(payment)); + this.checkout = transaction.checkout ? new TransactionCheckoutNotification(transaction.checkout) : null; + this.createdAt = transaction.created_at; + this.updatedAt = transaction.updated_at; + this.billedAt = transaction.billed_at ? transaction.billed_at : null; + } +} diff --git a/src/notifications/entities/transaction/transaction-proration-notification.ts b/src/notifications/entities/transaction/transaction-proration-notification.ts new file mode 100644 index 0000000..5b101d1 --- /dev/null +++ b/src/notifications/entities/transaction/transaction-proration-notification.ts @@ -0,0 +1,20 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionProrationNotificationResponse } from '../../types'; +import { TransactionsTimePeriodNotification } from '../index'; + +export class TransactionProrationNotification { + public readonly rate: string; + public readonly billingPeriod: TransactionsTimePeriodNotification | null; + + constructor(transactionProration: ITransactionProrationNotificationResponse) { + this.rate = transactionProration.rate; + this.billingPeriod = transactionProration.billing_period + ? new TransactionsTimePeriodNotification(transactionProration.billing_period) + : null; + } +} diff --git a/src/notifications/entities/transaction/transactions-time-period-notification.ts b/src/notifications/entities/transaction/transactions-time-period-notification.ts new file mode 100644 index 0000000..6010e00 --- /dev/null +++ b/src/notifications/entities/transaction/transactions-time-period-notification.ts @@ -0,0 +1,17 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionsTimePeriodNotificationResponse } from '../../types'; + +export class TransactionsTimePeriodNotification { + public readonly startsAt: string; + public readonly endsAt: string; + + constructor(transactionsTimePeriod: ITransactionsTimePeriodNotificationResponse) { + this.startsAt = transactionsTimePeriod.starts_at; + this.endsAt = transactionsTimePeriod.ends_at; + } +} diff --git a/src/notifications/events/address/address-created-event.ts b/src/notifications/events/address/address-created-event.ts index f1daa0d..6fdb497 100644 --- a/src/notifications/events/address/address-created-event.ts +++ b/src/notifications/events/address/address-created-event.ts @@ -3,17 +3,19 @@ * Do not make changes to this file. * Changes may be overwritten as part of auto-generation. */ -import { Address } from '../../../entities'; -import { type IAddressResponse, type IEventsResponse } from '../../../types'; + +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; import { Event } from '../../../entities/events/event'; +import { AddressNotification } from '../../entities'; +import { type IAddressNotificationResponse } from '../../types'; export class AddressCreatedEvent extends Event { public override readonly eventType = EventName.AddressCreated; - public override readonly data: Address; + public override readonly data: AddressNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Address(response.data); + this.data = new AddressNotification(response.data); } } diff --git a/src/notifications/events/address/address-imported-event.ts b/src/notifications/events/address/address-imported-event.ts index 2df5734..207edd7 100644 --- a/src/notifications/events/address/address-imported-event.ts +++ b/src/notifications/events/address/address-imported-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Address } from '../../../entities'; -import { type IAddressResponse, type IEventsResponse } from '../../../types'; +import { AddressNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IAddressNotificationResponse } from '../../types'; export class AddressImportedEvent extends Event { public override readonly eventType = EventName.AddressImported; - public override readonly data: Address; + public override readonly data: AddressNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Address(response.data); + this.data = new AddressNotification(response.data); } } diff --git a/src/notifications/events/address/address-updated-event.ts b/src/notifications/events/address/address-updated-event.ts index 7abc8b6..19c3af8 100644 --- a/src/notifications/events/address/address-updated-event.ts +++ b/src/notifications/events/address/address-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Address } from '../../../entities'; -import { type IAddressResponse, type IEventsResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { AddressNotification } from '../../entities'; +import { type IAddressNotificationResponse } from '../../types'; export class AddressUpdatedEvent extends Event { public override readonly eventType = EventName.AddressUpdated; - public override readonly data: Address; + public override readonly data: AddressNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Address(response.data); + this.data = new AddressNotification(response.data); } } diff --git a/src/notifications/events/adjustment/adjustment-created-event.ts b/src/notifications/events/adjustment/adjustment-created-event.ts index b96a7b4..7a16cab 100644 --- a/src/notifications/events/adjustment/adjustment-created-event.ts +++ b/src/notifications/events/adjustment/adjustment-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Adjustment } from '../../../entities'; -import { type IAdjustmentResponse, type IEventsResponse } from '../../../types'; +import { AdjustmentNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IAdjustmentNotificationResponse } from '../../types'; export class AdjustmentCreatedEvent extends Event { public override readonly eventType = EventName.AdjustmentCreated; - public override readonly data: Adjustment; + public override readonly data: AdjustmentNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Adjustment(response.data); + this.data = new AdjustmentNotification(response.data); } } diff --git a/src/notifications/events/adjustment/adjustment-updated-event.ts b/src/notifications/events/adjustment/adjustment-updated-event.ts index 1da3a43..eaa367e 100644 --- a/src/notifications/events/adjustment/adjustment-updated-event.ts +++ b/src/notifications/events/adjustment/adjustment-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Adjustment } from '../../../entities'; -import { type IAdjustmentResponse, type IEventsResponse } from '../../../types'; +import { AdjustmentNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IAdjustmentNotificationResponse } from '../../types'; export class AdjustmentUpdatedEvent extends Event { public override readonly eventType = EventName.AdjustmentUpdated; - public override readonly data: Adjustment; + public override readonly data: AdjustmentNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Adjustment(response.data); + this.data = new AdjustmentNotification(response.data); } } diff --git a/src/notifications/events/business/business-created-event.ts b/src/notifications/events/business/business-created-event.ts index 0fbc15d..0b48f82 100644 --- a/src/notifications/events/business/business-created-event.ts +++ b/src/notifications/events/business/business-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Business } from '../../../entities'; -import { type IBusinessResponse, type IEventsResponse } from '../../../types'; +import { BusinessNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IBusinessNotificationResponse } from '../../types'; export class BusinessCreatedEvent extends Event { public override readonly eventType = EventName.BusinessCreated; - public override readonly data: Business; + public override readonly data: BusinessNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Business(response.data); + this.data = new BusinessNotification(response.data); } } diff --git a/src/notifications/events/business/business-imported-event.ts b/src/notifications/events/business/business-imported-event.ts index 1da1790..a6a7fb1 100644 --- a/src/notifications/events/business/business-imported-event.ts +++ b/src/notifications/events/business/business-imported-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Business } from '../../../entities'; -import { type IBusinessResponse, type IEventsResponse } from '../../../types'; +import { BusinessNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IBusinessNotificationResponse } from '../../types'; export class BusinessImportedEvent extends Event { public override readonly eventType = EventName.BusinessImported; - public override readonly data: Business; + public override readonly data: BusinessNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Business(response.data); + this.data = new BusinessNotification(response.data); } } diff --git a/src/notifications/events/business/business-updated-event.ts b/src/notifications/events/business/business-updated-event.ts index 60b76ee..bffa1d8 100644 --- a/src/notifications/events/business/business-updated-event.ts +++ b/src/notifications/events/business/business-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Business } from '../../../entities'; -import { type IBusinessResponse, type IEventsResponse } from '../../../types'; +import { BusinessNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IBusinessNotificationResponse } from '../../types'; export class BusinessUpdatedEvent extends Event { public override readonly eventType = EventName.BusinessUpdated; - public override readonly data: Business; + public override readonly data: BusinessNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Business(response.data); + this.data = new BusinessNotification(response.data); } } diff --git a/src/notifications/events/customer/customer-created-event.ts b/src/notifications/events/customer/customer-created-event.ts index be81099..29876ae 100644 --- a/src/notifications/events/customer/customer-created-event.ts +++ b/src/notifications/events/customer/customer-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Customer } from '../../../entities'; -import { type ICustomerResponse, type IEventsResponse } from '../../../types'; +import { CustomerNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type ICustomerNotificationResponse } from '../../types'; export class CustomerCreatedEvent extends Event { public override readonly eventType = EventName.CustomerCreated; - public override readonly data: Customer; + public override readonly data: CustomerNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Customer(response.data); + this.data = new CustomerNotification(response.data); } } diff --git a/src/notifications/events/customer/customer-imported-event.ts b/src/notifications/events/customer/customer-imported-event.ts index 0b1a680..6953368 100644 --- a/src/notifications/events/customer/customer-imported-event.ts +++ b/src/notifications/events/customer/customer-imported-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Customer } from '../../../entities'; -import { type ICustomerResponse, type IEventsResponse } from '../../../types'; +import { CustomerNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type ICustomerNotificationResponse } from '../../types'; export class CustomerImportedEvent extends Event { public override readonly eventType = EventName.CustomerImported; - public override readonly data: Customer; + public override readonly data: CustomerNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Customer(response.data); + this.data = new CustomerNotification(response.data); } } diff --git a/src/notifications/events/customer/customer-updated-event.ts b/src/notifications/events/customer/customer-updated-event.ts index 67daca0..f19ef8a 100644 --- a/src/notifications/events/customer/customer-updated-event.ts +++ b/src/notifications/events/customer/customer-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Customer } from '../../../entities'; -import { type ICustomerResponse, type IEventsResponse } from '../../../types'; +import { CustomerNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type ICustomerNotificationResponse } from '../../types'; export class CustomerUpdatedEvent extends Event { public override readonly eventType = EventName.CustomerUpdated; - public override readonly data: Customer; + public override readonly data: CustomerNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Customer(response.data); + this.data = new CustomerNotification(response.data); } } diff --git a/src/notifications/events/discount/discount-created-event.ts b/src/notifications/events/discount/discount-created-event.ts index adaef6c..61cee74 100644 --- a/src/notifications/events/discount/discount-created-event.ts +++ b/src/notifications/events/discount/discount-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Discount } from '../../../entities'; -import { type IDiscountResponse, type IEventsResponse } from '../../../types'; +import { DiscountNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IDiscountNotificationResponse } from '../../types'; export class DiscountCreatedEvent extends Event { public override readonly eventType = EventName.DiscountCreated; - public override readonly data: Discount; + public override readonly data: DiscountNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Discount(response.data); + this.data = new DiscountNotification(response.data); } } diff --git a/src/notifications/events/discount/discount-imported-event.ts b/src/notifications/events/discount/discount-imported-event.ts index f4a3210..83edfec 100644 --- a/src/notifications/events/discount/discount-imported-event.ts +++ b/src/notifications/events/discount/discount-imported-event.ts @@ -4,16 +4,17 @@ * Changes may be overwritten as part of auto-generation. */ import { Event } from '../../../entities/events/event'; -import { Discount } from '../../../entities'; -import { type IDiscountResponse, type IEventsResponse } from '../../../types'; +import { DiscountNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IDiscountNotificationResponse } from '../../types'; export class DiscountImportedEvent extends Event { public override readonly eventType = EventName.DiscountImported; - public override readonly data: Discount; + public override readonly data: DiscountNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Discount(response.data); + this.data = new DiscountNotification(response.data); } } diff --git a/src/notifications/events/discount/discount-updated-event.ts b/src/notifications/events/discount/discount-updated-event.ts index f5f66ee..d60e338 100644 --- a/src/notifications/events/discount/discount-updated-event.ts +++ b/src/notifications/events/discount/discount-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Discount } from '../../../entities'; -import { type IDiscountResponse, type IEventsResponse } from '../../../types'; +import { DiscountNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IDiscountNotificationResponse } from '../../types'; export class DiscountUpdatedEvent extends Event { public override readonly eventType = EventName.DiscountUpdated; - public override readonly data: Discount; + public override readonly data: DiscountNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Discount(response.data); + this.data = new DiscountNotification(response.data); } } diff --git a/src/notifications/events/payout/payout-created-event.ts b/src/notifications/events/payout/payout-created-event.ts index d498183..a9920d8 100644 --- a/src/notifications/events/payout/payout-created-event.ts +++ b/src/notifications/events/payout/payout-created-event.ts @@ -4,16 +4,17 @@ * Changes may be overwritten as part of auto-generation. */ import { Event } from '../../../entities/events/event'; -import { Payout } from '../../../entities'; -import { type IEventsResponse, type IPayoutResponse } from '../../../types'; +import { PayoutNotification } from '../../entities'; +import { type IEventsResponse } from '../../../types'; import { EventName } from '../../helpers'; +import { type IPayoutNotificationResponse } from '../../types'; export class PayoutCreatedEvent extends Event { public override readonly eventType = EventName.PayoutCreated; - public override readonly data: Payout; + public override readonly data: PayoutNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Payout(response.data); + this.data = new PayoutNotification(response.data); } } diff --git a/src/notifications/events/payout/payout-paid-event.ts b/src/notifications/events/payout/payout-paid-event.ts index 226a914..e928251 100644 --- a/src/notifications/events/payout/payout-paid-event.ts +++ b/src/notifications/events/payout/payout-paid-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Payout } from '../../../entities'; +import { PayoutNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IPayoutResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IPayoutNotificationResponse } from '../../types'; export class PayoutPaidEvent extends Event { public override readonly eventType = EventName.PayoutPaid; - public override readonly data: Payout; + public override readonly data: PayoutNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Payout(response.data); + this.data = new PayoutNotification(response.data); } } diff --git a/src/notifications/events/price/price-created-event.ts b/src/notifications/events/price/price-created-event.ts index e36a454..3285e3e 100644 --- a/src/notifications/events/price/price-created-event.ts +++ b/src/notifications/events/price/price-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Price } from '../../../entities'; +import { PriceNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IPriceResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IPriceNotificationResponse } from '../../types'; export class PriceCreatedEvent extends Event { public override readonly eventType = EventName.PriceCreated; - public override readonly data: Price; + public override readonly data: PriceNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Price(response.data); + this.data = new PriceNotification(response.data); } } diff --git a/src/notifications/events/price/price-imported-event.ts b/src/notifications/events/price/price-imported-event.ts index 77ebf6d..c0d3783 100644 --- a/src/notifications/events/price/price-imported-event.ts +++ b/src/notifications/events/price/price-imported-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Price } from '../../../entities'; +import { PriceNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IPriceResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IPriceNotificationResponse } from '../../types'; export class PriceImportedEvent extends Event { public override readonly eventType = EventName.PriceImported; - public override readonly data: Price; + public override readonly data: PriceNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Price(response.data); + this.data = new PriceNotification(response.data); } } diff --git a/src/notifications/events/price/price-updated-event.ts b/src/notifications/events/price/price-updated-event.ts index 35833f0..0f9fc62 100644 --- a/src/notifications/events/price/price-updated-event.ts +++ b/src/notifications/events/price/price-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Price } from '../../../entities'; +import { PriceNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IPriceResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IPriceNotificationResponse } from '../../types'; export class PriceUpdatedEvent extends Event { public override readonly eventType = EventName.PriceUpdated; - public override readonly data: Price; + public override readonly data: PriceNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Price(response.data); + this.data = new PriceNotification(response.data); } } diff --git a/src/notifications/events/product/product-created-event.ts b/src/notifications/events/product/product-created-event.ts index f1ac9a0..22df41f 100644 --- a/src/notifications/events/product/product-created-event.ts +++ b/src/notifications/events/product/product-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Product } from '../../../entities'; +import { ProductNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IProductResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IProductNotificationResponse } from '../../types'; export class ProductCreatedEvent extends Event { public override readonly eventType = EventName.ProductCreated; - public override readonly data: Product; + public override readonly data: ProductNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Product(response.data); + this.data = new ProductNotification(response.data); } } diff --git a/src/notifications/events/product/product-imported-event.ts b/src/notifications/events/product/product-imported-event.ts index 27937b1..a182a32 100644 --- a/src/notifications/events/product/product-imported-event.ts +++ b/src/notifications/events/product/product-imported-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Product } from '../../../entities'; +import { ProductNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IProductResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IProductNotificationResponse } from '../../types'; export class ProductImportedEvent extends Event { public override readonly eventType = EventName.ProductImported; - public override readonly data: Product; + public override readonly data: ProductNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Product(response.data); + this.data = new ProductNotification(response.data); } } diff --git a/src/notifications/events/product/product-updated-event.ts b/src/notifications/events/product/product-updated-event.ts index d87f9d7..3e66f77 100644 --- a/src/notifications/events/product/product-updated-event.ts +++ b/src/notifications/events/product/product-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Product } from '../../../entities'; +import { ProductNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IProductResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IProductNotificationResponse } from '../../types'; export class ProductUpdatedEvent extends Event { public override readonly eventType = EventName.ProductUpdated; - public override readonly data: Product; + public override readonly data: ProductNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Product(response.data); + this.data = new ProductNotification(response.data); } } diff --git a/src/notifications/events/report/report-created-event.ts b/src/notifications/events/report/report-created-event.ts index 5399d93..f1417d8 100644 --- a/src/notifications/events/report/report-created-event.ts +++ b/src/notifications/events/report/report-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Report } from '../../../entities'; +import { ReportNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IReportResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IReportNotificationResponse } from '../../types'; export class ReportCreatedEvent extends Event { public override readonly eventType = EventName.ReportCreated; - public override readonly data: Report; + public override readonly data: ReportNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Report(response.data); + this.data = new ReportNotification(response.data); } } diff --git a/src/notifications/events/report/report-updated-event.ts b/src/notifications/events/report/report-updated-event.ts index d6fe911..f22ad6b 100644 --- a/src/notifications/events/report/report-updated-event.ts +++ b/src/notifications/events/report/report-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Report } from '../../../entities'; +import { ReportNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type IReportResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type IReportNotificationResponse } from '../../types'; export class ReportUpdatedEvent extends Event { public override readonly eventType = EventName.ReportUpdated; - public override readonly data: Report; + public override readonly data: ReportNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Report(response.data); + this.data = new ReportNotification(response.data); } } diff --git a/src/notifications/events/subscription/subscription-activated-event.ts b/src/notifications/events/subscription/subscription-activated-event.ts index 95a6e0c..f5696e6 100644 --- a/src/notifications/events/subscription/subscription-activated-event.ts +++ b/src/notifications/events/subscription/subscription-activated-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionActivatedEvent extends Event { public override readonly eventType = EventName.SubscriptionActivated; diff --git a/src/notifications/events/subscription/subscription-canceled-event.ts b/src/notifications/events/subscription/subscription-canceled-event.ts index 2cce641..1d91254 100644 --- a/src/notifications/events/subscription/subscription-canceled-event.ts +++ b/src/notifications/events/subscription/subscription-canceled-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionCanceledEvent extends Event { public override readonly eventType = EventName.SubscriptionCanceled; diff --git a/src/notifications/events/subscription/subscription-created-event.ts b/src/notifications/events/subscription/subscription-created-event.ts index 03ebf3d..dedf296 100644 --- a/src/notifications/events/subscription/subscription-created-event.ts +++ b/src/notifications/events/subscription/subscription-created-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionCreatedEvent extends Event { public override readonly eventType = EventName.SubscriptionCreated; diff --git a/src/notifications/events/subscription/subscription-imported-event.ts b/src/notifications/events/subscription/subscription-imported-event.ts index 192c9c4..5a592c8 100644 --- a/src/notifications/events/subscription/subscription-imported-event.ts +++ b/src/notifications/events/subscription/subscription-imported-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionImportedEvent extends Event { public override readonly eventType = EventName.SubscriptionImported; diff --git a/src/notifications/events/subscription/subscription-past-due-event.ts b/src/notifications/events/subscription/subscription-past-due-event.ts index 7e75c4c..1bc438b 100644 --- a/src/notifications/events/subscription/subscription-past-due-event.ts +++ b/src/notifications/events/subscription/subscription-past-due-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionPastDueEvent extends Event { public override readonly eventType = EventName.SubscriptionPastDue; diff --git a/src/notifications/events/subscription/subscription-paused-event.ts b/src/notifications/events/subscription/subscription-paused-event.ts index d07b4b8..e9d58a4 100644 --- a/src/notifications/events/subscription/subscription-paused-event.ts +++ b/src/notifications/events/subscription/subscription-paused-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionPausedEvent extends Event { public override readonly eventType = EventName.SubscriptionPaused; diff --git a/src/notifications/events/subscription/subscription-resumed-event.ts b/src/notifications/events/subscription/subscription-resumed-event.ts index 1ee067d..539b83d 100644 --- a/src/notifications/events/subscription/subscription-resumed-event.ts +++ b/src/notifications/events/subscription/subscription-resumed-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionResumedEvent extends Event { public override readonly eventType = EventName.SubscriptionResumed; diff --git a/src/notifications/events/subscription/subscription-trialing-event.ts b/src/notifications/events/subscription/subscription-trialing-event.ts index b48b984..a036b37 100644 --- a/src/notifications/events/subscription/subscription-trialing-event.ts +++ b/src/notifications/events/subscription/subscription-trialing-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionTrialingEvent extends Event { public override readonly eventType = EventName.SubscriptionTrialing; diff --git a/src/notifications/events/subscription/subscription-updated-event.ts b/src/notifications/events/subscription/subscription-updated-event.ts index 45ef38a..b1ab903 100644 --- a/src/notifications/events/subscription/subscription-updated-event.ts +++ b/src/notifications/events/subscription/subscription-updated-event.ts @@ -5,9 +5,10 @@ */ import { Event } from '../../../entities/events/event'; -import { SubscriptionNotification } from '../../../entities'; +import { SubscriptionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ISubscriptionNotificationResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ISubscriptionNotificationResponse } from '../../types'; export class SubscriptionUpdatedEvent extends Event { public override readonly eventType = EventName.SubscriptionUpdated; diff --git a/src/notifications/events/transaction/transaction-billed-event.ts b/src/notifications/events/transaction/transaction-billed-event.ts index 1448797..6429172 100644 --- a/src/notifications/events/transaction/transaction-billed-event.ts +++ b/src/notifications/events/transaction/transaction-billed-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionBilledEvent extends Event { public override readonly eventType = EventName.TransactionBilled; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-canceled-event.ts b/src/notifications/events/transaction/transaction-canceled-event.ts index c88a88e..3553103 100644 --- a/src/notifications/events/transaction/transaction-canceled-event.ts +++ b/src/notifications/events/transaction/transaction-canceled-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionCanceledEvent extends Event { public override readonly eventType = EventName.TransactionCanceled; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-completed-event.ts b/src/notifications/events/transaction/transaction-completed-event.ts index 7eab3fb..2bb4d4d 100644 --- a/src/notifications/events/transaction/transaction-completed-event.ts +++ b/src/notifications/events/transaction/transaction-completed-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionCompletedEvent extends Event { public override readonly eventType = EventName.TransactionCompleted; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-created-event.ts b/src/notifications/events/transaction/transaction-created-event.ts index 8102d6b..524bd9f 100644 --- a/src/notifications/events/transaction/transaction-created-event.ts +++ b/src/notifications/events/transaction/transaction-created-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionCreatedEvent extends Event { public override readonly eventType = EventName.TransactionCreated; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-paid-event.ts b/src/notifications/events/transaction/transaction-paid-event.ts index 2006615..d454a1e 100644 --- a/src/notifications/events/transaction/transaction-paid-event.ts +++ b/src/notifications/events/transaction/transaction-paid-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionPaidEvent extends Event { public override readonly eventType = EventName.TransactionPaid; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-past-due-event.ts b/src/notifications/events/transaction/transaction-past-due-event.ts index 69acfce..53667a4 100644 --- a/src/notifications/events/transaction/transaction-past-due-event.ts +++ b/src/notifications/events/transaction/transaction-past-due-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionPastDueEvent extends Event { public override readonly eventType = EventName.TransactionPastDue; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-payment-failed-event.ts b/src/notifications/events/transaction/transaction-payment-failed-event.ts index ee4059b..1eb52cd 100644 --- a/src/notifications/events/transaction/transaction-payment-failed-event.ts +++ b/src/notifications/events/transaction/transaction-payment-failed-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionPaymentFailedEvent extends Event { public override readonly eventType = EventName.TransactionPaymentFailed; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-ready-event.ts b/src/notifications/events/transaction/transaction-ready-event.ts index 474e9ab..1663853 100644 --- a/src/notifications/events/transaction/transaction-ready-event.ts +++ b/src/notifications/events/transaction/transaction-ready-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionReadyEvent extends Event { public override readonly eventType = EventName.TransactionReady; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/events/transaction/transaction-updated-event.ts b/src/notifications/events/transaction/transaction-updated-event.ts index d6bc879..4ee128d 100644 --- a/src/notifications/events/transaction/transaction-updated-event.ts +++ b/src/notifications/events/transaction/transaction-updated-event.ts @@ -5,16 +5,17 @@ */ import { Event } from '../../../entities/events/event'; -import { Transaction } from '../../../entities'; +import { TransactionNotification } from '../../entities'; import { EventName } from '../../helpers'; -import { type IEventsResponse, type ITransactionResponse } from '../../../types'; +import { type IEventsResponse } from '../../../types'; +import { type ITransactionNotificationResponse } from '../../types'; export class TransactionUpdatedEvent extends Event { public override readonly eventType = EventName.TransactionUpdated; - public override readonly data: Transaction; + public override readonly data: TransactionNotification; - constructor(response: IEventsResponse) { + constructor(response: IEventsResponse) { super(response); - this.data = new Transaction(response.data); + this.data = new TransactionNotification(response.data); } } diff --git a/src/notifications/helpers/webhooks.ts b/src/notifications/helpers/webhooks.ts index b3c1e1e..fbbabe2 100644 --- a/src/notifications/helpers/webhooks.ts +++ b/src/notifications/helpers/webhooks.ts @@ -1,13 +1,15 @@ import { type IEvents } from '../../types'; import { AddressCreatedEvent, - AddressUpdatedEvent, AddressImportedEvent, + AddressUpdatedEvent, AdjustmentCreatedEvent, AdjustmentUpdatedEvent, BusinessCreatedEvent, + BusinessImportedEvent, BusinessUpdatedEvent, CustomerCreatedEvent, + CustomerImportedEvent, CustomerUpdatedEvent, DiscountCreatedEvent, DiscountImportedEvent, @@ -15,8 +17,10 @@ import { PayoutCreatedEvent, PayoutPaidEvent, PriceCreatedEvent, + PriceImportedEvent, PriceUpdatedEvent, ProductCreatedEvent, + ProductImportedEvent, ProductUpdatedEvent, ReportCreatedEvent, ReportUpdatedEvent, @@ -38,10 +42,6 @@ import { TransactionPaymentFailedEvent, TransactionReadyEvent, TransactionUpdatedEvent, - BusinessImportedEvent, - CustomerImportedEvent, - PriceImportedEvent, - ProductImportedEvent, } from '../events'; import { type EventEntity, EventName } from './types'; import { WebhooksValidator } from './webhooks-validator'; diff --git a/src/notifications/index.ts b/src/notifications/index.ts index 035d37c..1ee0753 100644 --- a/src/notifications/index.ts +++ b/src/notifications/index.ts @@ -1,2 +1,4 @@ export * from './helpers'; export * from './events'; +export * from './types'; +export * from './entities'; diff --git a/src/notifications/types/address/address-notification-response.ts b/src/notifications/types/address/address-notification-response.ts new file mode 100644 index 0000000..0d21315 --- /dev/null +++ b/src/notifications/types/address/address-notification-response.ts @@ -0,0 +1,23 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ +import { type CountryCode, type Status } from '../../../enums'; +import { type ICustomData, type IImportMetaResponse } from '../../../types'; + +export interface IAddressNotificationResponse { + id: string; + description?: string | null; + first_line?: string | null; + second_line?: string | null; + city?: string | null; + postal_code?: string | null; + region?: string | null; + country_code: CountryCode; + custom_data?: ICustomData | null; + status: Status; + created_at: string; + updated_at: string; + import_meta?: IImportMetaResponse | null; +} diff --git a/src/notifications/types/address/index.ts b/src/notifications/types/address/index.ts new file mode 100644 index 0000000..76163f4 --- /dev/null +++ b/src/notifications/types/address/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './address-notification-response'; diff --git a/src/notifications/types/adjustment/adjustment-item-notification-response.ts b/src/notifications/types/adjustment/adjustment-item-notification-response.ts new file mode 100644 index 0000000..79f4107 --- /dev/null +++ b/src/notifications/types/adjustment/adjustment-item-notification-response.ts @@ -0,0 +1,20 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type IAdjustmentItemTotalsNotificationResponse, + type IAdjustmentsProrationNotificationResponse, +} from '../index'; +import { type AdjustmentType } from '../../../enums'; + +export interface IAdjustmentItemNotificationResponse { + id: string; + item_id: string; + 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 new file mode 100644 index 0000000..25a330e --- /dev/null +++ b/src/notifications/types/adjustment/adjustment-notification-response.ts @@ -0,0 +1,29 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type IAdjustmentItemNotificationResponse, + type ITotalAdjustmentsNotificationResponse, + type IPayoutTotalsAdjustmentNotificationResponse, +} from '../index'; +import { type AdjustmentAction, type CurrencyCode, type AdjustmentStatus } from '../../../enums'; + +export interface IAdjustmentNotificationResponse { + id: string; + action: AdjustmentAction; + transaction_id: string; + subscription_id?: string | null; + customer_id: string; + reason: string; + credit_applied_to_balance: boolean; + currency_code: CurrencyCode; + status: AdjustmentStatus; + items: IAdjustmentItemNotificationResponse[]; + totals: ITotalAdjustmentsNotificationResponse; + payout_totals?: IPayoutTotalsAdjustmentNotificationResponse | null; + created_at: string; + updated_at: string; +} diff --git a/src/notifications/types/adjustment/adjustment-totals-breakdown-notification.ts b/src/notifications/types/adjustment/adjustment-totals-breakdown-notification.ts new file mode 100644 index 0000000..b27e7be --- /dev/null +++ b/src/notifications/types/adjustment/adjustment-totals-breakdown-notification.ts @@ -0,0 +1,11 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface IAdjustmentTotalsBreakdownNotification { + credit: string; + refund: string; + chargeback: string; +} diff --git a/src/notifications/types/adjustment/adjustment-totals-notification-response.ts b/src/notifications/types/adjustment/adjustment-totals-notification-response.ts new file mode 100644 index 0000000..4118bf8 --- /dev/null +++ b/src/notifications/types/adjustment/adjustment-totals-notification-response.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentTotalsBreakdownNotification } from '../index'; +import { type CurrencyCode } from '../../../enums'; + +export interface IAdjustmentItemTotalsNotificationResponse { + subtotal: string; + tax: string; + total: string; + fee: string; + earnings: string; + breakdown?: IAdjustmentTotalsBreakdownNotification | null; + currency_code: CurrencyCode; +} diff --git a/src/notifications/types/adjustment/adjustments-proration-notification-response.ts b/src/notifications/types/adjustment/adjustments-proration-notification-response.ts new file mode 100644 index 0000000..e375a4c --- /dev/null +++ b/src/notifications/types/adjustment/adjustments-proration-notification-response.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentsTimePeriodNotificationResponse } from '../index'; + +export interface IAdjustmentsProrationNotificationResponse { + rate: string; + billing_period?: IAdjustmentsTimePeriodNotificationResponse | null; +} diff --git a/src/notifications/types/adjustment/adjustments-time-period-notification-response.ts b/src/notifications/types/adjustment/adjustments-time-period-notification-response.ts new file mode 100644 index 0000000..e90dd22 --- /dev/null +++ b/src/notifications/types/adjustment/adjustments-time-period-notification-response.ts @@ -0,0 +1,10 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface IAdjustmentsTimePeriodNotificationResponse { + starts_at: string; + ends_at: string; +} diff --git a/src/notifications/types/adjustment/index.ts b/src/notifications/types/adjustment/index.ts new file mode 100644 index 0000000..5a83cb8 --- /dev/null +++ b/src/notifications/types/adjustment/index.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './adjustments-time-period-notification-response'; +export * from './adjustments-proration-notification-response'; +export * from './adjustment-item-notification-response'; +export * from './adjustment-notification-response'; +export * from './adjustment-totals-breakdown-notification'; +export * from './adjustment-totals-notification-response'; diff --git a/src/notifications/types/business/business-notification-response.ts b/src/notifications/types/business/business-notification-response.ts new file mode 100644 index 0000000..badf57f --- /dev/null +++ b/src/notifications/types/business/business-notification-response.ts @@ -0,0 +1,22 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IBusinessContactsNotification, type IImportMetaNotificationResponse } from '../index'; +import { type Status } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface IBusinessNotificationResponse { + id: string; + name: string; + company_number?: string | null; + tax_identifier?: string | null; + status: Status; + contacts?: IBusinessContactsNotification[] | null; + created_at: string; + updated_at: string; + custom_data?: ICustomData | null; + import_meta?: IImportMetaNotificationResponse | null; +} diff --git a/src/notifications/types/business/businesses-contacts-notification.ts b/src/notifications/types/business/businesses-contacts-notification.ts new file mode 100644 index 0000000..ee7d0a0 --- /dev/null +++ b/src/notifications/types/business/businesses-contacts-notification.ts @@ -0,0 +1,10 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface IBusinessContactsNotification { + name?: string | null; + email: string; +} diff --git a/src/notifications/types/business/index.ts b/src/notifications/types/business/index.ts new file mode 100644 index 0000000..e1c1ef2 --- /dev/null +++ b/src/notifications/types/business/index.ts @@ -0,0 +1,8 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './businesses-contacts-notification'; +export * from './business-notification-response'; diff --git a/src/notifications/types/customer/customer-notification-response.ts b/src/notifications/types/customer/customer-notification-response.ts new file mode 100644 index 0000000..0fbf237 --- /dev/null +++ b/src/notifications/types/customer/customer-notification-response.ts @@ -0,0 +1,22 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IImportMetaNotificationResponse } from '../index'; +import { type Status } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface ICustomerNotificationResponse { + id: string; + name?: string | null; + email: string; + marketing_consent: boolean; + status: Status; + custom_data?: ICustomData | null; + locale: string; + created_at: string; + updated_at: string; + import_meta?: IImportMetaNotificationResponse | null; +} diff --git a/src/notifications/types/customer/index.ts b/src/notifications/types/customer/index.ts new file mode 100644 index 0000000..478afe7 --- /dev/null +++ b/src/notifications/types/customer/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './customer-notification-response'; diff --git a/src/notifications/types/discount/discount-notification-response.ts b/src/notifications/types/discount/discount-notification-response.ts new file mode 100644 index 0000000..744e5fb --- /dev/null +++ b/src/notifications/types/discount/discount-notification-response.ts @@ -0,0 +1,30 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type CurrencyCode, type DiscountStatus, type DiscountType } from '../../../enums'; +import { type IImportMetaNotificationResponse } from '../shared'; +import { type ICustomData } from '../../../types'; + +export interface IDiscountNotificationResponse { + id: string; + status: DiscountStatus; + description: string; + enabled_for_checkout: boolean; + code?: string | null; + type: DiscountType; + amount: string; + currency_code?: CurrencyCode | null; + recur: boolean; + maximum_recurring_intervals?: number | null; + usage_limit?: number | null; + restrict_to?: string[] | null; + expires_at?: string | null; + custom_data?: ICustomData | null; + times_used: number; + created_at: string; + updated_at: string; + import_meta?: IImportMetaNotificationResponse | null; +} diff --git a/src/notifications/types/discount/index.ts b/src/notifications/types/discount/index.ts new file mode 100644 index 0000000..725bd46 --- /dev/null +++ b/src/notifications/types/discount/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './discount-notification-response'; diff --git a/src/notifications/types/index.ts b/src/notifications/types/index.ts new file mode 100644 index 0000000..d9837b8 --- /dev/null +++ b/src/notifications/types/index.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './product'; +export * from './price'; +export * from './transaction'; +export * from './adjustment'; +export * from './customer'; +export * from './business'; +export * from './subscription'; +export * from './address'; +export * from './discount'; +export * from './payout'; +export * from './report'; +export * from './shared'; diff --git a/src/notifications/types/payout/index.ts b/src/notifications/types/payout/index.ts new file mode 100644 index 0000000..365e674 --- /dev/null +++ b/src/notifications/types/payout/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './payout-notification-response'; diff --git a/src/notifications/types/payout/payout-notification-response.ts b/src/notifications/types/payout/payout-notification-response.ts new file mode 100644 index 0000000..a8e8974 --- /dev/null +++ b/src/notifications/types/payout/payout-notification-response.ts @@ -0,0 +1,13 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ +import { type CurrencyCode, type PayoutStatus } from '../../../enums'; + +export interface IPayoutNotificationResponse { + id: string; + status: PayoutStatus; + amount: string; + currency_code: CurrencyCode; +} diff --git a/src/notifications/types/price/index.ts b/src/notifications/types/price/index.ts new file mode 100644 index 0000000..aa80fdf --- /dev/null +++ b/src/notifications/types/price/index.ts @@ -0,0 +1,8 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './price-notification-response'; +export * from './price-quantity-notification'; diff --git a/src/notifications/types/price/price-notification-response.ts b/src/notifications/types/price/price-notification-response.ts new file mode 100644 index 0000000..b20685b --- /dev/null +++ b/src/notifications/types/price/price-notification-response.ts @@ -0,0 +1,34 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type ITimePeriodNotification, + type IMoneyNotificationResponse, + type IUnitPriceOverrideNotificationResponse, + type IPriceQuantityNotification, + type ISharedProductNotificationResponse, + type IImportMetaNotificationResponse, +} from '../index'; +import { type TaxMode, type Status, type CatalogType } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface IPriceNotificationResponse { + id: string; + product_id: string; + description: string; + type?: CatalogType | null; + name?: string | null; + billing_cycle?: ITimePeriodNotification | null; + trial_period?: ITimePeriodNotification | null; + tax_mode: TaxMode; + unit_price: IMoneyNotificationResponse; + unit_price_overrides: IUnitPriceOverrideNotificationResponse[]; + quantity: IPriceQuantityNotification; + status: Status; + custom_data?: ICustomData | null; + import_meta?: IImportMetaNotificationResponse | null; + product?: ISharedProductNotificationResponse | null; +} diff --git a/src/notifications/types/price/price-quantity-notification.ts b/src/notifications/types/price/price-quantity-notification.ts new file mode 100644 index 0000000..ffe38e9 --- /dev/null +++ b/src/notifications/types/price/price-quantity-notification.ts @@ -0,0 +1,10 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface IPriceQuantityNotification { + minimum: number; + maximum: number; +} diff --git a/src/notifications/types/product/index.ts b/src/notifications/types/product/index.ts new file mode 100644 index 0000000..d2b56fd --- /dev/null +++ b/src/notifications/types/product/index.ts @@ -0,0 +1,7 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './product-notification-response'; diff --git a/src/notifications/types/product/product-notification-response.ts b/src/notifications/types/product/product-notification-response.ts new file mode 100644 index 0000000..e82e105 --- /dev/null +++ b/src/notifications/types/product/product-notification-response.ts @@ -0,0 +1,23 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IImportMetaNotificationResponse, type ISharedPriceNotificationResponse } from '../index'; +import { type TaxCategory, type Status, type CatalogType } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface IProductNotificationResponse { + id: string; + name: string; + type?: CatalogType | null; + description?: string | null; + tax_category: TaxCategory; + image_url?: string | null; + custom_data?: ICustomData | null; + status: Status; + created_at: string; + import_meta?: IImportMetaNotificationResponse | null; + prices?: ISharedPriceNotificationResponse[] | null; +} diff --git a/src/notifications/types/report/index.ts b/src/notifications/types/report/index.ts new file mode 100644 index 0000000..253f452 --- /dev/null +++ b/src/notifications/types/report/index.ts @@ -0,0 +1,8 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './report-filters-notification-response'; +export * from './report-notification-response'; diff --git a/src/notifications/types/report/report-filters-notification-response.ts b/src/notifications/types/report/report-filters-notification-response.ts new file mode 100644 index 0000000..98ed28c --- /dev/null +++ b/src/notifications/types/report/report-filters-notification-response.ts @@ -0,0 +1,13 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ReportFilterName, type ReportFilterOperator } from '../../../enums'; + +export interface IReportFiltersNotification { + name: ReportFilterName; + operator?: null | ReportFilterOperator; + value: string[] | string; +} diff --git a/src/notifications/types/report/report-notification-response.ts b/src/notifications/types/report/report-notification-response.ts new file mode 100644 index 0000000..de02753 --- /dev/null +++ b/src/notifications/types/report/report-notification-response.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IReportFiltersNotification } from '../index'; +import { type ReportType, type ReportStatus } from '../../../enums'; + +export interface IReportNotificationResponse { + id: string; + status: ReportStatus; + rows?: number | null; + type: ReportType; + filters: IReportFiltersNotification[]; + expires_at?: string | null; + created_at: string; +} diff --git a/src/notifications/types/shared/adjustment-original-amount-notification-response.ts b/src/notifications/types/shared/adjustment-original-amount-notification-response.ts new file mode 100644 index 0000000..24d3f2f --- /dev/null +++ b/src/notifications/types/shared/adjustment-original-amount-notification-response.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type AdjustmentCurrencyCode } from '../../../enums'; + +export interface IAdjustmentOriginalAmountNotificationResponse { + amount: string; + currency_code: AdjustmentCurrencyCode; +} diff --git a/src/notifications/types/shared/billing-details-notification-response.ts b/src/notifications/types/shared/billing-details-notification-response.ts new file mode 100644 index 0000000..834aea6 --- /dev/null +++ b/src/notifications/types/shared/billing-details-notification-response.ts @@ -0,0 +1,14 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITimePeriodNotification } from '../index'; + +export interface IBillingDetailsNotificationResponse { + enable_checkout?: boolean | null; + purchase_order_number?: string | null; + additional_information?: string | null; + payment_terms: ITimePeriodNotification; +} diff --git a/src/notifications/types/shared/chargeback-fee.ts b/src/notifications/types/shared/chargeback-fee.ts new file mode 100644 index 0000000..254943f --- /dev/null +++ b/src/notifications/types/shared/chargeback-fee.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IAdjustmentOriginalAmountNotificationResponse } from '../index'; + +export interface IChargebackFeeNotification { + amount: string; + original?: IAdjustmentOriginalAmountNotificationResponse | null; +} diff --git a/src/notifications/types/shared/import-meta-notification-response.ts b/src/notifications/types/shared/import-meta-notification-response.ts new file mode 100644 index 0000000..492933b --- /dev/null +++ b/src/notifications/types/shared/import-meta-notification-response.ts @@ -0,0 +1,10 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface IImportMetaNotificationResponse { + external_id?: string | null; + imported_from: string; +} diff --git a/src/notifications/types/shared/index.ts b/src/notifications/types/shared/index.ts new file mode 100644 index 0000000..584eb09 --- /dev/null +++ b/src/notifications/types/shared/index.ts @@ -0,0 +1,28 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './time-period-notification'; +export * from './money-notification-response'; +export * from './unit-price-override-notification-response'; +export * from './shared-price-notification-response'; +export * from './shared-product-notification-response'; +export * from './billing-details-notification-response'; +export * from './totals'; +export * from './tax-rates-used-notification-response'; +export * from './transaction-totals-notification-response'; +export * from './transaction-totals-adjusted-notification-response'; +export * from './transaction-payout-totals-notification-response'; +export * from './adjustment-original-amount-notification-response'; +export * from './chargeback-fee'; +export * from './transaction-payout-totals-adjusted-notification-response'; +export * from './unit-totals'; +export * from './payment-card-notification-response'; +export * from './payment-method-details'; +export * from './transaction-payment-attempt-notification-response'; +export * from './transaction-checkout-notification'; +export * from './total-adjustments-notification-response'; +export * from './payout-totals-adjustment-notification-response'; +export * from './import-meta-notification-response'; diff --git a/src/notifications/types/shared/money-notification-response.ts b/src/notifications/types/shared/money-notification-response.ts new file mode 100644 index 0000000..c8720f3 --- /dev/null +++ b/src/notifications/types/shared/money-notification-response.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type CurrencyCode } from '../../../enums'; + +export interface IMoneyNotificationResponse { + amount: string; + currency_code: CurrencyCode; +} diff --git a/src/notifications/types/shared/payment-card-notification-response.ts b/src/notifications/types/shared/payment-card-notification-response.ts new file mode 100644 index 0000000..78c467f --- /dev/null +++ b/src/notifications/types/shared/payment-card-notification-response.ts @@ -0,0 +1,15 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type PaymentCardType } from '../../../enums'; + +export interface IPaymentCardNotificationResponse { + type: PaymentCardType; + last4: string; + expiry_month: number; + expiry_year: number; + cardholder_name: string; +} diff --git a/src/notifications/types/shared/payment-method-details.ts b/src/notifications/types/shared/payment-method-details.ts new file mode 100644 index 0000000..b6f8a6f --- /dev/null +++ b/src/notifications/types/shared/payment-method-details.ts @@ -0,0 +1,13 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPaymentCardNotificationResponse } from '../index'; +import { type PaymentType } from '../../../enums'; + +export interface IPaymentMethodDetailsNotification { + type: PaymentType; + card?: IPaymentCardNotificationResponse | null; +} diff --git a/src/notifications/types/shared/payout-totals-adjustment-notification-response.ts b/src/notifications/types/shared/payout-totals-adjustment-notification-response.ts new file mode 100644 index 0000000..ec0476c --- /dev/null +++ b/src/notifications/types/shared/payout-totals-adjustment-notification-response.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IChargebackFeeNotification } from '../index'; +import { type PayoutCurrencyCode } from '../../../enums'; + +export interface IPayoutTotalsAdjustmentNotificationResponse { + subtotal: string; + tax: string; + total: string; + fee: string; + chargeback_fee?: IChargebackFeeNotification | null; + earnings: string; + currency_code: PayoutCurrencyCode; +} diff --git a/src/notifications/types/shared/shared-price-notification-response.ts b/src/notifications/types/shared/shared-price-notification-response.ts new file mode 100644 index 0000000..4d879fe --- /dev/null +++ b/src/notifications/types/shared/shared-price-notification-response.ts @@ -0,0 +1,32 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type ITimePeriodNotification, + type IMoneyNotificationResponse, + type IUnitPriceOverrideNotificationResponse, + type IPriceQuantityNotification, + type IImportMetaNotificationResponse, +} from '../index'; +import { type TaxMode, type Status, type CatalogType } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface ISharedPriceNotificationResponse { + id: string; + product_id: string; + description: string; + type: CatalogType; + name?: string | null; + billing_cycle?: ITimePeriodNotification | null; + trial_period?: ITimePeriodNotification | null; + tax_mode: TaxMode; + unit_price?: IMoneyNotificationResponse | null; + unit_price_overrides?: IUnitPriceOverrideNotificationResponse[] | null; + quantity?: IPriceQuantityNotification | null; + status: Status; + custom_data?: ICustomData | null; + import_meta?: IImportMetaNotificationResponse | null; +} diff --git a/src/notifications/types/shared/shared-product-notification-response.ts b/src/notifications/types/shared/shared-product-notification-response.ts new file mode 100644 index 0000000..d110daf --- /dev/null +++ b/src/notifications/types/shared/shared-product-notification-response.ts @@ -0,0 +1,22 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IImportMetaNotificationResponse } from '../index'; +import { type TaxCategory, type Status, type CatalogType } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface ISharedProductNotificationResponse { + id: string; + name: string; + type?: CatalogType | null; + description?: string | null; + tax_category: TaxCategory; + image_url?: string | null; + custom_data?: ICustomData | null; + status: Status; + created_at: string; + import_meta?: IImportMetaNotificationResponse | null; +} diff --git a/src/notifications/types/shared/tax-rates-used-notification-response.ts b/src/notifications/types/shared/tax-rates-used-notification-response.ts new file mode 100644 index 0000000..fe66040 --- /dev/null +++ b/src/notifications/types/shared/tax-rates-used-notification-response.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITotalsNotification } from '../index'; + +export interface ITaxRatesUsedNotificationResponse { + tax_rate: string; + totals?: ITotalsNotification | null; +} diff --git a/src/notifications/types/shared/time-period-notification.ts b/src/notifications/types/shared/time-period-notification.ts new file mode 100644 index 0000000..5946016 --- /dev/null +++ b/src/notifications/types/shared/time-period-notification.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type Interval } from '../../../enums'; + +export interface ITimePeriodNotification { + interval: Interval; + frequency: number; +} diff --git a/src/notifications/types/shared/total-adjustments-notification-response.ts b/src/notifications/types/shared/total-adjustments-notification-response.ts new file mode 100644 index 0000000..f04e420 --- /dev/null +++ b/src/notifications/types/shared/total-adjustments-notification-response.ts @@ -0,0 +1,16 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type CurrencyCode } from '../../../enums'; + +export interface ITotalAdjustmentsNotificationResponse { + subtotal: string; + tax: string; + total: string; + fee: string; + earnings: string; + currency_code: CurrencyCode; +} diff --git a/src/notifications/types/shared/totals.ts b/src/notifications/types/shared/totals.ts new file mode 100644 index 0000000..5f8575b --- /dev/null +++ b/src/notifications/types/shared/totals.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface ITotalsNotification { + subtotal: string; + discount: string; + tax: string; + total: string; +} diff --git a/src/notifications/types/shared/transaction-checkout-notification.ts b/src/notifications/types/shared/transaction-checkout-notification.ts new file mode 100644 index 0000000..cba8e98 --- /dev/null +++ b/src/notifications/types/shared/transaction-checkout-notification.ts @@ -0,0 +1,9 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface ITransactionCheckoutNotification { + url?: string | null; +} diff --git a/src/notifications/types/shared/transaction-payment-attempt-notification-response.ts b/src/notifications/types/shared/transaction-payment-attempt-notification-response.ts new file mode 100644 index 0000000..27182f4 --- /dev/null +++ b/src/notifications/types/shared/transaction-payment-attempt-notification-response.ts @@ -0,0 +1,23 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPaymentMethodDetailsNotification } from '../index'; +import { type PaymentAttemptStatus, type ErrorCode } from '../../../enums'; + +export interface ITransactionPaymentAttemptNotificationResponse { + payment_attempt_id: string; + /** + * @deprecated use payment_method_id instead + */ + stored_payment_method_id: string; + payment_method_id?: string | null; + amount: string; + status: PaymentAttemptStatus; + error_code?: ErrorCode | null; + method_details?: IPaymentMethodDetailsNotification | null; + created_at: string; + captured_at?: string | null; +} diff --git a/src/notifications/types/shared/transaction-payout-totals-adjusted-notification-response.ts b/src/notifications/types/shared/transaction-payout-totals-adjusted-notification-response.ts new file mode 100644 index 0000000..23bfffb --- /dev/null +++ b/src/notifications/types/shared/transaction-payout-totals-adjusted-notification-response.ts @@ -0,0 +1,18 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IChargebackFeeNotification } from '../index'; +import { type PayoutCurrencyCode } from '../../../enums'; + +export interface ITransactionPayoutTotalsAdjustedNotificationResponse { + subtotal: string; + tax: string; + total: string; + fee: string; + chargeback_fee?: IChargebackFeeNotification | null; + earnings: string; + currency_code: PayoutCurrencyCode; +} diff --git a/src/notifications/types/shared/transaction-payout-totals-notification-response.ts b/src/notifications/types/shared/transaction-payout-totals-notification-response.ts new file mode 100644 index 0000000..5806e79 --- /dev/null +++ b/src/notifications/types/shared/transaction-payout-totals-notification-response.ts @@ -0,0 +1,21 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type PayoutCurrencyCode } from '../../../enums'; + +export interface ITransactionPayoutTotalsNotificationResponse { + subtotal: string; + discount: string; + tax: string; + total: string; + credit: string; + balance: string; + grand_total: string; + credit_to_balance: string; + fee: string; + earnings: string; + currency_code: PayoutCurrencyCode; +} diff --git a/src/notifications/types/shared/transaction-totals-adjusted-notification-response.ts b/src/notifications/types/shared/transaction-totals-adjusted-notification-response.ts new file mode 100644 index 0000000..10908e0 --- /dev/null +++ b/src/notifications/types/shared/transaction-totals-adjusted-notification-response.ts @@ -0,0 +1,17 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type CurrencyCode } from '../../../enums'; + +export interface ITransactionTotalsAdjustedNotificationResponse { + subtotal: string; + tax: string; + total: string; + grand_total: string; + fee?: string | null; + earnings?: string | null; + currency_code: CurrencyCode; +} diff --git a/src/notifications/types/shared/transaction-totals-notification-response.ts b/src/notifications/types/shared/transaction-totals-notification-response.ts new file mode 100644 index 0000000..c9ceab2 --- /dev/null +++ b/src/notifications/types/shared/transaction-totals-notification-response.ts @@ -0,0 +1,21 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type CurrencyCode } from '../../../enums'; + +export interface ITransactionTotalsNotificationResponse { + subtotal: string; + discount: string; + tax: string; + total: string; + credit: string; + credit_to_balance: string; + balance: string; + grand_total: string; + fee?: string | null; + earnings?: string | null; + currency_code: CurrencyCode; +} diff --git a/src/notifications/types/shared/unit-price-override-notification-response.ts b/src/notifications/types/shared/unit-price-override-notification-response.ts new file mode 100644 index 0000000..d2ac266 --- /dev/null +++ b/src/notifications/types/shared/unit-price-override-notification-response.ts @@ -0,0 +1,13 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IMoneyNotificationResponse } from '../index'; +import { type CountryCode } from '../../../enums'; + +export interface IUnitPriceOverrideNotificationResponse { + country_codes: CountryCode[]; + unit_price: IMoneyNotificationResponse; +} diff --git a/src/notifications/types/shared/unit-totals.ts b/src/notifications/types/shared/unit-totals.ts new file mode 100644 index 0000000..cc7550b --- /dev/null +++ b/src/notifications/types/shared/unit-totals.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface IUnitTotalsNotification { + subtotal: string; + discount: string; + tax: string; + total: string; +} diff --git a/src/notifications/types/subscription/index.ts b/src/notifications/types/subscription/index.ts new file mode 100644 index 0000000..7721708 --- /dev/null +++ b/src/notifications/types/subscription/index.ts @@ -0,0 +1,13 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './subscription-discount-notification-response'; +export * from './subscription-time-period-notification-response'; +export * from './subscription-scheduled-change-notification-response'; +export * from './subscription-price-notification-response'; +export * from './subscription-item-notification-response'; +export * from './subscription-discount-notification-response'; +export * from './subscription-notification-response'; diff --git a/src/notifications/types/subscription/subscription-discount-notification-response.ts b/src/notifications/types/subscription/subscription-discount-notification-response.ts new file mode 100644 index 0000000..004f1ee --- /dev/null +++ b/src/notifications/types/subscription/subscription-discount-notification-response.ts @@ -0,0 +1,11 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface ISubscriptionDiscountNotificationResponse { + id: string; + starts_at: string; + ends_at?: string | null; +} diff --git a/src/notifications/types/subscription/subscription-item-notification-response.ts b/src/notifications/types/subscription/subscription-item-notification-response.ts new file mode 100644 index 0000000..d35c139 --- /dev/null +++ b/src/notifications/types/subscription/subscription-item-notification-response.ts @@ -0,0 +1,23 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type ISubscriptionPriceNotificationResponse, + type ISubscriptionTimePeriodNotificationResponse, +} from '../index'; +import { type SubscriptionItemStatus } from '../../../enums'; + +export interface ISubscriptionItemNotificationResponse { + status: SubscriptionItemStatus; + quantity: number; + recurring: boolean; + created_at: string; + updated_at: string; + previously_billed_at?: string | null; + next_billed_at?: string | null; + trial_dates?: ISubscriptionTimePeriodNotificationResponse | null; + price?: ISubscriptionPriceNotificationResponse | null; +} diff --git a/src/notifications/types/subscription/subscription-notification-response.ts b/src/notifications/types/subscription/subscription-notification-response.ts new file mode 100644 index 0000000..41be4c6 --- /dev/null +++ b/src/notifications/types/subscription/subscription-notification-response.ts @@ -0,0 +1,43 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type IBillingDetailsNotificationResponse, + type IImportMetaNotificationResponse, + type ISubscriptionDiscountNotificationResponse, + type ISubscriptionItemNotificationResponse, + type ISubscriptionScheduledChangeNotificationResponse, + type ISubscriptionTimePeriodNotificationResponse, + type ITimePeriodNotification, +} from '../index'; +import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface ISubscriptionNotificationResponse { + id: string; + status: SubscriptionStatus; + transaction_id: string; + customer_id: string; + address_id: string; + business_id?: string | null; + currency_code: CurrencyCode; + created_at: string; + updated_at: string; + started_at?: string | null; + first_billed_at?: string | null; + next_billed_at?: string | null; + paused_at?: string | null; + canceled_at?: string | null; + discount?: ISubscriptionDiscountNotificationResponse | null; + collection_mode: CollectionMode; + billing_details?: IBillingDetailsNotificationResponse | null; + current_billing_period?: ISubscriptionTimePeriodNotificationResponse | null; + billing_cycle: ITimePeriodNotification; + scheduled_change?: ISubscriptionScheduledChangeNotificationResponse | null; + items: ISubscriptionItemNotificationResponse[]; + custom_data?: ICustomData | null; + import_meta?: IImportMetaNotificationResponse | null; +} diff --git a/src/notifications/types/subscription/subscription-price-notification-response.ts b/src/notifications/types/subscription/subscription-price-notification-response.ts new file mode 100644 index 0000000..1befd53 --- /dev/null +++ b/src/notifications/types/subscription/subscription-price-notification-response.ts @@ -0,0 +1,34 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type IImportMetaNotificationResponse, + type IMoneyNotificationResponse, + type IPriceQuantityNotification, + type ISharedProductNotificationResponse, + type ITimePeriodNotification, + type IUnitPriceOverrideNotificationResponse, +} from '../index'; +import { type CatalogType, type Status, type TaxMode } from '../../../enums'; +import type { ICustomData } from '../../../types'; + +export interface ISubscriptionPriceNotificationResponse { + id: string; + product_id: string; + description: string; + type?: CatalogType | null; + name?: string | null; + billing_cycle?: ITimePeriodNotification | null; + trial_period?: ITimePeriodNotification | null; + tax_mode: TaxMode; + unit_price?: IMoneyNotificationResponse | null; + unit_price_overrides?: IUnitPriceOverrideNotificationResponse[] | null; + quantity?: IPriceQuantityNotification | null; + status?: Status | null; + custom_data?: ICustomData | null; + import_meta?: IImportMetaNotificationResponse | null; + product?: ISharedProductNotificationResponse | null; +} diff --git a/src/notifications/types/subscription/subscription-scheduled-change-notification-response.ts b/src/notifications/types/subscription/subscription-scheduled-change-notification-response.ts new file mode 100644 index 0000000..05f4196 --- /dev/null +++ b/src/notifications/types/subscription/subscription-scheduled-change-notification-response.ts @@ -0,0 +1,13 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ScheduledChangeAction } from '../../../enums'; + +export interface ISubscriptionScheduledChangeNotificationResponse { + action: ScheduledChangeAction; + effective_at: string; + resume_at?: string | null; +} diff --git a/src/notifications/types/subscription/subscription-time-period-notification-response.ts b/src/notifications/types/subscription/subscription-time-period-notification-response.ts new file mode 100644 index 0000000..5e473b8 --- /dev/null +++ b/src/notifications/types/subscription/subscription-time-period-notification-response.ts @@ -0,0 +1,10 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface ISubscriptionTimePeriodNotificationResponse { + starts_at: string; + ends_at: string; +} diff --git a/src/notifications/types/transaction/index.ts b/src/notifications/types/transaction/index.ts new file mode 100644 index 0000000..9981242 --- /dev/null +++ b/src/notifications/types/transaction/index.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export * from './transactions-time-period-notification-response'; +export * from './transaction-proration-notification-response'; +export * from './transaction-item-notification-response'; +export * from './transaction-line-item-notification-response'; +export * from './transaction-details-notification-response'; +export * from './transaction-notification-response'; diff --git a/src/notifications/types/transaction/transaction-details-notification-response.ts b/src/notifications/types/transaction/transaction-details-notification-response.ts new file mode 100644 index 0000000..f8888fc --- /dev/null +++ b/src/notifications/types/transaction/transaction-details-notification-response.ts @@ -0,0 +1,23 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type ITaxRatesUsedNotificationResponse, + type ITransactionTotalsNotificationResponse, + type ITransactionTotalsAdjustedNotificationResponse, + type ITransactionPayoutTotalsNotificationResponse, + type ITransactionPayoutTotalsAdjustedNotificationResponse, + type ITransactionLineItemNotificationResponse, +} from '../index'; + +export interface ITransactionDetailsNotificationResponse { + tax_rates_used: ITaxRatesUsedNotificationResponse[]; + totals?: ITransactionTotalsNotificationResponse | null; + adjusted_totals?: ITransactionTotalsAdjustedNotificationResponse | null; + payout_totals?: ITransactionPayoutTotalsNotificationResponse | null; + adjusted_payout_totals?: ITransactionPayoutTotalsAdjustedNotificationResponse | null; + line_items: ITransactionLineItemNotificationResponse[]; +} diff --git a/src/notifications/types/transaction/transaction-item-notification-response.ts b/src/notifications/types/transaction/transaction-item-notification-response.ts new file mode 100644 index 0000000..9231160 --- /dev/null +++ b/src/notifications/types/transaction/transaction-item-notification-response.ts @@ -0,0 +1,14 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type IPriceNotificationResponse, type ITransactionProrationNotificationResponse } from '../index'; + +export interface ITransactionItemNotificationResponse { + price_id?: string | null; + price?: IPriceNotificationResponse | null; + quantity: number; + proration?: ITransactionProrationNotificationResponse | null; +} diff --git a/src/notifications/types/transaction/transaction-line-item-notification-response.ts b/src/notifications/types/transaction/transaction-line-item-notification-response.ts new file mode 100644 index 0000000..08539a0 --- /dev/null +++ b/src/notifications/types/transaction/transaction-line-item-notification-response.ts @@ -0,0 +1,23 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type ITransactionProrationNotificationResponse, + type IUnitTotalsNotification, + type ITotalsNotification, + type ISharedProductNotificationResponse, +} from '../index'; + +export interface ITransactionLineItemNotificationResponse { + id: string; + price_id: string; + quantity: number; + proration?: ITransactionProrationNotificationResponse | null; + tax_rate: string; + unit_totals?: IUnitTotalsNotification | null; + totals?: ITotalsNotification | null; + product?: ISharedProductNotificationResponse | null; +} diff --git a/src/notifications/types/transaction/transaction-notification-response.ts b/src/notifications/types/transaction/transaction-notification-response.ts new file mode 100644 index 0000000..60dca7e --- /dev/null +++ b/src/notifications/types/transaction/transaction-notification-response.ts @@ -0,0 +1,41 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { + type IBillingDetailsNotificationResponse, + type ITransactionCheckoutNotification, + type ITransactionDetailsNotificationResponse, + type ITransactionItemNotificationResponse, + type ITransactionPaymentAttemptNotificationResponse, + type ITransactionsTimePeriodNotificationResponse, +} from '../index'; +import { type CollectionMode, type CurrencyCode, type TransactionOrigin, type TransactionStatus } from '../../../enums'; +import { type ICustomData } from '../../../types'; + +export interface ITransactionNotificationResponse { + id: string; + status: TransactionStatus; + customer_id?: string | null; + address_id?: string | null; + business_id?: string | null; + custom_data?: ICustomData | null; + currency_code: CurrencyCode; + origin: TransactionOrigin; + subscription_id?: string | null; + invoice_id?: string | null; + invoice_number?: string | null; + collection_mode: CollectionMode; + discount_id?: string | null; + billing_details?: IBillingDetailsNotificationResponse | null; + billing_period?: ITransactionsTimePeriodNotificationResponse | null; + items: ITransactionItemNotificationResponse[]; + details?: ITransactionDetailsNotificationResponse | null; + payments: ITransactionPaymentAttemptNotificationResponse[]; + checkout?: ITransactionCheckoutNotification | null; + created_at: string; + updated_at: string; + billed_at?: string | null; +} diff --git a/src/notifications/types/transaction/transaction-proration-notification-response.ts b/src/notifications/types/transaction/transaction-proration-notification-response.ts new file mode 100644 index 0000000..b3b2463 --- /dev/null +++ b/src/notifications/types/transaction/transaction-proration-notification-response.ts @@ -0,0 +1,12 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +import { type ITransactionsTimePeriodNotificationResponse } from '../index'; + +export interface ITransactionProrationNotificationResponse { + rate: string; + billing_period?: ITransactionsTimePeriodNotificationResponse | null; +} diff --git a/src/notifications/types/transaction/transactions-time-period-notification-response.ts b/src/notifications/types/transaction/transactions-time-period-notification-response.ts new file mode 100644 index 0000000..e5886b2 --- /dev/null +++ b/src/notifications/types/transaction/transactions-time-period-notification-response.ts @@ -0,0 +1,10 @@ +/** + * ! Autogenerated code ! + * Do not make changes to this file. + * Changes may be overwritten as part of auto-generation. + */ + +export interface ITransactionsTimePeriodNotificationResponse { + starts_at: string; + ends_at: string; +} diff --git a/src/types/events/events-response.ts b/src/types/events/events-response.ts index f9478b9..6f0890d 100644 --- a/src/types/events/events-response.ts +++ b/src/types/events/events-response.ts @@ -4,18 +4,20 @@ * Changes may be overwritten as part of auto-generation. */ -import { type IAddressResponse } from '../address'; -import { type IBusinessResponse } from '../business'; -import { type EventName } from '../../notifications'; -import { type IAdjustmentResponse } from '../adjustment'; -import { type ICustomerResponse } from '../customer'; -import { type IDiscountResponse } from '../discount'; -import { type IPriceResponse } from '../price'; -import { type IProductResponse } from '../product'; -import { type ISubscriptionNotificationResponse } from '../subscription'; -import { type ITransactionResponse } from '../transaction'; -import { type IPayoutResponse } from '../payout'; -import { type IReportResponse } from '../report'; +import { + type EventName, + type IAddressNotificationResponse, + type IAdjustmentNotificationResponse, + type IBusinessNotificationResponse, + type ICustomerNotificationResponse, + type IDiscountNotificationResponse, + type IPayoutNotificationResponse, + type IPriceNotificationResponse, + type IProductNotificationResponse, + type IReportNotificationResponse, + type ISubscriptionNotificationResponse, + type ITransactionNotificationResponse, +} from '../../notifications'; export interface IEventsResponse { event_id: string; @@ -25,91 +27,91 @@ export interface IEventsResponse { data: T; } -interface IAddressCreated extends IEventsResponse { +interface IAddressCreated extends IEventsResponse { event_type: EventName.AddressCreated; } -interface IAddressUpdated extends IEventsResponse { +interface IAddressUpdated extends IEventsResponse { event_type: EventName.AddressUpdated; } -interface IAddressImported extends IEventsResponse { +interface IAddressImported extends IEventsResponse { event_type: EventName.AddressImported; } -interface IAdjustmentCreated extends IEventsResponse { +interface IAdjustmentCreated extends IEventsResponse { event_type: EventName.AdjustmentCreated; } -interface IAdjustmentUpdated extends IEventsResponse { +interface IAdjustmentUpdated extends IEventsResponse { event_type: EventName.AdjustmentUpdated; } -interface IBusinessCreated extends IEventsResponse { +interface IBusinessCreated extends IEventsResponse { event_type: EventName.BusinessCreated; } -interface IBusinessUpdated extends IEventsResponse { +interface IBusinessUpdated extends IEventsResponse { event_type: EventName.BusinessUpdated; } -interface IBusinessImported extends IEventsResponse { +interface IBusinessImported extends IEventsResponse { event_type: EventName.BusinessImported; } -interface ICustomerCreated extends IEventsResponse { +interface ICustomerCreated extends IEventsResponse { event_type: EventName.CustomerCreated; } -interface ICustomerUpdated extends IEventsResponse { +interface ICustomerUpdated extends IEventsResponse { event_type: EventName.CustomerUpdated; } -interface ICustomerImported extends IEventsResponse { +interface ICustomerImported extends IEventsResponse { event_type: EventName.CustomerImported; } -interface IDiscountCreated extends IEventsResponse { +interface IDiscountCreated extends IEventsResponse { event_type: EventName.DiscountCreated; } -interface IDiscountUpdated extends IEventsResponse { +interface IDiscountUpdated extends IEventsResponse { event_type: EventName.DiscountUpdated; } -interface IDiscountImported extends IEventsResponse { +interface IDiscountImported extends IEventsResponse { event_type: EventName.DiscountImported; } -interface IPayoutCreated extends IEventsResponse { +interface IPayoutCreated extends IEventsResponse { event_type: EventName.PayoutCreated; } -interface IPayoutPaid extends IEventsResponse { +interface IPayoutPaid extends IEventsResponse { event_type: EventName.PayoutPaid; } -interface IPriceCreated extends IEventsResponse { +interface IPriceCreated extends IEventsResponse { event_type: EventName.PriceCreated; } -interface IPriceUpdated extends IEventsResponse { +interface IPriceUpdated extends IEventsResponse { event_type: EventName.PriceUpdated; } -interface IPriceImported extends IEventsResponse { +interface IPriceImported extends IEventsResponse { event_type: EventName.PriceImported; } -interface IProductCreated extends IEventsResponse { +interface IProductCreated extends IEventsResponse { event_type: EventName.ProductCreated; } -interface IProductUpdated extends IEventsResponse { +interface IProductUpdated extends IEventsResponse { event_type: EventName.ProductUpdated; } -interface IProductImported extends IEventsResponse { +interface IProductImported extends IEventsResponse { event_type: EventName.ProductImported; } @@ -149,47 +151,47 @@ interface ISubscriptionUpdated extends IEventsResponse { +interface ITransactionBilled extends IEventsResponse { event_type: EventName.TransactionBilled; } -interface ITransactionCanceled extends IEventsResponse { +interface ITransactionCanceled extends IEventsResponse { event_type: EventName.TransactionCanceled; } -interface ITransactionCompleted extends IEventsResponse { +interface ITransactionCompleted extends IEventsResponse { event_type: EventName.TransactionCompleted; } -interface ITransactionCreated extends IEventsResponse { +interface ITransactionCreated extends IEventsResponse { event_type: EventName.TransactionCreated; } -interface ITransactionPaid extends IEventsResponse { +interface ITransactionPaid extends IEventsResponse { event_type: EventName.TransactionPaid; } -interface ITransactionPastDue extends IEventsResponse { +interface ITransactionPastDue extends IEventsResponse { event_type: EventName.TransactionPastDue; } -interface ITransactionPaymentFailed extends IEventsResponse { +interface ITransactionPaymentFailed extends IEventsResponse { event_type: EventName.TransactionPaymentFailed; } -interface ITransactionReady extends IEventsResponse { +interface ITransactionReady extends IEventsResponse { event_type: EventName.TransactionReady; } -interface ITransactionUpdated extends IEventsResponse { +interface ITransactionUpdated extends IEventsResponse { event_type: EventName.TransactionUpdated; } -interface IReportCreated extends IEventsResponse { +interface IReportCreated extends IEventsResponse { event_type: EventName.ReportCreated; } -interface IReportUpdated extends IEventsResponse { +interface IReportUpdated extends IEventsResponse { event_type: EventName.ReportUpdated; } diff --git a/src/types/price/price-response.ts b/src/types/price/price-response.ts index aa3bac1..e2abef0 100644 --- a/src/types/price/price-response.ts +++ b/src/types/price/price-response.ts @@ -19,7 +19,7 @@ export interface IPriceResponse { id: string; product_id: string; description: string; - type?: CatalogType | null; + type: CatalogType; name?: string | null; billing_cycle?: ITimePeriod | null; trial_period?: ITimePeriod | null; diff --git a/src/types/pricing-preview/pricing-preview-response.ts b/src/types/pricing-preview/pricing-preview-response.ts index 3a77b84..d0b613f 100644 --- a/src/types/pricing-preview/pricing-preview-response.ts +++ b/src/types/pricing-preview/pricing-preview-response.ts @@ -4,11 +4,10 @@ * Changes may be overwritten as part of auto-generation. */ -import { type CurrencyCode } from '../../enums'; +import { type CurrencyCode, type AvailablePaymentMethod } from '../../enums'; import { type IAddressPreviewResponse } from '../../resources'; import { type IPricingPreviewItemResponse } from './pricing-preview-item-response'; import { type IPricingPreviewDetailsResponse } from './pricing-preview-details-response'; -import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods'; export interface IPricingPreviewResponse { customer_id?: string | null; diff --git a/src/types/shared/shared-price-response.ts b/src/types/shared/shared-price-response.ts index 2aa35e6..c79afc2 100644 --- a/src/types/shared/shared-price-response.ts +++ b/src/types/shared/shared-price-response.ts @@ -18,14 +18,14 @@ export interface ISharedPriceResponse { id: string; product_id: string; description: string; - type?: CatalogType | null; + type: CatalogType; name?: string | null; billing_cycle?: ITimePeriod | null; trial_period?: ITimePeriod | null; tax_mode: TaxMode; - unit_price?: IMoneyResponse | null; - unit_price_overrides?: IUnitPriceOverrideResponse[] | null; - quantity?: IPriceQuantity | null; + unit_price: IMoneyResponse; + unit_price_overrides: IUnitPriceOverrideResponse[]; + quantity: IPriceQuantity; status: Status; custom_data?: ICustomData | null; import_meta?: IImportMetaResponse | null; diff --git a/src/types/subscription/index.ts b/src/types/subscription/index.ts index 9d6fbfa..4c0c1f1 100644 --- a/src/types/subscription/index.ts +++ b/src/types/subscription/index.ts @@ -8,7 +8,6 @@ export * from './subscription-discount-response'; export * from './subscription-time-period-response'; export * from './subscription-scheduled-change-response'; export * from './subscription-management-response'; -export * from './subscription-price-response'; export * from './subscription-item-response'; export * from './next-transaction-response'; export * from './subscription-discount-response'; @@ -17,4 +16,3 @@ export * from './subscription-response'; export * from './subscription-preview-response'; export * from './subscription-preview-update-summary'; export * from './subscription-result-response'; -export * from './subscription-notification-response'; diff --git a/src/types/subscription/subscription-item-response.ts b/src/types/subscription/subscription-item-response.ts index 03f29c1..6e65631 100644 --- a/src/types/subscription/subscription-item-response.ts +++ b/src/types/subscription/subscription-item-response.ts @@ -4,7 +4,7 @@ * Changes may be overwritten as part of auto-generation. */ -import { type ISubscriptionPriceResponse, type ISubscriptionTimePeriodResponse } from '../index'; +import { type IPriceResponse, type ISubscriptionTimePeriodResponse } from '../index'; import { type SubscriptionItemStatus } from '../../enums'; export interface ISubscriptionItemResponse { @@ -16,5 +16,5 @@ export interface ISubscriptionItemResponse { previously_billed_at?: string | null; next_billed_at?: string | null; trial_dates?: ISubscriptionTimePeriodResponse | null; - price?: ISubscriptionPriceResponse | null; + price?: IPriceResponse | null; } diff --git a/src/types/subscription/subscription-notification-response.ts b/src/types/subscription/subscription-notification-response.ts deleted file mode 100644 index efa2fa2..0000000 --- a/src/types/subscription/subscription-notification-response.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * ! Autogenerated code ! - * Do not make changes to this file. - * Changes may be overwritten as part of auto-generation. - */ - -import { - type IBillingDetailsResponse, - type ICustomData, - type IImportMetaResponse, - type INextTransactionResponse, - type ISubscriptionDiscountResponse, - type ISubscriptionItemResponse, - type ISubscriptionScheduledChangeResponse, - type ISubscriptionTimePeriodResponse, - type ITimePeriod, - type ITransactionDetailsPreviewResponse, -} from '../index'; -import { type CollectionMode, type CurrencyCode, type SubscriptionStatus } from '../../enums'; - -export interface ISubscriptionNotificationResponse { - id: string; - status: SubscriptionStatus; - transaction_id: string; - customer_id: string; - address_id: string; - business_id?: string | null; - currency_code: CurrencyCode; - created_at: string; - updated_at: string; - started_at?: string | null; - first_billed_at?: string | null; - next_billed_at?: string | null; - paused_at?: string | null; - canceled_at?: string | null; - discount?: ISubscriptionDiscountResponse | null; - collection_mode: CollectionMode; - billing_details?: IBillingDetailsResponse | null; - current_billing_period?: ISubscriptionTimePeriodResponse | null; - billing_cycle: ITimePeriod; - scheduled_change?: ISubscriptionScheduledChangeResponse | null; - items: ISubscriptionItemResponse[]; - custom_data?: ICustomData | null; - import_meta?: IImportMetaResponse | null; - next_transaction?: INextTransactionResponse | null; - recurring_transaction_details?: ITransactionDetailsPreviewResponse | null; -} diff --git a/src/types/subscription/subscription-price-response.ts b/src/types/subscription/subscription-price-response.ts deleted file mode 100644 index 5b659f9..0000000 --- a/src/types/subscription/subscription-price-response.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * ! Autogenerated code ! - * Do not make changes to this file. - * Changes may be overwritten as part of auto-generation. - */ - -import { type ITimePeriod, type IMoneyResponse } from '../index'; -import { type TaxMode } from '../../enums'; - -export interface ISubscriptionPriceResponse { - id: string; - description: string; - product_id: string; - billing_cycle?: ITimePeriod | null; - trial_period?: ITimePeriod | null; - tax_mode: TaxMode; - unit_price: IMoneyResponse; -} diff --git a/src/types/transaction/transaction-preview-response.ts b/src/types/transaction/transaction-preview-response.ts index 0665da3..2f80ff1 100644 --- a/src/types/transaction/transaction-preview-response.ts +++ b/src/types/transaction/transaction-preview-response.ts @@ -4,12 +4,11 @@ * Changes may be overwritten as part of auto-generation. */ -import { type CurrencyCode } from '../../enums'; +import { type CurrencyCode, type AvailablePaymentMethod } from '../../enums'; import { type IAddressPreviewResponse } from '../../resources'; import { type ITransactionDetailsPreviewResponse } from '../shared'; import { type IPriceResponse } from '../price'; import { type ITransactionsTimePeriodResponse } from './transactions-time-period-response'; -import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods'; export interface IProrationResponse { rate: string; diff --git a/src/types/transaction/transaction-response.ts b/src/types/transaction/transaction-response.ts index 2eba52e..8fc08a0 100644 --- a/src/types/transaction/transaction-response.ts +++ b/src/types/transaction/transaction-response.ts @@ -19,8 +19,13 @@ import { type ICustomerResponse, type IDiscountResponse, } from '../index'; -import { type TransactionStatus, type CurrencyCode, type TransactionOrigin, type CollectionMode } from '../../enums'; -import { type AvailablePaymentMethod } from '../../enums/shared/available-payment-methods'; +import { + type TransactionStatus, + type CurrencyCode, + type TransactionOrigin, + type CollectionMode, + type AvailablePaymentMethod, +} from '../../enums'; export interface ITransactionResponse { id: string;