Skip to content

Commit ef68cde

Browse files
author
Alexey Babak
committed
product strict types fix
1 parent f02584c commit ef68cde

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

example.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
$orderAsProduct = new Product([
4343
'name' => 'Заказ №' . $merchantPaymentReference,
4444
'sku' => $merchantPaymentReference,
45-
'unitPrice' => '1.42',
46-
'quantity' => '2',
45+
'unitPrice' => 1.42,
46+
'quantity' => 2,
4747
]);
4848

4949
// Опишем Биллинговую (платёжную) информацию
@@ -134,8 +134,8 @@
134134
$product2 = new Product([
135135
'name' => 'Оранжевый Круг',
136136
'sku' => 'toy-15',
137-
'unitPrice' => '1600',
138-
'quantity' => '3',
137+
'unitPrice' => 160000,
138+
'quantity' => 3,
139139
'vat' => 0,
140140
]);
141141

src/Product.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types = 1);
4+
35
namespace payuru\phpPayu4;
46

57
/**
@@ -164,10 +166,10 @@ public function arraySerialize(): array
164166
return [
165167
'name' => $this->getName(),
166168
'sku' => $this->getSku(),
167-
'unitPrice' => (null !== $this->getUnitPrice() ? number_format($this->getUnitPrice(), 2) : null),
169+
'unitPrice' => (null !== $this->getUnitPrice() ? number_format($this->getUnitPrice(), 2,'.','') : null),
168170
'quantity' => $this->getQuantity(),
169171
'additionalDetails' => $this->getAdditionalDetails(),
170-
'amount' => (null !== $this->getAmount() ? number_format($this->getAmount(), 2) : null),
172+
'amount' => (null !== $this->getAmount() ? number_format($this->getAmount(), 2,'.','') : null),
171173
'vat' => $this->getVat(),
172174
];
173175
}

0 commit comments

Comments
 (0)