瀏覽代碼

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),
]
]
]

Loading…
取消
儲存