Skip to content

Commit

Permalink
fbs labels
Browse files Browse the repository at this point in the history
  • Loading branch information
0x543 committed Nov 16, 2024
1 parent bf23f55 commit 3d84a58
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/is_realized.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
use Gam6itko\OzonSeller\Service\V2\ProductService as V2ProductService;
use Gam6itko\OzonSeller\Service\V2\ReturnsService as V2ReturnsService;
use Gam6itko\OzonSeller\Service\V4\ProductService as V4ProductService;
use Gam6itko\OzonSeller\Service\V1\Posting\FbsService as V1FbsService;
use Gam6itko\OzonSeller\Service\V5\Posting\FbsService as V5FbsService;
use GuzzleHttp\Client;

Expand All @@ -39,6 +40,7 @@
'/v1/products/prices' => null,
'/v1/products/stocks' => null,
'/v1/products/update' => null,
'/v1/posting/fbs/package-label/get' => [V1FbsService::class, 'packageLabelGet'],

// V2
'/v2/fbs/posting/delivered' => [FbsService::class.'delivered'],
Expand All @@ -51,6 +53,7 @@
'/v2/products/info/attributes' => [V2ProductService::class, 'infoAttributes'],
'/v2/returns/company/fbo' => [V2ReturnsService::class, 'company'],
'/v2/returns/company/fbs' => [V2ReturnsService::class, 'company'],
'/v2/posting/fbs/package-label/create' => [FbsService::class, 'packageLabelCreate'],

// V3 - TODO

Expand Down
24 changes: 24 additions & 0 deletions src/Service/V1/Posting/FbsService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Gam6itko\OzonSeller\Service\V1\Posting;

use Gam6itko\OzonSeller\Service\AbstractService;


class FbsService extends AbstractService
{
private $path = '/v1/posting/fbs';

/**
* @see https://docs.ozon.ru/api/seller/#operation/PostingAPI_GetLabelBatch
*/
public function packageLabelGet(int $taskId): array
{
$body = [
'task_id' => $taskId,
];
return $this->request('POST', "{$this->path}/package-label/get", $body);
}
}
14 changes: 14 additions & 0 deletions src/Service/V2/Posting/FbsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ public function packageLabel($postingNumber): string
return $this->request('POST', "{$this->path}/package-label", ['posting_number' => $postingNumber], false);
}

/**
* @see https://docs.ozon.ru/api/seller/#operation/PostingAPI_CreateLabelBatchV2
*
* @param array|string $postingNumber
*/
public function packageLabelCreate($postingNumber): array
{
if (is_string($postingNumber)) {
$postingNumber = [$postingNumber];
}

return $this->request('POST', "{$this->path}/package-label/create", ['posting_number' => $postingNumber]);
}

/**
* @see https://cb-api.ozonru.me/apiref/en/#t-fbs_arbitration_title
*
Expand Down

0 comments on commit 3d84a58

Please sign in to comment.