-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inital boilerplate for implementing channel currency assignments #53
- Loading branch information
Showing
6 changed files
with
129 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
### New Features | ||
|
||
- Implement the missing _create_ and _update_ endpoints for Brands. | ||
- Implement [Channels APIs](https://developer.bigcommerce.com/api-reference/store-management/channels): | ||
- [Channels](https://developer.bigcommerce.com/api-reference/store-management/channels/channels/listchannels) | ||
- [Active Theme](https://developer.bigcommerce.com/api-reference/store-management/channels/channel-active-theme/get-channel-active-theme) | ||
- [Listings](https://developer.bigcommerce.com/api-reference/store-management/channels/channel-listings/listchannellistings) | ||
- [Site](https://developer.bigcommerce.com/api-reference/store-management/channels/channel-site/get-channel-site) | ||
- Implement the [Channel Currency Assignments API](https://developer.bigcommerce.com/api-reference/store-management/channels/channel-currency-assignments/post-channels-currency-assignments) | ||
|
||
### Fixed Issues | ||
|
||
- Fixed 404 errors on scripts api (#55), thanks to @kishan93 | ||
- Fixed issue where subscribers API was not accessible | ||
- Fixed issue where Widget Template endpoints were incorrect | ||
|
54 changes: 54 additions & 0 deletions
54
src/BigCommerce/Api/Channels/ChannelCurrencyAssignmentsApi.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace BigCommerce\ApiV3\Api\Channels; | ||
|
||
use BigCommerce\ApiV3\Api\Generic\ResourceWithBatchUpdateApi; | ||
use BigCommerce\ApiV3\ResponseModels\PaginatedResponse; | ||
use BigCommerce\ApiV3\ResponseModels\SingleResourceResponse; | ||
|
||
/** | ||
* Channel Currency Assignments API | ||
* | ||
* | ||
*/ | ||
class ChannelCurrencyAssignmentsApi extends ResourceWithBatchUpdateApi | ||
{ | ||
|
||
public function batchUpdate(array $resources): PaginatedResponse | ||
{ | ||
// TODO: Implement batchUpdate() method. | ||
} | ||
|
||
protected function multipleResourcesEndpoint(): string | ||
{ | ||
// TODO: Implement multipleResourcesEndpoint() method. | ||
} | ||
|
||
protected function singleResourceEndpoint(): string | ||
{ | ||
// TODO: Implement singleResourceEndpoint() method. | ||
} | ||
|
||
protected function resourceName(): string | ||
{ | ||
// TODO: Implement resourceName() method. | ||
} | ||
|
||
public function get(): SingleResourceResponse | ||
{ | ||
// TODO: Implement get() method. | ||
} | ||
|
||
public function getAll(array $filters = [], int $page = 1, int $limit = 250): PaginatedResponse | ||
{ | ||
// TODO: Implement getAll() method. | ||
} | ||
|
||
public function create(): SingleResourceResponse | ||
{ | ||
} | ||
|
||
public function update(): SingleResourceResponse | ||
{ | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/BigCommerce/ResourceModels/Channel/ChannelCurrencyAssignment.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace BigCommerce\ApiV3\ResourceModels\Channel; | ||
|
||
use BigCommerce\ApiV3\ResourceModels\ResourceModel; | ||
|
||
class ChannelCurrencyAssignment extends ResourceModel | ||
{ | ||
public int $channel_id; | ||
public array $enabled_currencies; | ||
public string $default_currency; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/BigCommerce/ResponseModels/Channel/ChannelCurrencyAssignmentResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace BigCommerce\ApiV3\ResponseModels\Channel; | ||
|
||
use BigCommerce\ApiV3\ResourceModels\Channel\ChannelCurrencyAssignment; | ||
use BigCommerce\ApiV3\ResponseModels\SingleResourceResponse; | ||
use stdClass; | ||
|
||
class ChannelCurrencyAssignmentResponse extends SingleResourceResponse | ||
{ | ||
private ChannelCurrencyAssignment $currencyAssignment; | ||
|
||
public function getCurrencyAssignment(): ChannelCurrencyAssignment | ||
{ | ||
return $this->currencyAssignment; | ||
} | ||
|
||
protected function addData(stdClass $rawData): void | ||
{ | ||
$this->currencyAssignment = new ChannelCurrencyAssignment($rawData); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/BigCommerce/ResponseModels/Channel/ChannelCurrencyAssignmentsResponse.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace BigCommerce\ApiV3\ResponseModels\Channel; | ||
|
||
use BigCommerce\ApiV3\ResourceModels\Channel\ChannelCurrencyAssignment; | ||
use BigCommerce\ApiV3\ResponseModels\PaginatedResponse; | ||
|
||
class ChannelCurrencyAssignmentsResponse extends PaginatedResponse | ||
{ | ||
/** | ||
* @return ChannelCurrencyAssignment[] | ||
*/ | ||
public function getCurrencyAssignments(): array | ||
{ | ||
return $this->getData(); | ||
} | ||
|
||
protected function resourceClass(): string | ||
{ | ||
return ChannelCurrencyAssignment::class; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
tests/BigCommerce/Api/Channels/ChannelCurrencyAssignmentsApiTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace BigCommerce\Tests\Api\Channels; | ||
|
||
use BigCommerce\Tests\BigCommerceApiTest; | ||
|
||
class ChannelCurrencyAssignmentsApiTest extends BigCommerceApiTest | ||
{ | ||
public function testCanGetCurrencyAssignment() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testCanGetAllCurrencyAssignments() | ||
{ | ||
$this->markTestIncomplete(); | ||
} | ||
} |