|
|
|
|
|
|
|
|
foreach ($order->productOrder as $productOrder) { |
|
|
foreach ($order->productOrder as $productOrder) { |
|
|
// v3 |
|
|
// v3 |
|
|
if($apiVersion == '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[] = [ |
|
|
$lines[] = [ |
|
|
'name' => $productOrder->product->name, |
|
|
'name' => $productOrder->product->name, |
|
|
'unitPrice' => [ |
|
|
'unitPrice' => [ |
|
|
'amount' => $this->productOrderSolver->getPriceWithTax($productOrder) * 100, |
|
|
|
|
|
|
|
|
'amount' => $amount, |
|
|
], |
|
|
], |
|
|
'taxRate' => $productOrder->taxRate->value * 100, |
|
|
'taxRate' => $productOrder->taxRate->value * 100, |
|
|
'quantity' => $productOrder->quantity |
|
|
|
|
|
|
|
|
'quantity' => $quantity |
|
|
]; |
|
|
]; |
|
|
} |
|
|
} |
|
|
// v2 |
|
|
// v2 |
|
|
|
|
|
|
|
|
'payments' => [ |
|
|
'payments' => [ |
|
|
[ |
|
|
[ |
|
|
'externalId' => ''.$order->id, |
|
|
'externalId' => ''.$order->id, |
|
|
'amount' => $this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_PAID) * 100, |
|
|
|
|
|
|
|
|
'amount' => round($this->orderSolver->getOrderAmountWithTax($order, Order::AMOUNT_PAID) * 100), |
|
|
] |
|
|
] |
|
|
] |
|
|
] |
|
|
] |
|
|
] |