Skip to content

Commit 9291034

Browse files
author
Pavel Agaletskiy
committed
Fixed OMS codes ordering
1 parent ff666ce commit 9291034

File tree

4 files changed

+23
-20
lines changed

4 files changed

+23
-20
lines changed

src/V2/Dto/CreateOrderForEmissionICResponse.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ final class CreateOrderForEmissionICResponse
1717
/**
1818
* @var int
1919
*/
20-
private $expectedCompletionTime;
20+
private $expectedCompleteTimestamp;
2121

22-
public function __construct(string $omsId, string $orderId, int $expectedCompletionTime)
22+
public function __construct(string $omsId, string $orderId, int $expectedCompleteTimestamp)
2323
{
2424
$this->omsId = $omsId;
2525
$this->orderId = $orderId;
26-
$this->expectedCompletionTime = $expectedCompletionTime;
26+
$this->expectedCompleteTimestamp = $expectedCompleteTimestamp;
2727
}
2828

2929
public function getOmsId(): string
@@ -36,8 +36,8 @@ public function getOrderId(): string
3636
return $this->orderId;
3737
}
3838

39-
public function getExpectedCompletionTime(): int
39+
public function getExpectedCompleteTimestamp(): int
4040
{
41-
return $this->expectedCompletionTime;
41+
return $this->expectedCompleteTimestamp;
4242
}
4343
}

src/V2/Dto/GetICBufferStatusResponse.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
final class GetICBufferStatusResponse
88
{
9-
public const BUFFER_STATUS_PENDING = 'pending';
10-
public const BUFFER_STATUS_ACTIVE = 'active';
11-
public const BUFFER_STATUS_EXHAUSTED = 'exhausted';
12-
public const BUFFER_STATUS_REJECTED = 'rejected';
13-
public const BUFFER_STATUS_CLOSED = 'closed';
9+
public const BUFFER_STATUS_PENDING = 'PENDING';
10+
public const BUFFER_STATUS_ACTIVE = 'ACTIVE';
11+
public const BUFFER_STATUS_EXHAUSTED = 'EXHAUSTED';
12+
public const BUFFER_STATUS_REJECTED = 'REJECTED';
13+
public const BUFFER_STATUS_CLOSED = 'CLOSED';
1414

1515
/**
1616
* @var string
@@ -39,7 +39,7 @@ final class GetICBufferStatusResponse
3939
/**
4040
* @var PoolInfo[]
4141
*/
42-
private $poolInfos;
42+
private $poolInfos = [];
4343
/**
4444
* @var string
4545
*/
@@ -58,7 +58,6 @@ final class GetICBufferStatusResponse
5858
* @param int $totalCodes
5959
* @param int $unavailableCodes
6060
* @param int $leftInBuffer
61-
* @param PoolInfo[] $poolInfos
6261
* @param string $bufferStatus
6362
*/
6463
public function __construct(
@@ -68,7 +67,6 @@ public function __construct(
6867
int $totalCodes,
6968
int $unavailableCodes,
7069
int $leftInBuffer,
71-
array $poolInfos,
7270
string $bufferStatus
7371
) {
7472
$this->omsId = $omsId;
@@ -77,7 +75,6 @@ public function __construct(
7775
$this->totalCodes = $totalCodes;
7876
$this->unavailableCodes = $unavailableCodes;
7977
$this->leftInBuffer = $leftInBuffer;
80-
$this->poolInfos = $poolInfos;
8178
$this->bufferStatus = $bufferStatus;
8279
}
8380

@@ -119,6 +116,14 @@ public function getPoolInfos(): array
119116
return $this->poolInfos;
120117
}
121118

119+
/**
120+
* @param PoolInfo[] $poolInfos
121+
*/
122+
public function setPoolInfos(array $poolInfos): void
123+
{
124+
$this->poolInfos = $poolInfos;
125+
}
126+
122127
public function getBufferStatus(): string
123128
{
124129
return $this->bufferStatus;

src/V2/OmsApi.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,8 @@ private function appendSignatureHeader(array $headers, string $data, SignerInter
169169
return $headers;
170170
}
171171

172-
$base64encoded = base64_encode($data);
173-
174172
try {
175-
$headers['X-Signature'] = $signer->sign($base64encoded);
173+
$headers['X-Signature'] = $signer->sign($data);
176174
} catch (\Throwable $exception) {
177175
throw OmsSignerErrorException::becauseOfError($exception);
178176
}

tests/V2/OmsApiTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function testCorrectUsageOfExtensions(Extension $extension, string $exten
102102
->withBody(stream_for(self::API_RESPONSE))
103103
);
104104

105-
$expectedResult = new GetICBufferStatusResponse('', '', '', 0, 0, 0, [], '');
105+
$expectedResult = new GetICBufferStatusResponse('', '', '', 0, 0, 0, '');
106106
$this->serializer->expects($this->once())
107107
->method('deserialize')
108108
->willReturn($expectedResult);
@@ -240,7 +240,7 @@ public function testCreateOrderForEmissionICWithSignature(): void
240240

241241
$signer = $this->createMock(SignerInterface::class);
242242
$signer->method('sign')
243-
->with(base64_encode($serializedRequest))
243+
->with($serializedRequest)
244244
->willReturn($signature);
245245

246246
$result = $this->api->createOrderForEmissionIC(
@@ -319,7 +319,7 @@ public function testGetICBufferStatus(): void
319319
->withBody(stream_for(self::API_RESPONSE))
320320
);
321321

322-
$expectedResult = new GetICBufferStatusResponse('', '', '', 0, 0, 0, [], '');
322+
$expectedResult = new GetICBufferStatusResponse('', '', '', 0, 0, 0, '');
323323
$this->serializer->expects($this->once())
324324
->method('deserialize')
325325
->with(

0 commit comments

Comments
 (0)