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 6902d0ca..4971ddf3 100644 --- a/examples/orders/CreateOrder.php +++ b/examples/orders/CreateOrder.php @@ -11,11 +11,12 @@ 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', @@ -23,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', - 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'), 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/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/Order/Request/Order/OrderRequest.php b/src/Apis/Order/Request/Order/OrderRequest.php index 160a7683..badfa176 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,27 +17,26 @@ /** * - * @param array|null $additionalDomains + * @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 $primaryDomain, - 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 ?array $additionalDomains = [], - 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 new file mode 100644 index 00000000..7ea81f14 --- /dev/null +++ b/src/Apis/Order/Request/Order/Schema/Billing/CCInvoice.php @@ -0,0 +1,26 @@ +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/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 @@ + $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 9d33a118..ff5e6d64 100644 --- a/src/Apis/Order/Response/Order/Order.php +++ b/src/Apis/Order/Response/Order/Order.php @@ -7,36 +7,37 @@ use Seravo\SeravoApi\Apis\AbstractResponse; use Seravo\SeravoApi\Apis\Order\Response\PromotionCode; use Seravo\SeravoApi\Apis\Public\Response\Price; +use Seravo\SeravoApi\Apis\Order\Response\Order\Domain; readonly class Order extends AbstractResponse { /** - * @param array $additionalDomains + * @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 $primaryDomain, - 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 array $additionalDomains = [], - 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 $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 3f935223..5dc83dca 100644 --- a/src/Apis/Order/Response/PromotionCode.php +++ b/src/Apis/Order/Response/PromotionCode.php @@ -5,32 +5,31 @@ namespace Seravo\SeravoApi\Apis\Order\Response; use Seravo\SeravoApi\Apis\AbstractResponse; +use Seravo\SeravoApi\Apis\Order\Response\Coupon; readonly class PromotionCode extends AbstractResponse { /** * * @param array $plans + * @param array $coupons */ public function __construct( public string $name, - public string $promotionCode, - public string $promotionType, + public string $promotion_code, + public string $promotion_type, public string $id, - public string $discount = "0", - public int $trialMonths = 0, - public bool $freeMigration = false, - public bool $stagingShadow = false, + 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 $createdAt = 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 5b286869..2c706088 100644 --- a/src/Apis/Order/Response/Reseller.php +++ b/src/Apis/Order/Response/Reseller.php @@ -10,25 +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 ?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/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 @@ +withCaseConversionMiddleware(TextNotation::UNDERSCORE(), TextNotation::CAMEL_CASE()) ->withDocBlockAnnotationsMiddleware() ->withNamespaceResolverMiddleware() ->withTypedPropertiesMiddleware() diff --git a/tests/Endpoints/OrdersEndpointTest.php b/tests/Endpoints/OrdersEndpointTest.php index e276717c..c6aa7792 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 @@ -58,21 +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', - primaryDomain: 'test.com', - siteLocation: 'eu', - priceData: '1234', + order_language: 'en', + domains: [ + new Domain( + name: 'test.com', + primary: true + ) + ], + 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', @@ -103,21 +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', - primaryDomain: 'test.com', - siteLocation: 'eu', - priceData: '1234', + order_language: 'en', + domains: [ + new Domain( + name: 'test.com', + primary: true + ) + ], + 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', 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 } ] } diff --git a/tests/MockData/prices/price.json b/tests/MockData/prices/price.json index 406a2da3..a515c24f 100644 --- a/tests/MockData/prices/price.json +++ b/tests/MockData/prices/price.json @@ -1,28 +1,42 @@ { - "interval": 12, + "interval": 1, "promotion": null, - "created_at": "2024-10-14T10:19:53", + "created_at": "2026-01-13T09:43:12", "updated_at": null, - "id": "0bb754a5-5de6-43aa-9a14-eb7fbedd3721", - "total": "46.62", + "id": "00498ac8-6ca2-45c6-91f9-fb38a1cf3936", + "total": "325.00", "products": [ { - "name": "Lexicographer", - "code": "UQNVENCGHDI", - "price": "2184.0", - "discount": "0" + "name": "Domain (fi)", + "code": "WP_DOMAIN_FI_13012026", + "price": "25.00", + "discount": "0.00000", + "id": "8c0c7793-70df-4cd4-8c57-1966e209ddbc" }, { - "name": "Engineer, water", - "code": "PSYDDQXQWGV", - "price": "2328.0", - "discount": "0" - }, + "name": "Domain (fr)", + "code": "WP_DOMAIN_FR_13012026", + "price": "25.00", + "discount": "0.00000", + "id": "169fc3cc-4ece-453d-9882-adb37cbb3f64" + } + ], + "domains": [ { - "name": "Pro", - "code": "WPPRO12", - "price": "150", - "discount": "0" + "name": "a.guru", + "primary": true, + "type": "registration", + "id": "d7e8f9a1-3b4c-4d1e-6f2a-7c8b5d9e2f3a", + "price": "150.00", + "code": "WP_DOMAIN_GURU_13012026", + "discount": "0.00000" } - ] + ], + "plan": { + "id": "fda78ded-9ea7-4920-ba88-1a97b306ab0b", + "name": "Staff", + "code": "WPSTAFF1", + "price": "125.00", + "discount": "0.00000" + } } 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": [] } ] }