From 3e87c047b82826811c0bfaa99f0c2ffa8773775a Mon Sep 17 00:00:00 2001 From: Stanislav Ilnytskyi Date: Sat, 18 Sep 2021 10:32:58 +0200 Subject: [PATCH] Add line level addresses support in request --- Framework/Interaction/Rest/Tax.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Framework/Interaction/Rest/Tax.php b/Framework/Interaction/Rest/Tax.php index 824ffae2..ad8284f4 100644 --- a/Framework/Interaction/Rest/Tax.php +++ b/Framework/Interaction/Rest/Tax.php @@ -229,7 +229,22 @@ protected function setLineDetails($transactionBuilder, $request) foreach ($request->getLines() as $line) { $amount = ($line->hasAmount()) ? $line->getAmount() : 0; $transactionBuilder->withLine($amount, $line->getQuantity(), $line->getItemCode(), $line->getTaxCode()); - + + if ($line->hasAddresses()) { + foreach($line->getAddresses() as $addressType => $lineAddress) { + $transactionBuilder->withLineAddress( + $addressType, + $lineAddress->getLine1(), + $lineAddress->getLine2(), + $lineAddress->getLine3(), + $lineAddress->getCity(), + $lineAddress->getRegion(), + $lineAddress->getPostalCode(), + $lineAddress->getCountry() + ); + } + } + if ($line->getTaxIncluded()) { $transactionBuilder->withLineTaxIncluded(); }