|
...
|
...
|
@@ -2,10 +2,12 @@ |
|
|
|
|
|
|
|
namespace Lackoxygen\TopWarehouse;
|
|
|
|
|
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
use Lackoxygen\TopWarehouse\Contracts\ResponseInterface;
|
|
|
|
use Lackoxygen\TopWarehouse\Contracts\TopWarehouseInterface;
|
|
|
|
use Lackoxygen\TopWarehouse\Request\GetStockInventoryRequest;
|
|
|
|
use Lackoxygen\TopWarehouse\Request\OrdersB2cAddRequest;
|
|
|
|
use Lackoxygen\TopWarehouse\Utils\SignatureUtil;
|
|
|
|
|
|
|
|
class TopWarehouse implements TopWarehouseInterface
|
|
|
|
{
|
|
...
|
...
|
@@ -24,4 +26,19 @@ class TopWarehouse implements TopWarehouseInterface |
|
|
|
{
|
|
|
|
return Client::make($getStockInventoryRequest)->send();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
|
|
|
public function verify(array $data): bool
|
|
|
|
{
|
|
|
|
$sign = Arr::get($data, 'sign');
|
|
|
|
if (empty($sign) || !is_string($sign)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
unset($data['sign']);
|
|
|
|
$generateSign = SignatureUtil::generate($data, config('top-warehouse.app_secret'));
|
|
|
|
|
|
|
|
return $generateSign === $sign;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|