Skip to content

Commit b604552

Browse files
authored
remove child items from Xendit invoice (#172)
* remove child items from Xendit invoice * add version * update
1 parent f058020 commit b604552

File tree

8 files changed

+22
-5
lines changed

8 files changed

+22
-5
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
## 11.0.1 (2023-10-26)
4+
- Fix wrong subtotal in Xendit invoice (Remove Order child items)
5+
36
## 11.0.0 (2023-10-17)
47
Improvements:
58
- Raise AstraPay limit to 20M IDR

Controller/Checkout/Invoice.php

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ private function getApiRequestData(Order $order)
8585
$items = [];
8686
/** @var OrderItemInterface $orderItem */
8787
foreach ($orderItems as $orderItem) {
88+
if (!empty($orderItem->getParentItem())) {
89+
continue;
90+
}
91+
8892
$product = $orderItem->getProduct();
8993
$item = [
9094
'reference_id' => $product->getId(),

Controller/Checkout/InvoiceMultishipping.php

+4
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public function execute()
7676
/** @var OrderItemInterface $orderItem */
7777
foreach ($orderItems as $orderItem) {
7878
$product = $orderItem->getProduct();
79+
if (!empty($orderItem->getParentItem())) {
80+
continue;
81+
}
82+
7983
$item = [
8084
'reference_id' => $product->getId(),
8185
'name' => $orderItem->getName(),

Helper/Data.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
class Data extends AbstractHelper
3232
{
33-
const XENDIT_M2INVOICE_VERSION = '11.0.0';
33+
const XENDIT_M2INVOICE_VERSION = '11.0.1';
3434

3535
/**
3636
* @var StoreManagerInterface

Helper/PhoneNumberFormat.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ protected function cleanUp(string $phoneNumber)
267267
public function formatNumber(string $phoneNumber, string $countryCode)
268268
{
269269
if (empty($phoneNumber)) {
270-
return '';
270+
return $phoneNumber;
271271
}
272272

273273
$countryPhoneCode = $this->getCountryPhoneCode($countryCode);
274+
if (empty($countryPhoneCode)) {
275+
return $phoneNumber;
276+
}
277+
274278
return preg_replace('/^(?:\+?' . $countryPhoneCode . '|0)?/', '+' . $countryPhoneCode, $this->cleanUp($phoneNumber));
275279
}
276280
}

Test/Unit/Helper/PhoneNumberFormatTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public function testFormatPhoneNumber()
3535
$this->assertEquals('+6319876543219', $this->helper->formatNumber('198.765.432-19', 'PH'));
3636
$this->assertEquals('+6319876543219', $this->helper->formatNumber('+63198.765.432-19', 'PH'));
3737
$this->assertEquals('+6319876543219', $this->helper->formatNumber('63198.765.432-19 ', 'PH'));
38-
$this->assertEquals('+6319876543219', $this->helper->formatNumber('63198.765.432-19 ', ''));
38+
39+
// in case country code is empty, we should respond the same phone number
40+
$this->assertEquals('019876543219', $this->helper->formatNumber('019876543219', ''));
3941
$this->assertEquals('', $this->helper->formatNumber('', ''));
4042
}
4143
}

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "xendit/m2invoice",
33
"description": "Xendit Payment Gateway Module",
44
"type": "magento2-module",
5-
"version": "11.0.0",
5+
"version": "11.0.1",
66
"license": [
77
"GPL-3.0"
88
],

etc/module.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0"?>
22
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
3-
<module name="Xendit_M2Invoice" setup_version="11.0.0" active="true"></module>
3+
<module name="Xendit_M2Invoice" setup_version="11.0.1" active="true"></module>
44
</config>

0 commit comments

Comments
 (0)