* change general omnipay-sberbank package source - fork from CvekCoding with revert pass default endpoint url and fix json_encode orderBundle array
* correctly generate orderBundle cartItems
This commit is contained in:
@ -87,10 +87,7 @@ class SberCheckout extends PaymentProvider
|
|||||||
|
|
||||||
assert($request instanceof AuthorizeRequest);
|
assert($request instanceof AuthorizeRequest);
|
||||||
|
|
||||||
// hacking private method
|
$request->setOrderBundle($this->getOrderBundle());
|
||||||
$reflectionMethod = new \ReflectionMethod(AbstractRequest::class, 'setParameter');
|
|
||||||
$reflectionMethod->setAccessible(true);
|
|
||||||
$reflectionMethod->invoke($request, 'orderBundle', $this->getOrderBundle());
|
|
||||||
|
|
||||||
$response = $request->send();
|
$response = $request->send();
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
@ -142,21 +139,25 @@ class SberCheckout extends PaymentProvider
|
|||||||
{
|
{
|
||||||
$cartItems = [];
|
$cartItems = [];
|
||||||
|
|
||||||
|
$items = [];
|
||||||
|
|
||||||
foreach ($this->order->products as $positionId => $product) {
|
foreach ($this->order->products as $positionId => $product) {
|
||||||
assert($product instanceof OrderProduct);
|
assert($product instanceof OrderProduct);
|
||||||
|
|
||||||
$cartItems['items'] = [
|
$items[] = [
|
||||||
'positionId' => $positionId,
|
'positionId' => $positionId + 1,
|
||||||
'name' => $product->name,
|
'name' => $product->name,
|
||||||
'quantity' => [
|
'quantity' => [
|
||||||
'value' => $product->quantity,
|
'value' => $product->quantity,
|
||||||
'measure' => ''
|
'measure' => 'шт.'
|
||||||
],
|
],
|
||||||
'itemCode' => $product->variant_id ?? $product->product_id,
|
'itemCode' => $product->variant_id ?? $product->product_id,
|
||||||
'itemPrice' => $product->pricePostTaxes()->float,
|
'itemPrice' => $product->pricePostTaxes()->integer,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cartItems['items'] = $items;
|
||||||
|
|
||||||
return $cartItems;
|
return $cartItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,5 +11,11 @@
|
|||||||
"email": "info@wpstudio.ru"
|
"email": "info@wpstudio.ru"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/dimti/omnipay-sberbank.git"
|
||||||
|
}
|
||||||
|
],
|
||||||
"minimum-stability": "dev"
|
"minimum-stability": "dev"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user