From ba79211d7141a2935c5b223efce40e5538b38fec Mon Sep 17 00:00:00 2001 From: TakeshiDaveau Date: Thu, 25 Jul 2024 16:41:24 +0200 Subject: [PATCH] fix: use proper API gateway domain --- src/Builder/UrlBuilder.php | 4 +++- tests/Unit/Builder/UrlBuilderTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Builder/UrlBuilder.php b/src/Builder/UrlBuilder.php index bf01d35..4b7e566 100644 --- a/src/Builder/UrlBuilder.php +++ b/src/Builder/UrlBuilder.php @@ -107,8 +107,10 @@ public function buildAPIGatewayUrl() case 'prestabulle4': case 'prestabulle5': case 'prestabulle6': + return 'https://api-' . $this->getEnvName() . '.billing.integration.prestashop.com'; + break; case 'preprod': - return 'https://billing-api-gateway-' . $this->getEnvName() . '.prestashop.com'; + return 'https://api.billing-preproduction.prestashop.com'; break; default: return 'https://api.billing.prestashop.com'; diff --git a/tests/Unit/Builder/UrlBuilderTest.php b/tests/Unit/Builder/UrlBuilderTest.php index 64bf1ad..d4e5e24 100644 --- a/tests/Unit/Builder/UrlBuilderTest.php +++ b/tests/Unit/Builder/UrlBuilderTest.php @@ -92,20 +92,20 @@ public function testBuildAPIGatewayUrl() $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://www.w3schools.com'); $builder = new UrlBuilder('prestabulle1'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-prestabulle1.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api-prestabulle1.billing.integration.prestashop.com'); $builder = new UrlBuilder('prestabulle2'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-prestabulle2.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api-prestabulle2.billing.integration.prestashop.com'); $builder = new UrlBuilder('prestabulle3'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-prestabulle3.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api-prestabulle3.billing.integration.prestashop.com'); $builder = new UrlBuilder('prestabulle4'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-prestabulle4.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api-prestabulle4.billing.integration.prestashop.com'); $builder = new UrlBuilder('prestabulle5'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-prestabulle5.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api-prestabulle5.billing.integration.prestashop.com'); $builder = new UrlBuilder('prestabulle6'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-prestabulle6.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api-prestabulle6.billing.integration.prestashop.com'); $builder = new UrlBuilder('preprod'); - $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://billing-api-gateway-preprod.prestashop.com'); + $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api.billing-preproduction.prestashop.com'); $builder = new UrlBuilder(); $this->assertEquals($builder->buildAPIGatewayUrl(), 'https://api.billing.prestashop.com'); }