Skip to content

Commit

Permalink
Fix subdomain
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaconnier committed May 21, 2024
1 parent 3e145ad commit c4f6130
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/Clients/ZohoUrlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ protected function baseApiUrl(ZohoModules $module): string

return [
ZohoModules::BOOKS->value => [
'EU' => 'https://zohoapis.eu/books/v3',
'US' => 'https://zohoapis.com/books/v3',
'IN' => 'https://zohoapis.in/books/v3',
'AU' => 'https://zohoapis.com.au/books/v3',
'CN' => 'https://zohoapis.com.cn/books/v3',
'EU' => 'https://www.zohoapis.eu/books/v3',
'US' => 'https://www.zohoapis.com/books/v3',
'IN' => 'https://www.zohoapis.in/books/v3',
'AU' => 'https://www.zohoapis.com.au/books/v3',
'CN' => 'https://www.zohoapis.com.cn/books/v3',
],
ZohoModules::CRM->value => [
'EU' => 'https://www.zohoapis.eu/crm/v3',
Expand Down
14 changes: 7 additions & 7 deletions tests/Clients/ZohoUrlFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function it_build_url_for_a_module(): void
);

$this->assertEquals(
'https://zohoapis.eu/books/v3/invoices?organization_id=1234',
'https://www.zohoapis.eu/books/v3/invoices?organization_id=1234',
$urlFactory->api(ZohoModules::BOOKS, '/invoices')
);

Expand All @@ -52,7 +52,7 @@ public function it_returns_the_base_urls_for_the_api(): void
);

$this->assertEquals(
'https://zohoapis.eu/books/v3',
'https://www.zohoapis.eu/books/v3',
invade($urlFactory)->baseApiUrl(ZohoModules::BOOKS)
);

Expand Down Expand Up @@ -89,12 +89,12 @@ public function it_add_the_current_organization_id_to_url_when_using_books(): vo
$urlFactory = app(ZohoUrlFactory::class);

$this->assertEquals(
'https://zohoapis.eu/books/v3/invoices?organization_id=1234',
'https://www.zohoapis.eu/books/v3/invoices?organization_id=1234',
$urlFactory->api(ZohoModules::BOOKS, '/invoices')
);

$this->assertEquals(
'https://zohoapis.eu/books/v3/invoices?param_1=param&organization_id=1234',
'https://www.zohoapis.eu/books/v3/invoices?param_1=param&organization_id=1234',
$urlFactory->api(ZohoModules::BOOKS, '/invoices?param_1=param')
);

Expand All @@ -107,15 +107,15 @@ public function it_uses_the_region(): void
$repository->shouldReceive('region')->andReturn('EU');
});
$this->assertEquals(
'https://zohoapis.eu/books/v3',
'https://www.zohoapis.eu/books/v3',
invade(app(ZohoUrlFactory::class))->baseApiUrl(ZohoModules::BOOKS)
);

$this->mock(StorageConfigRepository::class, static function (MockInterface $repository) {
$repository->shouldReceive('region')->andReturn('US');
});
$this->assertEquals(
'https://zohoapis.com/books/v3',
'https://www.zohoapis.com/books/v3',
invade(app(ZohoUrlFactory::class))->baseApiUrl(ZohoModules::BOOKS)
);
}
Expand All @@ -131,7 +131,7 @@ public function it_build_using_api_method(): void
);

$this->assertEquals(
'https://zohoapis.eu/books/v3/invoices?organization_id=1234',
'https://www.zohoapis.eu/books/v3/invoices?organization_id=1234',
$urlFactory->api(ZohoModules::BOOKS, '/invoices')
);

Expand Down

0 comments on commit c4f6130

Please sign in to comment.