From 750cac77fddf5715d41c81b3095ecf474186cb36 Mon Sep 17 00:00:00 2001 From: davidgrayston-paddle Date: Wed, 18 Sep 2024 10:52:52 +0100 Subject: [PATCH] feat: Add optional notification ID to events (#74) --- CHANGELOG.md | 1 + examples/webhook_verification_PSR7.php | 12 + src/Entities/Event.php | 18 +- src/Notifications/Events/AddressCreated.php | 8 +- src/Notifications/Events/AddressImported.php | 36 ++ src/Notifications/Events/AddressUpdated.php | 8 +- .../Events/AdjustmentCreated.php | 8 +- .../Events/AdjustmentUpdated.php | 8 +- src/Notifications/Events/BusinessCreated.php | 8 +- src/Notifications/Events/BusinessImported.php | 36 ++ src/Notifications/Events/BusinessUpdated.php | 8 +- src/Notifications/Events/CustomerCreated.php | 8 +- src/Notifications/Events/CustomerImported.php | 36 ++ src/Notifications/Events/CustomerUpdated.php | 8 +- src/Notifications/Events/DiscountCreated.php | 8 +- src/Notifications/Events/DiscountImported.php | 8 +- src/Notifications/Events/DiscountUpdated.php | 8 +- src/Notifications/Events/PayoutCreated.php | 8 +- src/Notifications/Events/PayoutPaid.php | 8 +- src/Notifications/Events/PriceCreated.php | 8 +- src/Notifications/Events/PriceImported.php | 36 ++ src/Notifications/Events/PriceUpdated.php | 8 +- src/Notifications/Events/ProductCreated.php | 8 +- src/Notifications/Events/ProductImported.php | 36 ++ src/Notifications/Events/ProductUpdated.php | 8 +- src/Notifications/Events/ReportCreated.php | 8 +- src/Notifications/Events/ReportUpdated.php | 8 +- .../Events/SubscriptionActivated.php | 8 +- .../Events/SubscriptionCanceled.php | 8 +- .../Events/SubscriptionCreated.php | 8 +- .../Events/SubscriptionImported.php | 8 +- .../Events/SubscriptionPastDue.php | 8 +- .../Events/SubscriptionPaused.php | 8 +- .../Events/SubscriptionResumed.php | 8 +- .../Events/SubscriptionTrialing.php | 8 +- .../Events/SubscriptionUpdated.php | 8 +- .../Events/TransactionBilled.php | 8 +- .../Events/TransactionCanceled.php | 8 +- .../Events/TransactionCompleted.php | 8 +- .../Events/TransactionCreated.php | 8 +- src/Notifications/Events/TransactionPaid.php | 8 +- .../Events/TransactionPastDue.php | 8 +- .../Events/TransactionPaymentFailed.php | 8 +- src/Notifications/Events/TransactionReady.php | 8 +- .../Events/TransactionUpdated.php | 8 +- tests/Unit/Entities/EventTest.php | 376 ++++++++++++++++++ .../notification/business.updated.json | 29 ++ .../notification/entity/address.created.json | 16 + .../notification/entity/address.imported.json | 19 + .../notification/entity/address.updated.json | 18 + .../entity/adjustment.created.json | 43 ++ .../entity/adjustment.updated.json | 43 ++ .../notification/entity/business.created.json | 18 + .../entity/business.imported.json | 21 + .../notification/entity/business.updated.json | 28 ++ .../notification/entity/customer.created.json | 12 + .../entity/customer.imported.json | 15 + .../notification/entity/customer.updated.json | 12 + .../notification/entity/discount.created.json | 19 + .../entity/discount.imported.json | 24 ++ .../notification/entity/discount.updated.json | 22 + .../notification/entity/payout.created.json | 6 + .../notification/entity/payout.paid.json | 6 + .../notification/entity/price.created.json | 30 ++ .../notification/entity/price.imported.json | 30 ++ .../notification/entity/price.updated.json | 51 +++ .../notification/entity/product.created.json | 27 ++ .../notification/entity/product.imported.json | 16 + .../notification/entity/product.updated.json | 27 ++ .../notification/entity/report.created.json | 21 + .../notification/entity/report.updated.json | 21 + .../entity/subscription.activated.json | 145 +++++++ .../entity/subscription.canceled.json | 192 +++++++++ .../entity/subscription.created.json | 146 +++++++ .../entity/subscription.imported.json | 148 +++++++ .../entity/subscription.past_due.json | 145 +++++++ .../entity/subscription.paused.json | 142 +++++++ .../entity/subscription.resumed.json | 145 +++++++ .../entity/subscription.trialing.json | 122 ++++++ .../entity/subscription.updated.json | 195 +++++++++ .../entity/transaction.billed.json | 269 +++++++++++++ .../entity/transaction.canceled.json | 269 +++++++++++++ .../entity/transaction.completed.json | 317 +++++++++++++++ .../entity/transaction.created.json | 261 ++++++++++++ .../notification/entity/transaction.paid.json | 302 ++++++++++++++ .../entity/transaction.past_due.json | 252 ++++++++++++ .../entity/transaction.payment_failed.json | 282 +++++++++++++ .../entity/transaction.ready.json | 261 ++++++++++++ .../entity/transaction.updated.json | 269 +++++++++++++ 89 files changed, 5204 insertions(+), 115 deletions(-) create mode 100644 src/Notifications/Events/AddressImported.php create mode 100644 src/Notifications/Events/BusinessImported.php create mode 100644 src/Notifications/Events/CustomerImported.php create mode 100644 src/Notifications/Events/PriceImported.php create mode 100644 src/Notifications/Events/ProductImported.php create mode 100644 tests/Unit/Entities/EventTest.php create mode 100644 tests/Unit/Entities/_fixtures/notification/business.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/address.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/address.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/address.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/adjustment.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/adjustment.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/business.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/business.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/business.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/customer.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/customer.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/customer.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/discount.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/discount.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/discount.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/payout.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/payout.paid.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/price.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/price.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/price.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/product.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/product.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/product.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/report.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/report.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.activated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.canceled.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.imported.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.past_due.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.paused.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.resumed.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.trialing.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/subscription.updated.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.billed.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.canceled.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.completed.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.created.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.paid.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.past_due.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.payment_failed.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.ready.json create mode 100644 tests/Unit/Entities/_fixtures/notification/entity/transaction.updated.json diff --git a/CHANGELOG.md b/CHANGELOG.md index ecb109e..1722b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx - `TransactionsClient::getInvoicePDF` now supports `disposition` parameter, see [related changelog](https://developer.paddle.com/changelog/2024/invoice-pdf-open-in-browser) - Support notification settings pagination, see [related changelog](https://developer.paddle.com/changelog/2024/notification-settings-pagination) - Support notification settings `active` filter +- Support for `notification_id` on notification events ### Fixed diff --git a/examples/webhook_verification_PSR7.php b/examples/webhook_verification_PSR7.php index 9e25cd2..b55db1a 100644 --- a/examples/webhook_verification_PSR7.php +++ b/examples/webhook_verification_PSR7.php @@ -11,6 +11,8 @@ */ use GuzzleHttp\Psr7\ServerRequest; +use Paddle\SDK\Entities\Event; +use Paddle\SDK\Notifications\Events\TransactionUpdated; use Paddle\SDK\Notifications\Secret; use Paddle\SDK\Notifications\Verifier; @@ -21,6 +23,16 @@ if ($isVerified) { echo "Webhook is verified\n"; + + $event = Event::fromRequest($request); + $id = $event->notificationId; + $eventId = $event->eventId; + $eventType = $event->eventType; + $occurredAt = $event->occurredAt; + + if ($event instanceof TransactionUpdated) { + $transactionId = $event->transaction->id; + } } else { echo "Webhook is not verified\n"; } diff --git a/src/Entities/Event.php b/src/Entities/Event.php index 92bd3a1..729c2db 100644 --- a/src/Entities/Event.php +++ b/src/Entities/Event.php @@ -6,17 +6,16 @@ use Paddle\SDK\Entities\Event\EventTypeName; use Paddle\SDK\Notifications\Entities\Entity as NotificationEntity; +use Psr\Http\Message\ServerRequestInterface; abstract class Event implements Entity { - /** - * @internal - */ protected function __construct( public string $eventId, public EventTypeName $eventType, public \DateTimeInterface $occurredAt, public NotificationEntity $data, + public string|null $notificationId = null, ) { } @@ -26,7 +25,7 @@ public static function from(array $data): self $entity = $type[0] ?? 'Unknown'; $identifier = str_replace('_', '', ucwords(implode('_', $type), '_')); - /** @var class-string $entity */ + /** @var class-string $event */ $event = sprintf('\Paddle\SDK\Notifications\Events\%s', $identifier); if (! class_exists($event) || ! is_subclass_of($event, self::class)) { @@ -45,13 +44,24 @@ public static function from(array $data): self EventTypeName::from($data['event_type']), DateTime::from($data['occurred_at']), $entity::from($data['data']), + $data['notification_id'] ?? null, ); } + public static function fromRequest(ServerRequestInterface $request): self + { + return self::from(json_decode( + (string) $request->getBody(), + true, + JSON_THROW_ON_ERROR, + )); + } + abstract public static function fromEvent( string $eventId, EventTypeName $eventType, \DateTimeInterface $occurredAt, NotificationEntity $data, + string|null $notificationId = null, ): static; } diff --git a/src/Notifications/Events/AddressCreated.php b/src/Notifications/Events/AddressCreated.php index aab43b4..0fa4c1e 100644 --- a/src/Notifications/Events/AddressCreated.php +++ b/src/Notifications/Events/AddressCreated.php @@ -15,9 +15,10 @@ private function __construct( string $eventId, EventTypeName $eventType, \DateTimeInterface $occurredAt, - Address $data, + public readonly Address $address, + string|null $notificationId, ) { - parent::__construct($eventId, $eventType, $occurredAt, $data); + parent::__construct($eventId, $eventType, $occurredAt, $address, $notificationId); } /** @@ -28,7 +29,8 @@ public static function fromEvent( EventTypeName $eventType, \DateTimeInterface $occurredAt, Entity $data, + string|null $notificationId = null, ): static { - return new self($eventId, $eventType, $occurredAt, $data); + return new self($eventId, $eventType, $occurredAt, $data, $notificationId); } } diff --git a/src/Notifications/Events/AddressImported.php b/src/Notifications/Events/AddressImported.php new file mode 100644 index 0000000..fce60b6 --- /dev/null +++ b/src/Notifications/Events/AddressImported.php @@ -0,0 +1,36 @@ + 'evt_01h8bzakzx3hm2fmen703n5q45', + 'event_type' => $eventType, + 'occurred_at' => '2023-08-21T11:57:47.390028Z', + 'notification_id' => 'ntf_01h8bzam1z32agrxjwhjgqk8w6', + 'data' => self::readJsonFixture('notification/entity/' . $eventType), + ]); + + self::assertSame('ntf_01h8bzam1z32agrxjwhjgqk8w6', $event->notificationId); + + self::assertInstanceOf($eventClass, $event); + self::assertInstanceOf(Entity::class, $event->data); + self::assertInstanceOf($entityClass, $event->{$entityProperty}); + self::assertSame($event->data, $event->{$entityProperty}); + self::assertSame('evt_01h8bzakzx3hm2fmen703n5q45', $event->eventId); + self::assertSame('2023-08-21T11:57:47.390+00:00', $event->occurredAt->format(DATE_RFC3339_EXTENDED)); + self::assertSame($eventType, $event->eventType->getValue()); + } + + /** + * @test + * + * @dataProvider eventDataProvider + */ + public function it_creates_event_from_data(string $eventType, string $entityProperty, string $eventClass, string $entityClass): void + { + $event = Event::from([ + 'event_id' => 'evt_01h8bzakzx3hm2fmen703n5q45', + 'event_type' => $eventType, + 'occurred_at' => '2023-08-21T11:57:47.390028Z', + 'data' => self::readJsonFixture('notification/entity/' . $eventType), + ]); + + self::assertNull($event->notificationId); + + self::assertInstanceOf($eventClass, $event); + self::assertInstanceOf(Entity::class, $event->data); + self::assertInstanceOf($entityClass, $event->{$entityProperty}); + self::assertSame($event->data, $event->{$entityProperty}); + self::assertSame('evt_01h8bzakzx3hm2fmen703n5q45', $event->eventId); + self::assertSame('2023-08-21T11:57:47.390+00:00', $event->occurredAt->format(DATE_RFC3339_EXTENDED)); + self::assertSame($eventType, $event->eventType->getValue()); + } + + public static function eventDataProvider(): iterable + { + $eventTypeData = [ + [ + 'address.created', + 'address', + \Paddle\SDK\Notifications\Events\AddressCreated::class, + \Paddle\SDK\Notifications\Entities\Address::class, + ], + [ + 'address.imported', + 'address', + \Paddle\SDK\Notifications\Events\AddressImported::class, + \Paddle\SDK\Notifications\Entities\Address::class, + ], + [ + 'address.updated', + 'address', + \Paddle\SDK\Notifications\Events\AddressUpdated::class, + \Paddle\SDK\Notifications\Entities\Address::class, + ], + [ + 'adjustment.created', + 'adjustment', + \Paddle\SDK\Notifications\Events\AdjustmentCreated::class, + \Paddle\SDK\Notifications\Entities\Adjustment::class, + ], + [ + 'adjustment.updated', + 'adjustment', + \Paddle\SDK\Notifications\Events\AdjustmentUpdated::class, + \Paddle\SDK\Notifications\Entities\Adjustment::class, + ], + [ + 'business.created', + 'business', + \Paddle\SDK\Notifications\Events\BusinessCreated::class, + \Paddle\SDK\Notifications\Entities\Business::class, + ], + [ + 'business.imported', + 'business', + \Paddle\SDK\Notifications\Events\BusinessImported::class, + \Paddle\SDK\Notifications\Entities\Business::class, + ], + [ + 'business.updated', + 'business', + \Paddle\SDK\Notifications\Events\BusinessUpdated::class, + \Paddle\SDK\Notifications\Entities\Business::class, + ], + [ + 'customer.created', + 'customer', + \Paddle\SDK\Notifications\Events\CustomerCreated::class, + \Paddle\SDK\Notifications\Entities\Customer::class, + ], + [ + 'customer.imported', + 'customer', + \Paddle\SDK\Notifications\Events\CustomerImported::class, + \Paddle\SDK\Notifications\Entities\Customer::class, + ], + [ + 'customer.updated', + 'customer', + \Paddle\SDK\Notifications\Events\CustomerUpdated::class, + \Paddle\SDK\Notifications\Entities\Customer::class, + ], + [ + 'discount.created', + 'discount', + \Paddle\SDK\Notifications\Events\DiscountCreated::class, + \Paddle\SDK\Notifications\Entities\Discount::class, + ], + [ + 'discount.imported', + 'discount', + \Paddle\SDK\Notifications\Events\DiscountImported::class, + \Paddle\SDK\Notifications\Entities\Discount::class, + ], + [ + 'discount.updated', + 'discount', + \Paddle\SDK\Notifications\Events\DiscountUpdated::class, + \Paddle\SDK\Notifications\Entities\Discount::class, + ], + [ + 'payout.created', + 'payout', + \Paddle\SDK\Notifications\Events\PayoutCreated::class, + \Paddle\SDK\Notifications\Entities\Payout::class, + ], + [ + 'payout.paid', + 'payout', + \Paddle\SDK\Notifications\Events\PayoutPaid::class, + \Paddle\SDK\Notifications\Entities\Payout::class, + ], + [ + 'price.created', + 'price', + \Paddle\SDK\Notifications\Events\PriceCreated::class, + \Paddle\SDK\Notifications\Entities\Price::class, + ], + [ + 'price.updated', + 'price', + \Paddle\SDK\Notifications\Events\PriceUpdated::class, + \Paddle\SDK\Notifications\Entities\Price::class, + ], + [ + 'price.imported', + 'price', + \Paddle\SDK\Notifications\Events\PriceImported::class, + \Paddle\SDK\Notifications\Entities\Price::class, + ], + [ + 'product.created', + 'product', + \Paddle\SDK\Notifications\Events\ProductCreated::class, + \Paddle\SDK\Notifications\Entities\Product::class, + ], + [ + 'product.updated', + 'product', + \Paddle\SDK\Notifications\Events\ProductUpdated::class, + \Paddle\SDK\Notifications\Entities\Product::class, + ], + [ + 'product.imported', + 'product', + \Paddle\SDK\Notifications\Events\ProductImported::class, + \Paddle\SDK\Notifications\Entities\Product::class, + ], + [ + 'subscription.activated', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionActivated::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.canceled', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionCanceled::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.created', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionCreated::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.imported', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionImported::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.past_due', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionPastDue::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.paused', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionPaused::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.resumed', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionResumed::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.trialing', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionTrialing::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'subscription.updated', + 'subscription', + \Paddle\SDK\Notifications\Events\SubscriptionUpdated::class, + \Paddle\SDK\Notifications\Entities\Subscription::class, + ], + [ + 'transaction.billed', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionBilled::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.canceled', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionCanceled::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.completed', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionCompleted::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.created', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionCreated::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.paid', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionPaid::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.past_due', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionPastDue::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.payment_failed', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionPaymentFailed::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.ready', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionReady::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'transaction.updated', + 'transaction', + \Paddle\SDK\Notifications\Events\TransactionUpdated::class, + \Paddle\SDK\Notifications\Entities\Transaction::class, + ], + [ + 'report.created', + 'report', + \Paddle\SDK\Notifications\Events\ReportCreated::class, + \Paddle\SDK\Notifications\Entities\Report::class, + ], + [ + 'report.updated', + 'report', + \Paddle\SDK\Notifications\Events\ReportUpdated::class, + \Paddle\SDK\Notifications\Entities\Report::class, + ], + ]; + + foreach ($eventTypeData as [$eventType, $entityProperty, $eventClass, $entityClass]) { + yield $eventType => [ + $eventType, + $entityProperty, + $eventClass, + $entityClass, + ]; + } + } + + /** + * @test + */ + public function it_creates_entity_from_data(): void + { + $event = Event::from(self::readJsonFixture('notification/business.updated')); + + self::assertSame('ntf_01h8bzam1z32agrxjwhjgqk8w6', $event->notificationId); + + self::assertInstanceOf(\Paddle\SDK\Notifications\Events\BusinessUpdated::class, $event); + self::assertInstanceOf(Entity::class, $event->data); + self::assertSame($event->data, $event->business); + self::assertSame('evt_01h8bzakzx3hm2fmen703n5q45', $event->eventId); + self::assertSame('2023-08-21T11:57:47.390+00:00', $event->occurredAt->format(DATE_RFC3339_EXTENDED)); + self::assertSame('business.updated', $event->eventType->getValue()); + + $business = $event->business; + self::assertInstanceOf(\Paddle\SDK\Notifications\Entities\Business::class, $business); + self::assertSame('biz_01h84a7hr4pzhsajkm8tev89ev', $business->id); + self::assertSame('ChatApp Inc.', $business->name); + self::assertSame('active', $business->status->getValue()); + } + + /** @test */ + public function it_creates_from_request(): void + { + $requestStream = $this->createMock(StreamInterface::class); + $requestStream + ->method('__toString') + ->willReturn(self::readRawJsonFixture('notification/business.updated')); + + $request = $this->createMock(ServerRequestInterface::class); + $request + ->method('getBody') + ->willReturn($requestStream); + + $notification = Event::fromRequest($request); + + self::assertSame('ntf_01h8bzam1z32agrxjwhjgqk8w6', $notification->notificationId); + } +} diff --git a/tests/Unit/Entities/_fixtures/notification/business.updated.json b/tests/Unit/Entities/_fixtures/notification/business.updated.json new file mode 100644 index 0000000..c3c93c8 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/business.updated.json @@ -0,0 +1,29 @@ +{ + "data": { + "id": "biz_01h84a7hr4pzhsajkm8tev89ev", + "name": "ChatApp Inc.", + "status": "active", + "contacts": [ + { + "name": "Parker Jones", + "email": "parker@example.com" + }, + { + "name": "Jo Riley", + "email": "jo@example.com" + }, + { + "name": "Jesse Garcia", + "email": "jo@example.com" + } + ], + "created_at": "2023-08-18T12:34:25.668Z", + "updated_at": "2023-08-21T11:57:47.03542Z", + "company_number": "555775291485", + "tax_identifier": null + }, + "event_id": "evt_01h8bzakzx3hm2fmen703n5q45", + "event_type": "business.updated", + "occurred_at": "2023-08-21T11:57:47.390028Z", + "notification_id": "ntf_01h8bzam1z32agrxjwhjgqk8w6" +} diff --git a/tests/Unit/Entities/_fixtures/notification/entity/address.created.json b/tests/Unit/Entities/_fixtures/notification/entity/address.created.json new file mode 100644 index 0000000..10dcb1e --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/address.created.json @@ -0,0 +1,16 @@ +{ + "id": "add_01hv8gq3318ktkfengj2r75gfx", + "city": "New York", + "region": "NY", + "status": "active", + "created_at": "2024-04-12T06:42:58.785Z", + "first_line": "4050 Jefferson Plaza, 41st Floor", + "updated_at": "2024-04-12T06:42:58.785Z", + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "description": "Head Office", + "import_meta": null, + "postal_code": "10021", + "second_line": null, + "country_code": "US" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/address.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/address.imported.json new file mode 100644 index 0000000..75b3a00 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/address.imported.json @@ -0,0 +1,19 @@ +{ + "id": "add_01hv8gq3318ktkfengj2r75gfx", + "city": "Phoenix", + "region": "AZ", + "status": "active", + "created_at": "2024-04-12T06:51:26.153Z", + "first_line": "8700 Edgemont Road", + "updated_at": "2024-04-12T06:51:26.153Z", + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "description": "Sales Office", + "import_meta": { + "external_id": "59f25141-28c3-4447-b77c-dae5677537f0", + "imported_from": "billing_platform" + }, + "postal_code": "85051", + "second_line": null, + "country_code": "US" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/address.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/address.updated.json new file mode 100644 index 0000000..53a9e5a --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/address.updated.json @@ -0,0 +1,18 @@ +{ + "id": "add_01hv8gq3318ktkfengj2r75gfx", + "city": "San Jose", + "region": "CA", + "status": "active", + "created_at": "2024-04-12T06:45:53.267Z", + "first_line": "5400 E Washington Drive, Floor 2", + "updated_at": "2024-04-12T06:47:01.533006Z", + "custom_data": { + "crm_id": "08bcfb7a-41d8-4747-9ade-3d885c287d0f" + }, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "description": "California Office", + "import_meta": null, + "postal_code": "95314", + "second_line": null, + "country_code": "US" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/adjustment.created.json b/tests/Unit/Entities/_fixtures/notification/entity/adjustment.created.json new file mode 100644 index 0000000..bff0110 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/adjustment.created.json @@ -0,0 +1,43 @@ +{ + "id": "adj_01hvgf2s84dr6reszzg29zbvcm", + "items": [ + { + "id": "adjitm_01hvgf2s84dr6reszzg2gx70gj", + "type": "partial", + "amount": "100", + "totals": { + "tax": "8", + "total": "100", + "subtotal": "92" + }, + "item_id": "txnitm_01hvcc94b7qgz60qmrqmbm19zw", + "proration": null + } + ], + "action": "refund", + "reason": "error", + "status": "pending_approval", + "totals": { + "fee": "5", + "tax": "8", + "total": "100", + "earnings": "87", + "subtotal": "92", + "currency_code": "USD" + }, + "created_at": "2024-04-15T08:48:20.239695Z", + "updated_at": "2024-04-15T08:48:20.239695Z", + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "currency_code": "USD", + "payout_totals": { + "fee": "5", + "tax": "8", + "total": "100", + "earnings": "87", + "subtotal": "92", + "currency_code": "USD" + }, + "transaction_id": "txn_01hvcc93znj3mpqt1tenkjb04y", + "subscription_id": "sub_01hvccbx32q2gb40sqx7n42430", + "credit_applied_to_balance": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/adjustment.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/adjustment.updated.json new file mode 100644 index 0000000..d01ba4f --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/adjustment.updated.json @@ -0,0 +1,43 @@ +{ + "id": "adj_01hvgf2s84dr6reszzg29zbvcm", + "items": [ + { + "id": "adjitm_01hvgf2s84dr6reszzg2gx70gj", + "type": "partial", + "amount": "100", + "totals": { + "tax": "8", + "total": "100", + "subtotal": "92" + }, + "item_id": "txnitm_01hvcc94b7qgz60qmrqmbm19zw", + "proration": null + } + ], + "action": "refund", + "reason": "error", + "status": "pending_approval", + "totals": { + "fee": "5", + "tax": "8", + "total": "100", + "earnings": "87", + "subtotal": "92", + "currency_code": "USD" + }, + "created_at": "2024-04-15T08:48:20.239695Z", + "updated_at": "2024-04-15T08:54:10.646377Z", + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "currency_code": "USD", + "payout_totals": { + "fee": "5", + "tax": "8", + "total": "100", + "earnings": "87", + "subtotal": "92", + "currency_code": "USD" + }, + "transaction_id": "txn_01hvcc93znj3mpqt1tenkjb04y", + "subscription_id": "sub_01hvccbx32q2gb40sqx7n42430", + "credit_applied_to_balance": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/business.created.json b/tests/Unit/Entities/_fixtures/notification/entity/business.created.json new file mode 100644 index 0000000..de039d6 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/business.created.json @@ -0,0 +1,18 @@ +{ + "id": "biz_01hv8hkr641vmpwytx38znv56k", + "name": "Uplift Inc.", + "status": "active", + "contacts": [ + { + "name": "Parker Jones", + "email": "parker@example.com" + } + ], + "created_at": "2024-04-12T06:58:37.892Z", + "updated_at": "2024-04-12T06:58:37.892Z", + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "company_number": "555775291485", + "tax_identifier": "555952383" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/business.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/business.imported.json new file mode 100644 index 0000000..6144d1d --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/business.imported.json @@ -0,0 +1,21 @@ +{ + "id": "biz_01hv8hkr641vmpwytx38znv56k", + "name": "HighFly LLC.", + "status": "active", + "contacts": [ + { + "name": "Blair Lopez", + "email": "blair@example.com" + } + ], + "created_at": "2024-04-12T07:05:50.887Z", + "updated_at": "2024-04-12T07:05:50.887Z", + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": { + "external_id": "1fc0727f-d3d5-43a0-907a-f3c002535ca0", + "imported_from": "billing_platform" + }, + "company_number": "555829503785", + "tax_identifier": "555810433" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/business.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/business.updated.json new file mode 100644 index 0000000..d815bb7 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/business.updated.json @@ -0,0 +1,28 @@ +{ + "id": "biz_01hv8hkr641vmpwytx38znv56k", + "name": "Uplift Inc.", + "status": "active", + "contacts": [ + { + "name": "Parker Jones", + "email": "parker@example.com" + }, + { + "name": "Jo Riley", + "email": "jo@example.com" + }, + { + "name": "Jesse Garcia", + "email": "jo@example.com" + } + ], + "created_at": "2024-04-12T06:58:37.892Z", + "updated_at": "2024-04-12T07:01:03.510528Z", + "custom_data": { + "crm_id": "eb9b8d9b-7dd6-48e6-8c39-8557bba5eaa9" + }, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "company_number": "555775291485", + "tax_identifier": "555952383" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/customer.created.json b/tests/Unit/Entities/_fixtures/notification/entity/customer.created.json new file mode 100644 index 0000000..3998f7d --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/customer.created.json @@ -0,0 +1,12 @@ +{ + "id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "name": "Jo Brown", + "email": "jo@example.com", + "locale": "en", + "status": "active", + "created_at": "2024-04-11T15:57:24.813Z", + "updated_at": "2024-04-11T15:57:24.813Z", + "custom_data": null, + "import_meta": null, + "marketing_consent": false +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/customer.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/customer.imported.json new file mode 100644 index 0000000..d603e8a --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/customer.imported.json @@ -0,0 +1,15 @@ +{ + "id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "name": "Lex Taylor", + "email": "lex@example.com", + "locale": "en", + "status": "active", + "created_at": "2024-04-11T16:07:56.554Z", + "updated_at": "2024-04-11T16:07:56.554Z", + "custom_data": null, + "import_meta": { + "external_id": "4f626321-f3af-46f6-925e-d1cb315e89f0", + "imported_from": "billing_platform" + }, + "marketing_consent": false +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/customer.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/customer.updated.json new file mode 100644 index 0000000..f19e856 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/customer.updated.json @@ -0,0 +1,12 @@ +{ + "id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "name": "Jo Brown-Anderson", + "email": "jo@example.com", + "locale": "en", + "status": "active", + "created_at": "2024-04-11T15:57:24.813Z", + "updated_at": "2024-04-11T15:59:56.658719Z", + "custom_data": null, + "import_meta": null, + "marketing_consent": false +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/discount.created.json b/tests/Unit/Entities/_fixtures/notification/entity/discount.created.json new file mode 100644 index 0000000..643172e --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/discount.created.json @@ -0,0 +1,19 @@ +{ + "id": "dsc_01hv6scyf7qdnzcdq01t2y8dx4", + "code": "SEWRGPB9WY", + "type": "percentage", + "recur": true, + "amount": "10", + "status": "active", + "created_at": "2024-04-11T14:36:14.695Z", + "expires_at": "2024-12-03T00:00:00Z", + "updated_at": "2024-04-11T14:36:14.695Z", + "custom_data": null, + "description": "Seasonal sale", + "import_meta": null, + "restrict_to": [], + "usage_limit": null, + "currency_code": null, + "enabled_for_checkout": true, + "maximum_recurring_intervals": 3 +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/discount.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/discount.imported.json new file mode 100644 index 0000000..ecee597 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/discount.imported.json @@ -0,0 +1,24 @@ +{ + "id": "dsc_01gv599b6zkj42fkpxftjeca8f", + "status": "active", + "description": "Legacy customer discount", + "enabled_for_checkout": true, + "code": "ZJFYC3K9KT", + "type": "flat", + "amount": "1000", + "currency_code": "USD", + "recur": true, + "maximum_recurring_intervals": null, + "usage_limit": null, + "restrict_to": [ + "pri_01h19fp7wgbasj0h1627jknp7f" + ], + "custom_data": null, + "import_meta": { + "external_id": "fc1ba9bc-8ddb-11ee-b9d1-0242ac120002", + "imported_from": "billing_platform" + }, + "expires_at": "2023-06-12T09:18:00Z", + "created_at": "2023-03-10T08:13:06.655Z", + "updated_at": "2023-06-05T09:18:46.63Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/discount.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/discount.updated.json new file mode 100644 index 0000000..6058c12 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/discount.updated.json @@ -0,0 +1,22 @@ +{ + "id": "dsc_01hv6scyf7qdnzcdq01t2y8dx4", + "code": "SPRINGSALE", + "type": "percentage", + "recur": true, + "amount": "10", + "status": "active", + "created_at": "2024-04-11T14:36:14.695Z", + "expires_at": "2024-12-03T00:00:00Z", + "updated_at": "2024-04-11T14:41:22.343Z", + "custom_data": null, + "description": "Seasonal sale", + "import_meta": null, + "restrict_to": [ + "pro_01gsz4t5hdjse780zja8vvr7jg", + "pro_01gsz4s0w61y0pp88528f1wvvb" + ], + "usage_limit": null, + "currency_code": null, + "enabled_for_checkout": true, + "maximum_recurring_intervals": 3 +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/payout.created.json b/tests/Unit/Entities/_fixtures/notification/entity/payout.created.json new file mode 100644 index 0000000..072417d --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/payout.created.json @@ -0,0 +1,6 @@ +{ + "id": "pay_01gsz4vmqbjk3x4vvtafffd540", + "status": "unpaid", + "amount": "10000", + "currency_code": "USD" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/payout.paid.json b/tests/Unit/Entities/_fixtures/notification/entity/payout.paid.json new file mode 100644 index 0000000..8db9322 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/payout.paid.json @@ -0,0 +1,6 @@ +{ + "id": "pay_01gsz4vmqbjk3x4vvtafffd540", + "status": "paid", + "amount": "10000", + "currency_code": "USD" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/price.created.json b/tests/Unit/Entities/_fixtures/notification/entity/price.created.json new file mode 100644 index 0000000..df2998f --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/price.created.json @@ -0,0 +1,30 @@ +{ + "id": "pri_01hv0vax6rv18t4tamj848ne4d", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "product_id": "pro_01htz88xpr0mm7b3ta2pjkr7w2", + "unit_price": { + "amount": "500", + "currency_code": "USD" + }, + "custom_data": null, + "description": "Monthly (per seat) with 14 day trial", + "import_meta": null, + "trial_period": { + "interval": "day", + "frequency": 14 + }, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "created_at": "2024-04-09T07:14:38.424504286Z", + "updated_at": "2024-04-09T07:14:38.424504359Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/price.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/price.imported.json new file mode 100644 index 0000000..963517d --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/price.imported.json @@ -0,0 +1,30 @@ +{ + "id": "pri_01gsz95g2zrkagg294kpstx54r", + "product_id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "type": "standard", + "description": "Monthly (recurring addon)", + "name": "Monthly (recurring addon)", + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "trial_period": null, + "tax_mode": "account_setting", + "unit_price": { + "amount": "25000", + "currency_code": "USD" + }, + "unit_price_overrides": [], + "custom_data": null, + "status": "active", + "quantity": { + "minimum": 1, + "maximum": 1 + }, + "import_meta": { + "external_id": "fc1ba9bc-8ddb-11ee-b9d1-0242ac120002", + "imported_from": "billing_platform" + }, + "created_at": "2024-01-01T13:31:34.071379Z", + "updated_at": "2024-01-01T13:31:34.071379Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/price.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/price.updated.json new file mode 100644 index 0000000..8096b0c --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/price.updated.json @@ -0,0 +1,51 @@ +{ + "id": "pri_01hv0vax6rv18t4tamj848ne4d", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "product_id": "pro_01htz88xpr0mm7b3ta2pjkr7w2", + "unit_price": { + "amount": "500", + "currency_code": "USD" + }, + "custom_data": null, + "description": "Monthly (per seat) with 14 day trial", + "import_meta": null, + "trial_period": { + "interval": "day", + "frequency": 14 + }, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [ + { + "unit_price": { + "amount": "700", + "currency_code": "EUR" + }, + "country_codes": [ + "IE", + "FR", + "DE" + ] + }, + { + "unit_price": { + "amount": "600", + "currency_code": "GBP" + }, + "country_codes": [ + "GB" + ] + } + ], + "created_at": "2024-01-01T13:31:34.071379Z", + "updated_at": "2024-04-09T07:15:54.208116Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/product.created.json b/tests/Unit/Entities/_fixtures/notification/entity/product.created.json new file mode 100644 index 0000000..e079118 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/product.created.json @@ -0,0 +1,27 @@ +{ + "id": "pro_01htz88xpr0mm7b3ta2pjkr7w2", + "name": "AeroEdit Student", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": false, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": null + }, + "description": "Essential tools for student pilots to manage flight logs, analyze performance, and plan routes, and ensure compliance. Valid student pilot certificate from the FAA required.", + "import_meta": null, + "tax_category": "standard", + "created_at": "2024-04-08T16:22:16.024Z", + "updated_at": "2024-04-08T16:22:16.024Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/product.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/product.imported.json new file mode 100644 index 0000000..471bfa2 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/product.imported.json @@ -0,0 +1,16 @@ +{ + "id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "name": "VIP support", + "tax_category": "standard", + "type": "standard", + "description": "Get exclusive access to our expert team of product specialists, available to help you make the most of your AeroEdit subscription.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/qgyipKJwRtq98YNboipo_vip-support.png", + "custom_data": null, + "status": "active", + "import_meta": { + "external_id": "16a2c842-8ddc-11ee-b9d1-0242ac120002", + "imported_from": "billing_platform" + }, + "created_at": "2024-01-28T10:54:46.181Z", + "updated_at": "2024-01-28T10:54:46.181Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/product.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/product.updated.json new file mode 100644 index 0000000..840f1b5 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/product.updated.json @@ -0,0 +1,27 @@ +{ + "id": "pro_01htz88xpr0mm7b3ta2pjkr7w2", + "name": "AeroEdit for learner pilots", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": false, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": null + }, + "description": "Essential tools for student pilots to manage flight logs, analyze performance, and plan routes, and ensure compliance. Valid student pilot certificate from the FAA required.", + "import_meta": null, + "tax_category": "standard", + "created_at": "2024-04-08T16:22:16.024Z", + "updated_at": "2024-04-08T16:27:59.074Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/report.created.json b/tests/Unit/Entities/_fixtures/notification/entity/report.created.json new file mode 100644 index 0000000..7f893f6 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/report.created.json @@ -0,0 +1,21 @@ +{ + "id": "rep_01hvgdpayq6kjzyk4hz5m02cpn", + "rows": null, + "type": "adjustments", + "status": "pending", + "filters": [ + { + "name": "updated_at", + "value": "2024-04-15", + "operator": "lt" + }, + { + "name": "updated_at", + "value": "2024-01-01", + "operator": "gte" + } + ], + "created_at": "2024-04-15T08:24:03.799Z", + "expires_at": null, + "updated_at": "2024-04-15T08:24:03.799Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/report.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/report.updated.json new file mode 100644 index 0000000..b2a155e --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/report.updated.json @@ -0,0 +1,21 @@ +{ + "id": "rep_01hvgdpayq6kjzyk4hz5m02cpn", + "rows": 8, + "type": "adjustments", + "status": "ready", + "filters": [ + { + "name": "updated_at", + "value": "2024-04-15", + "operator": "lt" + }, + { + "name": "updated_at", + "value": "2024-01-01", + "operator": "gte" + } + ], + "created_at": "2024-04-15T08:24:03.799Z", + "expires_at": "2024-04-29T08:24:13.042686Z", + "updated_at": "2024-04-15T08:24:13.042692Z" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.activated.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.activated.json new file mode 100644 index 0000000..9ef48f6 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.activated.json @@ -0,0 +1,145 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T10:18:48.831Z", + "updated_at": "2024-04-12T10:18:48.831Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:18:47.635628Z", + "previously_billed_at": "2024-04-12T10:18:47.635628Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:18:48.831Z", + "updated_at": "2024-04-12T10:18:48.831Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:18:47.635628Z", + "previously_billed_at": "2024-04-12T10:18:47.635628Z" + } + ], + "status": "active", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:18:48.831Z", + "started_at": "2024-04-12T10:18:47.635628Z", + "updated_at": "2024-04-12T10:18:48.831Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-05-12T10:18:47.635628Z", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T10:18:47.635628Z", + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-05-12T10:18:47.635628Z", + "starts_at": "2024-04-12T10:18:47.635628Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.canceled.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.canceled.json new file mode 100644 index 0000000..a13b288 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.canceled.json @@ -0,0 +1,192 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 20, + "recurring": true, + "created_at": "2024-04-12T10:38:00.761Z", + "updated_at": "2024-04-12T10:49:38.76Z", + "trial_dates": null, + "next_billed_at": null, + "previously_billed_at": "2024-04-12T10:37:59.556997Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:38:00.761Z", + "updated_at": "2024-04-12T10:38:00.761Z", + "trial_dates": null, + "next_billed_at": null, + "previously_billed_at": "2024-04-12T10:37:59.556997Z" + }, + { + "price": { + "id": "pri_01gsz95g2zrkagg294kpstx54r", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:59:52.159927Z", + "product_id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "unit_price": { + "amount": "25000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:27:48.018296Z", + "custom_data": null, + "description": "Monthly (recurring addon)", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "name": "VIP support", + "type": "standard", + "tax_category": "standard", + "description": "Get exclusive access to our expert team of product specialists, available to help you make the most of your AeroEdit subscription.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/qgyipKJwRtq98YNboipo_vip-support.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T13:58:17.615Z", + "updated_at": "2024-04-05T15:44:02.893Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:49:38.765Z", + "updated_at": "2024-04-12T10:49:38.765Z", + "trial_dates": null, + "next_billed_at": null, + "previously_billed_at": "2024-04-12T10:49:38.765Z" + } + ], + "status": "canceled", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:38:00.761Z", + "started_at": "2024-04-12T10:37:59.556997Z", + "updated_at": "2024-04-12T11:24:54.873Z", + "business_id": null, + "canceled_at": "2024-04-12T11:24:54.868Z", + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": null, + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T10:37:59.556997Z", + "scheduled_change": null, + "current_billing_period": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.created.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.created.json new file mode 100644 index 0000000..1d8d99b --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.created.json @@ -0,0 +1,146 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T10:18:48.831Z", + "updated_at": "2024-04-12T10:18:48.831Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:18:47.635628Z", + "previously_billed_at": "2024-04-12T10:18:47.635628Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:18:48.831Z", + "updated_at": "2024-04-12T10:18:48.831Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:18:47.635628Z", + "previously_billed_at": "2024-04-12T10:18:47.635628Z" + } + ], + "status": "active", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:18:48.831Z", + "started_at": "2024-04-12T10:18:47.635628Z", + "updated_at": "2024-04-12T10:18:48.831Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-05-12T10:18:47.635628Z", + "transaction_id": "txn_01hv8wptq8987qeep44cyrewp9", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T10:18:47.635628Z", + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-05-12T10:18:47.635628Z", + "starts_at": "2024-04-12T10:18:47.635628Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.imported.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.imported.json new file mode 100644 index 0000000..21a913c --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.imported.json @@ -0,0 +1,148 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T11:27:08.658Z", + "updated_at": "2024-04-12T11:27:08.658Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T11:27:07.516245Z", + "previously_billed_at": "2024-04-12T11:27:07.516245Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-12T10:42:45.476453Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T11:27:08.658Z", + "updated_at": "2024-04-12T11:27:08.658Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T11:27:07.516245Z", + "previously_billed_at": "2024-04-12T11:27:07.516245Z" + } + ], + "status": "active", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T11:27:08.658Z", + "started_at": "2024-04-12T11:27:07.516245Z", + "updated_at": "2024-04-12T11:27:08.658Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": { + "external_id": "018c166c-4a55-78bd-ac69-d058a45303fb", + "imported_from": "billing_platform" + }, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-05-12T11:27:07.516245Z", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T11:27:07.516245Z", + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-05-12T11:27:07.516245Z", + "starts_at": "2024-04-12T11:27:07.516245Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.past_due.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.past_due.json new file mode 100644 index 0000000..4c6e652 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.past_due.json @@ -0,0 +1,145 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T10:18:48.831Z", + "updated_at": "2024-05-12T10:19:26.007628Z", + "trial_dates": null, + "next_billed_at": "2024-06-12T10:18:47.635628Z", + "previously_billed_at": "2024-05-12T10:18:47.635628Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:18:48.831Z", + "updated_at": "2024-05-12T10:19:26.010628Z", + "trial_dates": null, + "next_billed_at": "2024-06-12T10:18:47.635628Z", + "previously_billed_at": "2024-05-12T10:18:47.635628Z" + } + ], + "status": "past_due", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:18:48.831Z", + "started_at": "2024-04-12T10:18:47.635628Z", + "updated_at": "2024-05-12T10:19:26.014628Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-06-12T10:18:47.635628Z", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T10:18:47.635628Z", + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-06-12T10:18:47.635628Z", + "starts_at": "2024-05-12T10:18:47.635628Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.paused.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.paused.json new file mode 100644 index 0000000..d4969c8 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.paused.json @@ -0,0 +1,142 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T12:42:27.89Z", + "updated_at": "2024-04-12T12:42:27.89Z", + "trial_dates": null, + "next_billed_at": null, + "previously_billed_at": "2024-04-12T12:42:27.185672Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-12T10:42:45.476453Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T12:42:27.89Z", + "updated_at": "2024-04-12T12:42:27.89Z", + "trial_dates": null, + "next_billed_at": null, + "previously_billed_at": "2024-04-12T12:42:27.185672Z" + } + ], + "status": "paused", + "discount": null, + "paused_at": "2024-04-12T12:43:43.214Z", + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T12:42:27.89Z", + "started_at": "2024-04-12T12:42:27.185672Z", + "updated_at": "2024-04-12T12:43:43.219Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": null, + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T12:42:27.185672Z", + "scheduled_change": null, + "current_billing_period": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.resumed.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.resumed.json new file mode 100644 index 0000000..74ed995 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.resumed.json @@ -0,0 +1,145 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T12:42:27.89Z", + "updated_at": "2024-04-12T12:44:51.311Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T12:44:51.27Z", + "previously_billed_at": "2024-04-12T12:44:51.27Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-12T10:42:45.476453Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T12:42:27.89Z", + "updated_at": "2024-04-12T12:44:51.312Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T12:44:51.27Z", + "previously_billed_at": "2024-04-12T12:44:51.27Z" + } + ], + "status": "active", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T12:42:27.89Z", + "started_at": "2024-04-12T12:42:27.185672Z", + "updated_at": "2024-04-12T12:44:51.309Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-05-12T12:44:51.27Z", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T12:42:27.185672Z", + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-05-12T12:44:51.27Z", + "starts_at": "2024-04-12T12:44:51.27Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.trialing.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.trialing.json new file mode 100644 index 0000000..29259c1 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.trialing.json @@ -0,0 +1,122 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01hv0vax6rv18t4tamj848ne4d", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2024-04-09T07:14:38.424504Z", + "product_id": "pro_01htz88xpr0mm7b3ta2pjkr7w2", + "unit_price": { + "amount": "500", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:15:53.950721Z", + "custom_data": null, + "description": "Monthly (per seat) with 14 day trial", + "import_meta": null, + "trial_period": { + "interval": "day", + "frequency": 14 + }, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [ + { + "unit_price": { + "amount": "700", + "currency_code": "EUR" + }, + "country_codes": [ + "IE", + "FR", + "DE" + ] + }, + { + "unit_price": { + "amount": "600", + "currency_code": "GBP" + }, + "country_codes": [ + "GB" + ] + } + ] + }, + "product": { + "id": "pro_01htz88xpr0mm7b3ta2pjkr7w2", + "name": "AeroEdit for learner pilots", + "type": "standard", + "tax_category": "standard", + "description": "Essential tools for student pilots to manage flight logs, analyze performance, and plan routes, and ensure compliance. Valid student pilot certificate from the FAA required.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": false, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": null + }, + "status": "active", + "import_meta": null, + "created_at": "2024-04-08T16:22:16.024Z", + "updated_at": "2024-04-08T16:27:59.074Z" + }, + "status": "trialing", + "quantity": 10, + "recurring": true, + "created_at": "2024-04-12T11:30:29.648Z", + "updated_at": "2024-04-12T11:30:29.648Z", + "trial_dates": { + "ends_at": "2024-04-26T11:30:29.637Z", + "starts_at": "2024-04-12T11:30:29.637Z" + }, + "next_billed_at": "2024-04-26T11:30:29.637Z", + "previously_billed_at": null + } + ], + "status": "trialing", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T11:30:29.648Z", + "started_at": "2024-04-12T11:30:29.637Z", + "updated_at": "2024-04-12T11:30:29.648Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-04-26T11:30:29.637Z", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": null, + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-04-26T11:30:29.637Z", + "starts_at": "2024-04-12T11:30:29.637Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/subscription.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/subscription.updated.json new file mode 100644 index 0000000..8e6338d --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/subscription.updated.json @@ -0,0 +1,195 @@ +{ + "id": "sub_01hv8x29kz0t586xy6zn1a62ny", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "tax_category": "standard", + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "custom_data": { + "features": { + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true, + "payment_by_invoice": false, + "route_planning": true, + "sso": false + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z" + }, + "status": "active", + "quantity": 20, + "recurring": true, + "created_at": "2024-04-12T10:38:00.761Z", + "updated_at": "2024-04-12T10:49:38.76Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:37:59.556997Z", + "previously_billed_at": "2024-04-12T10:37:59.556997Z" + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "tax_category": "standard", + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:38:00.761Z", + "updated_at": "2024-04-12T10:38:00.761Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:37:59.556997Z", + "previously_billed_at": "2024-04-12T10:37:59.556997Z" + }, + { + "price": { + "id": "pri_01gsz95g2zrkagg294kpstx54r", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:59:52.159927Z", + "product_id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "unit_price": { + "amount": "25000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:27:48.018296Z", + "custom_data": null, + "description": "Monthly (recurring addon)", + "import_meta": null, + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [] + }, + "product": { + "id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "name": "VIP support", + "type": "standard", + "tax_category": "standard", + "description": "Get exclusive access to our expert team of product specialists, available to help you make the most of your AeroEdit subscription.", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/qgyipKJwRtq98YNboipo_vip-support.png", + "custom_data": null, + "status": "active", + "import_meta": null, + "created_at": "2023-02-23T13:58:17.615Z", + "updated_at": "2024-04-05T15:44:02.893Z" + }, + "status": "active", + "quantity": 1, + "recurring": true, + "created_at": "2024-04-12T10:49:38.765Z", + "updated_at": "2024-04-12T10:49:38.765Z", + "trial_dates": null, + "next_billed_at": "2024-05-12T10:37:59.556997Z", + "previously_billed_at": "2024-04-12T10:49:38.765Z" + } + ], + "status": "active", + "discount": null, + "paused_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:38:00.761Z", + "started_at": "2024-04-12T10:37:59.556997Z", + "updated_at": "2024-04-12T10:49:38.771Z", + "business_id": null, + "canceled_at": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "import_meta": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "currency_code": "USD", + "next_billed_at": "2024-05-12T10:37:59.556997Z", + "billing_details": null, + "collection_mode": "automatic", + "first_billed_at": "2024-04-12T10:37:59.556997Z", + "scheduled_change": null, + "current_billing_period": { + "ends_at": "2024-05-12T10:37:59.556997Z", + "starts_at": "2024-04-12T10:37:59.556997Z" + } +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.billed.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.billed.json new file mode 100644 index 0000000..7b9cb03 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.billed.json @@ -0,0 +1,269 @@ +{ + "id": "txn_01hv8m0mnx3sj85e7gxc6kga03", + "items": [ + { + "price": { + "id": "pri_01gsz91wy9k1yn7kx82aafwvea", + "name": "Annual (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:57:54.249913Z", + "product_id": "pro_01gsz4vmqbjk3x4vvtafffd540", + "unit_price": { + "amount": "50000", + "currency_code": "USD" + }, + "updated_at": "2024-04-05T14:32:00.471447Z", + "custom_data": null, + "description": "Annual", + "trial_period": null, + "billing_cycle": { + "interval": "year", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 50, + "proration": null + }, + { + "price": { + "id": "pri_01gsz96z29d88jrmsf2ztbfgjg", + "name": "Annual (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:00:40.265185Z", + "product_id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "unit_price": { + "amount": "300000", + "currency_code": "USD" + }, + "updated_at": "2024-03-25T14:31:18.587603Z", + "custom_data": null, + "description": "Annual (recurring addon)", + "trial_period": null, + "billing_cycle": { + "interval": "year", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "api", + "status": "billed", + "details": { + "totals": { + "fee": null, + "tax": "225239", + "total": "2763149", + "credit": "0", + "balance": "2763149", + "discount": "281990", + "earnings": null, + "subtotal": "2819900", + "grand_total": "2763149", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8vzz0sjdj6grvpxyyjsmvf", + "totals": { + "tax": "199687", + "total": "2449687", + "discount": "250000", + "subtotal": "2500000" + }, + "product": { + "id": "pro_01gsz4vmqbjk3x4vvtafffd540", + "name": "AeroEdit Enterprise", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/Ws808ziTS76a6YbnMkiK_enterprise.png", + "created_at": "2023-02-23T12:44:34.923Z", + "updated_at": "2024-04-05T15:58:28.309Z", + "custom_data": { + "features": { + "sso": true, + "route_planning": true, + "payment_by_invoice": true, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [], + "upgrade_description": "Ready to reach new heights? Upgrade to enterprise to unlock single sign-on, payment by invoice, and dedicated account management." + }, + "description": "The ultimate solution for organizations, featuring all Pro capabilities plus multi-user support, advanced data storage capabilities, plus personalized onboarding, dedicated account management, and the ability to pay via invoice.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz91wy9k1yn7kx82aafwvea", + "quantity": 50, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "3994", + "total": "48994", + "discount": "5000", + "subtotal": "50000" + } + }, + { + "id": "txnitm_01hv8vzz0sjdj6grvpy1fzm46f", + "totals": { + "tax": "23962", + "total": "293962", + "discount": "30000", + "subtotal": "300000" + }, + "product": { + "id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "name": "VIP support", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/qgyipKJwRtq98YNboipo_vip-support.png", + "created_at": "2023-02-23T13:58:17.615Z", + "updated_at": "2024-04-05T15:44:02.893Z", + "custom_data": null, + "description": "Get exclusive access to our expert team of product specialists, available to help you make the most of your AeroEdit subscription.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz96z29d88jrmsf2ztbfgjg", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "23962", + "total": "293962", + "discount": "30000", + "subtotal": "300000" + } + }, + { + "id": "txnitm_01hv8vzz0sjdj6grvpy6g84gyw", + "totals": { + "tax": "1590", + "total": "19500", + "discount": "1990", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1590", + "total": "19500", + "discount": "1990", + "subtotal": "19900" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "225239", + "total": "2763149", + "discount": "281990", + "subtotal": "2819900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "225239", + "total": "2763149", + "earnings": "0", + "subtotal": "2537910", + "grand_total": "2763149", + "currency_code": "USD" + } + }, + "checkout": { + "url": null + }, + "payments": [], + "billed_at": "2024-04-12T10:30:27.198043152Z", + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T07:40:38.00704Z", + "invoice_id": "inv_01hv8m0nn5nbvdejcvv9cpg8jf", + "updated_at": "2024-04-12T10:30:27.584874645Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": "dsc_01gtgztp8fpchantd5g1wrksa3", + "currency_code": "USD", + "billing_period": { + "ends_at": "2025-04-11T23:59:00Z", + "starts_at": "2024-04-12T00:00:00Z" + }, + "invoice_number": null, + "billing_details": { + "payment_terms": { + "interval": "day", + "frequency": 14 + }, + "enable_checkout": false, + "purchase_order_number": "PO-123", + "additional_information": null + }, + "collection_mode": "manual", + "subscription_id": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.canceled.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.canceled.json new file mode 100644 index 0000000..0bbb616 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.canceled.json @@ -0,0 +1,269 @@ +{ + "id": "txn_01hv8m0mnx3sj85e7gxc6kga03", + "items": [ + { + "price": { + "id": "pri_01gsz91wy9k1yn7kx82aafwvea", + "name": "Annual (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:57:54.249913Z", + "product_id": "pro_01gsz4vmqbjk3x4vvtafffd540", + "unit_price": { + "amount": "50000", + "currency_code": "USD" + }, + "updated_at": "2024-04-05T14:32:00.471447Z", + "custom_data": null, + "description": "Annual", + "trial_period": null, + "billing_cycle": { + "interval": "year", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 50, + "proration": null + }, + { + "price": { + "id": "pri_01gsz96z29d88jrmsf2ztbfgjg", + "name": "Annual (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:00:40.265185Z", + "product_id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "unit_price": { + "amount": "300000", + "currency_code": "USD" + }, + "updated_at": "2024-03-25T14:31:18.587603Z", + "custom_data": null, + "description": "Annual (recurring addon)", + "trial_period": null, + "billing_cycle": { + "interval": "year", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "api", + "status": "canceled", + "details": { + "totals": { + "fee": null, + "tax": "225239", + "total": "2763149", + "credit": "0", + "balance": "2763149", + "discount": "281990", + "earnings": null, + "subtotal": "2819900", + "grand_total": "2763149", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8vzz0sjdj6grvpxyyjsmvf", + "totals": { + "tax": "199687", + "total": "2449687", + "discount": "250000", + "subtotal": "2500000" + }, + "product": { + "id": "pro_01gsz4vmqbjk3x4vvtafffd540", + "name": "AeroEdit Enterprise", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/Ws808ziTS76a6YbnMkiK_enterprise.png", + "created_at": "2023-02-23T12:44:34.923Z", + "updated_at": "2024-04-05T15:58:28.309Z", + "custom_data": { + "features": { + "sso": true, + "route_planning": true, + "payment_by_invoice": true, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [], + "upgrade_description": "Ready to reach new heights? Upgrade to enterprise to unlock single sign-on, payment by invoice, and dedicated account management." + }, + "description": "The ultimate solution for organizations, featuring all Pro capabilities plus multi-user support, advanced data storage capabilities, plus personalized onboarding, dedicated account management, and the ability to pay via invoice.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz91wy9k1yn7kx82aafwvea", + "quantity": 50, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "3994", + "total": "48994", + "discount": "5000", + "subtotal": "50000" + } + }, + { + "id": "txnitm_01hv8vzz0sjdj6grvpy1fzm46f", + "totals": { + "tax": "23962", + "total": "293962", + "discount": "30000", + "subtotal": "300000" + }, + "product": { + "id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "name": "VIP support", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/qgyipKJwRtq98YNboipo_vip-support.png", + "created_at": "2023-02-23T13:58:17.615Z", + "updated_at": "2024-04-05T15:44:02.893Z", + "custom_data": null, + "description": "Get exclusive access to our expert team of product specialists, available to help you make the most of your AeroEdit subscription.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz96z29d88jrmsf2ztbfgjg", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "23962", + "total": "293962", + "discount": "30000", + "subtotal": "300000" + } + }, + { + "id": "txnitm_01hv8vzz0sjdj6grvpy6g84gyw", + "totals": { + "tax": "1590", + "total": "19500", + "discount": "1990", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1590", + "total": "19500", + "discount": "1990", + "subtotal": "19900" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "225239", + "total": "2763149", + "discount": "281990", + "subtotal": "2819900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "225239", + "total": "2763149", + "earnings": "0", + "subtotal": "2537910", + "grand_total": "2763149", + "currency_code": "USD" + } + }, + "checkout": { + "url": null + }, + "payments": [], + "billed_at": "2024-04-12T10:30:27.198043Z", + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T07:40:38.00704Z", + "invoice_id": "inv_01hv8m0nn5nbvdejcvv9cpg8jf", + "updated_at": "2024-04-12T10:31:27.360716923Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": "dsc_01gtgztp8fpchantd5g1wrksa3", + "currency_code": "USD", + "billing_period": { + "ends_at": "2025-04-11T23:59:00Z", + "starts_at": "2024-04-12T00:00:00Z" + }, + "invoice_number": "325-10567", + "billing_details": { + "payment_terms": { + "interval": "day", + "frequency": 14 + }, + "enable_checkout": false, + "purchase_order_number": "PO-123", + "additional_information": null + }, + "collection_mode": "manual", + "subscription_id": "sub_01hv8xqmay5w5rfsnzkxzgy0yp" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.completed.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.completed.json new file mode 100644 index 0000000..8a73291 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.completed.json @@ -0,0 +1,317 @@ +{ + "id": "txn_01hv8wptq8987qeep44cyrewp9", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 10, + "proration": null + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "web", + "status": "completed", + "details": { + "totals": { + "fee": "3311", + "tax": "5315", + "total": "65215", + "credit": "0", + "balance": "0", + "discount": "0", + "earnings": "56589", + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8wt98jahpbm1t1tzr06z6n", + "totals": { + "tax": "2662", + "total": "32662", + "discount": "0", + "subtotal": "30000" + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "quantity": 10, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "266", + "total": "3266", + "discount": "0", + "subtotal": "3000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v1sd067y", + "totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z", + "custom_data": null, + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01h1vjfevh5etwq3rb416a23h2", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v67vqnb6", + "totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + } + } + ], + "payout_totals": { + "fee": "3311", + "tax": "5315", + "total": "65215", + "credit": "0", + "balance": "0", + "discount": "0", + "earnings": "56589", + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "tax_rates_used": [ + { + "totals": { + "tax": "5315", + "total": "65215", + "discount": "0", + "subtotal": "59900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "3311", + "tax": "5315", + "total": "65215", + "earnings": "56589", + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD" + } + }, + "checkout": { + "url": "https:\/\/aeroedit.com\/pay?_ptxn=txn_01hv8wptq8987qeep44cyrewp9" + }, + "payments": [ + { + "amount": "65215", + "status": "captured", + "created_at": "2024-04-12T10:18:33.579142Z", + "error_code": null, + "captured_at": "2024-04-12T10:18:47.635628Z", + "method_details": { + "card": { + "type": "visa", + "last4": "3184", + "expiry_year": 2025, + "expiry_month": 1, + "cardholder_name": "Michael McGovern" + }, + "type": "card" + }, + "payment_method_id": "paymtd_01hv8x1tpjfnttxddw73xnqx6s", + "payment_attempt_id": "937640dd-e3dc-40df-a16c-bb75aafd8f71", + "stored_payment_method_id": "281ff2ca-8550-42b9-bf39-15948e7de62d" + }, + { + "amount": "65215", + "status": "error", + "created_at": "2024-04-12T10:15:57.888183Z", + "error_code": "declined", + "captured_at": null, + "method_details": { + "card": { + "type": "visa", + "last4": "0002", + "expiry_year": 2025, + "expiry_month": 1, + "cardholder_name": "Michael McGovern" + }, + "type": "card" + }, + "payment_method_id": "paymtd_01hv8wx2mka7dfsqjjsxh1ne7z", + "payment_attempt_id": "8f72cfa6-26b4-4a57-91dc-8f2708f7822d", + "stored_payment_method_id": "a78ece50-356f-4e0c-b72d-ad5368b0a0d9" + } + ], + "billed_at": "2024-04-12T10:18:48.294633Z", + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:12:33.2014Z", + "invoice_id": "inv_01hv8x29nsh54c2pgt0hnq0zkx", + "updated_at": "2024-04-12T10:18:49.738971238Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": null, + "currency_code": "USD", + "billing_period": { + "ends_at": "2024-05-12T10:18:47.635628Z", + "starts_at": "2024-04-12T10:18:47.635628Z" + }, + "invoice_number": "325-10566", + "billing_details": null, + "collection_mode": "automatic", + "subscription_id": "sub_01hv8x29kz0t586xy6zn1a62ny" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.created.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.created.json new file mode 100644 index 0000000..c263173 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.created.json @@ -0,0 +1,261 @@ +{ + "id": "txn_01hv8wptq8987qeep44cyrewp9", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 10, + "proration": null + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "web", + "status": "draft", + "details": { + "totals": { + "fee": null, + "tax": "9585", + "total": "57509", + "credit": "0", + "balance": "57509", + "discount": "0", + "earnings": null, + "subtotal": "47924", + "grand_total": "57509", + "currency_code": "GBP", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8wpts6n6wkcr973fmt6gt7", + "totals": { + "tax": "4800", + "total": "28800", + "discount": "0", + "subtotal": "24000" + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "quantity": 10, + "tax_rate": "0.2", + "unit_totals": { + "tax": "480", + "total": "2880", + "discount": "0", + "subtotal": "2400" + } + }, + { + "id": "txnitm_01hv8wpts6n6wkcr973jywgjzx", + "totals": { + "tax": "1600", + "total": "9601", + "discount": "0", + "subtotal": "8001" + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z", + "custom_data": null, + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01h1vjfevh5etwq3rb416a23h2", + "quantity": 1, + "tax_rate": "0.2", + "unit_totals": { + "tax": "1600", + "total": "9601", + "discount": "0", + "subtotal": "8001" + } + }, + { + "id": "txnitm_01hv8wpts6n6wkcr973nc9r7dm", + "totals": { + "tax": "3185", + "total": "19108", + "discount": "0", + "subtotal": "15923" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.2", + "unit_totals": { + "tax": "3185", + "total": "19108", + "discount": "0", + "subtotal": "15923" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "9585", + "total": "57509", + "discount": "0", + "subtotal": "47924" + }, + "tax_rate": "0.2" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "9585", + "total": "57509", + "earnings": "0", + "subtotal": "47924", + "grand_total": "57509", + "currency_code": "GBP" + } + }, + "checkout": { + "url": "https:\/\/aeroedit.com\/pay?_ptxn=txn_01hv8wptq8987qeep44cyrewp9" + }, + "payments": [], + "billed_at": null, + "address_id": null, + "created_at": "2024-04-12T10:12:33.201400507Z", + "invoice_id": null, + "updated_at": "2024-04-12T10:12:33.201400507Z", + "business_id": null, + "custom_data": null, + "customer_id": null, + "discount_id": null, + "currency_code": "GBP", + "billing_period": null, + "invoice_number": null, + "billing_details": null, + "collection_mode": "automatic", + "subscription_id": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.paid.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.paid.json new file mode 100644 index 0000000..a50edc0 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.paid.json @@ -0,0 +1,302 @@ +{ + "id": "txn_01hv8wptq8987qeep44cyrewp9", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 10, + "proration": null + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "web", + "status": "paid", + "details": { + "totals": { + "fee": null, + "tax": "5315", + "total": "65215", + "credit": "0", + "balance": "0", + "discount": "0", + "earnings": null, + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8wt98jahpbm1t1tzr06z6n", + "totals": { + "tax": "2662", + "total": "32662", + "discount": "0", + "subtotal": "30000" + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "quantity": 10, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "266", + "total": "3266", + "discount": "0", + "subtotal": "3000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v1sd067y", + "totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z", + "custom_data": null, + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01h1vjfevh5etwq3rb416a23h2", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v67vqnb6", + "totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "5315", + "total": "65215", + "discount": "0", + "subtotal": "59900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "5315", + "total": "65215", + "earnings": "0", + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD" + } + }, + "checkout": { + "url": "https:\/\/aeroedit.com\/pay?_ptxn=txn_01hv8wptq8987qeep44cyrewp9" + }, + "payments": [ + { + "amount": "65215", + "status": "captured", + "created_at": "2024-04-12T10:18:33.579142Z", + "error_code": null, + "captured_at": "2024-04-12T10:18:47.635628Z", + "method_details": { + "card": { + "type": "visa", + "last4": "3184", + "expiry_year": 2025, + "expiry_month": 1, + "cardholder_name": "Michael McGovern" + }, + "type": "card" + }, + "payment_method_id": "paymtd_01hv8x1tpjfnttxddw73xnqx6s", + "payment_attempt_id": "937640dd-e3dc-40df-a16c-bb75aafd8f71", + "stored_payment_method_id": "281ff2ca-8550-42b9-bf39-15948e7de62d" + }, + { + "amount": "65215", + "status": "error", + "created_at": "2024-04-12T10:15:57.888183Z", + "error_code": "declined", + "captured_at": null, + "method_details": { + "card": { + "type": "visa", + "last4": "0002", + "expiry_year": 2025, + "expiry_month": 1, + "cardholder_name": "Michael McGovern" + }, + "type": "card" + }, + "payment_method_id": "paymtd_01hv8wx2mka7dfsqjjsxh1ne7z", + "payment_attempt_id": "8f72cfa6-26b4-4a57-91dc-8f2708f7822d", + "stored_payment_method_id": "a78ece50-356f-4e0c-b72d-ad5368b0a0d9" + } + ], + "billed_at": "2024-04-12T10:18:48.294633821Z", + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:12:33.2014Z", + "invoice_id": null, + "updated_at": "2024-04-12T10:18:48.294635093Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": null, + "currency_code": "USD", + "billing_period": null, + "invoice_number": null, + "billing_details": null, + "collection_mode": "automatic", + "subscription_id": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.past_due.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.past_due.json new file mode 100644 index 0000000..cfd1532 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.past_due.json @@ -0,0 +1,252 @@ +{ + "id": "txn_01hv8xbtmb6zc7c264ycteehth", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 10, + "proration": { + "rate": "1", + "billing_period": { + "ends_at": "2024-06-12T10:18:47.635628Z", + "starts_at": "2024-05-12T10:18:47.635628Z" + } + } + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": { + "rate": "1", + "billing_period": { + "ends_at": "2024-06-12T10:18:47.635628Z", + "starts_at": "2024-05-12T10:18:47.635628Z" + } + } + } + ], + "origin": "subscription_recurring", + "status": "past_due", + "details": { + "totals": { + "fee": null, + "tax": "3549", + "total": "43549", + "credit": "0", + "balance": "43549", + "discount": "0", + "earnings": null, + "subtotal": "40000", + "grand_total": "43549", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8xbv0wdggp4a9338b18ckn", + "totals": { + "tax": "2662", + "total": "32662", + "discount": "0", + "subtotal": "30000" + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "quantity": 10, + "tax_rate": "0.08875", + "proration": { + "rate": "1", + "billing_period": { + "ends_at": "2024-06-12T10:18:47.635628Z", + "starts_at": "2024-05-12T10:18:47.635628Z" + } + }, + "unit_totals": { + "tax": "266", + "total": "3266", + "discount": "0", + "subtotal": "3000" + } + }, + { + "id": "txnitm_01hv8xbv0wdggp4a933cx2m9qc", + "totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z", + "custom_data": null, + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01h1vjfevh5etwq3rb416a23h2", + "quantity": 1, + "tax_rate": "0.08875", + "proration": { + "rate": "1", + "billing_period": { + "ends_at": "2024-06-12T10:18:47.635628Z", + "starts_at": "2024-05-12T10:18:47.635628Z" + } + }, + "unit_totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "3549", + "total": "43549", + "discount": "0", + "subtotal": "40000" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "3549", + "total": "43549", + "earnings": "0", + "subtotal": "40000", + "grand_total": "43549", + "currency_code": "USD" + } + }, + "checkout": { + "url": "https:\/\/aeroedit.com\/pay?_ptxn=txn_01hv8xbtmb6zc7c264ycteehth" + }, + "payments": [ + { + "amount": "43549", + "status": "error", + "created_at": "2024-04-12T10:24:01.692772Z", + "error_code": "authentication_failed", + "captured_at": null, + "method_details": { + "card": { + "type": "visa", + "last4": "3184", + "expiry_year": 2025, + "expiry_month": 1, + "cardholder_name": "Michael McGovern" + }, + "type": "card" + }, + "payment_method_id": "paymtd_01hv8x1tpjfnttxddw73xnqx6s", + "payment_attempt_id": "ff8123f6-9cfc-4f04-9984-75e4ad04b169", + "stored_payment_method_id": "281ff2ca-8550-42b9-bf39-15948e7de62d" + } + ], + "billed_at": "2024-04-12T10:24:01.163479Z", + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:24:01.588479Z", + "invoice_id": null, + "updated_at": "2024-04-12T10:24:03.19700142Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": null, + "currency_code": "USD", + "billing_period": { + "ends_at": "2024-06-12T10:18:47.635628Z", + "starts_at": "2024-05-12T10:18:47.635628Z" + }, + "invoice_number": null, + "billing_details": null, + "collection_mode": "automatic", + "subscription_id": "sub_01hv8x29kz0t586xy6zn1a62ny" +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.payment_failed.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.payment_failed.json new file mode 100644 index 0000000..be420e2 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.payment_failed.json @@ -0,0 +1,282 @@ +{ + "id": "txn_01hv8wptq8987qeep44cyrewp9", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 10, + "proration": null + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "web", + "status": "ready", + "details": { + "totals": { + "fee": null, + "tax": "5315", + "total": "65215", + "credit": "0", + "balance": "65215", + "discount": "0", + "earnings": null, + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8wt98jahpbm1t1tzr06z6n", + "totals": { + "tax": "2662", + "total": "32662", + "discount": "0", + "subtotal": "30000" + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "quantity": 10, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "266", + "total": "3266", + "discount": "0", + "subtotal": "3000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v1sd067y", + "totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z", + "custom_data": null, + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01h1vjfevh5etwq3rb416a23h2", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v67vqnb6", + "totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "5315", + "total": "65215", + "discount": "0", + "subtotal": "59900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "5315", + "total": "65215", + "earnings": "0", + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD" + } + }, + "checkout": { + "url": "https:\/\/aeroedit.com\/pay?_ptxn=txn_01hv8wptq8987qeep44cyrewp9" + }, + "payments": [ + { + "amount": "65215", + "status": "error", + "created_at": "2024-04-12T10:15:57.888183Z", + "error_code": "declined", + "captured_at": null, + "method_details": { + "card": { + "type": "visa", + "last4": "0002", + "expiry_year": 2025, + "expiry_month": 1, + "cardholder_name": "Michael McGovern" + }, + "type": "card" + }, + "payment_method_id": "paymtd_01hv8wx2mka7dfsqjjsxh1ne7z", + "payment_attempt_id": "8f72cfa6-26b4-4a57-91dc-8f2708f7822d", + "stored_payment_method_id": "a78ece50-356f-4e0c-b72d-ad5368b0a0d9" + } + ], + "billed_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:12:33.2014Z", + "invoice_id": null, + "updated_at": "2024-04-12T10:14:26.325076Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": null, + "currency_code": "USD", + "billing_period": null, + "invoice_number": null, + "billing_details": null, + "collection_mode": "automatic", + "subscription_id": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.ready.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.ready.json new file mode 100644 index 0000000..5987dbd --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.ready.json @@ -0,0 +1,261 @@ +{ + "id": "txn_01hv8wptq8987qeep44cyrewp9", + "items": [ + { + "price": { + "id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "name": "Monthly (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 999, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:55:22.538367Z", + "product_id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "unit_price": { + "amount": "3000", + "currency_code": "USD" + }, + "updated_at": "2024-04-11T13:54:52.254748Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 10, + "proration": null + }, + { + "price": { + "id": "pri_01h1vjfevh5etwq3rb416a23h2", + "name": "Monthly (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-06-01T13:31:12.625056Z", + "product_id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "unit_price": { + "amount": "10000", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:00.907834Z", + "custom_data": null, + "description": "Monthly", + "trial_period": null, + "billing_cycle": { + "interval": "month", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "web", + "status": "ready", + "details": { + "totals": { + "fee": null, + "tax": "5315", + "total": "65215", + "credit": "0", + "balance": "65215", + "discount": "0", + "earnings": null, + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8wt98jahpbm1t1tzr06z6n", + "totals": { + "tax": "2662", + "total": "32662", + "discount": "0", + "subtotal": "30000" + }, + "product": { + "id": "pro_01gsz4t5hdjse780zja8vvr7jg", + "name": "AeroEdit Pro", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/bT1XUOJAQhOUxGs83cbk_pro.png", + "created_at": "2023-02-23T12:43:46.605Z", + "updated_at": "2024-04-05T15:53:44.687Z", + "custom_data": { + "features": { + "sso": false, + "route_planning": true, + "payment_by_invoice": false, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [ + "pro_01h1vjes1y163xfj1rh1tkfb65", + "pro_01gsz97mq9pa4fkyy0wqenepkz" + ], + "upgrade_description": "Move from Basic to Pro to take advantage of aircraft performance, advanced route planning, and compliance monitoring." + }, + "description": "Designed for professional pilots, including all features plus in Basic plus compliance monitoring, route optimization, and third-party integrations.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz8x8sawmvhz1pv30nge1ke", + "quantity": 10, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "266", + "total": "3266", + "discount": "0", + "subtotal": "3000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v1sd067y", + "totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + }, + "product": { + "id": "pro_01h1vjes1y163xfj1rh1tkfb65", + "name": "Analytics addon", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/97dRpA6SXzcE6ekK9CAr_analytics.png", + "created_at": "2023-06-01T13:30:50.302Z", + "updated_at": "2024-04-05T15:47:17.163Z", + "custom_data": null, + "description": "Unlock advanced insights into your flight data with enhanced analytics and reporting features. Includes customizable reporting templates and trend analysis across flights.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01h1vjfevh5etwq3rb416a23h2", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "887", + "total": "10887", + "discount": "0", + "subtotal": "10000" + } + }, + { + "id": "txnitm_01hv8wt98jahpbm1t1v67vqnb6", + "totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1766", + "total": "21666", + "discount": "0", + "subtotal": "19900" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "5315", + "total": "65215", + "discount": "0", + "subtotal": "59900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "5315", + "total": "65215", + "earnings": "0", + "subtotal": "59900", + "grand_total": "65215", + "currency_code": "USD" + } + }, + "checkout": { + "url": "https:\/\/aeroedit.com\/pay?_ptxn=txn_01hv8wptq8987qeep44cyrewp9" + }, + "payments": [], + "billed_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T10:12:33.2014Z", + "invoice_id": null, + "updated_at": "2024-04-12T10:14:26.325076344Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": null, + "currency_code": "USD", + "billing_period": null, + "invoice_number": null, + "billing_details": null, + "collection_mode": "automatic", + "subscription_id": null +} \ No newline at end of file diff --git a/tests/Unit/Entities/_fixtures/notification/entity/transaction.updated.json b/tests/Unit/Entities/_fixtures/notification/entity/transaction.updated.json new file mode 100644 index 0000000..8219689 --- /dev/null +++ b/tests/Unit/Entities/_fixtures/notification/entity/transaction.updated.json @@ -0,0 +1,269 @@ +{ + "id": "txn_01hv8m0mnx3sj85e7gxc6kga03", + "items": [ + { + "price": { + "id": "pri_01gsz91wy9k1yn7kx82aafwvea", + "name": "Annual (per seat)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 100, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T13:57:54.249913Z", + "product_id": "pro_01gsz4vmqbjk3x4vvtafffd540", + "unit_price": { + "amount": "50000", + "currency_code": "USD" + }, + "updated_at": "2024-04-05T14:32:00.471447Z", + "custom_data": null, + "description": "Annual", + "trial_period": null, + "billing_cycle": { + "interval": "year", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 50, + "proration": null + }, + { + "price": { + "id": "pri_01gsz96z29d88jrmsf2ztbfgjg", + "name": "Annual (recurring addon)", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:00:40.265185Z", + "product_id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "unit_price": { + "amount": "300000", + "currency_code": "USD" + }, + "updated_at": "2024-03-25T14:31:18.587603Z", + "custom_data": null, + "description": "Annual (recurring addon)", + "trial_period": null, + "billing_cycle": { + "interval": "year", + "frequency": 1 + }, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + }, + { + "price": { + "id": "pri_01gsz98e27ak2tyhexptwc58yk", + "name": "One-time addon", + "type": "standard", + "status": "active", + "quantity": { + "maximum": 1, + "minimum": 1 + }, + "tax_mode": "account_setting", + "created_at": "2023-02-23T14:01:28.391712Z", + "product_id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "unit_price": { + "amount": "19900", + "currency_code": "USD" + }, + "updated_at": "2024-04-09T07:23:10.921392Z", + "custom_data": null, + "description": "One-time addon", + "trial_period": null, + "billing_cycle": null, + "unit_price_overrides": [], + "import_meta": null + }, + "quantity": 1, + "proration": null + } + ], + "origin": "api", + "status": "ready", + "details": { + "totals": { + "fee": null, + "tax": "225239", + "total": "2763149", + "credit": "0", + "balance": "2763149", + "discount": "281990", + "earnings": null, + "subtotal": "2819900", + "grand_total": "2763149", + "currency_code": "USD", + "credit_to_balance": "0" + }, + "line_items": [ + { + "id": "txnitm_01hv8vzz0sjdj6grvpxyyjsmvf", + "totals": { + "tax": "199687", + "total": "2449687", + "discount": "250000", + "subtotal": "2500000" + }, + "product": { + "id": "pro_01gsz4vmqbjk3x4vvtafffd540", + "name": "AeroEdit Enterprise", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/Ws808ziTS76a6YbnMkiK_enterprise.png", + "created_at": "2023-02-23T12:44:34.923Z", + "updated_at": "2024-04-05T15:58:28.309Z", + "custom_data": { + "features": { + "sso": true, + "route_planning": true, + "payment_by_invoice": true, + "aircraft_performance": true, + "compliance_monitoring": true, + "flight_log_management": true + }, + "suggested_addons": [], + "upgrade_description": "Ready to reach new heights? Upgrade to enterprise to unlock single sign-on, payment by invoice, and dedicated account management." + }, + "description": "The ultimate solution for organizations, featuring all Pro capabilities plus multi-user support, advanced data storage capabilities, plus personalized onboarding, dedicated account management, and the ability to pay via invoice.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz91wy9k1yn7kx82aafwvea", + "quantity": 50, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "3994", + "total": "48994", + "discount": "5000", + "subtotal": "50000" + } + }, + { + "id": "txnitm_01hv8vzz0sjdj6grvpy1fzm46f", + "totals": { + "tax": "23962", + "total": "293962", + "discount": "30000", + "subtotal": "300000" + }, + "product": { + "id": "pro_01gsz92krfzy3hcx5h5rtgnfwz", + "name": "VIP support", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/qgyipKJwRtq98YNboipo_vip-support.png", + "created_at": "2023-02-23T13:58:17.615Z", + "updated_at": "2024-04-05T15:44:02.893Z", + "custom_data": null, + "description": "Get exclusive access to our expert team of product specialists, available to help you make the most of your AeroEdit subscription.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz96z29d88jrmsf2ztbfgjg", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "23962", + "total": "293962", + "discount": "30000", + "subtotal": "300000" + } + }, + { + "id": "txnitm_01hv8vzz0sjdj6grvpy6g84gyw", + "totals": { + "tax": "1590", + "total": "19500", + "discount": "1990", + "subtotal": "19900" + }, + "product": { + "id": "pro_01gsz97mq9pa4fkyy0wqenepkz", + "name": "Custom domains", + "type": "standard", + "status": "active", + "image_url": "https:\/\/paddle.s3.amazonaws.com\/user\/165798\/XIG7UXoJQHmlIAiKcnkA_custom-domains.png", + "created_at": "2023-02-23T14:01:02.441Z", + "updated_at": "2024-04-05T15:43:28.971Z", + "custom_data": null, + "description": "Make AeroEdit truly your own with custom domains. Custom domains reinforce your brand identity and make it easy for your team to access your account.", + "tax_category": "standard", + "import_meta": null + }, + "price_id": "pri_01gsz98e27ak2tyhexptwc58yk", + "quantity": 1, + "tax_rate": "0.08875", + "unit_totals": { + "tax": "1590", + "total": "19500", + "discount": "1990", + "subtotal": "19900" + } + } + ], + "payout_totals": null, + "tax_rates_used": [ + { + "totals": { + "tax": "225239", + "total": "2763149", + "discount": "281990", + "subtotal": "2819900" + }, + "tax_rate": "0.08875" + } + ], + "adjusted_totals": { + "fee": "0", + "tax": "225239", + "total": "2763149", + "earnings": "0", + "subtotal": "2537910", + "grand_total": "2763149", + "currency_code": "USD" + } + }, + "checkout": { + "url": null + }, + "payments": [], + "billed_at": null, + "address_id": "add_01hv8gq3318ktkfengj2r75gfx", + "created_at": "2024-04-12T07:40:38.00704Z", + "invoice_id": "inv_01hv8m0nn5nbvdejcvv9cpg8jf", + "updated_at": "2024-04-12T10:00:03.871169408Z", + "business_id": null, + "custom_data": null, + "customer_id": "ctm_01hv6y1jedq4p1n0yqn5ba3ky4", + "discount_id": "dsc_01gtgztp8fpchantd5g1wrksa3", + "currency_code": "USD", + "billing_period": { + "ends_at": "2025-04-11T23:59:00Z", + "starts_at": "2024-04-12T00:00:00Z" + }, + "invoice_number": null, + "billing_details": { + "payment_terms": { + "interval": "day", + "frequency": 14 + }, + "enable_checkout": false, + "purchase_order_number": "PO-123", + "additional_information": null + }, + "collection_mode": "manual", + "subscription_id": null +} \ No newline at end of file