|
@@ -2,10 +2,12 @@ |
|
@@ -2,10 +2,12 @@ |
|
2
|
|
2
|
|
|
3
|
namespace Lackoxygen\TopWarehouse;
|
3
|
namespace Lackoxygen\TopWarehouse;
|
|
4
|
|
4
|
|
|
|
|
5
|
+use Illuminate\Support\Arr;
|
|
5
|
use Lackoxygen\TopWarehouse\Contracts\ResponseInterface;
|
6
|
use Lackoxygen\TopWarehouse\Contracts\ResponseInterface;
|
|
6
|
use Lackoxygen\TopWarehouse\Contracts\TopWarehouseInterface;
|
7
|
use Lackoxygen\TopWarehouse\Contracts\TopWarehouseInterface;
|
|
7
|
use Lackoxygen\TopWarehouse\Request\GetStockInventoryRequest;
|
8
|
use Lackoxygen\TopWarehouse\Request\GetStockInventoryRequest;
|
|
8
|
use Lackoxygen\TopWarehouse\Request\OrdersB2cAddRequest;
|
9
|
use Lackoxygen\TopWarehouse\Request\OrdersB2cAddRequest;
|
|
|
|
10
|
+use Lackoxygen\TopWarehouse\Utils\SignatureUtil;
|
|
9
|
|
11
|
|
|
10
|
class TopWarehouse implements TopWarehouseInterface
|
12
|
class TopWarehouse implements TopWarehouseInterface
|
|
11
|
{
|
13
|
{
|
|
@@ -24,4 +26,19 @@ class TopWarehouse implements TopWarehouseInterface |
|
@@ -24,4 +26,19 @@ class TopWarehouse implements TopWarehouseInterface |
|
24
|
{
|
26
|
{
|
|
25
|
return Client::make($getStockInventoryRequest)->send();
|
27
|
return Client::make($getStockInventoryRequest)->send();
|
|
26
|
}
|
28
|
}
|
|
|
|
29
|
+
|
|
|
|
30
|
+ /**
|
|
|
|
31
|
+ * @inheritDoc
|
|
|
|
32
|
+ */
|
|
|
|
33
|
+ public function verify(array $data): bool
|
|
|
|
34
|
+ {
|
|
|
|
35
|
+ $sign = Arr::get($data, 'sign');
|
|
|
|
36
|
+ if (empty($sign) || !is_string($sign)) {
|
|
|
|
37
|
+ return false;
|
|
|
|
38
|
+ }
|
|
|
|
39
|
+ unset($data['sign']);
|
|
|
|
40
|
+ $generateSign = SignatureUtil::generate($data, config('top-warehouse.app_secret'));
|
|
|
|
41
|
+
|
|
|
|
42
|
+ return $generateSign === $sign;
|
|
|
|
43
|
+ }
|
|
27
|
} |
44
|
} |