Skip to content

Commit

Permalink
fix: use proper API gateway domain
Browse files Browse the repository at this point in the history
  • Loading branch information
TakeshiDaveau committed Jul 25, 2024
1 parent 5645899 commit ba79211
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/Builder/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
14 changes: 7 additions & 7 deletions tests/Unit/Builder/UrlBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit ba79211

Please sign in to comment.