Переглянути джерело

Maj V3 Sumup

feature/rotating_product
Guillaume Bourgeois 8 місяці тому
джерело
коміт
ebd941611c
2 змінених файлів з 25 додано та 10 видалено
  1. +10
    -7
      common/components/Tiller/TillerClientV3.php
  2. +15
    -3
      domain/Order/Order/TillerManager.php

+ 10
- 7
common/components/Tiller/TillerClientV3.php Переглянути файл

@@ -97,13 +97,16 @@ class TillerClientV3 implements TillerClientInterface

public function postOrder($params)
{
$response = $this->client->request('POST', $this->urlApi.'purchase-requests/v1/requests', [
'query' => [
'storeId' => $this->storeId
],
'body' => json_encode($params),
'headers' => $this->headers
]);
try {
$response = $this->client->request('POST', $this->urlApi.'purchase-requests/v1/requests?storeId='.$this->storeId, [
'body' => json_encode($params),
'headers' => $this->headers
]);
}
catch (RequestException $exception) {
print_r($exception);
die();
}

return $response->getBody()->getContents();
}

+ 15
- 3
domain/Order/Order/TillerManager.php Переглянути файл

@@ -89,13 +89,25 @@ class TillerManager extends AbstractManager
foreach ($order->productOrder as $productOrder) {
// v3
if($apiVersion == 'v3') {
$amount = round($this->productOrderSolver->getPriceWithTax($productOrder) * 100);

// classique
if(is_int($productOrder->quantity)) {
$quantity = $productOrder->quantity;
}
// vrac
else {
$amount = $amount * $productOrder->quantity;
$quantity = 1;
}

$lines[] = [
'name' => $productOrder->product->name,
'unitPrice' => [
'amount' => $this->productOrderSolver->getPriceWithTax($productOrder) * 100,
'amount' => $amount,
],
'taxRate' => $productOrder->taxRate->value * 100,
'quantity' => $productOrder->quantity
'quantity' => $quantity
];
}
// v2
@@ -140,7 +152,7 @@ class TillerManager extends AbstractManager
'payments' => [
[
'externalId' => ''.$order->id,
'amount' => $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_PAID) * 100,
'amount' => round($this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_PAID) * 100),
]
]
]

Завантаження…
Відмінити
Зберегти