Skip to content

Commit

Permalink
V5 FbsService (#90)
Browse files Browse the repository at this point in the history
* V5 FbsService

* cs
  • Loading branch information
0x543 authored Nov 12, 2024
1 parent e78bafb commit bf23f55
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
5 changes: 5 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\V5\Posting\FbsService as V5FbsService;
use GuzzleHttp\Client;

const MAPPING = [
Expand Down Expand Up @@ -55,6 +56,10 @@

// V4
'/v4/product/info/prices' => [V4ProductService::class, 'infoPrices'],

//V5
'/v5/fbs/posting/product/exemplar/create-or-get' => [V5FbsService::class, 'productExemplarCreateOrGet'],
'/v5/fbs/posting/product/exemplar/set' => [V5FbsService::class, 'productExemplarSet'],
];

$client = new Client();
Expand Down
37 changes: 37 additions & 0 deletions src/Service/V5/Posting/FbsService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Gam6itko\OzonSeller\Service\V5\Posting;

use Gam6itko\OzonSeller\Service\AbstractService;


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

/**
* @see https://docs.ozon.ru/api/seller/#operation/PostingAPI_FbsPostingProductExemplarCreateOrGet
*/
public function productExemplarCreateOrGet(string $postingNumber): array
{
$body = [
'posting_number' => $postingNumber,
];
return $this->request('POST', "{$this->path}/product/exemplar/create-or-get", $body);
}

/**
* @see https://docs.ozon.ru/api/seller/#operation/PostingAPI_FbsPostingProductExemplarSet
*/
public function productExemplarSet(int $multiBoxQty, string $postingNumber, array $products): bool
{
$body = [
'multi_box_qty' => $multiBoxQty,
'posting_number' => $postingNumber,
'products' => $products,
];
return $this->request('POST', "{$this->path}/product/exemplar/set", $body);
}
}

0 comments on commit bf23f55

Please sign in to comment.