From 8721fdc2b6d78d5a742d6449b9c897b4ba16b216 Mon Sep 17 00:00:00 2001 From: Michael Woodward Date: Thu, 11 Jan 2024 17:53:58 +0000 Subject: [PATCH 1/3] feat!: Refactor operation names The change prevents the need to alias when working with different resource operations. BREAKING CHANGE: All operation classes have been renamed, this will require consumer class instantiations to be updated accordingly. --- examples/catalog_management.php | 10 +- examples/event_polling.php | 4 +- src/Client.php | 2 +- src/Resources/Addresses/AddressesClient.php | 14 +-- ...{CreateOperation.php => CreateAddress.php} | 2 +- .../{ListOperation.php => ListAddresses.php} | 2 +- ...{UpdateOperation.php => UpdateAddress.php} | 2 +- .../Adjustments/AdjustmentsClient.php | 8 +- ...eateOperation.php => CreateAdjustment.php} | 2 +- ...{ListOperation.php => ListAdjustments.php} | 2 +- src/Resources/Businesses/BusinessesClient.php | 14 +-- ...CreateOperation.php => CreateBusiness.php} | 2 +- .../{ListOperation.php => ListBusinesses.php} | 2 +- ...UpdateOperation.php => UpdateBusiness.php} | 2 +- src/Resources/Customers/CustomersClient.php | 14 +-- ...CreateOperation.php => CreateCustomer.php} | 2 +- .../{ListOperation.php => ListCustomers.php} | 2 +- ...UpdateOperation.php => UpdateCustomer.php} | 2 +- src/Resources/Discounts/DiscountsClient.php | 14 +-- ...CreateOperation.php => CreateDiscount.php} | 2 +- .../{ListOperation.php => ListDiscounts.php} | 2 +- ...UpdateOperation.php => UpdateDiscount.php} | 2 +- src/Resources/Events/EventsClient.php | 4 +- .../{ListOperation.php => ListEvents.php} | 2 +- .../NotificationLogsClient.php | 4 +- ...Operation.php => ListNotificationLogs.php} | 2 +- .../NotificationSettingsClient.php | 8 +- ...tion.php => CreateNotificationSetting.php} | 2 +- ...tion.php => UpdateNotificationSetting.php} | 2 +- .../Notifications/NotificationsClient.php | 4 +- ...istOperation.php => ListNotifications.php} | 2 +- .../{CreateOperation.php => CreatePrice.php} | 2 +- .../{ListOperation.php => ListPrices.php} | 2 +- .../{UpdateOperation.php => UpdatePrice.php} | 2 +- src/Resources/Prices/PricesClient.php | 14 +-- ...ewPricesOperation.php => PreviewPrice.php} | 2 +- .../PricingPreviews/PricingPreviewsClient.php | 4 +- ...{CreateOperation.php => CreateProduct.php} | 2 +- .../{ListOperation.php => ListProducts.php} | 2 +- ...{UpdateOperation.php => UpdateProduct.php} | 2 +- src/Resources/Products/ProductsClient.php | 14 +-- .../{CreateOperation.php => CreateReport.php} | 2 +- .../{ListOperation.php => ListReports.php} | 2 +- src/Resources/Reports/ReportsClient.php | 8 +- ...elOperation.php => CancelSubscription.php} | 2 +- ...eOperation.php => CreateOneTimeCharge.php} | 2 +- ...istOperation.php => ListSubscriptions.php} | 2 +- ...useOperation.php => PauseSubscription.php} | 2 +- ...Operation.php => PreviewOneTimeCharge.php} | 2 +- ...tion.php => PreviewUpdateSubscription.php} | 2 +- ...meOperation.php => ResumeSubscription.php} | 2 +- ...teOperation.php => UpdateSubscription.php} | 2 +- .../Subscriptions/SubscriptionsClient.php | 32 +++---- ...ateOperation.php => CreateTransaction.php} | 2 +- ...ListOperation.php => ListTransactions.php} | 2 +- ...ewOperation.php => PreviewTransaction.php} | 2 +- ...ateOperation.php => UpdateTransaction.php} | 2 +- .../Transactions/TransactionsClient.php | 16 ++-- .../Addresses/AddressesClientTest.php | 36 +++---- .../Adjustments/AdjustmentsClientTest.php | 38 ++++---- .../Businesses/BusinessesClientTest.php | 36 +++---- .../Customers/CustomersClientTest.php | 36 +++---- .../Discounts/DiscountsClientTest.php | 38 ++++---- .../Resources/Events/EventsClientTest.php | 10 +- .../NotificationLogsClientTest.php | 10 +- .../NotificationSettingsClientTest.php | 18 ++-- .../Notifications/NotificationsClientTest.php | 28 +++--- .../Resources/Prices/PricesClientTest.php | 42 ++++----- .../PricingPreviewsClientTest.php | 10 +- .../Resources/Products/ProductsClientTest.php | 38 ++++---- .../Resources/Reports/ReportsClientTest.php | 20 ++-- .../Subscriptions/SubscriptionsClientTest.php | 94 +++++++++---------- .../Transactions/TransactionsClientTest.php | 72 +++++++------- 73 files changed, 397 insertions(+), 397 deletions(-) rename src/Resources/Addresses/Operations/{CreateOperation.php => CreateAddress.php} (96%) rename src/Resources/Addresses/Operations/{ListOperation.php => ListAddresses.php} (96%) rename src/Resources/Addresses/Operations/{UpdateOperation.php => UpdateAddress.php} (96%) rename src/Resources/Adjustments/Operations/{CreateOperation.php => CreateAdjustment.php} (94%) rename src/Resources/Adjustments/Operations/{ListOperation.php => ListAdjustments.php} (98%) rename src/Resources/Businesses/Operations/{CreateOperation.php => CreateBusiness.php} (95%) rename src/Resources/Businesses/Operations/{ListOperation.php => ListBusinesses.php} (97%) rename src/Resources/Businesses/Operations/{UpdateOperation.php => UpdateBusiness.php} (96%) rename src/Resources/Customers/Operations/{CreateOperation.php => CreateCustomer.php} (93%) rename src/Resources/Customers/Operations/{ListOperation.php => ListCustomers.php} (97%) rename src/Resources/Customers/Operations/{UpdateOperation.php => UpdateCustomer.php} (94%) rename src/Resources/Discounts/Operations/{CreateOperation.php => CreateDiscount.php} (97%) rename src/Resources/Discounts/Operations/{ListOperation.php => ListDiscounts.php} (97%) rename src/Resources/Discounts/Operations/{UpdateOperation.php => UpdateDiscount.php} (97%) rename src/Resources/Events/Operations/{ListOperation.php => ListEvents.php} (89%) rename src/Resources/NotificationLogs/Operations/{ListOperation.php => ListNotificationLogs.php} (87%) rename src/Resources/NotificationSettings/Operations/{CreateOperation.php => CreateNotificationSetting.php} (94%) rename src/Resources/NotificationSettings/Operations/{UpdateOperation.php => UpdateNotificationSetting.php} (95%) rename src/Resources/Notifications/Operations/{ListOperation.php => ListNotifications.php} (96%) rename src/Resources/Prices/Operations/{CreateOperation.php => CreatePrice.php} (97%) rename src/Resources/Prices/Operations/{ListOperation.php => ListPrices.php} (98%) rename src/Resources/Prices/Operations/{UpdateOperation.php => UpdatePrice.php} (97%) rename src/Resources/PricingPreviews/Operations/{PreviewPricesOperation.php => PreviewPrice.php} (96%) rename src/Resources/Products/Operations/{CreateOperation.php => CreateProduct.php} (95%) rename src/Resources/Products/Operations/{ListOperation.php => ListProducts.php} (98%) rename src/Resources/Products/Operations/{UpdateOperation.php => UpdateProduct.php} (96%) rename src/Resources/Reports/Operations/{CreateOperation.php => CreateReport.php} (95%) rename src/Resources/Reports/Operations/{ListOperation.php => ListReports.php} (96%) rename src/Resources/Subscriptions/Operations/{CancelOperation.php => CancelSubscription.php} (88%) rename src/Resources/Subscriptions/Operations/{CreateOneTimeChargeOperation.php => CreateOneTimeCharge.php} (94%) rename src/Resources/Subscriptions/Operations/{ListOperation.php => ListSubscriptions.php} (98%) rename src/Resources/Subscriptions/Operations/{PauseOperation.php => PauseSubscription.php} (92%) rename src/Resources/Subscriptions/Operations/{PreviewOneTimeChargeOperation.php => PreviewOneTimeCharge.php} (94%) rename src/Resources/Subscriptions/Operations/{PreviewUpdateOperation.php => PreviewUpdateSubscription.php} (97%) rename src/Resources/Subscriptions/Operations/{ResumeOperation.php => ResumeSubscription.php} (91%) rename src/Resources/Subscriptions/Operations/{UpdateOperation.php => UpdateSubscription.php} (98%) rename src/Resources/Transactions/Operations/{CreateOperation.php => CreateTransaction.php} (97%) rename src/Resources/Transactions/Operations/{ListOperation.php => ListTransactions.php} (98%) rename src/Resources/Transactions/Operations/{PreviewOperation.php => PreviewTransaction.php} (97%) rename src/Resources/Transactions/Operations/{UpdateOperation.php => UpdateTransaction.php} (97%) diff --git a/examples/catalog_management.php b/examples/catalog_management.php index 01c2126..54e9ae7 100644 --- a/examples/catalog_management.php +++ b/examples/catalog_management.php @@ -40,7 +40,7 @@ // │ Create Product │ // └────────────────┘ try { - $product = $paddle->products->create(new Products\Operations\CreateOperation( + $product = $paddle->products->create(new Products\Operations\CreateProduct( name: 'Kitten Service', taxCategory: TaxCategory::Standard, description: 'Simply an awesome product', @@ -57,7 +57,7 @@ // ┌─── // │ Update Product │ // └────────────────┘ -$update = new Products\Operations\UpdateOperation( +$update = new Products\Operations\UpdateProduct( name: 'Bear Service', imageUrl: 'https://placebear.com/200/300', customData: new CustomData(['beep' => 'boop']), @@ -76,7 +76,7 @@ // │ Create Price │ // └──────────────┘ try { - $price = $paddle->prices->create(new Prices\Operations\CreateOperation( + $price = $paddle->prices->create(new Prices\Operations\CreatePrice( description: 'Bear Hug', productId: $product->id, unitPrice: new Money('1000', CurrencyCode::GBP), @@ -101,7 +101,7 @@ // ┌─── // │ Update Price │ // └──────────────┘ -$update = new Prices\Operations\UpdateOperation( +$update = new Prices\Operations\UpdatePrice( description: 'One-off Bear Hug', unitPrice: new Money('500', CurrencyCode::GBP), customData: new CustomData(['beep' => 'boop']), @@ -154,7 +154,7 @@ // │ Get Products │ // └──────────────┘ try { - $products = $paddle->products->list(new Products\Operations\ListOperation( + $products = $paddle->products->list(new Products\Operations\ListProducts( includes: [ProductIncludes::Prices], statuses: [Status::Active], )); diff --git a/examples/event_polling.php b/examples/event_polling.php index 225f290..e4d5206 100644 --- a/examples/event_polling.php +++ b/examples/event_polling.php @@ -4,7 +4,7 @@ use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Events\Operations\ListOperation; +use Paddle\SDK\Resources\Events\Operations\ListEvents; use Paddle\SDK\Resources\Shared\Operations\List\Pager; require __DIR__ . '/../vendor/autoload.php'; @@ -25,7 +25,7 @@ $lastProcessedEventId = 'evt_01hfxx8t6ek9h399srcrp36jt3'; try { - $events = $paddle->events->list(new ListOperation(new Pager(after: $lastProcessedEventId))); + $events = $paddle->events->list(new ListEvents(new Pager(after: $lastProcessedEventId))); } catch (ApiError|MalformedResponse $e) { // Handle an error, terminate the poll var_dump($e->getMessage()); diff --git a/src/Client.php b/src/Client.php index c40be63..8570cec 100644 --- a/src/Client.php +++ b/src/Client.php @@ -51,7 +51,7 @@ class Client { - private const SDK_VERSION = '0.1.1'; + private const SDK_VERSION = '0.2.0'; public readonly LoggerInterface $logger; public readonly Options $options; diff --git a/src/Resources/Addresses/AddressesClient.php b/src/Resources/Addresses/AddressesClient.php index 9954ebf..ece6a99 100644 --- a/src/Resources/Addresses/AddressesClient.php +++ b/src/Resources/Addresses/AddressesClient.php @@ -18,9 +18,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Addresses\Operations\CreateOperation; -use Paddle\SDK\Resources\Addresses\Operations\ListOperation; -use Paddle\SDK\Resources\Addresses\Operations\UpdateOperation; +use Paddle\SDK\Resources\Addresses\Operations\CreateAddress; +use Paddle\SDK\Resources\Addresses\Operations\ListAddresses; +use Paddle\SDK\Resources\Addresses\Operations\UpdateAddress; use Paddle\SDK\ResponseParser; class AddressesClient @@ -34,7 +34,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(string $customerId, ListOperation $listOperation = new ListOperation()): AddressCollection + public function list(string $customerId, ListAddresses $listOperation = new ListAddresses()): AddressCollection { $parser = new ResponseParser( $this->client->getRaw("/customers/{$customerId}/addresses", $listOperation), @@ -64,7 +64,7 @@ public function get(string $customerId, string $id): Address * @throws ApiError\AddressApiError On an address specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(string $customerId, CreateOperation $createOperation): Address + public function create(string $customerId, CreateAddress $createOperation): Address { $parser = new ResponseParser( $this->client->postRaw("/customers/{$customerId}/addresses", $createOperation), @@ -78,7 +78,7 @@ public function create(string $customerId, CreateOperation $createOperation): Ad * @throws ApiError\AddressApiError On an address specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $customerId, string $id, UpdateOperation $operation): Address + public function update(string $customerId, string $id, UpdateAddress $operation): Address { $parser = new ResponseParser( $this->client->patchRaw("/customers/{$customerId}/addresses/{$id}", $operation), @@ -94,6 +94,6 @@ public function update(string $customerId, string $id, UpdateOperation $operatio */ public function archive(string $customerId, string $id): Address { - return $this->update($customerId, $id, new UpdateOperation(status: Status::Archived)); + return $this->update($customerId, $id, new UpdateAddress(status: Status::Archived)); } } diff --git a/src/Resources/Addresses/Operations/CreateOperation.php b/src/Resources/Addresses/Operations/CreateAddress.php similarity index 96% rename from src/Resources/Addresses/Operations/CreateOperation.php rename to src/Resources/Addresses/Operations/CreateAddress.php index fa961ad..c795387 100644 --- a/src/Resources/Addresses/Operations/CreateOperation.php +++ b/src/Resources/Addresses/Operations/CreateAddress.php @@ -9,7 +9,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateAddress implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Addresses/Operations/ListOperation.php b/src/Resources/Addresses/Operations/ListAddresses.php similarity index 96% rename from src/Resources/Addresses/Operations/ListOperation.php rename to src/Resources/Addresses/Operations/ListAddresses.php index 4375bff..bbae867 100644 --- a/src/Resources/Addresses/Operations/ListOperation.php +++ b/src/Resources/Addresses/Operations/ListAddresses.php @@ -9,7 +9,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListAddresses implements HasParameters { public function __construct( private readonly ?Pager $pager = null, diff --git a/src/Resources/Addresses/Operations/UpdateOperation.php b/src/Resources/Addresses/Operations/UpdateAddress.php similarity index 96% rename from src/Resources/Addresses/Operations/UpdateOperation.php rename to src/Resources/Addresses/Operations/UpdateAddress.php index cdbb06b..2b1312b 100644 --- a/src/Resources/Addresses/Operations/UpdateOperation.php +++ b/src/Resources/Addresses/Operations/UpdateAddress.php @@ -10,7 +10,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateAddress implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Adjustments/AdjustmentsClient.php b/src/Resources/Adjustments/AdjustmentsClient.php index f2440c5..086b25d 100644 --- a/src/Resources/Adjustments/AdjustmentsClient.php +++ b/src/Resources/Adjustments/AdjustmentsClient.php @@ -17,8 +17,8 @@ use Paddle\SDK\Entities\Collections\Paginator; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Adjustments\Operations\CreateOperation; -use Paddle\SDK\Resources\Adjustments\Operations\ListOperation; +use Paddle\SDK\Resources\Adjustments\Operations\CreateAdjustment; +use Paddle\SDK\Resources\Adjustments\Operations\ListAdjustments; use Paddle\SDK\ResponseParser; class AdjustmentsClient @@ -32,7 +32,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): AdjustmentsAdjustmentCollection + public function list(ListAdjustments $listOperation = new ListAdjustments()): AdjustmentsAdjustmentCollection { $parser = new ResponseParser( $this->client->getRaw('/adjustments', $listOperation), @@ -49,7 +49,7 @@ public function list(ListOperation $listOperation = new ListOperation()): Adjust * @throws ApiError\AdjustmentApiError On an adjustment specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): Adjustment + public function create(CreateAdjustment $createOperation): Adjustment { $parser = new ResponseParser( $this->client->postRaw('/adjustments', $createOperation), diff --git a/src/Resources/Adjustments/Operations/CreateOperation.php b/src/Resources/Adjustments/Operations/CreateAdjustment.php similarity index 94% rename from src/Resources/Adjustments/Operations/CreateOperation.php rename to src/Resources/Adjustments/Operations/CreateAdjustment.php index a2196b4..69c6a2d 100644 --- a/src/Resources/Adjustments/Operations/CreateOperation.php +++ b/src/Resources/Adjustments/Operations/CreateAdjustment.php @@ -7,7 +7,7 @@ use Paddle\SDK\Entities\Adjustment\AdjustmentItem; use Paddle\SDK\Entities\Shared\Action; -class CreateOperation implements \JsonSerializable +class CreateAdjustment implements \JsonSerializable { /** * @param array $items diff --git a/src/Resources/Adjustments/Operations/ListOperation.php b/src/Resources/Adjustments/Operations/ListAdjustments.php similarity index 98% rename from src/Resources/Adjustments/Operations/ListOperation.php rename to src/Resources/Adjustments/Operations/ListAdjustments.php index d309304..6914503 100644 --- a/src/Resources/Adjustments/Operations/ListOperation.php +++ b/src/Resources/Adjustments/Operations/ListAdjustments.php @@ -10,7 +10,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListAdjustments implements HasParameters { /** * @param array $ids diff --git a/src/Resources/Businesses/BusinessesClient.php b/src/Resources/Businesses/BusinessesClient.php index 22f4999..b083367 100644 --- a/src/Resources/Businesses/BusinessesClient.php +++ b/src/Resources/Businesses/BusinessesClient.php @@ -18,9 +18,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Businesses\Operations\CreateOperation; -use Paddle\SDK\Resources\Businesses\Operations\ListOperation; -use Paddle\SDK\Resources\Businesses\Operations\UpdateOperation; +use Paddle\SDK\Resources\Businesses\Operations\CreateBusiness; +use Paddle\SDK\Resources\Businesses\Operations\ListBusinesses; +use Paddle\SDK\Resources\Businesses\Operations\UpdateBusiness; use Paddle\SDK\ResponseParser; class BusinessesClient @@ -34,7 +34,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(string $customerId, ListOperation $listOperation = new ListOperation()): BusinessCollection + public function list(string $customerId, ListBusinesses $listOperation = new ListBusinesses()): BusinessCollection { $parser = new ResponseParser( $this->client->getRaw("/customers/{$customerId}/businesses", $listOperation), @@ -64,7 +64,7 @@ public function get(string $customerId, string $id): Business * @throws ApiError\BusinessApiError On an business specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(string $customerId, CreateOperation $createOperation): Business + public function create(string $customerId, CreateBusiness $createOperation): Business { $parser = new ResponseParser( $this->client->postRaw("/customers/{$customerId}/businesses", $createOperation), @@ -78,7 +78,7 @@ public function create(string $customerId, CreateOperation $createOperation): Bu * @throws ApiError\BusinessApiError On an business specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $customerId, string $id, UpdateOperation $operation): Business + public function update(string $customerId, string $id, UpdateBusiness $operation): Business { $parser = new ResponseParser( $this->client->patchRaw("/customers/{$customerId}/businesses/{$id}", $operation), @@ -94,6 +94,6 @@ public function update(string $customerId, string $id, UpdateOperation $operatio */ public function archive(string $customerId, string $id): Business { - return $this->update($customerId, $id, new UpdateOperation(status: Status::Archived)); + return $this->update($customerId, $id, new UpdateBusiness(status: Status::Archived)); } } diff --git a/src/Resources/Businesses/Operations/CreateOperation.php b/src/Resources/Businesses/Operations/CreateBusiness.php similarity index 95% rename from src/Resources/Businesses/Operations/CreateOperation.php rename to src/Resources/Businesses/Operations/CreateBusiness.php index aecabd8..0320715 100644 --- a/src/Resources/Businesses/Operations/CreateOperation.php +++ b/src/Resources/Businesses/Operations/CreateBusiness.php @@ -9,7 +9,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateBusiness implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Businesses/Operations/ListOperation.php b/src/Resources/Businesses/Operations/ListBusinesses.php similarity index 97% rename from src/Resources/Businesses/Operations/ListOperation.php rename to src/Resources/Businesses/Operations/ListBusinesses.php index b6bfc36..6aade5f 100644 --- a/src/Resources/Businesses/Operations/ListOperation.php +++ b/src/Resources/Businesses/Operations/ListBusinesses.php @@ -9,7 +9,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListBusinesses implements HasParameters { /** * @param array $ids diff --git a/src/Resources/Businesses/Operations/UpdateOperation.php b/src/Resources/Businesses/Operations/UpdateBusiness.php similarity index 96% rename from src/Resources/Businesses/Operations/UpdateOperation.php rename to src/Resources/Businesses/Operations/UpdateBusiness.php index 46b95c9..2fe3ccd 100644 --- a/src/Resources/Businesses/Operations/UpdateOperation.php +++ b/src/Resources/Businesses/Operations/UpdateBusiness.php @@ -10,7 +10,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateBusiness implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Customers/CustomersClient.php b/src/Resources/Customers/CustomersClient.php index 3b7cabe..6365c3f 100644 --- a/src/Resources/Customers/CustomersClient.php +++ b/src/Resources/Customers/CustomersClient.php @@ -19,9 +19,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Customers\Operations\CreateOperation; -use Paddle\SDK\Resources\Customers\Operations\ListOperation; -use Paddle\SDK\Resources\Customers\Operations\UpdateOperation; +use Paddle\SDK\Resources\Customers\Operations\CreateCustomer; +use Paddle\SDK\Resources\Customers\Operations\ListCustomers; +use Paddle\SDK\Resources\Customers\Operations\UpdateCustomer; use Paddle\SDK\ResponseParser; class CustomersClient @@ -35,7 +35,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): CustomerCollection + public function list(ListCustomers $listOperation = new ListCustomers()): CustomerCollection { $parser = new ResponseParser( $this->client->getRaw('/customers', $listOperation), @@ -65,7 +65,7 @@ public function get(string $id): Customer * @throws ApiError\CustomerApiError On a customer specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): Customer + public function create(CreateCustomer $createOperation): Customer { $parser = new ResponseParser( $this->client->postRaw('/customers', $createOperation), @@ -79,7 +79,7 @@ public function create(CreateOperation $createOperation): Customer * @throws ApiError\CustomerApiError On a customer specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): Customer + public function update(string $id, UpdateCustomer $operation): Customer { $parser = new ResponseParser( $this->client->patchRaw("/customers/{$id}", $operation), @@ -95,7 +95,7 @@ public function update(string $id, UpdateOperation $operation): Customer */ public function archive(string $id): Customer { - return $this->update($id, new UpdateOperation(status: Status::Archived)); + return $this->update($id, new UpdateCustomer(status: Status::Archived)); } /** diff --git a/src/Resources/Customers/Operations/CreateOperation.php b/src/Resources/Customers/Operations/CreateCustomer.php similarity index 93% rename from src/Resources/Customers/Operations/CreateOperation.php rename to src/Resources/Customers/Operations/CreateCustomer.php index 47a4412..9d6de44 100644 --- a/src/Resources/Customers/Operations/CreateOperation.php +++ b/src/Resources/Customers/Operations/CreateCustomer.php @@ -8,7 +8,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateCustomer implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Customers/Operations/ListOperation.php b/src/Resources/Customers/Operations/ListCustomers.php similarity index 97% rename from src/Resources/Customers/Operations/ListOperation.php rename to src/Resources/Customers/Operations/ListCustomers.php index a905291..fdf516d 100644 --- a/src/Resources/Customers/Operations/ListOperation.php +++ b/src/Resources/Customers/Operations/ListCustomers.php @@ -9,7 +9,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListCustomers implements HasParameters { /** * @param array $ids diff --git a/src/Resources/Customers/Operations/UpdateOperation.php b/src/Resources/Customers/Operations/UpdateCustomer.php similarity index 94% rename from src/Resources/Customers/Operations/UpdateOperation.php rename to src/Resources/Customers/Operations/UpdateCustomer.php index 4143913..db85137 100644 --- a/src/Resources/Customers/Operations/UpdateOperation.php +++ b/src/Resources/Customers/Operations/UpdateCustomer.php @@ -9,7 +9,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateCustomer implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Discounts/DiscountsClient.php b/src/Resources/Discounts/DiscountsClient.php index cf8ac4a..35ea761 100644 --- a/src/Resources/Discounts/DiscountsClient.php +++ b/src/Resources/Discounts/DiscountsClient.php @@ -18,9 +18,9 @@ use Paddle\SDK\Entities\Discount\DiscountStatus; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Discounts\Operations\CreateOperation; -use Paddle\SDK\Resources\Discounts\Operations\ListOperation; -use Paddle\SDK\Resources\Discounts\Operations\UpdateOperation; +use Paddle\SDK\Resources\Discounts\Operations\CreateDiscount; +use Paddle\SDK\Resources\Discounts\Operations\ListDiscounts; +use Paddle\SDK\Resources\Discounts\Operations\UpdateDiscount; use Paddle\SDK\ResponseParser; class DiscountsClient @@ -34,7 +34,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): DiscountCollection + public function list(ListDiscounts $listOperation = new ListDiscounts()): DiscountCollection { $parser = new ResponseParser( $this->client->getRaw('/discounts', $listOperation), @@ -64,7 +64,7 @@ public function get(string $id): Discount * @throws ApiError\DiscountApiError On a discount specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): Discount + public function create(CreateDiscount $createOperation): Discount { $parser = new ResponseParser( $this->client->postRaw('/discounts', $createOperation), @@ -78,7 +78,7 @@ public function create(CreateOperation $createOperation): Discount * @throws ApiError\DiscountApiError On a discount specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): Discount + public function update(string $id, UpdateDiscount $operation): Discount { $parser = new ResponseParser( $this->client->patchRaw("/discounts/{$id}", $operation), @@ -94,6 +94,6 @@ public function update(string $id, UpdateOperation $operation): Discount */ public function archive(string $id): Discount { - return $this->update($id, new UpdateOperation(status: DiscountStatus::Archived)); + return $this->update($id, new UpdateDiscount(status: DiscountStatus::Archived)); } } diff --git a/src/Resources/Discounts/Operations/CreateOperation.php b/src/Resources/Discounts/Operations/CreateDiscount.php similarity index 97% rename from src/Resources/Discounts/Operations/CreateOperation.php rename to src/Resources/Discounts/Operations/CreateDiscount.php index 80a1e94..5028324 100644 --- a/src/Resources/Discounts/Operations/CreateOperation.php +++ b/src/Resources/Discounts/Operations/CreateDiscount.php @@ -9,7 +9,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateDiscount implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Discounts/Operations/ListOperation.php b/src/Resources/Discounts/Operations/ListDiscounts.php similarity index 97% rename from src/Resources/Discounts/Operations/ListOperation.php rename to src/Resources/Discounts/Operations/ListDiscounts.php index 0156e67..5bfcc1c 100644 --- a/src/Resources/Discounts/Operations/ListOperation.php +++ b/src/Resources/Discounts/Operations/ListDiscounts.php @@ -9,7 +9,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListDiscounts implements HasParameters { /** * @param array $ids diff --git a/src/Resources/Discounts/Operations/UpdateOperation.php b/src/Resources/Discounts/Operations/UpdateDiscount.php similarity index 97% rename from src/Resources/Discounts/Operations/UpdateOperation.php rename to src/Resources/Discounts/Operations/UpdateDiscount.php index c219316..beb03a4 100644 --- a/src/Resources/Discounts/Operations/UpdateOperation.php +++ b/src/Resources/Discounts/Operations/UpdateDiscount.php @@ -10,7 +10,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateDiscount implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Events/EventsClient.php b/src/Resources/Events/EventsClient.php index f235576..1b2f1dd 100644 --- a/src/Resources/Events/EventsClient.php +++ b/src/Resources/Events/EventsClient.php @@ -16,7 +16,7 @@ use Paddle\SDK\Entities\Collections\Paginator; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Events\Operations\ListOperation; +use Paddle\SDK\Resources\Events\Operations\ListEvents; use Paddle\SDK\ResponseParser; class EventsClient @@ -30,7 +30,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): EventCollection + public function list(ListEvents $listOperation = new ListEvents()): EventCollection { $parser = new ResponseParser( $this->client->getRaw('/events', $listOperation), diff --git a/src/Resources/Events/Operations/ListOperation.php b/src/Resources/Events/Operations/ListEvents.php similarity index 89% rename from src/Resources/Events/Operations/ListOperation.php rename to src/Resources/Events/Operations/ListEvents.php index a8023f4..5cb5008 100644 --- a/src/Resources/Events/Operations/ListOperation.php +++ b/src/Resources/Events/Operations/ListEvents.php @@ -7,7 +7,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListEvents implements HasParameters { public function __construct(private readonly ?Pager $pager = null) { diff --git a/src/Resources/NotificationLogs/NotificationLogsClient.php b/src/Resources/NotificationLogs/NotificationLogsClient.php index dd9251f..2f4fd9f 100644 --- a/src/Resources/NotificationLogs/NotificationLogsClient.php +++ b/src/Resources/NotificationLogs/NotificationLogsClient.php @@ -9,7 +9,7 @@ use Paddle\SDK\Entities\Collections\Paginator; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\NotificationLogs\Operations\ListOperation; +use Paddle\SDK\Resources\NotificationLogs\Operations\ListNotificationLogs; use Paddle\SDK\ResponseParser; class NotificationLogsClient @@ -23,7 +23,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(string $notificationId, ListOperation $listOperation = new ListOperation()): NotificationLogCollection + public function list(string $notificationId, ListNotificationLogs $listOperation = new ListNotificationLogs()): NotificationLogCollection { $parser = new ResponseParser( $this->client->getRaw("/notifications/{$notificationId}/logs", $listOperation), diff --git a/src/Resources/NotificationLogs/Operations/ListOperation.php b/src/Resources/NotificationLogs/Operations/ListNotificationLogs.php similarity index 87% rename from src/Resources/NotificationLogs/Operations/ListOperation.php rename to src/Resources/NotificationLogs/Operations/ListNotificationLogs.php index 817948a..9a4b598 100644 --- a/src/Resources/NotificationLogs/Operations/ListOperation.php +++ b/src/Resources/NotificationLogs/Operations/ListNotificationLogs.php @@ -7,7 +7,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListNotificationLogs implements HasParameters { public function __construct(private readonly ?Pager $pager = null) { diff --git a/src/Resources/NotificationSettings/NotificationSettingsClient.php b/src/Resources/NotificationSettings/NotificationSettingsClient.php index 86d466c..ee1099e 100644 --- a/src/Resources/NotificationSettings/NotificationSettingsClient.php +++ b/src/Resources/NotificationSettings/NotificationSettingsClient.php @@ -16,8 +16,8 @@ use Paddle\SDK\Entities\NotificationSetting; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\NotificationSettings\Operations\CreateOperation; -use Paddle\SDK\Resources\NotificationSettings\Operations\UpdateOperation; +use Paddle\SDK\Resources\NotificationSettings\Operations\CreateNotificationSetting; +use Paddle\SDK\Resources\NotificationSettings\Operations\UpdateNotificationSetting; use Paddle\SDK\ResponseParser; class NotificationSettingsClient @@ -59,7 +59,7 @@ public function get(string $id): NotificationSetting * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): NotificationSetting + public function create(CreateNotificationSetting $createOperation): NotificationSetting { $parser = new ResponseParser( $this->client->postRaw('notification-settings', $createOperation), @@ -72,7 +72,7 @@ public function create(CreateOperation $createOperation): NotificationSetting * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): NotificationSetting + public function update(string $id, UpdateNotificationSetting $operation): NotificationSetting { $parser = new ResponseParser( $this->client->patchRaw("notification-settings/{$id}", $operation), diff --git a/src/Resources/NotificationSettings/Operations/CreateOperation.php b/src/Resources/NotificationSettings/Operations/CreateNotificationSetting.php similarity index 94% rename from src/Resources/NotificationSettings/Operations/CreateOperation.php rename to src/Resources/NotificationSettings/Operations/CreateNotificationSetting.php index 79298c7..5adfd06 100644 --- a/src/Resources/NotificationSettings/Operations/CreateOperation.php +++ b/src/Resources/NotificationSettings/Operations/CreateNotificationSetting.php @@ -9,7 +9,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateNotificationSetting implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/NotificationSettings/Operations/UpdateOperation.php b/src/Resources/NotificationSettings/Operations/UpdateNotificationSetting.php similarity index 95% rename from src/Resources/NotificationSettings/Operations/UpdateOperation.php rename to src/Resources/NotificationSettings/Operations/UpdateNotificationSetting.php index 3fdd55a..624c503 100644 --- a/src/Resources/NotificationSettings/Operations/UpdateOperation.php +++ b/src/Resources/NotificationSettings/Operations/UpdateNotificationSetting.php @@ -8,7 +8,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateNotificationSetting implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Notifications/NotificationsClient.php b/src/Resources/Notifications/NotificationsClient.php index 8ce2181..f96e79d 100644 --- a/src/Resources/Notifications/NotificationsClient.php +++ b/src/Resources/Notifications/NotificationsClient.php @@ -17,7 +17,7 @@ use Paddle\SDK\Entities\Notification; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Notifications\Operations\ListOperation; +use Paddle\SDK\Resources\Notifications\Operations\ListNotifications; use Paddle\SDK\ResponseParser; class NotificationsClient @@ -31,7 +31,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): NotificationCollection + public function list(ListNotifications $listOperation = new ListNotifications()): NotificationCollection { $parser = new ResponseParser( $this->client->getRaw('/notifications', $listOperation), diff --git a/src/Resources/Notifications/Operations/ListOperation.php b/src/Resources/Notifications/Operations/ListNotifications.php similarity index 96% rename from src/Resources/Notifications/Operations/ListOperation.php rename to src/Resources/Notifications/Operations/ListNotifications.php index f478bde..871b9c5 100644 --- a/src/Resources/Notifications/Operations/ListOperation.php +++ b/src/Resources/Notifications/Operations/ListNotifications.php @@ -9,7 +9,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListNotifications implements HasParameters { /** * @param array $notificationSettingId diff --git a/src/Resources/Prices/Operations/CreateOperation.php b/src/Resources/Prices/Operations/CreatePrice.php similarity index 97% rename from src/Resources/Prices/Operations/CreateOperation.php rename to src/Resources/Prices/Operations/CreatePrice.php index 51be095..1798674 100644 --- a/src/Resources/Prices/Operations/CreateOperation.php +++ b/src/Resources/Prices/Operations/CreatePrice.php @@ -14,7 +14,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreatePrice implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Prices/Operations/ListOperation.php b/src/Resources/Prices/Operations/ListPrices.php similarity index 98% rename from src/Resources/Prices/Operations/ListOperation.php rename to src/Resources/Prices/Operations/ListPrices.php index 4f8f4b2..7452266 100644 --- a/src/Resources/Prices/Operations/ListOperation.php +++ b/src/Resources/Prices/Operations/ListPrices.php @@ -11,7 +11,7 @@ use Paddle\SDK\Resources\Prices\Operations\List\Includes; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListPrices implements HasParameters { /** * @param array $includes diff --git a/src/Resources/Prices/Operations/UpdateOperation.php b/src/Resources/Prices/Operations/UpdatePrice.php similarity index 97% rename from src/Resources/Prices/Operations/UpdateOperation.php rename to src/Resources/Prices/Operations/UpdatePrice.php index 3ba94a6..ba64ef9 100644 --- a/src/Resources/Prices/Operations/UpdateOperation.php +++ b/src/Resources/Prices/Operations/UpdatePrice.php @@ -15,7 +15,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdatePrice implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Prices/PricesClient.php b/src/Resources/Prices/PricesClient.php index e77b952..fa5afa8 100644 --- a/src/Resources/Prices/PricesClient.php +++ b/src/Resources/Prices/PricesClient.php @@ -19,10 +19,10 @@ use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\InvalidArgumentException; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Prices\Operations\CreateOperation; +use Paddle\SDK\Resources\Prices\Operations\CreatePrice; use Paddle\SDK\Resources\Prices\Operations\List\Includes; -use Paddle\SDK\Resources\Prices\Operations\ListOperation; -use Paddle\SDK\Resources\Prices\Operations\UpdateOperation; +use Paddle\SDK\Resources\Prices\Operations\ListPrices; +use Paddle\SDK\Resources\Prices\Operations\UpdatePrice; use Paddle\SDK\ResponseParser; class PricesClient @@ -36,7 +36,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): PriceWithIncludesCollection + public function list(ListPrices $listOperation = new ListPrices()): PriceWithIncludesCollection { $parser = new ResponseParser( $this->client->getRaw('/prices', $listOperation), @@ -76,7 +76,7 @@ public function get(string $id, array $includes = []): PriceWithIncludes * @throws ApiError\PriceApiError On a price specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): PriceWithIncludes + public function create(CreatePrice $createOperation): PriceWithIncludes { $parser = new ResponseParser( $this->client->postRaw('/prices', $createOperation), @@ -90,7 +90,7 @@ public function create(CreateOperation $createOperation): PriceWithIncludes * @throws ApiError\PriceApiError On a price specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): PriceWithIncludes + public function update(string $id, UpdatePrice $operation): PriceWithIncludes { $parser = new ResponseParser( $this->client->patchRaw("/prices/{$id}", $operation), @@ -106,6 +106,6 @@ public function update(string $id, UpdateOperation $operation): PriceWithInclude */ public function archive(string $id): PriceWithIncludes { - return $this->update($id, new UpdateOperation(status: Status::Archived)); + return $this->update($id, new UpdatePrice(status: Status::Archived)); } } diff --git a/src/Resources/PricingPreviews/Operations/PreviewPricesOperation.php b/src/Resources/PricingPreviews/Operations/PreviewPrice.php similarity index 96% rename from src/Resources/PricingPreviews/Operations/PreviewPricesOperation.php rename to src/Resources/PricingPreviews/Operations/PreviewPrice.php index a33762a..0728e0d 100644 --- a/src/Resources/PricingPreviews/Operations/PreviewPricesOperation.php +++ b/src/Resources/PricingPreviews/Operations/PreviewPrice.php @@ -10,7 +10,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class PreviewPricesOperation implements \JsonSerializable +class PreviewPrice implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/PricingPreviews/PricingPreviewsClient.php b/src/Resources/PricingPreviews/PricingPreviewsClient.php index 0a75bba..e7d6753 100644 --- a/src/Resources/PricingPreviews/PricingPreviewsClient.php +++ b/src/Resources/PricingPreviews/PricingPreviewsClient.php @@ -15,7 +15,7 @@ use Paddle\SDK\Entities\PricePreview; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\PricingPreviews\Operations\PreviewPricesOperation; +use Paddle\SDK\Resources\PricingPreviews\Operations\PreviewPrice; use Paddle\SDK\ResponseParser; class PricingPreviewsClient @@ -29,7 +29,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function previewPrices(PreviewPricesOperation $operation): PricePreview + public function previewPrices(PreviewPrice $operation): PricePreview { $parser = new ResponseParser( $this->client->postRaw('/pricing-preview', $operation), diff --git a/src/Resources/Products/Operations/CreateOperation.php b/src/Resources/Products/Operations/CreateProduct.php similarity index 95% rename from src/Resources/Products/Operations/CreateOperation.php rename to src/Resources/Products/Operations/CreateProduct.php index 2aa138c..542c661 100644 --- a/src/Resources/Products/Operations/CreateOperation.php +++ b/src/Resources/Products/Operations/CreateProduct.php @@ -10,7 +10,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateProduct implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Products/Operations/ListOperation.php b/src/Resources/Products/Operations/ListProducts.php similarity index 98% rename from src/Resources/Products/Operations/ListOperation.php rename to src/Resources/Products/Operations/ListProducts.php index 28d0af4..d682c63 100644 --- a/src/Resources/Products/Operations/ListOperation.php +++ b/src/Resources/Products/Operations/ListProducts.php @@ -12,7 +12,7 @@ use Paddle\SDK\Resources\Products\Operations\List\Includes; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListProducts implements HasParameters { /** * @param Includes[] $includes diff --git a/src/Resources/Products/Operations/UpdateOperation.php b/src/Resources/Products/Operations/UpdateProduct.php similarity index 96% rename from src/Resources/Products/Operations/UpdateOperation.php rename to src/Resources/Products/Operations/UpdateProduct.php index 3b3ae94..35ce035 100644 --- a/src/Resources/Products/Operations/UpdateOperation.php +++ b/src/Resources/Products/Operations/UpdateProduct.php @@ -11,7 +11,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateProduct implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Products/ProductsClient.php b/src/Resources/Products/ProductsClient.php index b118a90..71983dc 100644 --- a/src/Resources/Products/ProductsClient.php +++ b/src/Resources/Products/ProductsClient.php @@ -19,10 +19,10 @@ use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\InvalidArgumentException; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Products\Operations\CreateOperation; +use Paddle\SDK\Resources\Products\Operations\CreateProduct; use Paddle\SDK\Resources\Products\Operations\List\Includes; -use Paddle\SDK\Resources\Products\Operations\ListOperation; -use Paddle\SDK\Resources\Products\Operations\UpdateOperation; +use Paddle\SDK\Resources\Products\Operations\ListProducts; +use Paddle\SDK\Resources\Products\Operations\UpdateProduct; use Paddle\SDK\ResponseParser; class ProductsClient @@ -36,7 +36,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): ProductWithIncludesCollection + public function list(ListProducts $listOperation = new ListProducts()): ProductWithIncludesCollection { $parser = new ResponseParser( $this->client->getRaw('/products', $listOperation), @@ -76,7 +76,7 @@ public function get(string $id, array $includes = []): ProductWithIncludes * @throws ApiError\ProductApiError On a product specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): ProductWithIncludes + public function create(CreateProduct $createOperation): ProductWithIncludes { $parser = new ResponseParser( $this->client->postRaw('/products', $createOperation), @@ -90,7 +90,7 @@ public function create(CreateOperation $createOperation): ProductWithIncludes * @throws ApiError\ProductApiError On a product specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): ProductWithIncludes + public function update(string $id, UpdateProduct $operation): ProductWithIncludes { $parser = new ResponseParser( $this->client->patchRaw("/products/{$id}", $operation), @@ -106,6 +106,6 @@ public function update(string $id, UpdateOperation $operation): ProductWithInclu */ public function archive(string $id): ProductWithIncludes { - return $this->update($id, new UpdateOperation(status: Status::Archived)); + return $this->update($id, new UpdateProduct(status: Status::Archived)); } } diff --git a/src/Resources/Reports/Operations/CreateOperation.php b/src/Resources/Reports/Operations/CreateReport.php similarity index 95% rename from src/Resources/Reports/Operations/CreateOperation.php rename to src/Resources/Reports/Operations/CreateReport.php index f0ce343..d229874 100644 --- a/src/Resources/Reports/Operations/CreateOperation.php +++ b/src/Resources/Reports/Operations/CreateReport.php @@ -9,7 +9,7 @@ use Paddle\SDK\Exceptions\SdkExceptions\InvalidArgumentException; use Paddle\SDK\FiltersUndefined; -class CreateOperation implements \JsonSerializable +class CreateReport implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Reports/Operations/ListOperation.php b/src/Resources/Reports/Operations/ListReports.php similarity index 96% rename from src/Resources/Reports/Operations/ListOperation.php rename to src/Resources/Reports/Operations/ListReports.php index 656afa0..0fde3de 100644 --- a/src/Resources/Reports/Operations/ListOperation.php +++ b/src/Resources/Reports/Operations/ListReports.php @@ -9,7 +9,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListReports implements HasParameters { /** * @param array $statuses diff --git a/src/Resources/Reports/ReportsClient.php b/src/Resources/Reports/ReportsClient.php index 41b0448..82334db 100644 --- a/src/Resources/Reports/ReportsClient.php +++ b/src/Resources/Reports/ReportsClient.php @@ -18,8 +18,8 @@ use Paddle\SDK\Entities\ReportCSV; use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Reports\Operations\CreateOperation; -use Paddle\SDK\Resources\Reports\Operations\ListOperation; +use Paddle\SDK\Resources\Reports\Operations\CreateReport; +use Paddle\SDK\Resources\Reports\Operations\ListReports; use Paddle\SDK\ResponseParser; class ReportsClient @@ -33,7 +33,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): ReportCollection + public function list(ListReports $listOperation = new ListReports()): ReportCollection { $parser = new ResponseParser( $this->client->getRaw('/reports', $listOperation), @@ -76,7 +76,7 @@ public function getReportCsv(string $id): ReportCSV * @throws ApiError\AddressApiError On an address specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation): Report + public function create(CreateReport $createOperation): Report { $parser = new ResponseParser( $this->client->postRaw('/reports', $createOperation), diff --git a/src/Resources/Subscriptions/Operations/CancelOperation.php b/src/Resources/Subscriptions/Operations/CancelSubscription.php similarity index 88% rename from src/Resources/Subscriptions/Operations/CancelOperation.php rename to src/Resources/Subscriptions/Operations/CancelSubscription.php index 33301ed..0500a0c 100644 --- a/src/Resources/Subscriptions/Operations/CancelOperation.php +++ b/src/Resources/Subscriptions/Operations/CancelSubscription.php @@ -6,7 +6,7 @@ use Paddle\SDK\Entities\Subscription\SubscriptionEffectiveFrom; -class CancelOperation implements \JsonSerializable +class CancelSubscription implements \JsonSerializable { public function __construct( public readonly SubscriptionEffectiveFrom|null $effectiveFrom = null, diff --git a/src/Resources/Subscriptions/Operations/CreateOneTimeChargeOperation.php b/src/Resources/Subscriptions/Operations/CreateOneTimeCharge.php similarity index 94% rename from src/Resources/Subscriptions/Operations/CreateOneTimeChargeOperation.php rename to src/Resources/Subscriptions/Operations/CreateOneTimeCharge.php index 3792b7e..dc316f9 100644 --- a/src/Resources/Subscriptions/Operations/CreateOneTimeChargeOperation.php +++ b/src/Resources/Subscriptions/Operations/CreateOneTimeCharge.php @@ -11,7 +11,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOneTimeChargeOperation implements \JsonSerializable +class CreateOneTimeCharge implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Subscriptions/Operations/ListOperation.php b/src/Resources/Subscriptions/Operations/ListSubscriptions.php similarity index 98% rename from src/Resources/Subscriptions/Operations/ListOperation.php rename to src/Resources/Subscriptions/Operations/ListSubscriptions.php index 0ecac9d..5ee113a 100644 --- a/src/Resources/Subscriptions/Operations/ListOperation.php +++ b/src/Resources/Subscriptions/Operations/ListSubscriptions.php @@ -11,7 +11,7 @@ use Paddle\SDK\HasParameters; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -class ListOperation implements HasParameters +class ListSubscriptions implements HasParameters { /** * @param array $addressIds diff --git a/src/Resources/Subscriptions/Operations/PauseOperation.php b/src/Resources/Subscriptions/Operations/PauseSubscription.php similarity index 92% rename from src/Resources/Subscriptions/Operations/PauseOperation.php rename to src/Resources/Subscriptions/Operations/PauseSubscription.php index ba2cef5..b16470d 100644 --- a/src/Resources/Subscriptions/Operations/PauseOperation.php +++ b/src/Resources/Subscriptions/Operations/PauseSubscription.php @@ -7,7 +7,7 @@ use Paddle\SDK\Entities\DateTime; use Paddle\SDK\Entities\Subscription\SubscriptionEffectiveFrom; -class PauseOperation implements \JsonSerializable +class PauseSubscription implements \JsonSerializable { public function __construct( public readonly SubscriptionEffectiveFrom|null $effectiveFrom = null, diff --git a/src/Resources/Subscriptions/Operations/PreviewOneTimeChargeOperation.php b/src/Resources/Subscriptions/Operations/PreviewOneTimeCharge.php similarity index 94% rename from src/Resources/Subscriptions/Operations/PreviewOneTimeChargeOperation.php rename to src/Resources/Subscriptions/Operations/PreviewOneTimeCharge.php index b5545de..0d7d5b6 100644 --- a/src/Resources/Subscriptions/Operations/PreviewOneTimeChargeOperation.php +++ b/src/Resources/Subscriptions/Operations/PreviewOneTimeCharge.php @@ -11,7 +11,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class PreviewOneTimeChargeOperation implements \JsonSerializable +class PreviewOneTimeCharge implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Subscriptions/Operations/PreviewUpdateOperation.php b/src/Resources/Subscriptions/Operations/PreviewUpdateSubscription.php similarity index 97% rename from src/Resources/Subscriptions/Operations/PreviewUpdateOperation.php rename to src/Resources/Subscriptions/Operations/PreviewUpdateSubscription.php index a08a685..5402016 100644 --- a/src/Resources/Subscriptions/Operations/PreviewUpdateOperation.php +++ b/src/Resources/Subscriptions/Operations/PreviewUpdateSubscription.php @@ -16,7 +16,7 @@ use Paddle\SDK\Resources\Subscriptions\Operations\Update\SubscriptionDiscount; use Paddle\SDK\Undefined; -class PreviewUpdateOperation implements \JsonSerializable +class PreviewUpdateSubscription implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Subscriptions/Operations/ResumeOperation.php b/src/Resources/Subscriptions/Operations/ResumeSubscription.php similarity index 91% rename from src/Resources/Subscriptions/Operations/ResumeOperation.php rename to src/Resources/Subscriptions/Operations/ResumeSubscription.php index c31062a..3aa34b4 100644 --- a/src/Resources/Subscriptions/Operations/ResumeOperation.php +++ b/src/Resources/Subscriptions/Operations/ResumeSubscription.php @@ -7,7 +7,7 @@ use Paddle\SDK\Entities\DateTime; use Paddle\SDK\Entities\Subscription\SubscriptionEffectiveFrom; -class ResumeOperation implements \JsonSerializable +class ResumeSubscription implements \JsonSerializable { public function __construct( public readonly SubscriptionEffectiveFrom|\DateTimeInterface|null $effectiveFrom = null, diff --git a/src/Resources/Subscriptions/Operations/UpdateOperation.php b/src/Resources/Subscriptions/Operations/UpdateSubscription.php similarity index 98% rename from src/Resources/Subscriptions/Operations/UpdateOperation.php rename to src/Resources/Subscriptions/Operations/UpdateSubscription.php index fe9560e..52919d8 100644 --- a/src/Resources/Subscriptions/Operations/UpdateOperation.php +++ b/src/Resources/Subscriptions/Operations/UpdateSubscription.php @@ -16,7 +16,7 @@ use Paddle\SDK\Resources\Subscriptions\Operations\Update\SubscriptionDiscount; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateSubscription implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Subscriptions/SubscriptionsClient.php b/src/Resources/Subscriptions/SubscriptionsClient.php index 8753fc0..e33d87a 100644 --- a/src/Resources/Subscriptions/SubscriptionsClient.php +++ b/src/Resources/Subscriptions/SubscriptionsClient.php @@ -20,15 +20,15 @@ use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\InvalidArgumentException; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Subscriptions\Operations\CancelOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\CreateOneTimeChargeOperation; +use Paddle\SDK\Resources\Subscriptions\Operations\CancelSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\CreateOneTimeCharge; use Paddle\SDK\Resources\Subscriptions\Operations\Get\Includes; -use Paddle\SDK\Resources\Subscriptions\Operations\ListOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\PauseOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\PreviewOneTimeChargeOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\PreviewUpdateOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\ResumeOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\UpdateOperation; +use Paddle\SDK\Resources\Subscriptions\Operations\ListSubscriptions; +use Paddle\SDK\Resources\Subscriptions\Operations\PauseSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\PreviewOneTimeCharge; +use Paddle\SDK\Resources\Subscriptions\Operations\PreviewUpdateSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\ResumeSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\UpdateSubscription; use Paddle\SDK\ResponseParser; class SubscriptionsClient @@ -42,7 +42,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): SubscriptionWithIncludesCollection + public function list(ListSubscriptions $listOperation = new ListSubscriptions()): SubscriptionWithIncludesCollection { $parser = new ResponseParser( $this->client->getRaw('/subscriptions', $listOperation), @@ -82,7 +82,7 @@ public function get(string $id, array $includes = []): SubscriptionWithIncludes * @throws ApiError\SubscriptionApiError On a subscription specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): SubscriptionWithIncludes + public function update(string $id, UpdateSubscription $operation): SubscriptionWithIncludes { $parser = new ResponseParser( $this->client->patchRaw("/subscriptions/{$id}", $operation), @@ -91,7 +91,7 @@ public function update(string $id, UpdateOperation $operation): SubscriptionWith return SubscriptionWithIncludes::from($parser->getData()); } - public function pause(string $id, PauseOperation $operation): SubscriptionWithIncludes + public function pause(string $id, PauseSubscription $operation): SubscriptionWithIncludes { $parser = new ResponseParser( $this->client->postRaw("/subscriptions/{$id}/pause", $operation), @@ -100,7 +100,7 @@ public function pause(string $id, PauseOperation $operation): SubscriptionWithIn return SubscriptionWithIncludes::from($parser->getData()); } - public function resume(string $id, ResumeOperation $operation): SubscriptionWithIncludes + public function resume(string $id, ResumeSubscription $operation): SubscriptionWithIncludes { $parser = new ResponseParser( $this->client->postRaw("/subscriptions/{$id}/resume", $operation), @@ -109,7 +109,7 @@ public function resume(string $id, ResumeOperation $operation): SubscriptionWith return SubscriptionWithIncludes::from($parser->getData()); } - public function cancel(string $id, CancelOperation $operation): SubscriptionWithIncludes + public function cancel(string $id, CancelSubscription $operation): SubscriptionWithIncludes { $parser = new ResponseParser( $this->client->postRaw("/subscriptions/{$id}/cancel", $operation), @@ -136,7 +136,7 @@ public function activate(string $id): SubscriptionWithIncludes return SubscriptionWithIncludes::from($parser->getData()); } - public function createOneTimeCharge(string $id, CreateOneTimeChargeOperation $operation): SubscriptionWithIncludes + public function createOneTimeCharge(string $id, CreateOneTimeCharge $operation): SubscriptionWithIncludes { $parser = new ResponseParser( $this->client->postRaw("/subscriptions/{$id}/charge", $operation), @@ -145,7 +145,7 @@ public function createOneTimeCharge(string $id, CreateOneTimeChargeOperation $op return SubscriptionWithIncludes::from($parser->getData()); } - public function previewUpdate(string $id, PreviewUpdateOperation $operation): SubscriptionPreview + public function previewUpdate(string $id, PreviewUpdateSubscription $operation): SubscriptionPreview { $parser = new ResponseParser( $this->client->patchRaw("/subscriptions/{$id}/preview", $operation), @@ -154,7 +154,7 @@ public function previewUpdate(string $id, PreviewUpdateOperation $operation): Su return SubscriptionPreview::from($parser->getData()); } - public function previewOneTimeCharge(string $id, PreviewOneTimeChargeOperation $operation): SubscriptionPreview + public function previewOneTimeCharge(string $id, PreviewOneTimeCharge $operation): SubscriptionPreview { $parser = new ResponseParser( $this->client->postRaw("/subscriptions/{$id}/charge/preview", $operation), diff --git a/src/Resources/Transactions/Operations/CreateOperation.php b/src/Resources/Transactions/Operations/CreateTransaction.php similarity index 97% rename from src/Resources/Transactions/Operations/CreateOperation.php rename to src/Resources/Transactions/Operations/CreateTransaction.php index 0a81a1f..258914b 100644 --- a/src/Resources/Transactions/Operations/CreateOperation.php +++ b/src/Resources/Transactions/Operations/CreateTransaction.php @@ -16,7 +16,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class CreateOperation implements \JsonSerializable +class CreateTransaction implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Transactions/Operations/ListOperation.php b/src/Resources/Transactions/Operations/ListTransactions.php similarity index 98% rename from src/Resources/Transactions/Operations/ListOperation.php rename to src/Resources/Transactions/Operations/ListTransactions.php index 3fb5703..4a2d4f4 100644 --- a/src/Resources/Transactions/Operations/ListOperation.php +++ b/src/Resources/Transactions/Operations/ListTransactions.php @@ -12,7 +12,7 @@ use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Resources\Transactions\Operations\List\Includes; -class ListOperation implements HasParameters +class ListTransactions implements HasParameters { /** * @param array $customerIds diff --git a/src/Resources/Transactions/Operations/PreviewOperation.php b/src/Resources/Transactions/Operations/PreviewTransaction.php similarity index 97% rename from src/Resources/Transactions/Operations/PreviewOperation.php rename to src/Resources/Transactions/Operations/PreviewTransaction.php index 92d8096..93c4a7f 100644 --- a/src/Resources/Transactions/Operations/PreviewOperation.php +++ b/src/Resources/Transactions/Operations/PreviewTransaction.php @@ -12,7 +12,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class PreviewOperation implements \JsonSerializable +class PreviewTransaction implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Transactions/Operations/UpdateOperation.php b/src/Resources/Transactions/Operations/UpdateTransaction.php similarity index 97% rename from src/Resources/Transactions/Operations/UpdateOperation.php rename to src/Resources/Transactions/Operations/UpdateTransaction.php index ca4ed19..a35bf87 100644 --- a/src/Resources/Transactions/Operations/UpdateOperation.php +++ b/src/Resources/Transactions/Operations/UpdateTransaction.php @@ -15,7 +15,7 @@ use Paddle\SDK\FiltersUndefined; use Paddle\SDK\Undefined; -class UpdateOperation implements \JsonSerializable +class UpdateTransaction implements \JsonSerializable { use FiltersUndefined; diff --git a/src/Resources/Transactions/TransactionsClient.php b/src/Resources/Transactions/TransactionsClient.php index a5216ce..53b65e7 100644 --- a/src/Resources/Transactions/TransactionsClient.php +++ b/src/Resources/Transactions/TransactionsClient.php @@ -20,11 +20,11 @@ use Paddle\SDK\Exceptions\ApiError; use Paddle\SDK\Exceptions\SdkExceptions\InvalidArgumentException; use Paddle\SDK\Exceptions\SdkExceptions\MalformedResponse; -use Paddle\SDK\Resources\Transactions\Operations\CreateOperation; +use Paddle\SDK\Resources\Transactions\Operations\CreateTransaction; use Paddle\SDK\Resources\Transactions\Operations\List\Includes; -use Paddle\SDK\Resources\Transactions\Operations\ListOperation; -use Paddle\SDK\Resources\Transactions\Operations\PreviewOperation; -use Paddle\SDK\Resources\Transactions\Operations\UpdateOperation; +use Paddle\SDK\Resources\Transactions\Operations\ListTransactions; +use Paddle\SDK\Resources\Transactions\Operations\PreviewTransaction; +use Paddle\SDK\Resources\Transactions\Operations\UpdateTransaction; use Paddle\SDK\ResponseParser; class TransactionsClient @@ -38,7 +38,7 @@ public function __construct( * @throws ApiError On a generic API error * @throws MalformedResponse If the API response was not parsable */ - public function list(ListOperation $listOperation = new ListOperation()): TransactionWithIncludesCollection + public function list(ListTransactions $listOperation = new ListTransactions()): TransactionWithIncludesCollection { $parser = new ResponseParser( $this->client->getRaw('/transactions', $listOperation), @@ -78,7 +78,7 @@ public function get(string $id, array $includes = []): TransactionWithIncludes * @throws ApiError\TransactionApiError On a transaction specific API error * @throws MalformedResponse If the API response was not parsable */ - public function create(CreateOperation $createOperation, array $includes = []): TransactionWithIncludes + public function create(CreateTransaction $createOperation, array $includes = []): TransactionWithIncludes { if ($invalid = array_filter($includes, fn ($value): bool => ! $value instanceof Includes)) { throw InvalidArgumentException::arrayContainsInvalidTypes('includes', Includes::class, implode(', ', $invalid)); @@ -100,7 +100,7 @@ public function create(CreateOperation $createOperation, array $includes = []): * @throws ApiError\TransactionApiError On a transaction specific API error * @throws MalformedResponse If the API response was not parsable */ - public function update(string $id, UpdateOperation $operation): TransactionWithIncludes + public function update(string $id, UpdateTransaction $operation): TransactionWithIncludes { $parser = new ResponseParser( $this->client->patchRaw("/transactions/{$id}", $operation), @@ -114,7 +114,7 @@ public function update(string $id, UpdateOperation $operation): TransactionWithI * @throws ApiError\TransactionApiError On a transaction specific API error * @throws MalformedResponse If the API response was not parsable */ - public function preview(PreviewOperation $operation): TransactionPreview + public function preview(PreviewTransaction $operation): TransactionPreview { $parser = new ResponseParser( $this->client->postRaw('/transactions/preview', $operation), diff --git a/tests/Functional/Resources/Addresses/AddressesClientTest.php b/tests/Functional/Resources/Addresses/AddressesClientTest.php index d463ad6..5c985bc 100644 --- a/tests/Functional/Resources/Addresses/AddressesClientTest.php +++ b/tests/Functional/Resources/Addresses/AddressesClientTest.php @@ -12,9 +12,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Addresses\Operations\CreateOperation; -use Paddle\SDK\Resources\Addresses\Operations\ListOperation; -use Paddle\SDK\Resources\Addresses\Operations\UpdateOperation; +use Paddle\SDK\Resources\Addresses\Operations\CreateAddress; +use Paddle\SDK\Resources\Addresses\Operations\ListAddresses; +use Paddle\SDK\Resources\Addresses\Operations\UpdateAddress; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -43,7 +43,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateAddress $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -63,13 +63,13 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation(CountryCode::AG), + new CreateAddress(CountryCode::AG), new Response(200, body: self::readRawJsonFixture('response/minimal_entity')), self::readRawJsonFixture('request/create_basic'), ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateAddress( countryCode: CountryCode::US, description: 'Head Office', firstLine: '4050 Jefferson Plaza, 41st Floor', @@ -90,7 +90,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateAddress $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -110,7 +110,7 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation( + new UpdateAddress( description: 'Head Office', ), new Response(200, body: self::readRawJsonFixture('response/full_entity')), @@ -118,13 +118,13 @@ public static function updateOperationsProvider(): \Generator ]; yield 'Update Partial' => [ - new UpdateOperation(description: 'Head Office', city: 'New York'), + new UpdateAddress(description: 'Head Office', city: 'New York'), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateAddress( description: 'Head Office', firstLine: '4050 Jefferson Plaza, 41st Floor', secondLine: null, @@ -146,7 +146,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListAddresses $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -162,13 +162,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListAddresses(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListAddresses(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses?order_by=id[asc]&per_page=50', @@ -177,7 +177,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'add_01h848pep46enq8y372x7maj0p')), + new ListAddresses(new Pager(after: 'add_01h848pep46enq8y372x7maj0p')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses?after=add_01h848pep46enq8y372x7maj0p&order_by=id[asc]&per_page=50', @@ -186,19 +186,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [Status::Archived]), + new ListAddresses(statuses: [Status::Archived]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses?status=archived', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['add_01h848pep46enq8y372x7maj0p']), + new ListAddresses(ids: ['add_01h848pep46enq8y372x7maj0p']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses?id=add_01h848pep46enq8y372x7maj0p', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['add_01h8494f4w5rwfp8b12yqh8fp1', 'add_01h848pep46enq8y372x7maj0p']), + new ListAddresses(ids: ['add_01h8494f4w5rwfp8b12yqh8fp1', 'add_01h848pep46enq8y372x7maj0p']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses?id=add_01h8494f4w5rwfp8b12yqh8fp1,add_01h848pep46enq8y372x7maj0p', @@ -207,7 +207,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Search Filtered' => [ - new ListOperation(search: 'Office'), + new ListAddresses(search: 'Office'), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/addresses?search=Office', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Adjustments/AdjustmentsClientTest.php b/tests/Functional/Resources/Adjustments/AdjustmentsClientTest.php index 97556e7..1dfb782 100644 --- a/tests/Functional/Resources/Adjustments/AdjustmentsClientTest.php +++ b/tests/Functional/Resources/Adjustments/AdjustmentsClientTest.php @@ -13,8 +13,8 @@ use Paddle\SDK\Entities\Shared\StatusAdjustment; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Adjustments\Operations\CreateOperation; -use Paddle\SDK\Resources\Adjustments\Operations\ListOperation; +use Paddle\SDK\Resources\Adjustments\Operations\CreateAdjustment; +use Paddle\SDK\Resources\Adjustments\Operations\ListAdjustments; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -43,7 +43,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateAdjustment $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -63,7 +63,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateAdjustment( Action::Refund, [new AdjustmentItem( 'txnitm_01h8bxryv3065dyh6103p3yg28', @@ -78,7 +78,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateAdjustment( Action::Refund, [ new AdjustmentItem( @@ -106,7 +106,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListAdjustments $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -122,13 +122,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListAdjustments(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListAdjustments(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/adjustments?order_by=id[asc]&per_page=50', @@ -137,7 +137,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'adj_01h8c65c2ggq5nxswnnwv78e75')), + new ListAdjustments(new Pager(after: 'adj_01h8c65c2ggq5nxswnnwv78e75')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/adjustments?after=adj_01h8c65c2ggq5nxswnnwv78e75&order_by=id[asc]&per_page=50', @@ -146,19 +146,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [StatusAdjustment::PendingApproval]), + new ListAdjustments(statuses: [StatusAdjustment::PendingApproval]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?status=pending_approval', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['adj_01h8c65c2ggq5nxswnnwv78e75']), + new ListAdjustments(ids: ['adj_01h8c65c2ggq5nxswnnwv78e75']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?id=adj_01h8c65c2ggq5nxswnnwv78e75', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['add_01h8494f4w5rwfp8b12yqh8fp1', 'adj_01h8c65c2ggq5nxswnnwv78e75']), + new ListAdjustments(ids: ['add_01h8494f4w5rwfp8b12yqh8fp1', 'adj_01h8c65c2ggq5nxswnnwv78e75']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/adjustments?id=add_01h8494f4w5rwfp8b12yqh8fp1,adj_01h8c65c2ggq5nxswnnwv78e75', @@ -167,43 +167,43 @@ public static function listOperationsProvider(): \Generator ]; yield 'Customer ID Filtered' => [ - new ListOperation(customerIds: ['ctm_01h8441jn5pcwrfhwh78jqt8hk']), + new ListAdjustments(customerIds: ['ctm_01h8441jn5pcwrfhwh78jqt8hk']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?customer_id=ctm_01h8441jn5pcwrfhwh78jqt8hk', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Customer ID Filtered' => [ - new ListOperation(customerIds: ['ctm_01h8441jn5pcwrfhwh78jqt8hk', 'ctm_01h7hswb86rtps5ggbq7ybydcw']), + new ListAdjustments(customerIds: ['ctm_01h8441jn5pcwrfhwh78jqt8hk', 'ctm_01h7hswb86rtps5ggbq7ybydcw']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?customer_id=ctm_01h8441jn5pcwrfhwh78jqt8hk,ctm_01h7hswb86rtps5ggbq7ybydcw', Environment::SANDBOX->baseUrl()), ]; yield 'Transaction ID Filtered' => [ - new ListOperation(transactionIds: ['txn_01h8bxpvx398a7zbawb77y0kp5']), + new ListAdjustments(transactionIds: ['txn_01h8bxpvx398a7zbawb77y0kp5']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?transaction_id=txn_01h8bxpvx398a7zbawb77y0kp5', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Transaction ID Filtered' => [ - new ListOperation(transactionIds: ['ctm_01h8441jn5pcwrfhwh78jqt8hk', 'txn_01h8bx69629a16wwm9z8rjmak3']), + new ListAdjustments(transactionIds: ['ctm_01h8441jn5pcwrfhwh78jqt8hk', 'txn_01h8bx69629a16wwm9z8rjmak3']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?transaction_id=ctm_01h8441jn5pcwrfhwh78jqt8hk,txn_01h8bx69629a16wwm9z8rjmak3', Environment::SANDBOX->baseUrl()), ]; yield 'NotificationSubscription ID Filtered' => [ - new ListOperation(subscriptionIds: ['sub_01h8bxswamxysj44zt5n48njwh']), + new ListAdjustments(subscriptionIds: ['sub_01h8bxswamxysj44zt5n48njwh']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?subscription_id=sub_01h8bxswamxysj44zt5n48njwh', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple NotificationSubscription ID Filtered' => [ - new ListOperation(subscriptionIds: ['sub_01h8bxswamxysj44zt5n48njwh', 'sub_01h8bx8fmywym11t6swgzba704']), + new ListAdjustments(subscriptionIds: ['sub_01h8bxswamxysj44zt5n48njwh', 'sub_01h8bx8fmywym11t6swgzba704']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?subscription_id=sub_01h8bxswamxysj44zt5n48njwh,sub_01h8bx8fmywym11t6swgzba704', Environment::SANDBOX->baseUrl()), ]; yield 'Action Filtered' => [ - new ListOperation(action: Action::Refund), + new ListAdjustments(action: Action::Refund), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/adjustments?action=refund', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Businesses/BusinessesClientTest.php b/tests/Functional/Resources/Businesses/BusinessesClientTest.php index 4f4a59c..d67e7a4 100644 --- a/tests/Functional/Resources/Businesses/BusinessesClientTest.php +++ b/tests/Functional/Resources/Businesses/BusinessesClientTest.php @@ -12,9 +12,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Businesses\Operations\CreateOperation; -use Paddle\SDK\Resources\Businesses\Operations\ListOperation; -use Paddle\SDK\Resources\Businesses\Operations\UpdateOperation; +use Paddle\SDK\Resources\Businesses\Operations\CreateBusiness; +use Paddle\SDK\Resources\Businesses\Operations\ListBusinesses; +use Paddle\SDK\Resources\Businesses\Operations\UpdateBusiness; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -43,7 +43,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateBusiness $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -63,7 +63,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateBusiness( name: 'ChatApp Inc.', ), new Response(200, body: self::readRawJsonFixture('response/minimal_entity')), @@ -71,7 +71,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateBusiness( name: 'ChatApp Inc.', companyNumber: '555775291485', taxIdentifier: '555952383', @@ -96,7 +96,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateBusiness $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -116,13 +116,13 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(name: 'ChatApp Inc.'), + new UpdateBusiness(name: 'ChatApp Inc.'), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation( + new UpdateBusiness( name: 'ChatApp Inc.', contacts: [ new Contacts('Parker Jones', 'parker@example.com'), @@ -135,7 +135,7 @@ public static function updateOperationsProvider(): \Generator ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateBusiness( name: 'ChatApp Inc.', companyNumber: '555775291485', taxIdentifier: '555952383', @@ -160,7 +160,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListBusinesses $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -176,13 +176,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListBusinesses(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListBusinesses(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses?order_by=id[asc]&per_page=50', @@ -191,7 +191,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'biz_01h84a7hr4pzhsajkm8tev89ev')), + new ListBusinesses(new Pager(after: 'biz_01h84a7hr4pzhsajkm8tev89ev')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses?after=biz_01h84a7hr4pzhsajkm8tev89ev&order_by=id[asc]&per_page=50', @@ -200,19 +200,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [Status::Archived]), + new ListBusinesses(statuses: [Status::Archived]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses?status=archived', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['biz_01h84a7hr4pzhsajkm8tev89ev']), + new ListBusinesses(ids: ['biz_01h84a7hr4pzhsajkm8tev89ev']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses?id=biz_01h84a7hr4pzhsajkm8tev89ev', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['biz_01h84a7hr4pzhsajkm8tev89ev', 'biz_01hf6pv0tmnw1cs0bcj2z8nmqx']), + new ListBusinesses(ids: ['biz_01h84a7hr4pzhsajkm8tev89ev', 'biz_01hf6pv0tmnw1cs0bcj2z8nmqx']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses?id=biz_01h84a7hr4pzhsajkm8tev89ev,biz_01hf6pv0tmnw1cs0bcj2z8nmqx', @@ -221,7 +221,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Search Filtered' => [ - new ListOperation(search: 'ChatApp'), + new ListBusinesses(search: 'ChatApp'), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers/ctm_01h8441jn5pcwrfhwh78jqt8hk/businesses?search=ChatApp', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Customers/CustomersClientTest.php b/tests/Functional/Resources/Customers/CustomersClientTest.php index 88a9477..97ed51d 100644 --- a/tests/Functional/Resources/Customers/CustomersClientTest.php +++ b/tests/Functional/Resources/Customers/CustomersClientTest.php @@ -11,9 +11,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Customers\Operations\CreateOperation; -use Paddle\SDK\Resources\Customers\Operations\ListOperation; -use Paddle\SDK\Resources\Customers\Operations\UpdateOperation; +use Paddle\SDK\Resources\Customers\Operations\CreateCustomer; +use Paddle\SDK\Resources\Customers\Operations\ListCustomers; +use Paddle\SDK\Resources\Customers\Operations\UpdateCustomer; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -42,7 +42,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateCustomer $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -59,13 +59,13 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation('test2@example.com'), + new CreateCustomer('test2@example.com'), new Response(200, body: self::readRawJsonFixture('response/minimal_entity')), self::readRawJsonFixture('request/create_basic'), ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateCustomer( email: 'test2@example.com', name: 'Alex Wilson', customData: new CustomData(['customer_reference_id' => 'abcd1234']), @@ -82,7 +82,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateCustomer $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -99,19 +99,19 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(name: 'Alex Wilson'), + new UpdateCustomer(name: 'Alex Wilson'), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation(name: 'Alex Wilson', email: 'test1@example.com'), + new UpdateCustomer(name: 'Alex Wilson', email: 'test1@example.com'), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateCustomer( name: 'Alex Wilson', email: 'test1@example.com', locale: 'el', @@ -129,7 +129,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListCustomers $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -145,13 +145,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListCustomers(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListCustomers(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers?order_by=id[asc]&per_page=50', @@ -160,7 +160,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'ctm_01h8441jn5pcwrfhwh78jqt8hk')), + new ListCustomers(new Pager(after: 'ctm_01h8441jn5pcwrfhwh78jqt8hk')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers?after=ctm_01h8441jn5pcwrfhwh78jqt8hk&order_by=id[asc]&per_page=50', @@ -169,19 +169,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [Status::Archived]), + new ListCustomers(statuses: [Status::Archived]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers?status=archived', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['ctm_01h8441jn5pcwrfhwh78jqt8hk']), + new ListCustomers(ids: ['ctm_01h8441jn5pcwrfhwh78jqt8hk']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers?id=ctm_01h8441jn5pcwrfhwh78jqt8hk', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['ctm_01h8441jn5pcwrfhwh78jqt8hk', 'ctm_01h844p3h41s12zs5mn4axja51']), + new ListCustomers(ids: ['ctm_01h8441jn5pcwrfhwh78jqt8hk', 'ctm_01h844p3h41s12zs5mn4axja51']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/customers?id=ctm_01h8441jn5pcwrfhwh78jqt8hk,ctm_01h844p3h41s12zs5mn4axja51', @@ -190,7 +190,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Search Filtered' => [ - new ListOperation(search: 'Alex'), + new ListCustomers(search: 'Alex'), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/customers?search=Alex', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Discounts/DiscountsClientTest.php b/tests/Functional/Resources/Discounts/DiscountsClientTest.php index 464d1c8..8a57ba2 100644 --- a/tests/Functional/Resources/Discounts/DiscountsClientTest.php +++ b/tests/Functional/Resources/Discounts/DiscountsClientTest.php @@ -13,9 +13,9 @@ use Paddle\SDK\Entities\Shared\Status; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Discounts\Operations\CreateOperation; -use Paddle\SDK\Resources\Discounts\Operations\ListOperation; -use Paddle\SDK\Resources\Discounts\Operations\UpdateOperation; +use Paddle\SDK\Resources\Discounts\Operations\CreateDiscount; +use Paddle\SDK\Resources\Discounts\Operations\ListDiscounts; +use Paddle\SDK\Resources\Discounts\Operations\UpdateDiscount; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -44,7 +44,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateDiscount $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -61,7 +61,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateDiscount( '10', 'Nonprofit discount', DiscountType::Percentage, @@ -74,7 +74,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateDiscount( '10', 'Nonprofit discount', DiscountType::Percentage, @@ -98,7 +98,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateDiscount $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -115,19 +115,19 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(enabledForCheckout: false), + new UpdateDiscount(enabledForCheckout: false), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation(enabledForCheckout: false, code: null), + new UpdateDiscount(enabledForCheckout: false, code: null), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateDiscount( description: 'Nonprofit discount', enabledForCheckout: true, type: DiscountType::Percentage, @@ -155,7 +155,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListDiscounts $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -171,13 +171,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListDiscounts(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/discounts', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListDiscounts(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/discounts?order_by=id[asc]&per_page=50', @@ -186,7 +186,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'dsc_01h83xenpcfjyhkqr4x214m02x')), + new ListDiscounts(new Pager(after: 'dsc_01h83xenpcfjyhkqr4x214m02x')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/discounts?after=dsc_01h83xenpcfjyhkqr4x214m02x&order_by=id[asc]&per_page=50', @@ -195,19 +195,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [Status::Archived]), + new ListDiscounts(statuses: [Status::Archived]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/discounts?status=archived', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['dsc_01h83xenpcfjyhkqr4x214m02x']), + new ListDiscounts(ids: ['dsc_01h83xenpcfjyhkqr4x214m02x']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/discounts?id=dsc_01h83xenpcfjyhkqr4x214m02x', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['dsc_01h83xenpcfjyhkqr4x214m02x', 'dsc_01gtgraak4chyhnp47rrdv89ad']), + new ListDiscounts(ids: ['dsc_01h83xenpcfjyhkqr4x214m02x', 'dsc_01gtgraak4chyhnp47rrdv89ad']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/discounts?id=dsc_01h83xenpcfjyhkqr4x214m02x,dsc_01gtgraak4chyhnp47rrdv89ad', @@ -216,13 +216,13 @@ public static function listOperationsProvider(): \Generator ]; yield 'Code Filtered' => [ - new ListOperation(codes: ['ABCDE12345']), + new ListDiscounts(codes: ['ABCDE12345']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/discounts?code=ABCDE12345', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Code Filtered' => [ - new ListOperation(codes: ['ABCDE12345', '54321EDCBA']), + new ListDiscounts(codes: ['ABCDE12345', '54321EDCBA']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/discounts?code=ABCDE12345,54321EDCBA', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Events/EventsClientTest.php b/tests/Functional/Resources/Events/EventsClientTest.php index 09956d1..c47f829 100644 --- a/tests/Functional/Resources/Events/EventsClientTest.php +++ b/tests/Functional/Resources/Events/EventsClientTest.php @@ -9,7 +9,7 @@ use Paddle\SDK\Client; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Events\Operations\ListOperation; +use Paddle\SDK\Resources\Events\Operations\ListEvents; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -38,7 +38,7 @@ public function setUp(): void * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListEvents $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -54,13 +54,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListEvents(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/events', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListEvents(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/events?order_by=id[asc]&per_page=50', @@ -69,7 +69,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'evt_01h83xenpcfjyhkqr4x214m02x')), + new ListEvents(new Pager(after: 'evt_01h83xenpcfjyhkqr4x214m02x')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/events?after=evt_01h83xenpcfjyhkqr4x214m02x&order_by=id[asc]&per_page=50', diff --git a/tests/Functional/Resources/NotificationLogs/NotificationLogsClientTest.php b/tests/Functional/Resources/NotificationLogs/NotificationLogsClientTest.php index cb25907..835b43e 100644 --- a/tests/Functional/Resources/NotificationLogs/NotificationLogsClientTest.php +++ b/tests/Functional/Resources/NotificationLogs/NotificationLogsClientTest.php @@ -9,7 +9,7 @@ use Paddle\SDK\Client; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\NotificationLogs\Operations\ListOperation; +use Paddle\SDK\Resources\NotificationLogs\Operations\ListNotificationLogs; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -40,7 +40,7 @@ public function setUp(): void * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListNotificationLogs $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -56,13 +56,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListNotificationLogs(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications/%s/logs', Environment::SANDBOX->baseUrl(), self::TEST_ID), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListNotificationLogs(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/notifications/%s/logs?order_by=id[asc]&per_page=50', @@ -72,7 +72,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'pro_01gsz4s0w61y0pp88528f1wvvb')), + new ListNotificationLogs(new Pager(after: 'pro_01gsz4s0w61y0pp88528f1wvvb')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/notifications/%s/logs?after=pro_01gsz4s0w61y0pp88528f1wvvb&order_by=id[asc]&per_page=50', diff --git a/tests/Functional/Resources/NotificationSettings/NotificationSettingsClientTest.php b/tests/Functional/Resources/NotificationSettings/NotificationSettingsClientTest.php index f228766..2836cbe 100644 --- a/tests/Functional/Resources/NotificationSettings/NotificationSettingsClientTest.php +++ b/tests/Functional/Resources/NotificationSettings/NotificationSettingsClientTest.php @@ -11,8 +11,8 @@ use Paddle\SDK\Entities\NotificationSetting\NotificationSettingType; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\NotificationSettings\Operations\CreateOperation; -use Paddle\SDK\Resources\NotificationSettings\Operations\UpdateOperation; +use Paddle\SDK\Resources\NotificationSettings\Operations\CreateNotificationSetting; +use Paddle\SDK\Resources\NotificationSettings\Operations\UpdateNotificationSetting; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; @@ -40,7 +40,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateNotificationSetting $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -57,7 +57,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateNotificationSetting( description: 'Slack notifications', type: NotificationSettingType::Url, destination: 'https://hooks.slack.com/example', @@ -76,7 +76,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateNotificationSetting( description: 'Slack notifications', type: NotificationSettingType::Url, destination: 'https://hooks.slack.com/example', @@ -110,7 +110,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateNotificationSetting $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -127,19 +127,19 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(active: false), + new UpdateNotificationSetting(active: false), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation(description: 'Slack notifications (old)', active: false), + new UpdateNotificationSetting(description: 'Slack notifications (old)', active: false), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateNotificationSetting( description: 'Slack notifications (old)', destination: 'https://hooks.slack.com/example', active: false, diff --git a/tests/Functional/Resources/Notifications/NotificationsClientTest.php b/tests/Functional/Resources/Notifications/NotificationsClientTest.php index 48b3a2d..9789504 100644 --- a/tests/Functional/Resources/Notifications/NotificationsClientTest.php +++ b/tests/Functional/Resources/Notifications/NotificationsClientTest.php @@ -10,7 +10,7 @@ use Paddle\SDK\Entities\Notification\NotificationStatus; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Notifications\Operations\ListOperation; +use Paddle\SDK\Resources\Notifications\Operations\ListNotifications; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -39,7 +39,7 @@ public function setUp(): void * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListNotifications $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -55,13 +55,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListNotifications(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListNotifications(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/notifications?order_by=id[asc]&per_page=50', @@ -70,7 +70,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'nft_01h83xenpcfjyhkqr4x214m02x')), + new ListNotifications(new Pager(after: 'nft_01h83xenpcfjyhkqr4x214m02x')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/notifications?after=nft_01h83xenpcfjyhkqr4x214m02x&order_by=id[asc]&per_page=50', @@ -79,13 +79,13 @@ public static function listOperationsProvider(): \Generator ]; yield 'Notification Setting ID Filtered' => [ - new ListOperation(notificationSettingId: ['nftset_01h83xenpcfjyhkqr4x214m02']), + new ListNotifications(notificationSettingId: ['nftset_01h83xenpcfjyhkqr4x214m02']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?notification_setting_id=nftset_01h83xenpcfjyhkqr4x214m02', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Notification Setting ID Filtered' => [ - new ListOperation(notificationSettingId: ['nftset_01h83xenpcfjyhkqr4x214m02', 'nftset_01h8brhckjd6qk4n7e4py2340t']), + new ListNotifications(notificationSettingId: ['nftset_01h83xenpcfjyhkqr4x214m02', 'nftset_01h8brhckjd6qk4n7e4py2340t']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/notifications?notification_setting_id=nftset_01h83xenpcfjyhkqr4x214m02,nftset_01h8brhckjd6qk4n7e4py2340t', @@ -94,43 +94,43 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(status: [NotificationStatus::Delivered]), + new ListNotifications(status: [NotificationStatus::Delivered]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?status=delivered', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple NotificationStatus Filtered' => [ - new ListOperation(status: [NotificationStatus::Delivered, NotificationStatus::NotAttempted]), + new ListNotifications(status: [NotificationStatus::Delivered, NotificationStatus::NotAttempted]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?status=delivered,not_attempted', Environment::SANDBOX->baseUrl()), ]; yield 'Filter Filtered' => [ - new ListOperation(filter: 'txn_01h83xenpcfjyhkqr4x214m02'), + new ListNotifications(filter: 'txn_01h83xenpcfjyhkqr4x214m02'), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?filter=txn_01h83xenpcfjyhkqr4x214m02', Environment::SANDBOX->baseUrl()), ]; yield 'Search Filtered' => [ - new ListOperation(search: 'transaction.created'), + new ListNotifications(search: 'transaction.created'), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?search=transaction.created', Environment::SANDBOX->baseUrl()), ]; yield 'To Filtered' => [ - new ListOperation(to: new \DateTime('2023-12-25T00:00:00.000Z')), + new ListNotifications(to: new \DateTime('2023-12-25T00:00:00.000Z')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?to=2023-12-25T00:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'From Filtered' => [ - new ListOperation(to: new \DateTime('2023-12-25T00:00:00.000Z')), + new ListNotifications(to: new \DateTime('2023-12-25T00:00:00.000Z')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/notifications?to=2023-12-25T00:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'To and From Filtered' => [ - new ListOperation( + new ListNotifications( to: new \DateTime('2023-12-25T00:00:00.000Z'), from: new \DateTime('2023-12-24T00:00:00.000Z'), ), diff --git a/tests/Functional/Resources/Prices/PricesClientTest.php b/tests/Functional/Resources/Prices/PricesClientTest.php index 27ca528..74a01e7 100644 --- a/tests/Functional/Resources/Prices/PricesClientTest.php +++ b/tests/Functional/Resources/Prices/PricesClientTest.php @@ -19,10 +19,10 @@ use Paddle\SDK\Entities\Shared\UnitPriceOverride; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Prices\Operations\CreateOperation; +use Paddle\SDK\Resources\Prices\Operations\CreatePrice; use Paddle\SDK\Resources\Prices\Operations\List\Includes; -use Paddle\SDK\Resources\Prices\Operations\ListOperation; -use Paddle\SDK\Resources\Prices\Operations\UpdateOperation; +use Paddle\SDK\Resources\Prices\Operations\ListPrices; +use Paddle\SDK\Resources\Prices\Operations\UpdatePrice; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -51,7 +51,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreatePrice $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -68,7 +68,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreatePrice( description: 'Monthly (per seat)', productId: 'pro_01h7zcgmdc6tmwtjehp3sh7azf', unitPrice: new Money('500', CurrencyCode::USD), @@ -78,7 +78,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with Data' => [ - new CreateOperation( + new CreatePrice( description: 'Weekly (per seat)', productId: 'pro_01gsz4t5hdjse780zja8vvr7jg', unitPrice: new Money('1000', CurrencyCode::GBP), @@ -106,7 +106,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdatePrice $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -123,19 +123,19 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(name: 'Annually'), + new UpdatePrice(name: 'Annually'), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation(name: 'Annually', unitPrice: new Money('100000', CurrencyCode::GBP)), + new UpdatePrice(name: 'Annually', unitPrice: new Money('100000', CurrencyCode::GBP)), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdatePrice( name: 'Annually', description: 'Annually (per seat)', unitPrice: new Money('100000', CurrencyCode::GBP), @@ -157,7 +157,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListPrices $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -173,13 +173,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListPrices(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/prices', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListPrices(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/prices?order_by=id[asc]&per_page=50', @@ -188,7 +188,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'pro_01gsz4s0w61y0pp88528f1wvvb')), + new ListPrices(new Pager(after: 'pro_01gsz4s0w61y0pp88528f1wvvb')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/prices?after=pro_01gsz4s0w61y0pp88528f1wvvb&order_by=id[asc]&per_page=50', @@ -197,19 +197,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [Status::Archived]), + new ListPrices(statuses: [Status::Archived]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/prices?status=archived', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['pri_01gsz4s0w61y0pp88528f1wvvb']), + new ListPrices(ids: ['pri_01gsz4s0w61y0pp88528f1wvvb']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/prices?id=pri_01gsz4s0w61y0pp88528f1wvvb', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['pri_01he6hp8cg49jjf1pdjf6d5yw1', 'pri_01h1vjes1y163xfj1rh1tkfb65']), + new ListPrices(ids: ['pri_01he6hp8cg49jjf1pdjf6d5yw1', 'pri_01h1vjes1y163xfj1rh1tkfb65']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/prices?id=pri_01he6hp8cg49jjf1pdjf6d5yw1,pri_01h1vjes1y163xfj1rh1tkfb65', @@ -218,13 +218,13 @@ public static function listOperationsProvider(): \Generator ]; yield 'Product ID Filtered' => [ - new ListOperation(productIds: ['pro_01gsz4s0w61y0pp88528f1wvvb']), + new ListPrices(productIds: ['pro_01gsz4s0w61y0pp88528f1wvvb']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/prices?product_id=pro_01gsz4s0w61y0pp88528f1wvvb', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Product ID Filtered' => [ - new ListOperation(productIds: ['pro_01he6hp8cg49jjf1pdjf6d5yw1', 'pro_01h1vjes1y163xfj1rh1tkfb65']), + new ListPrices(productIds: ['pro_01he6hp8cg49jjf1pdjf6d5yw1', 'pro_01h1vjes1y163xfj1rh1tkfb65']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/prices?product_id=pro_01he6hp8cg49jjf1pdjf6d5yw1,pro_01h1vjes1y163xfj1rh1tkfb65', @@ -233,13 +233,13 @@ public static function listOperationsProvider(): \Generator ]; yield 'Recurring Filtered' => [ - new ListOperation(recurring: true), + new ListPrices(recurring: true), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/prices?recurring=true', Environment::SANDBOX->baseUrl()), ]; yield 'With Includes' => [ - new ListOperation(includes: [Includes::Product]), + new ListPrices(includes: [Includes::Product]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/prices?include=product', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/PricingPreviews/PricingPreviewsClientTest.php b/tests/Functional/Resources/PricingPreviews/PricingPreviewsClientTest.php index c45f22a..264cba5 100644 --- a/tests/Functional/Resources/PricingPreviews/PricingPreviewsClientTest.php +++ b/tests/Functional/Resources/PricingPreviews/PricingPreviewsClientTest.php @@ -13,7 +13,7 @@ use Paddle\SDK\Entities\Shared\CurrencyCode; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\PricingPreviews\Operations\PreviewPricesOperation; +use Paddle\SDK\Resources\PricingPreviews\Operations\PreviewPrice; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; @@ -41,7 +41,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_preview_prices( - PreviewPricesOperation $operation, + PreviewPrice $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -58,7 +58,7 @@ public function it_uses_expected_payload_on_preview_prices( public static function createOperationsProvider(): \Generator { yield 'Minimal' => [ - new PreviewPricesOperation( + new PreviewPrice( [ new PricePreviewItem('pri_01gsz8z1q1n00f12qt82y31smh', 20), ], @@ -68,7 +68,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Multiple' => [ - new PreviewPricesOperation( + new PreviewPrice( [ new PricePreviewItem('pri_01gsz8z1q1n00f12qt82y31smh', 20), new PricePreviewItem('pri_01gsz98e27ak2tyhexptwc58yk', 1), @@ -82,7 +82,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Full' => [ - new PreviewPricesOperation( + new PreviewPrice( [ new PricePreviewItem('pri_01gsz8z1q1n00f12qt82y31smh', 20), new PricePreviewItem('pri_01gsz98e27ak2tyhexptwc58yk', 1), diff --git a/tests/Functional/Resources/Products/ProductsClientTest.php b/tests/Functional/Resources/Products/ProductsClientTest.php index 65ecb96..2ae9bf5 100644 --- a/tests/Functional/Resources/Products/ProductsClientTest.php +++ b/tests/Functional/Resources/Products/ProductsClientTest.php @@ -12,10 +12,10 @@ use Paddle\SDK\Entities\Shared\TaxCategory; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Products\Operations\CreateOperation; +use Paddle\SDK\Resources\Products\Operations\CreateProduct; use Paddle\SDK\Resources\Products\Operations\List\Includes; -use Paddle\SDK\Resources\Products\Operations\ListOperation; -use Paddle\SDK\Resources\Products\Operations\UpdateOperation; +use Paddle\SDK\Resources\Products\Operations\ListProducts; +use Paddle\SDK\Resources\Products\Operations\UpdateProduct; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -44,7 +44,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateProduct $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -61,7 +61,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateProduct( name: 'ChatApp Basic', taxCategory: TaxCategory::Standard, ), @@ -70,7 +70,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with Data' => [ - new CreateOperation( + new CreateProduct( name: 'ChatApp Full', taxCategory: TaxCategory::Standard, description: 'Spend more time engaging with students with ChataApp Education.', @@ -94,7 +94,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateProduct $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -111,19 +111,19 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(name: 'ChatApp Pro'), + new UpdateProduct(name: 'ChatApp Pro'), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation(name: 'ChatApp Pro', taxCategory: TaxCategory::Saas), + new UpdateProduct(name: 'ChatApp Pro', taxCategory: TaxCategory::Saas), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateProduct( name: 'ChatApp Pro', taxCategory: TaxCategory::Saas, description: 'Spend more time engaging with students with ChatApp Pro.', @@ -147,7 +147,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListProducts $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -163,13 +163,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListProducts(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/products', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListProducts(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/products?order_by=id[asc]&per_page=50', @@ -178,7 +178,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'pro_01gsz4s0w61y0pp88528f1wvvb')), + new ListProducts(new Pager(after: 'pro_01gsz4s0w61y0pp88528f1wvvb')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/products?after=pro_01gsz4s0w61y0pp88528f1wvvb&order_by=id[asc]&per_page=50', @@ -187,19 +187,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [Status::Archived]), + new ListProducts(statuses: [Status::Archived]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/products?status=archived', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['pro_01gsz4s0w61y0pp88528f1wvvb']), + new ListProducts(ids: ['pro_01gsz4s0w61y0pp88528f1wvvb']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/products?id=pro_01gsz4s0w61y0pp88528f1wvvb', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['pro_01gsz4s0w61y0pp88528f1wvvb', 'pro_01h1vjes1y163xfj1rh1tkfb65']), + new ListProducts(ids: ['pro_01gsz4s0w61y0pp88528f1wvvb', 'pro_01h1vjes1y163xfj1rh1tkfb65']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/products?id=pro_01gsz4s0w61y0pp88528f1wvvb,pro_01h1vjes1y163xfj1rh1tkfb65', @@ -208,13 +208,13 @@ public static function listOperationsProvider(): \Generator ]; yield 'Tax Category Filtered' => [ - new ListOperation(taxCategories: [TaxCategory::DigitalGoods, TaxCategory::Standard]), + new ListProducts(taxCategories: [TaxCategory::DigitalGoods, TaxCategory::Standard]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/products?tax_category=digital-goods,standard', Environment::SANDBOX->baseUrl()), ]; yield 'With Includes' => [ - new ListOperation(includes: [Includes::Prices]), + new ListProducts(includes: [Includes::Prices]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/products?include=prices', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Reports/ReportsClientTest.php b/tests/Functional/Resources/Reports/ReportsClientTest.php index 82d900e..b3adc2f 100644 --- a/tests/Functional/Resources/Reports/ReportsClientTest.php +++ b/tests/Functional/Resources/Reports/ReportsClientTest.php @@ -14,8 +14,8 @@ use Paddle\SDK\Entities\Report\ReportType; use Paddle\SDK\Environment; use Paddle\SDK\Options; -use Paddle\SDK\Resources\Reports\Operations\CreateOperation; -use Paddle\SDK\Resources\Reports\Operations\ListOperation; +use Paddle\SDK\Resources\Reports\Operations\CreateReport; +use Paddle\SDK\Resources\Reports\Operations\ListReports; use Paddle\SDK\Resources\Shared\Operations\List\Pager; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; @@ -44,7 +44,7 @@ public function setUp(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateReport $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -64,7 +64,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateReport( type: ReportType::Transactions, ), new Response(201, body: self::readRawJsonFixture('response/full_entity')), @@ -72,7 +72,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with filters' => [ - new CreateOperation( + new CreateReport( type: ReportType::Transactions, filters: [new ReportFilters(name: ReportName::UpdatedAt, operator: ReportOperator::Lt, value: '2023-12-30')], ), @@ -87,7 +87,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListReports $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -103,13 +103,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListReports(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/reports', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListReports(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/reports?order_by=id[asc]&per_page=50', @@ -118,7 +118,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'rep_01hhq4c3b03g3x2kpkj8aecjv6')), + new ListReports(new Pager(after: 'rep_01hhq4c3b03g3x2kpkj8aecjv6')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/reports?after=rep_01hhq4c3b03g3x2kpkj8aecjv6&order_by=id[asc]&per_page=50', @@ -127,7 +127,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Status Filtered' => [ - new ListOperation(statuses: [ReportStatus::Ready]), + new ListReports(statuses: [ReportStatus::Ready]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/reports?status=ready', Environment::SANDBOX->baseUrl()), ]; diff --git a/tests/Functional/Resources/Subscriptions/SubscriptionsClientTest.php b/tests/Functional/Resources/Subscriptions/SubscriptionsClientTest.php index c417f3a..ae64e15 100644 --- a/tests/Functional/Resources/Subscriptions/SubscriptionsClientTest.php +++ b/tests/Functional/Resources/Subscriptions/SubscriptionsClientTest.php @@ -19,16 +19,16 @@ use Paddle\SDK\Environment; use Paddle\SDK\Options; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -use Paddle\SDK\Resources\Subscriptions\Operations\CancelOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\CreateOneTimeChargeOperation; +use Paddle\SDK\Resources\Subscriptions\Operations\CancelSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\CreateOneTimeCharge; use Paddle\SDK\Resources\Subscriptions\Operations\Get\Includes; -use Paddle\SDK\Resources\Subscriptions\Operations\ListOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\PauseOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\PreviewOneTimeChargeOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\PreviewUpdateOperation; -use Paddle\SDK\Resources\Subscriptions\Operations\ResumeOperation; +use Paddle\SDK\Resources\Subscriptions\Operations\ListSubscriptions; +use Paddle\SDK\Resources\Subscriptions\Operations\PauseSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\PreviewOneTimeCharge; +use Paddle\SDK\Resources\Subscriptions\Operations\PreviewUpdateSubscription; +use Paddle\SDK\Resources\Subscriptions\Operations\ResumeSubscription; use Paddle\SDK\Resources\Subscriptions\Operations\Update\SubscriptionDiscount; -use Paddle\SDK\Resources\Subscriptions\Operations\UpdateOperation; +use Paddle\SDK\Resources\Subscriptions\Operations\UpdateSubscription; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; @@ -56,7 +56,7 @@ public function setUp(): void * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateSubscription $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -76,19 +76,19 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(prorationBillingMode: SubscriptionProrationBillingMode::ProratedNextBillingPeriod), + new UpdateSubscription(prorationBillingMode: SubscriptionProrationBillingMode::ProratedNextBillingPeriod), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation(prorationBillingMode: SubscriptionProrationBillingMode::FullImmediately, scheduledChange: null), + new UpdateSubscription(prorationBillingMode: SubscriptionProrationBillingMode::FullImmediately, scheduledChange: null), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_partial'), ]; yield 'Update All' => [ - new UpdateOperation( + new UpdateSubscription( customerId: 'ctm_01h8441jn5pcwrfhwh78jqt8hk', addressId: 'add_01h848pep46enq8y372x7maj0p', businessId: null, @@ -119,7 +119,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListSubscriptions $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -135,13 +135,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListSubscriptions(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListSubscriptions(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/subscriptions?order_by=id[asc]&per_page=50', @@ -150,7 +150,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'sub_01h848pep46enq8y372x7maj0p')), + new ListSubscriptions(new Pager(after: 'sub_01h848pep46enq8y372x7maj0p')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/subscriptions?after=sub_01h848pep46enq8y372x7maj0p&order_by=id[asc]&per_page=50', @@ -159,19 +159,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [SubscriptionStatus::Paused]), + new ListSubscriptions(statuses: [SubscriptionStatus::Paused]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?status=paused', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['sub_01h848pep46enq8y372x7maj0p']), + new ListSubscriptions(ids: ['sub_01h848pep46enq8y372x7maj0p']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?id=sub_01h848pep46enq8y372x7maj0p', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['sub_01h8494f4w5rwfp8b12yqh8fp1', 'sub_01h848pep46enq8y372x7maj0p']), + new ListSubscriptions(ids: ['sub_01h8494f4w5rwfp8b12yqh8fp1', 'sub_01h848pep46enq8y372x7maj0p']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/subscriptions?id=sub_01h8494f4w5rwfp8b12yqh8fp1,sub_01h848pep46enq8y372x7maj0p', @@ -180,43 +180,43 @@ public static function listOperationsProvider(): \Generator ]; yield 'Collection Mode Filtered' => [ - new ListOperation(collectionMode: CollectionMode::Automatic), + new ListSubscriptions(collectionMode: CollectionMode::Automatic), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?collection_mode=automatic', Environment::SANDBOX->baseUrl()), ]; yield 'Address ID Filtered' => [ - new ListOperation(addressIds: ['add_01h8494f4w5rwfp8b12yqh8fp1']), + new ListSubscriptions(addressIds: ['add_01h8494f4w5rwfp8b12yqh8fp1']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?address_id=add_01h8494f4w5rwfp8b12yqh8fp1', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Address ID Filtered' => [ - new ListOperation(addressIds: ['add_01h8494f4w5rwfp8b12yqh8fp1', 'add_01h848pep46enq8y372x7maj0p']), + new ListSubscriptions(addressIds: ['add_01h8494f4w5rwfp8b12yqh8fp1', 'add_01h848pep46enq8y372x7maj0p']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?address_id=add_01h8494f4w5rwfp8b12yqh8fp1,add_01h848pep46enq8y372x7maj0p', Environment::SANDBOX->baseUrl()), ]; yield 'Price ID Filtered' => [ - new ListOperation(priceIds: ['pri_01h8494f4w5rwfp8b12yqh8fp1']), + new ListSubscriptions(priceIds: ['pri_01h8494f4w5rwfp8b12yqh8fp1']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?price_id=pri_01h8494f4w5rwfp8b12yqh8fp1', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Price ID Filtered' => [ - new ListOperation(priceIds: ['pri_01h8494f4w5rwfp8b12yqh8fp1', 'pri_01h848pep46enq8y372x7maj0p']), + new ListSubscriptions(priceIds: ['pri_01h8494f4w5rwfp8b12yqh8fp1', 'pri_01h848pep46enq8y372x7maj0p']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?price_id=pri_01h8494f4w5rwfp8b12yqh8fp1,pri_01h848pep46enq8y372x7maj0p', Environment::SANDBOX->baseUrl()), ]; yield 'Scheduled Change Action Filtered' => [ - new ListOperation(scheduledChangeActions: [SubscriptionScheduledChangeAction::Pause]), + new ListSubscriptions(scheduledChangeActions: [SubscriptionScheduledChangeAction::Pause]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/subscriptions?scheduled_change_action=pause', Environment::SANDBOX->baseUrl()), ]; yield 'Multiple Scheduled Change Action Filtered' => [ - new ListOperation(scheduledChangeActions: [ + new ListSubscriptions(scheduledChangeActions: [ SubscriptionScheduledChangeAction::Pause, SubscriptionScheduledChangeAction::Cancel, ]), @@ -267,7 +267,7 @@ public static function getRequestProvider(): \Generator * @dataProvider pauseOperationsProvider */ public function pause_uses_expected_payload( - PauseOperation $operation, + PauseSubscription $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -287,19 +287,19 @@ public function pause_uses_expected_payload( public static function pauseOperationsProvider(): \Generator { yield 'Update None' => [ - new PauseOperation(), + new PauseSubscription(), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/pause_none'), ]; yield 'Update Single' => [ - new PauseOperation(SubscriptionEffectiveFrom::NextBillingPeriod), + new PauseSubscription(SubscriptionEffectiveFrom::NextBillingPeriod), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/pause_single'), ]; yield 'Update All' => [ - new PauseOperation( + new PauseSubscription( SubscriptionEffectiveFrom::NextBillingPeriod, new \DateTime('2023-10-09T16:30:00Z'), ), @@ -314,7 +314,7 @@ public static function pauseOperationsProvider(): \Generator * @dataProvider resumeOperationsProvider */ public function resume_uses_expected_payload( - ResumeOperation $operation, + ResumeSubscription $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -334,19 +334,19 @@ public function resume_uses_expected_payload( public static function resumeOperationsProvider(): \Generator { yield 'Update None' => [ - new ResumeOperation(), + new ResumeSubscription(), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/resume_none'), ]; yield 'Update Single As Enum' => [ - new ResumeOperation(SubscriptionEffectiveFrom::NextBillingPeriod), + new ResumeSubscription(SubscriptionEffectiveFrom::NextBillingPeriod), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/resume_single_as_enum'), ]; yield 'Update Single As Date' => [ - new ResumeOperation(new \DateTime('2023-10-09T16:30:00Z')), + new ResumeSubscription(new \DateTime('2023-10-09T16:30:00Z')), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/resume_single_as_date'), ]; @@ -358,7 +358,7 @@ public static function resumeOperationsProvider(): \Generator * @dataProvider cancelOperationsProvider */ public function cancel_uses_expected_payload( - CancelOperation $operation, + CancelSubscription $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -378,13 +378,13 @@ public function cancel_uses_expected_payload( public static function cancelOperationsProvider(): \Generator { yield 'Update None' => [ - new CancelOperation(), + new CancelSubscription(), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/cancel_none'), ]; yield 'Update Single' => [ - new CancelOperation(SubscriptionEffectiveFrom::NextBillingPeriod), + new CancelSubscription(SubscriptionEffectiveFrom::NextBillingPeriod), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/cancel_single'), ]; @@ -452,7 +452,7 @@ public static function activateOperationsProvider(): \Generator * @dataProvider createOneTimeChargeOperationsProvider */ public function create_one_time_charge_uses_expected_payload( - CreateOneTimeChargeOperation $operation, + CreateOneTimeCharge $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -472,7 +472,7 @@ public function create_one_time_charge_uses_expected_payload( public static function createOneTimeChargeOperationsProvider(): \Generator { yield 'Update Minimal' => [ - new CreateOneTimeChargeOperation( + new CreateOneTimeCharge( SubscriptionEffectiveFrom::NextBillingPeriod, [ new SubscriptionItems('pri_01gsz98e27ak2tyhexptwc58yk', 1), @@ -483,7 +483,7 @@ public static function createOneTimeChargeOperationsProvider(): \Generator ]; yield 'Update Full' => [ - new CreateOneTimeChargeOperation( + new CreateOneTimeCharge( SubscriptionEffectiveFrom::Immediately, [ new SubscriptionItems('pri_01gsz98e27ak2tyhexptwc58yk', 1), @@ -503,7 +503,7 @@ public static function createOneTimeChargeOperationsProvider(): \Generator * @dataProvider previewUpdateOperationsProvider */ public function it_uses_expected_payload_on_preview_update( - PreviewUpdateOperation $operation, + PreviewUpdateSubscription $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -523,7 +523,7 @@ public function it_uses_expected_payload_on_preview_update( public static function previewUpdateOperationsProvider(): \Generator { yield 'Preview Update Single' => [ - new PreviewUpdateOperation( + new PreviewUpdateSubscription( prorationBillingMode: SubscriptionProrationBillingMode::ProratedNextBillingPeriod, ), new Response(200, body: self::readRawJsonFixture('response/preview_update_full_entity')), @@ -531,7 +531,7 @@ public static function previewUpdateOperationsProvider(): \Generator ]; yield 'Preview Update Partial' => [ - new PreviewUpdateOperation( + new PreviewUpdateSubscription( prorationBillingMode: SubscriptionProrationBillingMode::FullImmediately, scheduledChange: null, ), @@ -540,7 +540,7 @@ public static function previewUpdateOperationsProvider(): \Generator ]; yield 'Preview Update All' => [ - new PreviewUpdateOperation( + new PreviewUpdateSubscription( customerId: 'ctm_01h8441jn5pcwrfhwh78jqt8hk', addressId: 'add_01h848pep46enq8y372x7maj0p', businessId: null, @@ -571,7 +571,7 @@ public static function previewUpdateOperationsProvider(): \Generator * @dataProvider previewOneTimeChargeOperationsProvider */ public function preview_one_time_charge_uses_expected_payload( - PreviewOneTimeChargeOperation $operation, + PreviewOneTimeCharge $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -591,7 +591,7 @@ public function preview_one_time_charge_uses_expected_payload( public static function previewOneTimeChargeOperationsProvider(): \Generator { yield 'Update Minimal' => [ - new PreviewOneTimeChargeOperation( + new PreviewOneTimeCharge( SubscriptionEffectiveFrom::NextBillingPeriod, [ new SubscriptionItems('pri_01gsz98e27ak2tyhexptwc58yk', 1), @@ -602,7 +602,7 @@ public static function previewOneTimeChargeOperationsProvider(): \Generator ]; yield 'Update Full' => [ - new PreviewOneTimeChargeOperation( + new PreviewOneTimeCharge( SubscriptionEffectiveFrom::Immediately, [ new SubscriptionItems('pri_01gsz98e27ak2tyhexptwc58yk', 1), diff --git a/tests/Functional/Resources/Transactions/TransactionsClientTest.php b/tests/Functional/Resources/Transactions/TransactionsClientTest.php index 480319a..ee7e400 100644 --- a/tests/Functional/Resources/Transactions/TransactionsClientTest.php +++ b/tests/Functional/Resources/Transactions/TransactionsClientTest.php @@ -28,11 +28,11 @@ use Paddle\SDK\Resources\Shared\Operations\List\Comparator; use Paddle\SDK\Resources\Shared\Operations\List\DateComparison; use Paddle\SDK\Resources\Shared\Operations\List\Pager; -use Paddle\SDK\Resources\Transactions\Operations\CreateOperation; +use Paddle\SDK\Resources\Transactions\Operations\CreateTransaction; use Paddle\SDK\Resources\Transactions\Operations\List\Includes; -use Paddle\SDK\Resources\Transactions\Operations\ListOperation; -use Paddle\SDK\Resources\Transactions\Operations\PreviewOperation; -use Paddle\SDK\Resources\Transactions\Operations\UpdateOperation; +use Paddle\SDK\Resources\Transactions\Operations\ListTransactions; +use Paddle\SDK\Resources\Transactions\Operations\PreviewTransaction; +use Paddle\SDK\Resources\Transactions\Operations\UpdateTransaction; use Paddle\SDK\Tests\Utils\ReadsFixtures; use PHPUnit\Framework\TestCase; use Psr\Http\Message\RequestInterface; @@ -84,7 +84,7 @@ public function it_can_paginate(): void /** @test */ public function it_can_include_on_create(): void { - $operation = new CreateOperation( + $operation = new CreateTransaction( items: [ new TransactionCreateItem('pri_01he5kxqey1k8ankgef29cj4bv', 1), ], @@ -108,7 +108,7 @@ public function it_can_include_on_create(): void * @dataProvider createOperationsProvider */ public function it_uses_expected_payload_on_create( - CreateOperation $operation, + CreateTransaction $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -125,7 +125,7 @@ public function it_uses_expected_payload_on_create( public static function createOperationsProvider(): \Generator { yield 'Basic Create' => [ - new CreateOperation( + new CreateTransaction( items: [ new TransactionCreateItem('pri_01he5kxqey1k8ankgef29cj4bv', 1), ], @@ -135,7 +135,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create with non catalog price' => [ - new CreateOperation( + new CreateTransaction( items: [ new TransactionCreateItemWithPrice( new TransactionNonCatalogPrice( @@ -159,7 +159,7 @@ public static function createOperationsProvider(): \Generator ]; yield 'Create Manually Collected' => [ - new CreateOperation( + new CreateTransaction( items: [ new TransactionCreateItem('pri_01gsz8x8sawmvhz1pv30nge1ke', 1), ], @@ -187,7 +187,7 @@ public static function createOperationsProvider(): \Generator * @dataProvider updateOperationsProvider */ public function it_uses_expected_payload_on_update( - UpdateOperation $operation, + UpdateTransaction $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -204,13 +204,13 @@ public function it_uses_expected_payload_on_update( public static function updateOperationsProvider(): \Generator { yield 'Update Single' => [ - new UpdateOperation(status: StatusTransaction::Billed), + new UpdateTransaction(status: StatusTransaction::Billed), new Response(200, body: self::readRawJsonFixture('response/full_entity')), self::readRawJsonFixture('request/update_single'), ]; yield 'Update Partial' => [ - new UpdateOperation( + new UpdateTransaction( status: StatusTransaction::Billed, customData: new CustomData(['completed_by' => 'Frank T']), ), @@ -225,7 +225,7 @@ public static function updateOperationsProvider(): \Generator * @dataProvider listOperationsProvider */ public function list_hits_expected_uri( - ListOperation $operation, + ListTransactions $operation, ResponseInterface $response, string $expectedUri, ): void { @@ -241,13 +241,13 @@ public function list_hits_expected_uri( public static function listOperationsProvider(): \Generator { yield 'Default' => [ - new ListOperation(), + new ListTransactions(), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions', Environment::SANDBOX->baseUrl()), ]; yield 'Default Paged' => [ - new ListOperation(new Pager()), + new ListTransactions(new Pager()), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/transactions?order_by=id[asc]&per_page=50', @@ -256,7 +256,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Default Paged with After' => [ - new ListOperation(new Pager(after: 'txn_01hen7bxc1p8ep4yk7n5jbzk9r')), + new ListTransactions(new Pager(after: 'txn_01hen7bxc1p8ep4yk7n5jbzk9r')), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/transactions?after=txn_01hen7bxc1p8ep4yk7n5jbzk9r&order_by=id[asc]&per_page=50', @@ -265,19 +265,19 @@ public static function listOperationsProvider(): \Generator ]; yield 'NotificationStatus Filtered' => [ - new ListOperation(statuses: [StatusTransaction::Billed]), + new ListTransactions(statuses: [StatusTransaction::Billed]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?status=billed', Environment::SANDBOX->baseUrl()), ]; yield 'NotificationStatus Filtered Multiple' => [ - new ListOperation(statuses: [StatusTransaction::Billed, StatusTransaction::Completed]), + new ListTransactions(statuses: [StatusTransaction::Billed, StatusTransaction::Completed]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?status=billed,completed', Environment::SANDBOX->baseUrl()), ]; yield 'ID Filtered' => [ - new ListOperation(ids: ['txn_01gsz4s0w61y0pp88528f1wvvb']), + new ListTransactions(ids: ['txn_01gsz4s0w61y0pp88528f1wvvb']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/transactions?id=txn_01gsz4s0w61y0pp88528f1wvvb', @@ -286,7 +286,7 @@ public static function listOperationsProvider(): \Generator ]; yield 'Multiple ID Filtered' => [ - new ListOperation(ids: ['txn_01gsz4s0w61y0pp88528f1wvvb', 'txn_01h1vjes1y163xfj1rh1tkfb65']), + new ListTransactions(ids: ['txn_01gsz4s0w61y0pp88528f1wvvb', 'txn_01h1vjes1y163xfj1rh1tkfb65']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf( '%s/transactions?id=txn_01gsz4s0w61y0pp88528f1wvvb,txn_01h1vjes1y163xfj1rh1tkfb65', @@ -295,79 +295,79 @@ public static function listOperationsProvider(): \Generator ]; yield 'Collection Mode Filtered' => [ - new ListOperation(collectionMode: CollectionMode::Automatic), + new ListTransactions(collectionMode: CollectionMode::Automatic), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?collection_mode=automatic', Environment::SANDBOX->baseUrl()), ]; yield 'Billed At Filtered No Comparator' => [ - new ListOperation(billedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'))), + new ListTransactions(billedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'))), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?billed_at=2023-11-06T14:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'Billed At Filtered With Comparator' => [ - new ListOperation(billedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'), Comparator::GT)), + new ListTransactions(billedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'), Comparator::GT)), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?billed_at[GT]=2023-11-06T14:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'Invoice Number Filtered' => [ - new ListOperation(invoiceNumbers: ['inv_01gsz4s0w61y0pp88528f1wvvb']), + new ListTransactions(invoiceNumbers: ['inv_01gsz4s0w61y0pp88528f1wvvb']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?invoice_number=inv_01gsz4s0w61y0pp88528f1wvvb', Environment::SANDBOX->baseUrl()), ]; yield 'Invoice Number Filtered multiple' => [ - new ListOperation(invoiceNumbers: ['inv_01gsz4s0w61y0pp88528f1wvvb', 'inv_01h1vjes1y163xfj1rh1tkfb65']), + new ListTransactions(invoiceNumbers: ['inv_01gsz4s0w61y0pp88528f1wvvb', 'inv_01h1vjes1y163xfj1rh1tkfb65']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?invoice_number=inv_01gsz4s0w61y0pp88528f1wvvb,inv_01h1vjes1y163xfj1rh1tkfb65', Environment::SANDBOX->baseUrl()), ]; yield 'NotificationSubscription ID Filtered' => [ - new ListOperation(subscriptionIds: ['sub_01gsz4s0w61y0pp88528f1wvvb']), + new ListTransactions(subscriptionIds: ['sub_01gsz4s0w61y0pp88528f1wvvb']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?subscription_id=sub_01gsz4s0w61y0pp88528f1wvvb', Environment::SANDBOX->baseUrl()), ]; yield 'NotificationSubscription ID Filtered Multiple' => [ - new ListOperation(subscriptionIds: ['sub_01gsz4s0w61y0pp88528f1wvvb', 'sub_01h1vjes1y163xfj1rh1tkfb65']), + new ListTransactions(subscriptionIds: ['sub_01gsz4s0w61y0pp88528f1wvvb', 'sub_01h1vjes1y163xfj1rh1tkfb65']), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?subscription_id=sub_01gsz4s0w61y0pp88528f1wvvb,sub_01h1vjes1y163xfj1rh1tkfb65', Environment::SANDBOX->baseUrl()), ]; yield 'Updated At Filtered No Comparator' => [ - new ListOperation(updatedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'))), + new ListTransactions(updatedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'))), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?updated_at=2023-11-06T14:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'Updated At Filtered With Comparator' => [ - new ListOperation(updatedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'), Comparator::GT)), + new ListTransactions(updatedAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'), Comparator::GT)), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?updated_at[GT]=2023-11-06T14:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'Created At Filtered No Comparator' => [ - new ListOperation(createdAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'))), + new ListTransactions(createdAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'))), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?created_at=2023-11-06T14:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'Created At Filtered With Comparator' => [ - new ListOperation(createdAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'), Comparator::GT)), + new ListTransactions(createdAt: new DateComparison(new \DateTimeImmutable('2023-11-06 14:00:00'), Comparator::GT)), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?created_at[GT]=2023-11-06T14:00:00.000000Z', Environment::SANDBOX->baseUrl()), ]; yield 'With Includes' => [ - new ListOperation(includes: [Includes::Customer]), + new ListTransactions(includes: [Includes::Customer]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?include=customer', Environment::SANDBOX->baseUrl()), ]; yield 'With Includes Multiple' => [ - new ListOperation(includes: [Includes::Customer, Includes::Address, Includes::Discount]), + new ListTransactions(includes: [Includes::Customer, Includes::Address, Includes::Discount]), new Response(200, body: self::readRawJsonFixture('response/list_default')), sprintf('%s/transactions?include=customer,address,discount', Environment::SANDBOX->baseUrl()), ]; @@ -415,7 +415,7 @@ public static function getRequestProvider(): \Generator * @dataProvider previewOperationsProvider */ public function it_uses_expected_payload_on_preview( - PreviewOperation $operation, + PreviewTransaction $operation, ResponseInterface $response, string $expectedBody, ): void { @@ -432,7 +432,7 @@ public function it_uses_expected_payload_on_preview( public static function previewOperationsProvider(): \Generator { yield 'Basic Preview' => [ - new PreviewOperation( + new PreviewTransaction( items: [ new TransactionItemPreviewWithPriceId('pri_01he5kxqey1k8ankgef29cj4bv', 1, true), ], @@ -442,7 +442,7 @@ public static function previewOperationsProvider(): \Generator ]; yield 'Preview with non catalog price' => [ - new PreviewOperation( + new PreviewTransaction( items: [ new TransactionItemPreviewWithNonCatalogPrice( new TransactionNonCatalogPrice( From 13f2505688f037c6802590407d92bb12a8ac6d60 Mon Sep 17 00:00:00 2001 From: Michael Woodward Date: Mon, 22 Jan 2024 10:28:41 +0000 Subject: [PATCH 2/3] docs(release): 0.2.0 --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa398a6..a71f686 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-php-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools. -## 0.1.1 - 2024-01-15 +## [0.2.0] - 2024-01-22 + +### Changed + +- Operations have been renamed to reduce import conflicts and the use of aliases +- Unused and abandoned dependency `php-http/message-factory` was removed + +## [0.1.1] - 2024-01-15 ### Fixed From 51823a13ed0ce3b44e4a57cea6d902ee26d828ea Mon Sep 17 00:00:00 2001 From: Michael Woodward Date: Tue, 23 Jan 2024 13:52:06 +0000 Subject: [PATCH 3/3] docs(release): Add UPGRADING.md for 0.2.0 --- CHANGELOG.md | 2 +- UPGRADING.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 UPGRADING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index a71f686..953866d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-php-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools. -## [0.2.0] - 2024-01-22 +## [0.2.0] - 2024-01-23 ### Changed diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..4f20cf7 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,24 @@ +# Upgrading + +All breaking changes prior to v1 will be documented in this file to assist with upgrading. + +## v0.2.0 + +This version includes a breaking change to the naming of operations. Prior to this version operations were commonly named `Operation`, e.g. `CreateOperation` which posed problems when using more than one resource such as when creating a product and price. The new naming convention includes the resource to prevent the need of aliasing in these circumstances. e.g. `CreatePrice` and `CreateProduct`. + +To upgrade to `0.2.0` from any earlier version you will need to refactor your use of operations to use the new names. These follow a common pattern that can be seen below: + +`Paddle\SDK\Resources\Prices\Operations\CreateOperation` => `Paddle\SDK\Resources\Prices\Operations\CreatePrice` +`Paddle\SDK\Resources\Prices\Operations\UpdateOperation` => `Paddle\SDK\Resources\Prices\Operations\UpdatePrice` +`Paddle\SDK\Resources\Prices\Operations\ListOperation` => `Paddle\SDK\Resources\Prices\Operations\ListPrices` + +There are also some operations that are unique, these are detailed below: + +`Paddle\SDK\Resources\PricingPreviews\Operations\PreviewPricesOperation` => `Paddle\SDK\Resources\PricingPreviews\Operations\PreviewPrice` +`\Paddle\SDK\Resources\Transactions\Operations\PreviewOperation` => `\Paddle\SDK\Resources\Transactions\Operations\PreviewTransaction` +`\Paddle\SDK\Resources\Subscriptions\Operations\CancelOperation` => `\Paddle\SDK\Resources\Subscriptions\Operations\CancelSubscription` +`\Paddle\SDK\Resources\Subscriptions\Operations\CreateOneTimeChargeOperation` => `\Paddle\SDK\Resources\Subscriptions\Operations\CreateOneTimeCharge` +`\Paddle\SDK\Resources\Subscriptions\Operations\PauseOperation` => `\Paddle\SDK\Resources\Subscriptions\Operations\PauseSubscription` +`\Paddle\SDK\Resources\Subscriptions\Operations\PreviewOneTimeChargeOperation` => `\Paddle\SDK\Resources\Subscriptions\Operations\PreviewOneTimeCharge` +`\Paddle\SDK\Resources\Subscriptions\Operations\PreviewUpdateOperation` => `\Paddle\SDK\Resources\Subscriptions\Operations\PreviewUpdateSubscription` +`\Paddle\SDK\Resources\Subscriptions\Operations\ResumeOperation` => `\Paddle\SDK\Resources\Subscriptions\Operations\ResumeSubscription`