From 9e891d0f0554b4e476e576d006a5eb1dff24815b Mon Sep 17 00:00:00 2001 From: Tatu Kulmala Date: Fri, 16 Jan 2026 15:28:27 +0200 Subject: [PATCH 1/7] Extend Price response class to support plan and domain objects Impact: major Related: CP-359 --- src/Apis/Public/Response/Price.php | 4 ++ src/Apis/Public/Response/PriceDomain.php | 21 ++++++++++ src/Apis/Public/Response/PricePlan.php | 19 +++++++++ src/Apis/Public/Response/PriceProduct.php | 3 +- tests/MockData/prices/price.json | 50 +++++++++++++++-------- 5 files changed, 78 insertions(+), 19 deletions(-) create mode 100644 src/Apis/Public/Response/PriceDomain.php create mode 100644 src/Apis/Public/Response/PricePlan.php diff --git a/src/Apis/Public/Response/Price.php b/src/Apis/Public/Response/Price.php index 4506d5d7..03f09017 100644 --- a/src/Apis/Public/Response/Price.php +++ b/src/Apis/Public/Response/Price.php @@ -5,10 +5,12 @@ namespace Seravo\SeravoApi\Apis\Public\Response; use Seravo\SeravoApi\Apis\AbstractResponse; +use Seravo\SeravoApi\Apis\Public\Response\PricePlan; readonly class Price extends AbstractResponse { /** + * @param PriceDomain[] $domains * @param PriceProduct[] $products */ public function __construct( @@ -16,6 +18,8 @@ public function __construct( public int $interval, public string $total, public array $products, + public PricePlan $plan, + public array $domains, public ?\DateTime $createdAt, public ?\DateTime $updatedAt = null, public ?string $promotion = null diff --git a/src/Apis/Public/Response/PriceDomain.php b/src/Apis/Public/Response/PriceDomain.php new file mode 100644 index 00000000..c2151ad4 --- /dev/null +++ b/src/Apis/Public/Response/PriceDomain.php @@ -0,0 +1,21 @@ + Date: Mon, 19 Jan 2026 11:42:28 +0200 Subject: [PATCH 2/7] Refactor Order response to use Domain class for domains attributes To conform to the updated API response structure, this commit introduces a new Domain class to encapsulate domain-related attributes within the Order response. Impact: major Related: CP-359 --- src/Apis/Order/Response/Order/Domain.php | 18 ++++ src/Apis/Order/Response/Order/Order.php | 9 +- tests/MockData/orders/order.json | 92 +++++++++------- tests/MockData/orders/orders.json | 127 ++++++++++------------- 4 files changed, 135 insertions(+), 111 deletions(-) create mode 100644 src/Apis/Order/Response/Order/Domain.php diff --git a/src/Apis/Order/Response/Order/Domain.php b/src/Apis/Order/Response/Order/Domain.php new file mode 100644 index 00000000..172179f9 --- /dev/null +++ b/src/Apis/Order/Response/Order/Domain.php @@ -0,0 +1,18 @@ + $additionalDomains + * @param Domain[] $domains */ public function __construct( public bool $acceptServiceTerms, + public array $domains, public Contact $contact, public bool $migration, public string $orderLanguage, - public string $primaryDomain, public string $siteLocation, public \DateTime $createdAt, public string $id, @@ -27,7 +28,6 @@ public function __construct( public Mail $mail, public string $orderStatus, public Price $priceData, - public array $additionalDomains = [], public int $orderTrialPeriod = 0, public ?string $affiliateId = null, public ?string $externalCustomerId = null, @@ -36,7 +36,8 @@ public function __construct( public ?string $requestId = null, public ?int $serviceId = null, public ?\DateTime $updatedAt = null, - public ?PromotionCode $promotionCode = null + public ?PromotionCode $promotionCode = null, + public ?string $paymentUrl = null ) { } } diff --git a/tests/MockData/orders/order.json b/tests/MockData/orders/order.json index c51ad073..f96c7715 100644 --- a/tests/MockData/orders/order.json +++ b/tests/MockData/orders/order.json @@ -1,30 +1,36 @@ { "accept_service_terms": true, - "additional_domains": [], + "domains": [ + { + "name": "dsadadasd.fi", + "primary": true, + "dns_zone": null, + "transfer_key": null + } + ], "contact": { - "email": "haberg@example.org", - "name": "Terttu Lehtonen", - "phone": "+46 (0)8 101 054 33" + "email": "vuwur@mailinator.com", + "name": "Abra Vincent", + "phone": "+12938738972" }, "migration": false, - "order_language": "FI", + "order_language": "fi", "order_trial_period": 0, - "primary_domain": "edwards.com", - "site_location": "MX", - "affiliate_id": "303bcee4-5988-40d2-ad02-2c853882298b", + "site_location": "ch", + "affiliate_id": null, "external_customer_id": null, - "message": null, + "message": "Maxime adipisicing e", "miss_affiliate_id": null, "request_id": null, - "service_id": 1562, - "created_at": "2024-09-18T08:34:40", + "service_id": null, + "created_at": "2026-01-14T07:06:36", "updated_at": null, - "id": "102a3471-e5c4-4f9e-ac15-f5c7be9d31cb", + "id": "139e592a-5572-4c0c-9f72-c557d1b6edc0", "billing": { - "contact_email": null, - "contact_name": null, - "contact_phone": null, - "option": null, + "contact_email": "vuwur@mailinator.com", + "contact_name": "Abra Vincent", + "contact_phone": "+12938738972", + "option": "credit_card", "address": null, "address2": null, "city": null, @@ -35,38 +41,50 @@ "postal": null }, "company": { - "address2": null, - "id": null, - "address": null, - "city": null, - "email": null, - "location": null, - "name": null, - "phone": null, - "postal": null + "address2": "Autem et nesciunt n", + "id": "65712", + "address": "16 Hague Extension", + "city": "Asperiores doloribus", + "email": "cowamaho@mailinator.com", + "location": "FI", + "name": "Hurst Patel Co", + "phone": "+17862038013", + "postal": "80384" }, "mail": { "boxes": [], "forwarding_from": [], "forwarding_to": [], - "option": null + "option": "1" }, - "order_status": "new", + "order_status": "payment_required", "price_data": { + "interval": 12, "promotion": null, - "created_at": "2024-09-18T08:34:40", + "created_at": "2026-01-14T07:06:35", "updated_at": null, - "interval": 1, - "products": [ + "id": "7d6bde25-5501-4fe8-836e-f8b28d43101d", + "total": "484.00", + "products": [], + "domains": [ { - "name": "Sponsored", - "code": "WPSPONSORED1", - "price": "125", - "discount": 0 + "name": "dsadadasd.fi", + "primary": true, + "type": "registration", + "id": "877c794d-8a3f-4e15-8dbf-68d008ac166f", + "price": "324.00", + "code": "WP_DOMAIN_FI_13012026", + "discount": "0.00000" } ], - "id": "b1ca6eb4-786b-4b9e-b62f-1d35fea9a8d3", - "total": "125" + "plan": { + "id": "3b3e163b-fd61-49a9-af7c-73aadd8349e9", + "name": "Corporate", + "code": "WPCORPORATE12", + "price": "160.00", + "discount": "0.00000" + } }, - "promotion_code": null + "promotion_code": null, + "payment_url": null } diff --git a/tests/MockData/orders/orders.json b/tests/MockData/orders/orders.json index e8d71a1f..a85f4b03 100644 --- a/tests/MockData/orders/orders.json +++ b/tests/MockData/orders/orders.json @@ -1,36 +1,42 @@ { - "count": 1, + "count": 41, "page": 1, "previous_page": null, - "next_page": null, + "next_page": "http://api.seravo.dev/order/orders/?limit=2&page=2", "results": [ { "accept_service_terms": true, - "additional_domains": [], + "domains": [ + { + "name": "dsadadasd.fi", + "primary": true, + "dns_zone": null, + "transfer_key": null + } + ], "contact": { - "email": "haberg@example.org", - "name": "Terttu Lehtonen", - "phone": "+46 (0)8 101 054 33" + "email": "vuwur@mailinator.com", + "name": "Abra Vincent", + "phone": "+12938738972" }, "migration": false, - "order_language": "FI", + "order_language": "fi", "order_trial_period": 0, - "primary_domain": "edwards.com", - "site_location": "MX", - "affiliate_id": "303bcee4-5988-40d2-ad02-2c853882298b", + "site_location": "ch", + "affiliate_id": null, "external_customer_id": null, - "message": null, + "message": "Maxime adipisicing e", "miss_affiliate_id": null, "request_id": null, - "service_id": 1562, - "created_at": "2024-09-18T08:34:40", + "service_id": null, + "created_at": "2026-01-14T07:06:36", "updated_at": null, - "id": "102a3471-e5c4-4f9e-ac15-f5c7be9d31cb", + "id": "139e592a-5572-4c0c-9f72-c557d1b6edc0", "billing": { - "contact_email": null, - "contact_name": null, - "contact_phone": null, - "option": null, + "contact_email": "vuwur@mailinator.com", + "contact_name": "Abra Vincent", + "contact_phone": "+12938738972", + "option": "credit_card", "address": null, "address2": null, "city": null, @@ -41,15 +47,15 @@ "postal": null }, "company": { - "address2": null, - "id": null, - "address": null, - "city": null, - "email": null, - "location": null, - "name": null, - "phone": null, - "postal": null + "address2": "Autem et nesciunt n", + "id": "65712", + "address": "16 Hague Extension", + "city": "Asperiores doloribus", + "email": "cowamaho@mailinator.com", + "location": "FI", + "name": "Hurst Patel Co", + "phone": "+17862038013", + "postal": "80384" }, "mail": { "boxes": [], @@ -57,55 +63,36 @@ "forwarding_to": [], "option": "1" }, - "order_status": "new", + "order_status": "payment_required", "price_data": { "interval": 12, - "promotion": "LnoPAmUBWnmR4ms", - "created_at": "2024-10-14T10:19:53", + "promotion": null, + "created_at": "2026-01-14T07:06:35", "updated_at": null, - "id": "ff67d517-e5a1-4826-b936-5c41cd12853f", - "total": "31.98", - "products": [ - { - "name": "Games developer", - "code": "IKPXURZMEUR", - "price": "936.0", - "discount": "0" - }, + "id": "7d6bde25-5501-4fe8-836e-f8b28d43101d", + "total": "484.00", + "products": [], + "domains": [ { - "name": "Magazine journalist", - "code": "VXUIZFRNHYZ", - "price": "2112.0", - "discount": "0" - }, - { - "name": "Pro", - "code": "WPPRO12", - "price": "150", - "discount": "0" + "name": "dsadadasd.fi", + "primary": true, + "type": "registration", + "id": "877c794d-8a3f-4e15-8dbf-68d008ac166f", + "price": "324.00", + "code": "WP_DOMAIN_FI_13012026", + "discount": "0.00000" } - ] + ], + "plan": { + "id": "3b3e163b-fd61-49a9-af7c-73aadd8349e9", + "name": "Corporate", + "code": "WPCORPORATE12", + "price": "160.00", + "discount": "0.00000" + } }, - "promotion_code": { - "name": "Benjamin-Roberts", - "promotion_code": "LnoPAmUBWnmR4ms", - "promotion_type": "other", - "wp_admin_username": "johnssonbirger", - "discount": "0.33", - "trial_months": 3, - "account_manager": "lisasilva@example.com", - "deploy_location": null, - "template": null, - "free_migration": true, - "staging_shadow": true, - "whitelabel": "clark.org", - "plans": [], - "reseller_id": null, - "created_at": "2024-09-18T08:34:40", - "updated_at": null, - "id": "413b04ad-0aab-461d-9873-de937356f2b6", - "reseller": null - } + "promotion_code": null, + "payment_url": null } ] } From 764d0684734600ab2bcc0d1031bf1d2551ffd9c3 Mon Sep 17 00:00:00 2001 From: Tatu Kulmala Date: Mon, 19 Jan 2026 12:11:48 +0200 Subject: [PATCH 3/7] Refactor PromotionCode response class - Remove unused properties from PromotionCode response class - Add Coupon response class to represent coupons in PromotionCode - Add contactInformation property to Reseller response class - Update mock data to reflect new structure Impact: major Related: CP-359 --- src/Apis/Order/Response/Coupon.php | 26 +++++ src/Apis/Order/Response/PromotionCode.php | 9 +- src/Apis/Order/Response/Reseller.php | 1 + tests/MockData/promotions/promotion.json | 72 ++++++++++---- tests/MockData/promotions/promotions.json | 110 +++++++++++----------- 5 files changed, 138 insertions(+), 80 deletions(-) create mode 100644 src/Apis/Order/Response/Coupon.php diff --git a/src/Apis/Order/Response/Coupon.php b/src/Apis/Order/Response/Coupon.php new file mode 100644 index 00000000..201baa4e --- /dev/null +++ b/src/Apis/Order/Response/Coupon.php @@ -0,0 +1,26 @@ + $plans + * @param array $coupons */ public function __construct( public string $name, public string $promotionCode, public string $promotionType, public string $id, - public string $discount = "0", - public int $trialMonths = 0, - public bool $freeMigration = false, - public bool $stagingShadow = false, + public \DateTime $createdAt, public array $plans = [], public ?string $accountManager = null, public ?string $deployLocation = null, @@ -28,9 +27,9 @@ public function __construct( public ?string $whitelabel = null, public ?string $wpAdminUsername = null, public ?string $resellerId = null, - public ?\DateTime $createdAt = null, public ?\DateTime $updatedAt = null, public ?Reseller $reseller = null, + public ?array $coupons = null, ) { } } diff --git a/src/Apis/Order/Response/Reseller.php b/src/Apis/Order/Response/Reseller.php index 5b286869..24eaf6dc 100644 --- a/src/Apis/Order/Response/Reseller.php +++ b/src/Apis/Order/Response/Reseller.php @@ -29,6 +29,7 @@ public function __construct( public ?string $internalNotes = null, public ?\DateTime $updatedAt = null, public ?\DateTime $deletedAt = null, + public ?\stdClass $contactInformation = null, ) { } } diff --git a/tests/MockData/promotions/promotion.json b/tests/MockData/promotions/promotion.json index 75f9b539..602c6402 100644 --- a/tests/MockData/promotions/promotion.json +++ b/tests/MockData/promotions/promotion.json @@ -1,20 +1,56 @@ { - "name": "Kauppinen", - "promotion_code": "zFsIoQXPZEhnGqQ", - "promotion_type": "referrer", - "wp_admin_username": "johanneshyttinen", - "discount": "0.0", - "trial_months": 1, - "account_manager": "simolaine@example.net", - "deploy_location": null, - "template": null, - "free_migration": true, - "staging_shadow": true, - "whitelabel": "jackson.com", - "plans": [], - "reseller_id": null, - "created_at": "2024-09-18T08:34:40", + "name": "Test promo", + "promotion_code": "TESTPROMO", + "promotion_type": "reseller", + "wp_admin_username": "test", + "account_manager": null, + "deploy_location": null, + "template": null, + "whitelabel": null, + "plans": ["d3680605-1d84-4363-abbb-363dccaa9129"], + "reseller_id": "e097a793-0901-4f40-8016-c665399389da", + "created_at": "2026-01-15T09:27:49", + "updated_at": null, + "id": "23c2e367-e76c-403e-a0a3-5a774d13e646", + "reseller": { + "name": "Test the Webdeveloper", + "email": "test@seravo.com", + "business_id": "1234567-8", + "domain": "tehdaankaupat.invalid", + "project_size": null, + "languages": ["fi"], + "office_locations": ["turku"], + "expertise": null, + "internal_notes": null, + "contact_information": { + "company_name": null, + "company_address": null, + "company_address_2": null, + "company_postal": null, + "company_city": null, + "company_location": null, + "company_phone": null, + "company_email": null, + "contact_name": null, + "contact_phone": null, + "contact_email": null, + "billing_name": null, + "billing_address": null, + "billing_address_2": null, + "billing_postal": null, + "billing_city": null, + "billing_operator": null, + "billing_email": null, + "billing_contact_name": null, + "billing_contact_phone": null, + "billing_contact_email": null + }, + "organisation_id": "c1500726-5df4-4925-b09c-e1c01d222a7d", + "created_at": "2026-01-15T09:27:29", "updated_at": null, - "id": "0d83c053-bf27-44c2-83ac-7f7bbe27e61b", - "reseller": null -} \ No newline at end of file + "id": "e097a793-0901-4f40-8016-c665399389da", + "deleted_at": null, + "webhooks": [] + }, + "coupons": [] +} diff --git a/tests/MockData/promotions/promotions.json b/tests/MockData/promotions/promotions.json index 550c3438..bd9a2c5e 100644 --- a/tests/MockData/promotions/promotions.json +++ b/tests/MockData/promotions/promotions.json @@ -1,68 +1,64 @@ { - "count": 908, + "count": 1, "page": 1, "previous_page": null, - "next_page": "http://api.seravo.dev/public/promotions/?limit=3&page=2", + "next_page": null, "results": [ { - "name": "Kauppinen", - "promotion_code": "zFsIoQXPZEhnGqQ", - "promotion_type": "referrer", - "wp_admin_username": "johanneshyttinen", - "discount": "0.0", - "trial_months": 1, - "account_manager": "simolaine@example.net", + "name": "Test promo", + "promotion_code": "TESTPROMO", + "promotion_type": "reseller", + "wp_admin_username": "test", + "account_manager": null, "deploy_location": null, "template": null, - "free_migration": true, - "staging_shadow": true, - "whitelabel": "jackson.com", - "plans": [], - "reseller_id": null, - "created_at": "2024-09-18T08:34:40", + "whitelabel": null, + "plans": ["d3680605-1d84-4363-abbb-363dccaa9129"], + "reseller_id": "e097a793-0901-4f40-8016-c665399389da", + "created_at": "2026-01-15T09:27:49", "updated_at": null, - "id": "0d83c053-bf27-44c2-83ac-7f7bbe27e61b", - "reseller": null - }, - { - "name": "Vartiainen Oy", - "promotion_code": "Mqf19LoTsXvwdrE", - "promotion_type": "referrer", - "wp_admin_username": "esalminen", - "discount": "0.0", - "trial_months": 7, - "account_manager": "sbjorklund@example.net", - "deploy_location": null, - "template": null, - "free_migration": false, - "staging_shadow": true, - "whitelabel": "vaananen.fi", - "plans": [], - "reseller_id": null, - "created_at": "2024-09-18T08:34:40", - "updated_at": null, - "id": "145ba545-5063-4103-8fd4-e9df2c924dc2", - "reseller": null - }, - { - "name": "Larsson AB", - "promotion_code": "VWdFrBUCmA2lImo", - "promotion_type": "referrer", - "wp_admin_username": "malinenolli", - "discount": "0.0", - "trial_months": 3, - "account_manager": "vpeck@example.org", - "deploy_location": null, - "template": null, - "free_migration": true, - "staging_shadow": true, - "whitelabel": "salonen.fi", - "plans": [], - "reseller_id": null, - "created_at": "2024-09-18T08:34:40", - "updated_at": null, - "id": "2b21a88f-ac47-48e5-9ec4-6bef7fbf1bc8", - "reseller": null + "id": "23c2e367-e76c-403e-a0a3-5a774d13e646", + "reseller": { + "name": "Test the Webdeveloper", + "email": "test@seravo.com", + "business_id": "1234567-8", + "domain": "tehdaankaupat.invalid", + "project_size": null, + "languages": ["fi"], + "office_locations": ["turku"], + "expertise": null, + "internal_notes": null, + "contact_information": { + "company_name": null, + "company_address": null, + "company_address_2": null, + "company_postal": null, + "company_city": null, + "company_location": null, + "company_phone": null, + "company_email": null, + "contact_name": null, + "contact_phone": null, + "contact_email": null, + "billing_name": null, + "billing_address": null, + "billing_address_2": null, + "billing_postal": null, + "billing_city": null, + "billing_operator": null, + "billing_email": null, + "billing_contact_name": null, + "billing_contact_phone": null, + "billing_contact_email": null + }, + "organisation_id": "c1500726-5df4-4925-b09c-e1c01d222a7d", + "created_at": "2026-01-15T09:27:29", + "updated_at": null, + "id": "e097a793-0901-4f40-8016-c665399389da", + "deleted_at": null, + "webhooks": [] + }, + "coupons": [] } ] } From 47c009bae14ff8a13b886059e70214ac1cdd12f7 Mon Sep 17 00:00:00 2001 From: Tatu Kulmala Date: Mon, 26 Jan 2026 09:26:57 +0200 Subject: [PATCH 4/7] Add new CCInvoice billing method request class This commit introduces a new billing method request class, CCInvoice, to the Order API. This class allows users to create orders with credit card invoice billing. Impact: major Related: CP-359 --- .../Order/Schema/Billing/CCInvoice.php | 26 +++++++++++++++++++ src/Enums/BillingMethod.php | 1 + 2 files changed, 27 insertions(+) create mode 100644 src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php diff --git a/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php b/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php new file mode 100644 index 00000000..4820767f --- /dev/null +++ b/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php @@ -0,0 +1,26 @@ +value); + } +} diff --git a/src/Enums/BillingMethod.php b/src/Enums/BillingMethod.php index b64731f9..a05d47d0 100644 --- a/src/Enums/BillingMethod.php +++ b/src/Enums/BillingMethod.php @@ -9,4 +9,5 @@ enum BillingMethod: string case Paper = 'paper'; case Email = 'email'; case EInvoice = 'einvoice'; + case CCInvoice = 'credit_card'; } From 9896c2209bc7ccb13f77b109f7dcf6359b16108f Mon Sep 17 00:00:00 2001 From: Tatu Kulmala Date: Mon, 26 Jan 2026 10:45:26 +0200 Subject: [PATCH 5/7] Refactor CreatePriceRequest to include Domain objects This commit introduces a new Domain class and a DomainType enum to better represent domain-related data in the CreatePriceRequest. The CreatePriceRequest now accepts an array of Domain objects, allowing for more structured and type-safe handling of domain information. Impact: major Related: CP-359 --- examples/prices/CreatePrice.php | 5 +++++ .../Request/Price/CreatePriceRequest.php | 3 +++ src/Apis/Public/Request/Price/Domain.php | 18 ++++++++++++++++++ src/Enums/DomainType.php | 12 ++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 src/Apis/Public/Request/Price/Domain.php create mode 100644 src/Enums/DomainType.php diff --git a/examples/prices/CreatePrice.php b/examples/prices/CreatePrice.php index 5c949a45..1bb09c01 100644 --- a/examples/prices/CreatePrice.php +++ b/examples/prices/CreatePrice.php @@ -7,11 +7,16 @@ use Seravo\SeravoApi\SeravoAPI; use Seravo\SeravoApi\Apis\Public\Request\Price\CreatePriceRequest; +use Seravo\SeravoApi\Apis\Public\Request\Price\Domain; +use Seravo\SeravoApi\Enums\DomainType; $createPriceRequest = new CreatePriceRequest( interval: 1, products: [], plan: '0e6bb9d4-2c90-4ae7-b876-4e17d5e8ff11', + domains: [ + new Domain(name: 'mydomainexample123.fi', primary: true, type: DomainType::Registration->value), + ], promotion: null, ); diff --git a/src/Apis/Public/Request/Price/CreatePriceRequest.php b/src/Apis/Public/Request/Price/CreatePriceRequest.php index 09ad6665..de1873c3 100644 --- a/src/Apis/Public/Request/Price/CreatePriceRequest.php +++ b/src/Apis/Public/Request/Price/CreatePriceRequest.php @@ -5,6 +5,7 @@ namespace Seravo\SeravoApi\Apis\Public\Request\Price; use Seravo\SeravoApi\Concerns\ArrayTransformer; +use Seravo\SeravoApi\Apis\Public\Request\Price\Domain; readonly class CreatePriceRequest implements \JsonSerializable { @@ -13,11 +14,13 @@ /** * * @param array $products + * @param Domain[] $domains */ public function __construct( public int $interval, public array $products, public string $plan, + public array $domains = [], public ?string $promotion = null, ) { } diff --git a/src/Apis/Public/Request/Price/Domain.php b/src/Apis/Public/Request/Price/Domain.php new file mode 100644 index 00000000..6301ebc1 --- /dev/null +++ b/src/Apis/Public/Request/Price/Domain.php @@ -0,0 +1,18 @@ + Date: Mon, 26 Jan 2026 11:05:54 +0200 Subject: [PATCH 6/7] Refactor OrderRequest class to accept Domain response objects This commit updates the OrderRequest class to utilize the Domain response objects. This change improves type safety and consistency across the codebase by ensuring that the OrderRequest class works with well-defined response types. Impact: major Related: CP-359 --- examples/orders/CreateOrder.php | 7 ++++--- src/Apis/Order/Request/Order/OrderRequest.php | 6 +++--- tests/Endpoints/OrdersEndpointTest.php | 15 +++++++++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/orders/CreateOrder.php b/examples/orders/CreateOrder.php index 6902d0ca..2355cb97 100644 --- a/examples/orders/CreateOrder.php +++ b/examples/orders/CreateOrder.php @@ -11,6 +11,7 @@ use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Company; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Contact; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Mail; +use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; $billing = new PaperInvoice( contactEmail: 'jonh@doe.com', @@ -24,13 +25,13 @@ $createOrderRequest = new CreateOrderRequest( acceptServiceTerms: true, + domains: [ new Domain(name: 'mydomainexample123.fi', primary: true) ], contact: new Contact(email: 'john@doe.com', name: 'John Doe', phone: '0401234567'), migration: false, - orderLanguage: 'FI', + orderLanguage: 'fi', // 'fi', 'en_US', 'sv_SE' orderTrialPeriod: 0, - primaryDomain: 'example.fi', siteLocation: 'FI', - priceData: 'ff67d517-e5a1-4826-b936-5c41cd12853f', + priceData: 'd289afc7-b02e-44b5-918b-da66aa3d8858', billing: $billing, company: new Company(id: '1', name: 'John Doe'), mail: new Mail(option: '1'), diff --git a/src/Apis/Order/Request/Order/OrderRequest.php b/src/Apis/Order/Request/Order/OrderRequest.php index 160a7683..1cbc4c3a 100644 --- a/src/Apis/Order/Request/Order/OrderRequest.php +++ b/src/Apis/Order/Request/Order/OrderRequest.php @@ -9,6 +9,7 @@ use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Mail; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Company; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Contact; +use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; abstract readonly class OrderRequest implements \JsonSerializable { @@ -16,20 +17,19 @@ /** * - * @param array|null $additionalDomains + * @param array $domains */ public function __construct( public bool $acceptServiceTerms, + public array $domains, public Contact $contact, public bool $migration, public string $orderLanguage, - public string $primaryDomain, public string $siteLocation, public string $priceData, public BillingMethod $billing, public Company $company, public Mail $mail, - public ?array $additionalDomains = [], public ?int $orderTrialPeriod = 0, public ?string $affiliateId = null, public ?string $externalCustomerId = null, diff --git a/tests/Endpoints/OrdersEndpointTest.php b/tests/Endpoints/OrdersEndpointTest.php index e276717c..c1c4a1ef 100644 --- a/tests/Endpoints/OrdersEndpointTest.php +++ b/tests/Endpoints/OrdersEndpointTest.php @@ -13,6 +13,7 @@ use Seravo\SeravoApi\Apis\Order\Request\Order\CreateOrderRequest; use Seravo\SeravoApi\Apis\Order\Request\Order\UpdateOrderRequest; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Billing\PaperInvoice; +use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; use Seravo\SeravoApi\Exceptions\BadRequestException; class OrdersEndpointTest extends BaseEndpointTestCase @@ -66,7 +67,12 @@ public function testCreateOrder(): void ), migration: false, orderLanguage: 'en', - primaryDomain: 'test.com', + domains: [ + new Domain( + name: 'test.com', + primary: true + ) + ], siteLocation: 'eu', priceData: '1234', billing: new PaperInvoice( @@ -111,7 +117,12 @@ public function testUpdateOrder(): void ), migration: false, orderLanguage: 'en', - primaryDomain: 'test.com', + domains: [ + new Domain( + name: 'test.com', + primary: true + ) + ], siteLocation: 'eu', priceData: '1234', billing: new PaperInvoice( From 9826e67394c781ba2fdc222deca36fa10e11f9e9 Mon Sep 17 00:00:00 2001 From: Tatu Kulmala Date: Mon, 26 Jan 2026 11:16:12 +0200 Subject: [PATCH 7/7] Match casing with the API response fields This commit updates the casing of all classes to snake_case to match the API response fields. This ensures consistency and prevents potential issues when mapping API responses to class properties. Impact: major Related: CP-359 --- README.md | 23 +++++++------- examples/orders/CreateOrder.php | 16 +++++----- examples/orders/UpdateOrder.php | 28 ++++++++++------- src/Apis/Order/Request/Order/OrderRequest.php | 20 ++++++------- .../Order/Schema/Billing/BillingMethod.php | 6 ++-- .../Order/Schema/Billing/CCInvoice.php | 8 ++--- .../Request/Order/Schema/Billing/EInvoice.php | 8 ++--- .../Order/Schema/Billing/EmailInvoice.php | 8 ++--- .../Order/Schema/Billing/PaperInvoice.php | 8 ++--- src/Apis/Order/Request/Order/Schema/Mail.php | 8 ++--- src/Apis/Order/Response/Affiliate.php | 8 ++--- src/Apis/Order/Response/Order/Billing.php | 6 ++-- src/Apis/Order/Response/Order/Domain.php | 4 +-- src/Apis/Order/Response/Order/Mail.php | 8 ++--- src/Apis/Order/Response/Order/Order.php | 30 +++++++++---------- src/Apis/Order/Response/PromotionCode.php | 16 +++++----- src/Apis/Order/Response/Reseller.php | 20 ++++++------- src/Apis/Public/Response/Plan.php | 22 +++++++------- src/Apis/Public/Response/Price.php | 4 +-- src/Apis/Public/Response/Product.php | 10 +++---- src/Apis/Public/Response/ProductGroup.php | 4 +-- src/JsonResponseMapper.php | 1 - tests/Endpoints/OrdersEndpointTest.php | 28 ++++++++--------- 23 files changed, 150 insertions(+), 144 deletions(-) diff --git a/README.md b/README.md index 6f8ae13c..5803fb25 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The following environment variables are required to be set before using the libr Optionally, you may pass these environment variables as well: - `SERAVO_ENVIRONMENT` - - Defines the API environment (`testing`, `staging`, `production`) to be used. Defaults to `production` if omitted from `.env` and/or constructor. + - Defines the API environment (`testing`, `staging`, `production`) to be used. Defaults to `production` if omitted from `.env` and/or constructor. These values must be set in the `/.env` file. See `.env.example`. @@ -146,11 +146,12 @@ use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Billing\PaperInvoice; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Company; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Contact; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Mail; +use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; $billing = new PaperInvoice( - contactEmail: 'jonh@doe.com', - contactName: 'John Doe', - contactPhone: '0401234567', + contact_email: 'john@doe.com', + contact_name: 'John Doe', + contact_phone: '0401234567', address: 'Testikatu 1', city: 'Helsinki', postal: '00100', @@ -158,14 +159,14 @@ $billing = new PaperInvoice( ); $createOrderRequest = new CreateOrderRequest( - acceptServiceTerms: true, + accept_service_terms: true, + domains: [ new Domain(name: 'mydomainexample123.fi', primary: true) ], contact: new Contact(email: 'john@doe.com', name: 'John Doe', phone: '0401234567'), migration: false, - orderLanguage: 'FI', - orderTrialPeriod: 0, - primaryDomain: 'example.fi', - siteLocation: 'FI', - priceData: 'ff67d517-e5a1-4826-b936-5c41cd12853f', + order_language: 'fi', // 'fi', 'en_US', 'sv_SE' + order_trial_period: 0, + site_location: 'FI', + price_data: 'd289afc7-b02e-44b5-918b-da66aa3d8858', billing: $billing, company: new Company(id: '1', name: 'John Doe'), mail: new Mail(option: '1'), @@ -192,4 +193,4 @@ See our documentation for [Order Module API](https://api.seravo.com/order/docs#/ ## License -This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \ No newline at end of file +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/examples/orders/CreateOrder.php b/examples/orders/CreateOrder.php index 2355cb97..4971ddf3 100644 --- a/examples/orders/CreateOrder.php +++ b/examples/orders/CreateOrder.php @@ -14,9 +14,9 @@ use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; $billing = new PaperInvoice( - contactEmail: 'jonh@doe.com', - contactName: 'John Doe', - contactPhone: '0401234567', + contact_email: 'john@doe.com', + contact_name: 'John Doe', + contact_phone: '0401234567', address: 'Testikatu 1', city: 'Helsinki', postal: '00100', @@ -24,14 +24,14 @@ ); $createOrderRequest = new CreateOrderRequest( - acceptServiceTerms: true, + accept_service_terms: true, domains: [ new Domain(name: 'mydomainexample123.fi', primary: true) ], contact: new Contact(email: 'john@doe.com', name: 'John Doe', phone: '0401234567'), migration: false, - orderLanguage: 'fi', // 'fi', 'en_US', 'sv_SE' - orderTrialPeriod: 0, - siteLocation: 'FI', - priceData: 'd289afc7-b02e-44b5-918b-da66aa3d8858', + order_language: 'fi', // 'fi', 'en_US', 'sv_SE' + order_trial_period: 0, + site_location: 'FI', + price_data: 'd289afc7-b02e-44b5-918b-da66aa3d8858', billing: $billing, company: new Company(id: '1', name: 'John Doe'), mail: new Mail(option: '1'), diff --git a/examples/orders/UpdateOrder.php b/examples/orders/UpdateOrder.php index 167c1e29..10e8e66e 100644 --- a/examples/orders/UpdateOrder.php +++ b/examples/orders/UpdateOrder.php @@ -10,12 +10,13 @@ use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Company; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Contact; use Seravo\SeravoApi\Apis\Order\Request\Order\Schema\Mail; +use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; use Seravo\SeravoApi\SeravoAPI; $billing = new PaperInvoice( - contactEmail: 'john@doe.com', - contactName: 'John Doe', - contactPhone: '0401234567', + contact_email: 'john@doe.com', + contact_name: 'John Doe', + contact_phone: '0401234567', address: 'Testikatu 1', city: 'Helsinki', postal: '00100', @@ -24,18 +25,23 @@ $updateOrderRequest = new UpdateOrderRequest( ...[ - 'acceptServiceTerms' => true, + 'accept_service_terms' => true, 'contact' => new Contact(email: 'john@doe.com', name: 'John Doe', phone: '0401234567'), 'migration' => false, - 'orderLanguage' => 'FI', - 'orderTrialPeriod' => 12, - 'primaryDomain' => 'example.fi', - 'siteLocation' => 'FI', - 'priceData' => 'ff67d517-e5a1-4826-b936-5c41cd12853f', + 'order_language' => 'fi', // 'fi', 'en_US', 'sv_SE' + 'order_trial_period' => 12, + 'domains' => [ + new Domain( + name: 'mydomainexample123.fi', + primary: true + ) + ], + 'site_location' => 'FI', + 'price_data' => 'd289afc7-b02e-44b5-918b-da66aa3d8858', 'billing' => $billing, 'company' => new Company(id: '1', name: 'John Doe'), 'mail' => new Mail(option: '1'), - 'id' => 'e608fd78-a0e0-4a9d-98db-8e38de79acb7' + 'id' => '1d3c9e84-9c71-40c7-ba62-fbc5d9b59e96' ] ); @@ -48,7 +54,7 @@ try { $result = $api->order->orders()->update( - id: 'e608fd78-a0e0-4a9d-98db-8e38de79acb7', + id: '1d3c9e84-9c71-40c7-ba62-fbc5d9b59e96', request: $updateOrderRequest ); dd($result); diff --git a/src/Apis/Order/Request/Order/OrderRequest.php b/src/Apis/Order/Request/Order/OrderRequest.php index 1cbc4c3a..badfa176 100644 --- a/src/Apis/Order/Request/Order/OrderRequest.php +++ b/src/Apis/Order/Request/Order/OrderRequest.php @@ -20,23 +20,23 @@ * @param array $domains */ public function __construct( - public bool $acceptServiceTerms, + public bool $accept_service_terms, public array $domains, public Contact $contact, public bool $migration, - public string $orderLanguage, - public string $siteLocation, - public string $priceData, + public string $order_language, + public string $site_location, + public string $price_data, public BillingMethod $billing, public Company $company, public Mail $mail, - public ?int $orderTrialPeriod = 0, - public ?string $affiliateId = null, - public ?string $externalCustomerId = null, + public ?int $order_trial_period = 0, + public ?string $affiliate_id = null, + public ?string $external_customer_id = null, public ?string $message = null, - public ?string $missAffiliateId = null, - public ?string $requestId = null, - public ?int $serviceId = null, + public ?string $miss_affiliate_id = null, + public ?string $request_id = null, + public ?int $service_id = null, ) { } diff --git a/src/Apis/Order/Request/Order/Schema/Billing/BillingMethod.php b/src/Apis/Order/Request/Order/Schema/Billing/BillingMethod.php index 1a5a42a8..e509cb5a 100644 --- a/src/Apis/Order/Request/Order/Schema/Billing/BillingMethod.php +++ b/src/Apis/Order/Request/Order/Schema/Billing/BillingMethod.php @@ -7,9 +7,9 @@ abstract class BillingMethod { public function __construct( - public string $contactEmail, - public string $contactName, - public string $contactPhone, + public string $contact_email, + public string $contact_name, + public string $contact_phone, public string $option, ) { } diff --git a/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php b/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php index 4820767f..7ea81f14 100644 --- a/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php +++ b/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php @@ -9,9 +9,9 @@ class CCInvoice extends BillingMethod { public function __construct( - public string $contactEmail, - public string $contactName, - public string $contactPhone, + public string $contact_email, + public string $contact_name, + public string $contact_phone, public ?string $invoice = null, public ?string $operator = null, public ?string $address = null, @@ -21,6 +21,6 @@ public function __construct( public ?string $name = null, public ?string $postal = null, ) { - parent::__construct($contactEmail, $contactName, $contactPhone, BillingMethodEnum::CCInvoice->value); + parent::__construct($contact_email, $contact_name, $contact_phone, BillingMethodEnum::CCInvoice->value); } } diff --git a/src/Apis/Order/Request/Order/Schema/Billing/EInvoice.php b/src/Apis/Order/Request/Order/Schema/Billing/EInvoice.php index 228daaae..09656e04 100644 --- a/src/Apis/Order/Request/Order/Schema/Billing/EInvoice.php +++ b/src/Apis/Order/Request/Order/Schema/Billing/EInvoice.php @@ -9,9 +9,9 @@ class EInvoice extends BillingMethod { public function __construct( - public string $contactEmail, - public string $contactName, - public string $contactPhone, + public string $contact_email, + public string $contact_name, + public string $contact_phone, public string $invoice, public string $operator, public ?string $address = null, @@ -21,6 +21,6 @@ public function __construct( public ?string $name = null, public ?string $postal = null, ) { - parent::__construct($contactEmail, $contactName, $contactPhone, BillingMethodEnum::EInvoice->value); + parent::__construct($contact_email, $contact_name, $contact_phone, BillingMethodEnum::EInvoice->value); } } diff --git a/src/Apis/Order/Request/Order/Schema/Billing/EmailInvoice.php b/src/Apis/Order/Request/Order/Schema/Billing/EmailInvoice.php index 3b69158a..4214d01a 100644 --- a/src/Apis/Order/Request/Order/Schema/Billing/EmailInvoice.php +++ b/src/Apis/Order/Request/Order/Schema/Billing/EmailInvoice.php @@ -9,9 +9,9 @@ class EmailInvoice extends BillingMethod { public function __construct( - public string $contactEmail, - public string $contactName, - public string $contactPhone, + public string $contact_email, + public string $contact_name, + public string $contact_phone, public string $email, public ?string $invoice = null, public ?string $operator = null, @@ -21,6 +21,6 @@ public function __construct( public ?string $name = null, public ?string $postal = null ) { - parent::__construct($contactEmail, $contactName, $contactPhone, BillingMethodEnum::Email->value); + parent::__construct($contact_email, $contact_name, $contact_phone, BillingMethodEnum::Email->value); } } diff --git a/src/Apis/Order/Request/Order/Schema/Billing/PaperInvoice.php b/src/Apis/Order/Request/Order/Schema/Billing/PaperInvoice.php index 879c5eaa..293d976e 100644 --- a/src/Apis/Order/Request/Order/Schema/Billing/PaperInvoice.php +++ b/src/Apis/Order/Request/Order/Schema/Billing/PaperInvoice.php @@ -9,9 +9,9 @@ class PaperInvoice extends BillingMethod { public function __construct( - public string $contactEmail, - public string $contactName, - public string $contactPhone, + public string $contact_email, + public string $contact_name, + public string $contact_phone, public string $address, public string $city, public string $name, @@ -21,6 +21,6 @@ public function __construct( public ?string $operator = null, public ?string $address2 = null, ) { - parent::__construct($contactEmail, $contactName, $contactPhone, BillingMethodEnum::Paper->value); + parent::__construct($contact_email, $contact_name, $contact_phone, BillingMethodEnum::Paper->value); } } diff --git a/src/Apis/Order/Request/Order/Schema/Mail.php b/src/Apis/Order/Request/Order/Schema/Mail.php index c40a0920..fd861b78 100644 --- a/src/Apis/Order/Request/Order/Schema/Mail.php +++ b/src/Apis/Order/Request/Order/Schema/Mail.php @@ -10,14 +10,14 @@ * Undocumented function * * @param array $boxes - * @param array $forwardingFrom - * @param array $forwardingTo + * @param array $forwarding_from + * @param array $forwarding_to */ public function __construct( public string $option, public array $boxes = [], - public array $forwardingFrom = [], - public array $forwardingTo = [] + public array $forwarding_from = [], + public array $forwarding_to = [] ) { } } diff --git a/src/Apis/Order/Response/Affiliate.php b/src/Apis/Order/Response/Affiliate.php index c81cbad7..072d80ce 100644 --- a/src/Apis/Order/Response/Affiliate.php +++ b/src/Apis/Order/Response/Affiliate.php @@ -10,11 +10,11 @@ { public function __construct( public string $name, - public string $partnerId, - public \DateTime $createdAt, + public string $partner_id, + public \DateTime $created_at, public string $id, - public ?\DateTime $updatedAt = null, - public ?\DateTime $deletedAt = null, + public ?\DateTime $updated_at = null, + public ?\DateTime $deleted_at = null, ) { } } diff --git a/src/Apis/Order/Response/Order/Billing.php b/src/Apis/Order/Response/Order/Billing.php index d76d967d..57db0ebd 100644 --- a/src/Apis/Order/Response/Order/Billing.php +++ b/src/Apis/Order/Response/Order/Billing.php @@ -9,9 +9,9 @@ readonly class Billing extends AbstractResponse { public function __construct( - public ?string $contactEmail = null, - public ?string $contactName = null, - public ?string $contactPhone = null, + public ?string $contact_email = null, + public ?string $contact_name = null, + public ?string $contact_phone = null, public ?string $option = null, public ?string $address = null, public ?string $address2 = null, diff --git a/src/Apis/Order/Response/Order/Domain.php b/src/Apis/Order/Response/Order/Domain.php index 172179f9..1d983cb3 100644 --- a/src/Apis/Order/Response/Order/Domain.php +++ b/src/Apis/Order/Response/Order/Domain.php @@ -11,8 +11,8 @@ public function __construct( public string $name, public bool $primary, - public ?string $dnsZone = null, - public ?string $transferKey = null, + public ?string $dns_zone = null, + public ?string $transfer_key = null, ) { } } diff --git a/src/Apis/Order/Response/Order/Mail.php b/src/Apis/Order/Response/Order/Mail.php index d1ae396a..f31aa7ac 100644 --- a/src/Apis/Order/Response/Order/Mail.php +++ b/src/Apis/Order/Response/Order/Mail.php @@ -11,13 +11,13 @@ { /** * @param array $boxes - * @param array $forwardingFrom - * @param array $forwardingTo + * @param array $forwarding_from + * @param array $forwarding_to */ public function __construct( public array $boxes = [], - public array $forwardingFrom = [], - public array $forwardingTo = [], + public array $forwarding_from = [], + public array $forwarding_to = [], public ?string $option = null, ) { } diff --git a/src/Apis/Order/Response/Order/Order.php b/src/Apis/Order/Response/Order/Order.php index 07fa755c..ff5e6d64 100644 --- a/src/Apis/Order/Response/Order/Order.php +++ b/src/Apis/Order/Response/Order/Order.php @@ -15,29 +15,29 @@ * @param Domain[] $domains */ public function __construct( - public bool $acceptServiceTerms, + public bool $accept_service_terms, public array $domains, public Contact $contact, public bool $migration, - public string $orderLanguage, - public string $siteLocation, - public \DateTime $createdAt, + public string $order_language, + public string $site_location, + public \DateTime $created_at, public string $id, public Billing $billing, public Company $company, public Mail $mail, - public string $orderStatus, - public Price $priceData, - public int $orderTrialPeriod = 0, - public ?string $affiliateId = null, - public ?string $externalCustomerId = null, + public string $order_status, + public Price $price_data, + public int $order_trial_period = 0, + public ?string $affiliate_id = null, + public ?string $external_customer_id = null, public ?string $message = null, - public ?string $missAffiliateId = null, - public ?string $requestId = null, - public ?int $serviceId = null, - public ?\DateTime $updatedAt = null, - public ?PromotionCode $promotionCode = null, - public ?string $paymentUrl = null + public ?string $miss_affiliate_id = null, + public ?string $request_id = null, + public ?int $service_id = null, + public ?\DateTime $updated_at = null, + public ?PromotionCode $promotion_code = null, + public ?string $payment_url = null ) { } } diff --git a/src/Apis/Order/Response/PromotionCode.php b/src/Apis/Order/Response/PromotionCode.php index f0ebcff5..5dc83dca 100644 --- a/src/Apis/Order/Response/PromotionCode.php +++ b/src/Apis/Order/Response/PromotionCode.php @@ -16,18 +16,18 @@ */ public function __construct( public string $name, - public string $promotionCode, - public string $promotionType, + public string $promotion_code, + public string $promotion_type, public string $id, - public \DateTime $createdAt, + public \DateTime $created_at, public array $plans = [], - public ?string $accountManager = null, - public ?string $deployLocation = null, + public ?string $account_manager = null, + public ?string $deploy_location = null, public ?string $template = null, public ?string $whitelabel = null, - public ?string $wpAdminUsername = null, - public ?string $resellerId = null, - public ?\DateTime $updatedAt = null, + public ?string $wp_admin_username = null, + public ?string $reseller_id = null, + public ?\DateTime $updated_at = null, public ?Reseller $reseller = null, public ?array $coupons = null, ) { diff --git a/src/Apis/Order/Response/Reseller.php b/src/Apis/Order/Response/Reseller.php index 24eaf6dc..2c706088 100644 --- a/src/Apis/Order/Response/Reseller.php +++ b/src/Apis/Order/Response/Reseller.php @@ -10,26 +10,26 @@ { /** * @param array $languages - * @param array $officeLocations + * @param array $office_locations * @param array $webhooks */ public function __construct( public string $name, public string $email, - public string $businessId, + public string $business_id, public string $domain, - public string $organisationId, - public \DateTime $createdAt, + public string $organisation_id, + public \DateTime $created_at, public string $id, public array $webhooks, - public ?string $projectSize, + public ?string $project_size, public array $languages = [], - public array $officeLocations = [], + public array $office_locations = [], public ?string $expertise = null, - public ?string $internalNotes = null, - public ?\DateTime $updatedAt = null, - public ?\DateTime $deletedAt = null, - public ?\stdClass $contactInformation = null, + public ?string $internal_notes = null, + public ?\DateTime $updated_at = null, + public ?\DateTime $deleted_at = null, + public ?\stdClass $contact_information = null, ) { } } diff --git a/src/Apis/Public/Response/Plan.php b/src/Apis/Public/Response/Plan.php index 57cbc042..607b322c 100644 --- a/src/Apis/Public/Response/Plan.php +++ b/src/Apis/Public/Response/Plan.php @@ -10,25 +10,25 @@ { public function __construct( public string $id, - public bool $accountManager, + public bool $account_manager, public int $disklimit, - public int $emailsSent, + public int $emails_sent, public int|null $httplimit, - public string $monitorInterval, + public string $monitor_interval, public string $name, public bool $network, - public int $networkSubsites, - public int $phpMaxWorkers, + public int $network_subsites, + public int $php_max_workers, public int $price, public bool $private, - public int $redisMaxMem, - public string $securitySla, + public int $redis_max_mem, + public string $security_sla, public int $shadowlimit, - public string $siteSla, - public int $visitorsPerMonth, + public string $site_sla, + public int $visitors_per_month, public bool $woocommerce, - public \DateTime $createdAt, - public ?\DateTime $updatedAt = null, + public \DateTime $created_at, + public ?\DateTime $updated_at = null, ) { } } diff --git a/src/Apis/Public/Response/Price.php b/src/Apis/Public/Response/Price.php index 03f09017..88104a88 100644 --- a/src/Apis/Public/Response/Price.php +++ b/src/Apis/Public/Response/Price.php @@ -20,8 +20,8 @@ public function __construct( public array $products, public PricePlan $plan, public array $domains, - public ?\DateTime $createdAt, - public ?\DateTime $updatedAt = null, + public ?\DateTime $created_at, + public ?\DateTime $updated_at = null, public ?string $promotion = null ) { } diff --git a/src/Apis/Public/Response/Product.php b/src/Apis/Public/Response/Product.php index 457dd1ab..7242d555 100644 --- a/src/Apis/Public/Response/Product.php +++ b/src/Apis/Public/Response/Product.php @@ -16,11 +16,11 @@ public function __construct( public string $type, public string $unit, public \stdClass $locale, - public string $productType, - public \DateTime $createdAt, - public ?\DateTime $updatedAt = null, - public ?\DateTime $deletedAt = null, - public ?string $groupId = null, + public string $product_type, + public \DateTime $created_at, + public ?\DateTime $updated_at = null, + public ?\DateTime $deleted_at = null, + public ?string $group_id = null, public ?\stdClass $metadata = null ) { } diff --git a/src/Apis/Public/Response/ProductGroup.php b/src/Apis/Public/Response/ProductGroup.php index 9c29e95d..cc5b42d2 100644 --- a/src/Apis/Public/Response/ProductGroup.php +++ b/src/Apis/Public/Response/ProductGroup.php @@ -12,8 +12,8 @@ public function __construct( public string $id, public string $name, public string $type, - public \DateTime $createdAt, - public ?\DateTime $updatedAt = null, + public \DateTime $created_at, + public ?\DateTime $updated_at = null, ) { } } diff --git a/src/JsonResponseMapper.php b/src/JsonResponseMapper.php index e81acd00..20bf7e49 100644 --- a/src/JsonResponseMapper.php +++ b/src/JsonResponseMapper.php @@ -30,7 +30,6 @@ private function init(): JsonMapperInterface $factoryRegistry = FactoryRegistry::withNativePhpClassesAdded(); return JsonMapperBuilder::new() - ->withCaseConversionMiddleware(TextNotation::UNDERSCORE(), TextNotation::CAMEL_CASE()) ->withDocBlockAnnotationsMiddleware() ->withNamespaceResolverMiddleware() ->withTypedPropertiesMiddleware() diff --git a/tests/Endpoints/OrdersEndpointTest.php b/tests/Endpoints/OrdersEndpointTest.php index c1c4a1ef..c6aa7792 100644 --- a/tests/Endpoints/OrdersEndpointTest.php +++ b/tests/Endpoints/OrdersEndpointTest.php @@ -59,26 +59,26 @@ public function testCreateOrder(): void ]); $request = new CreateOrderRequest( - acceptServiceTerms: true, + accept_service_terms: true, contact: new Contact( email: 'test@test.com', name: 'Test', phone: '1234567890' ), migration: false, - orderLanguage: 'en', + order_language: 'en', domains: [ new Domain( name: 'test.com', primary: true ) ], - siteLocation: 'eu', - priceData: '1234', + site_location: 'eu', + price_data: '1234', billing: new PaperInvoice( - contactEmail: 'test@test.com', - contactName: 'Test', - contactPhone: '1234567890', + contact_email: 'test@test.com', + contact_name: 'Test', + contact_phone: '1234567890', address: 'Test Address', city: 'Test City', name: 'Test Name', @@ -109,26 +109,26 @@ public function testUpdateOrder(): void ]); $request = new UpdateOrderRequest( - acceptServiceTerms: true, + accept_service_terms: true, contact: new Contact( email: 'test@test.com', name: 'Test', phone: '1234567890' ), migration: false, - orderLanguage: 'en', + order_language: 'en', domains: [ new Domain( name: 'test.com', primary: true ) ], - siteLocation: 'eu', - priceData: '1234', + site_location: 'eu', + price_data: '1234', billing: new PaperInvoice( - contactEmail: 'test@test.com', - contactName: 'Test', - contactPhone: '1234567890', + contact_email: 'test@test.com', + contact_name: 'Test', + contact_phone: '1234567890', address: 'Test Address', city: 'Test City', name: 'Test Name',