-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9eddb2
commit 252bacf
Showing
3 changed files
with
123 additions
and
0 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
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,75 @@ | ||
<?php | ||
/* | ||
* This file is part of tiktok-shop. | ||
* | ||
* (c) Jin <j@sax.vn> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace EcomPHP\TiktokShop\Resources; | ||
|
||
use EcomPHP\TiktokShop\Resource; | ||
use GuzzleHttp\RequestOptions; | ||
|
||
class FulfilledByTiktok extends Resource | ||
{ | ||
protected $category = 'fbt'; | ||
protected $minimum_version = 202408; | ||
|
||
public function getFbtMerchantOnboardedRegions() | ||
{ | ||
return $this->call('GET', 'merchants/onboarded_regions', [], 202409); | ||
} | ||
|
||
public function getFbtWarehouseList() | ||
{ | ||
return $this->call('GET', 'warehouses'); | ||
} | ||
|
||
public function getInboundOrder($ids) | ||
{ | ||
return $this->call('GET', 'inbound_orders', [ | ||
RequestOptions::QUERY => [ | ||
'ids' => static::dataTypeCast('array', $ids) | ||
] | ||
], 202409); | ||
} | ||
|
||
public function searchFbtInventory($query = [], $body = []) | ||
{ | ||
$query = array_merge([ | ||
'page_size' => 10, | ||
], $query); | ||
|
||
return $this->call('POST', 'inventory/search', [ | ||
RequestOptions::QUERY => $query, | ||
RequestOptions::JSON => $body, | ||
]); | ||
} | ||
|
||
public function searchFbtInventoryRecord($query = [], $body = []) | ||
{ | ||
$query = array_merge([ | ||
'page_size' => 10, | ||
], $query); | ||
|
||
return $this->call('POST', 'inventory_records/search', [ | ||
RequestOptions::QUERY => $query, | ||
RequestOptions::JSON => $body, | ||
], 202410); | ||
} | ||
|
||
public function searchGoodsInfo($query = [], $body = []) | ||
{ | ||
$query = array_merge([ | ||
'page_size' => 10, | ||
], $query); | ||
|
||
return $this->call('POST', 'goods/search', [ | ||
RequestOptions::QUERY => $query, | ||
RequestOptions::JSON => $body, | ||
], 202409); | ||
} | ||
} |
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,46 @@ | ||
<?php | ||
|
||
namespace EcomPHP\TiktokShop\Tests\Resources; | ||
|
||
use EcomPHP\TiktokShop\Tests\TestResource; | ||
|
||
class FulfilledByTiktokTest extends TestResource | ||
{ | ||
public const TEST_API_VERSION = 202408; | ||
|
||
public function testGetFbtMerchantOnboardedRegions() | ||
{ | ||
$this->caller->getFbtMerchantOnboardedRegions(); | ||
$this->assertPreviousRequest('GET', 'fbt/202409/merchants/onboarded_regions'); | ||
} | ||
|
||
public function getFbtWarehouseList() | ||
{ | ||
$this->caller->getFbtWarehouseList(); | ||
$this->assertPreviousRequest('GET', 'fbt/' . self::TEST_API_VERSION . '/warehouses'); | ||
} | ||
|
||
public function getInboundOrder() | ||
{ | ||
$this->caller->getInboundOrder([]); | ||
$this->assertPreviousRequest('GET', 'fbt/202409/inbound_orders'); | ||
} | ||
|
||
public function testSearchFbtInventory() | ||
{ | ||
$this->caller->searchFbtInventory(); | ||
$this->assertPreviousRequest('POST', 'fbt/' . self::TEST_API_VERSION . '/inventory/search'); | ||
} | ||
|
||
public function testSearchFbtInventoryRecord() | ||
{ | ||
$this->caller->searchFbtInventoryRecord(); | ||
$this->assertPreviousRequest('POST', 'fbt/202410/inventory_records/search'); | ||
} | ||
|
||
public function testSearchGoodsInfo() | ||
{ | ||
$this->caller->searchGoodsInfo(); | ||
$this->assertPreviousRequest('POST', 'fbt/202409/goods/search'); | ||
} | ||
} |