Skip to content

Commit

Permalink
add: new api supplychain (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
nVuln authored Apr 22, 2023
1 parent 0d7edef commit e6374ac
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use NVuln\TiktokShop\Resources\Reverse;
use NVuln\TiktokShop\Resources\Seller;
use NVuln\TiktokShop\Resources\Shop;
use NVuln\TiktokShop\Resources\Supplychain;
use Psr\Http\Message\RequestInterface;

/**
Expand All @@ -38,6 +39,7 @@
* @property-read Finance $Finance
* @property-read GlobalProduct $GlobalProduct
* @property-read Promotion $Promotion
* @property-read Supplychain $Supplychain
*/
class Client
{
Expand Down Expand Up @@ -68,6 +70,7 @@ class Client
Finance::class,
GlobalProduct::class,
Promotion::class,
Supplychain::class,
];

public function __construct($app_key, $app_secret, $shop_id = null, $sandbox = false, $version = self::DEFAULT_VERSION, $options = [])
Expand Down
27 changes: 27 additions & 0 deletions src/Resources/Supplychain.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/*
* This file is part of tiktokshop-client.
*
* (c) Jin <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NVuln\TiktokShop\Resources;

use GuzzleHttp\RequestOptions;
use NVuln\TiktokShop\Resource;

class Supplychain extends Resource
{
public function packageFulfillmentDataSync($warehouse_provider_id, $package)
{
return $this->call('POST', 'supply_chain/package_shipment_confirmation', [
RequestOptions::JSON => [
'warehouse_provider_id' => $warehouse_provider_id,
'package' => $package,
]
]);
}
}
22 changes: 22 additions & 0 deletions tests/Resources/SupplychainTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
* This file is part of tiktokshop-client.
*
* Copyright (c) 2023 Jin <[email protected]> All rights reserved.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace NVuln\TiktokShop\Tests\Resources;

use NVuln\TiktokShop\Tests\TestResource;

class SupplychainTest extends TestResource
{
public function testPackageFulfillmentDataSync()
{
$this->caller->packageFulfillmentDataSync(1, []);
$this->assertPreviousRequest('POST', 'supply_chain/package_shipment_confirmation');
}
}

0 comments on commit e6374ac

Please sign in to comment.