@@ -32,6 +32,11 @@ class Refund implements RefundInterface, JsonSerializable, TransactionInterface
32
32
/** @var MarketplaceSubmerchant[] */
33
33
private array $ marketplaceSubmerchants = [];
34
34
35
+ /** @var Product[] Массив продуктов */
36
+ private array $ products ;
37
+
38
+ private bool $ skipCheckSkuAmount = false ;
39
+
35
40
/**
36
41
* @inheritDoc
37
42
*/
@@ -129,6 +134,53 @@ public function getCurrency(): string
129
134
return $ this ->currency ;
130
135
}
131
136
137
+ /**
138
+ * @return bool
139
+ */
140
+ public function isSkipCheckSkuAmount (): bool
141
+ {
142
+ return $ this ->skipCheckSkuAmount ;
143
+ }
144
+
145
+ /**
146
+ * @param bool $skipCheckSkuAmount
147
+ */
148
+ public function setSkipCheckSkuAmount (bool $ skipCheckSkuAmount ): self
149
+ {
150
+ $ this ->skipCheckSkuAmount = $ skipCheckSkuAmount ;
151
+
152
+ return $ this ;
153
+ }
154
+
155
+ /** @inheritDoc */
156
+ public function addProduct (ProductInterface $ product ) : self
157
+ {
158
+ $ this ->products [] = $ product ;
159
+
160
+ return $ this ;
161
+ }
162
+
163
+ /** @inheritDoc */
164
+ public function getProducts (): array
165
+ {
166
+ return $ this ->products ;
167
+ }
168
+
169
+ /** @inheritDoc */
170
+ public function getProductsArray (): array
171
+ {
172
+ $ productsArray = [];
173
+ foreach ($ this ->getProducts () as $ product ) {
174
+ $ productsArray [] = [
175
+ 'sku ' => $ product ->getSku (),
176
+ 'quantity ' => $ product ->getQuantity (),
177
+ 'amount ' => $ product ->getAmount (),
178
+ ];
179
+ }
180
+
181
+ return $ productsArray ;
182
+ }
183
+
132
184
/**
133
185
* @inheritDoc
134
186
* @throws PaymentException
@@ -154,6 +206,14 @@ public function jsonSerialize()
154
206
'currency ' => $ this ->getCurrency ()
155
207
];
156
208
209
+ if ($ this ->skipCheckSkuAmount ) {
210
+ $ requestData ['skipCheckSkuAmount ' ] = true ;
211
+ }
212
+
213
+ if (count ($ this ->products ) > 0 ) {
214
+ $ requestData ['products ' ] = $ this ->getProductsArray ();
215
+ }
216
+
157
217
if (count ($ this ->marketplaceSubmerchants ) > 0 ) {
158
218
foreach ($ this ->marketplaceSubmerchants as $ marketplaceSubmerchant ) {
159
219
$ requestData ['marketplaceV1 ' ][] = (object ) [
0 commit comments