Skip to content
Snippets Groups Projects
Commit 0930ee8d authored by Aleksey Zubenko's avatar Aleksey Zubenko Committed by Oleg Krasnobaev
Browse files

Issue #3283611 by Alezu: Respect price adjustments

parent 8f5dc830
No related branches found
No related tags found
No related merge requests found
......@@ -53,14 +53,13 @@ class OffsitePaymentForm extends PaymentOffsiteForm {
$items = [];
$c = 0;
foreach ($payment->getOrder()->order_items as $item) {
$order_item = $item->entity;
$quantity = $order_item->quantity->value;
$price = $order_item->unit_price->number;
$quantity = $item->getQuantity();
$price = $item->getAdjustedUnitPrice()->getNumber();
$price = $precision ? $price : bcmul($price, 100, 0);
$total = $order_item->total_price->number;
$total = $item->getAdjustedTotalPrice()->getNumber();
$total = $precision ? $total : bcmul($total, 100, 0);
$variation = $order_item->purchased_entity->entity;
$product = $variation->product_id->entity;
$variation = $item->getPurchasedEntity();
$product = $variation->getProduct();
$unit = 'шт';
if ($product->hasField('field_unit')) {
$unit = $product->field_unit->entity->getName();
......@@ -69,7 +68,7 @@ class OffsitePaymentForm extends PaymentOffsiteForm {
switch ($synpay->gateway->getPluginId()) {
case 'robokassa':
$items[] = [
'name' => $order_item->title->value,
'name' => $item->getTitle(),
'quantity' => $quantity,
'sum' => $total,
'tax' => 'none',
......@@ -80,10 +79,10 @@ class OffsitePaymentForm extends PaymentOffsiteForm {
default:
$items[] = [
'positionId' => $c++,
'name' => $order_item->title->value,
'itemCode' => $variation->id(),
'name' => $item->getTitle(),
'itemCode' => $item->id(),
'quantity' => [
'value' => $quantity,
'value' => str_replace(',', '.', $quantity),
'measure' => $unit,
],
'itemPrice' => $price,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment