diff --git a/CHANGELOG.md b/CHANGELOG.md index 600ff937..46075fe0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # CHANGELOG +## 11.0.0 (2023-10-17) +Improvements: +- Raise AstraPay limit to 20M IDR +- Add BDO Direct Debit +- Add CIMB VA +- Add Direct Debit (ChinaBank) +- Add JeniusPay + ## 10.0.4 (2023-05-23) Improvements: - Update new ShopeePay icon diff --git a/Helper/Data.php b/Helper/Data.php index 7060681a..35da7366 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -30,7 +30,7 @@ */ class Data extends AbstractHelper { - const XENDIT_M2INVOICE_VERSION = '10.0.4'; + const XENDIT_M2INVOICE_VERSION = '11.0.0'; /** * @var StoreManagerInterface @@ -107,6 +107,11 @@ class Data extends AbstractHelper */ protected $categoryRepository; + /** + * @var PhoneNumberFormat $phoneNumberFormatHelper + */ + protected $phoneNumberFormatHelper; + /** * Data constructor. * @@ -126,6 +131,7 @@ class Data extends AbstractHelper * @param OrderNotifier $orderNotifier * @param AssetRepository $assetRepository * @param CategoryRepository $categoryRepository + * @param PhoneNumberFormat $phoneNumberFormatHelper */ public function __construct( Context $context, @@ -143,7 +149,8 @@ public function __construct( DbTransaction $dbTransaction, OrderNotifier $orderNotifier, AssetRepository $assetRepository, - CategoryRepository $categoryRepository + CategoryRepository $categoryRepository, + \Xendit\M2Invoice\Helper\PhoneNumberFormat $phoneNumberFormatHelper ) { $this->storeManager = $storeManager; $this->xendit = $xendit; @@ -160,6 +167,7 @@ public function __construct( $this->orderNotifier = $orderNotifier; $this->assetRepository = $assetRepository; $this->categoryRepository = $categoryRepository; + $this->phoneNumberFormatHelper = $phoneNumberFormatHelper; parent::__construct($context); } @@ -436,7 +444,11 @@ public function getXenditPaymentList(): array "akulaku" => "akulaku", "atome" => "atome", "dd_rcbc" => "dd_rcbc", - "lbc" => "lbc" + "lbc" => "lbc", + "jeniuspay" => "jeniuspay", + "dd_chinabank" => "dd_chinabank", + "cimbva" => "cimb", + "dd_bdo_epay" => "dd_bdo_epay" ]; } @@ -596,10 +608,14 @@ public function extractXenditInvoiceCustomerFromOrder(Order $order): array $customerObject = [ 'given_names' => $order->getCustomerFirstname(), 'surname' => $order->getCustomerLastname(), - 'email' => $order->getCustomerEmail(), - 'mobile_number' => $shippingAddress->getTelephone() + 'email' => $order->getCustomerEmail() ]; + $mobileNumber = $this->phoneNumberFormatHelper->formatNumber($shippingAddress->getTelephone(), $shippingAddress->getCountryId()); + if (!empty($mobileNumber)) { + $customerObject['mobile_number'] = $mobileNumber; + } + $customerObject = array_filter($customerObject); $addressObject = $this->extractXenditInvoiceCustomerAddress($shippingAddress); if (!empty($addressObject)) { diff --git a/Helper/PhoneNumberFormat.php b/Helper/PhoneNumberFormat.php new file mode 100644 index 00000000..7064b8b4 --- /dev/null +++ b/Helper/PhoneNumberFormat.php @@ -0,0 +1,276 @@ +'376', + 'AE'=>'971', + 'AF'=>'93', + 'AG'=>'1268', + 'AI'=>'1264', + 'AL'=>'355', + 'AM'=>'374', + 'AN'=>'599', + 'AO'=>'244', + 'AQ'=>'672', + 'AR'=>'54', + 'AS'=>'1684', + 'AT'=>'43', + 'AU'=>'61', + 'AW'=>'297', + 'AZ'=>'994', + 'BA'=>'387', + 'BB'=>'1246', + 'BD'=>'880', + 'BE'=>'32', + 'BF'=>'226', + 'BG'=>'359', + 'BH'=>'973', + 'BI'=>'257', + 'BJ'=>'229', + 'BL'=>'590', + 'BM'=>'1441', + 'BN'=>'673', + 'BO'=>'591', + 'BR'=>'55', + 'BS'=>'1242', + 'BT'=>'975', + 'BW'=>'267', + 'BY'=>'375', + 'BZ'=>'501', + 'CA'=>'1', + 'CC'=>'61', + 'CD'=>'243', + 'CF'=>'236', + 'CG'=>'242', + 'CH'=>'41', + 'CI'=>'225', + 'CK'=>'682', + 'CL'=>'56', + 'CM'=>'237', + 'CN'=>'86', + 'CO'=>'57', + 'CR'=>'506', + 'CU'=>'53', + 'CV'=>'238', + 'CX'=>'61', + 'CY'=>'357', + 'CZ'=>'420', + 'DE'=>'49', + 'DJ'=>'253', + 'DK'=>'45', + 'DM'=>'1767', + 'DO'=>'1809', + 'DZ'=>'213', + 'EC'=>'593', + 'EE'=>'372', + 'EG'=>'20', + 'ER'=>'291', + 'ES'=>'34', + 'ET'=>'251', + 'FI'=>'358', + 'FJ'=>'679', + 'FK'=>'500', + 'FM'=>'691', + 'FO'=>'298', + 'FR'=>'33', + 'GA'=>'241', + 'GB'=>'44', + 'GD'=>'1473', + 'GE'=>'995', + 'GH'=>'233', + 'GI'=>'350', + 'GL'=>'299', + 'GM'=>'220', + 'GN'=>'224', + 'GQ'=>'240', + 'GR'=>'30', + 'GT'=>'502', + 'GU'=>'1671', + 'GW'=>'245', + 'GY'=>'592', + 'HK'=>'852', + 'HN'=>'504', + 'HR'=>'385', + 'HT'=>'509', + 'HU'=>'36', + 'ID'=>'62', + 'IE'=>'353', + 'IL'=>'972', + 'IM'=>'44', + 'IN'=>'91', + 'IQ'=>'964', + 'IR'=>'98', + 'IS'=>'354', + 'IT'=>'39', + 'JM'=>'1876', + 'JO'=>'962', + 'JP'=>'81', + 'KE'=>'254', + 'KG'=>'996', + 'KH'=>'855', + 'KI'=>'686', + 'KM'=>'269', + 'KN'=>'1869', + 'KP'=>'850', + 'KR'=>'82', + 'KW'=>'965', + 'KY'=>'1345', + 'KZ'=>'7', + 'LA'=>'856', + 'LB'=>'961', + 'LC'=>'1758', + 'LI'=>'423', + 'LK'=>'94', + 'LR'=>'231', + 'LS'=>'266', + 'LT'=>'370', + 'LU'=>'352', + 'LV'=>'371', + 'LY'=>'218', + 'MA'=>'212', + 'MC'=>'377', + 'MD'=>'373', + 'ME'=>'382', + 'MF'=>'1599', + 'MG'=>'261', + 'MH'=>'692', + 'MK'=>'389', + 'ML'=>'223', + 'MM'=>'95', + 'MN'=>'976', + 'MO'=>'853', + 'MP'=>'1670', + 'MR'=>'222', + 'MS'=>'1664', + 'MT'=>'356', + 'MU'=>'230', + 'MV'=>'960', + 'MW'=>'265', + 'MX'=>'52', + 'MY'=>'60', + 'MZ'=>'258', + 'NA'=>'264', + 'NC'=>'687', + 'NE'=>'227', + 'NG'=>'234', + 'NI'=>'505', + 'NL'=>'31', + 'NO'=>'47', + 'NP'=>'977', + 'NR'=>'674', + 'NU'=>'683', + 'NZ'=>'64', + 'OM'=>'968', + 'PA'=>'507', + 'PE'=>'51', + 'PF'=>'689', + 'PG'=>'675', + 'PH'=>'63', + 'PK'=>'92', + 'PL'=>'48', + 'PM'=>'508', + 'PN'=>'870', + 'PR'=>'1', + 'PT'=>'351', + 'PW'=>'680', + 'PY'=>'595', + 'QA'=>'974', + 'RO'=>'40', + 'RS'=>'381', + 'RU'=>'7', + 'RW'=>'250', + 'SA'=>'966', + 'SB'=>'677', + 'SC'=>'248', + 'SD'=>'249', + 'SE'=>'46', + 'SG'=>'65', + 'SH'=>'290', + 'SI'=>'386', + 'SK'=>'421', + 'SL'=>'232', + 'SM'=>'378', + 'SN'=>'221', + 'SO'=>'252', + 'SR'=>'597', + 'ST'=>'239', + 'SV'=>'503', + 'SY'=>'963', + 'SZ'=>'268', + 'TC'=>'1649', + 'TD'=>'235', + 'TG'=>'228', + 'TH'=>'66', + 'TJ'=>'992', + 'TK'=>'690', + 'TL'=>'670', + 'TM'=>'993', + 'TN'=>'216', + 'TO'=>'676', + 'TR'=>'90', + 'TT'=>'1868', + 'TV'=>'688', + 'TW'=>'886', + 'TZ'=>'255', + 'UA'=>'380', + 'UG'=>'256', + 'US'=>'1', + 'UY'=>'598', + 'UZ'=>'998', + 'VA'=>'39', + 'VC'=>'1784', + 'VE'=>'58', + 'VG'=>'1284', + 'VI'=>'1340', + 'VN'=>'84', + 'VU'=>'678', + 'WF'=>'681', + 'WS'=>'685', + 'XK'=>'381', + 'YE'=>'967', + 'YT'=>'262', + 'ZA'=>'27', + 'ZM'=>'260', + 'ZW'=>'263' + ]; + + /** + * @param string $countryCode + * @return string + */ + protected function getCountryPhoneCode(string $countryCode): string + { + if (empty($countryCode)) { + return ''; + } + return self::COUNTRY_CODE_PHONE_MAPPING[$countryCode] ?: ''; + } + + /** + * @param string $phoneNumber + * @return array|string|string[]|null + */ + protected function cleanUp(string $phoneNumber) + { + return preg_replace("/[^0-9]/", "", trim($phoneNumber)); + } + + /** + * @param string $phoneNumber + * @param string $countryCode + * @return array|string|string[]|null + */ + public function formatNumber(string $phoneNumber, string $countryCode) + { + if (empty($phoneNumber)) { + return ''; + } + + $countryPhoneCode = $this->getCountryPhoneCode($countryCode); + return preg_replace('/^(?:\+?' . $countryPhoneCode . '|0)?/', '+' . $countryPhoneCode, $this->cleanUp($phoneNumber)); + } +} diff --git a/Model/Adminhtml/Source/ChosenMethod.php b/Model/Adminhtml/Source/ChosenMethod.php index 6d334d84..56eef59c 100644 --- a/Model/Adminhtml/Source/ChosenMethod.php +++ b/Model/Adminhtml/Source/ChosenMethod.php @@ -58,6 +58,10 @@ public function toOptionArray($isMultiselect = false) ['value' => 'atome', 'label' => __('Atome')], ['value' => 'dd_rcbc', 'label' => __('Direct Debit (RCBC)')], ['value' => 'lbc', 'label' => __('LBC')], + ['value' => 'jeniuspay', 'label' => __('Jenius Pay')], + ['value' => 'dd_chinabank', 'label' => __('Direct Debit (ChinaBank)')], + ['value' => 'cimbva', 'label' => __('Bank Transfer CIMB')], + ['value' => 'dd_bdo_epay', 'label' => __('Direct Debit (BDO)')], ]; if (!$isMultiselect) { diff --git a/Model/Payment/CIMBVA.php b/Model/Payment/CIMBVA.php new file mode 100644 index 00000000..26e978df --- /dev/null +++ b/Model/Payment/CIMBVA.php @@ -0,0 +1,27 @@ + $this->xenditHelper->getPaymentDescription("bssva"), 'image' => $this->xenditHelper->getPaymentImage('bssva') ], + 'jeniuspay' => [ + 'title' => $this->xenditHelper->getPaymentTitle("jeniuspay"), + 'min_order_amount' => $this->xenditHelper->getPaymentMinOrderAmount("jeniuspay"), + 'max_order_amount' => $this->xenditHelper->getPaymentMaxOrderAmount("jeniuspay"), + 'description' => $this->xenditHelper->getPaymentDescription("jeniuspay"), + 'image' => $this->xenditHelper->getPaymentImage('jeniuspay') + ], + 'dd_chinabank' => [ + 'title' => $this->xenditHelper->getPaymentTitle("dd_chinabank"), + 'min_order_amount' => $this->xenditHelper->getPaymentMinOrderAmount("dd_chinabank"), + 'max_order_amount' => $this->xenditHelper->getPaymentMaxOrderAmount("dd_chinabank"), + 'description' => $this->xenditHelper->getPaymentDescription("dd_chinabank"), + 'image' => $this->xenditHelper->getPaymentImage('dd_chinabank') + ], + 'cimbva' => [ + 'title' => $this->xenditHelper->getPaymentTitle("cimbva"), + 'min_order_amount' => $this->xenditHelper->getPaymentMinOrderAmount("cimbva"), + 'max_order_amount' => $this->xenditHelper->getPaymentMaxOrderAmount("cimbva"), + 'description' => $this->xenditHelper->getPaymentDescription("cimbva"), + 'image' => $this->xenditHelper->getPaymentImage('cimbva') + ], + 'dd_bdo_epay' => [ + 'title' => $this->xenditHelper->getPaymentTitle("dd_bdo_epay"), + 'min_order_amount' => $this->xenditHelper->getPaymentMinOrderAmount("dd_bdo_epay"), + 'max_order_amount' => $this->xenditHelper->getPaymentMaxOrderAmount("dd_bdo_epay"), + 'description' => $this->xenditHelper->getPaymentDescription("dd_bdo_epay"), + 'image' => $this->xenditHelper->getPaymentImage('dd_bdo_epay') + ], ] ]; } diff --git a/README.md b/README.md index ba10571f..fb57cf90 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ If the Xendit payment links expired, it will auto cancel the order via the webho - BSI - Mandiri - Permata + - CIMB - Retail Outlets - Alfamart - Indomaret @@ -121,6 +122,7 @@ If the Xendit payment links expired, it will auto cancel the order via the webho - GrabPay (PH) - GCash (PH) - PayMaya (PH) + - JeniusPay - PayLater - Kredivo - BillEase (PH) @@ -132,6 +134,8 @@ If the Xendit payment links expired, it will auto cancel the order via the webho - BRI - BPI (PH) - UBP (PH) + - ChinaBank (PH) + - BDO (PH) ## Refund Support Since v1.3.0, online refund (full and partial) is supported for payment through credit and debit card channel. diff --git a/Test/Unit/Helper/TruncateDecimalTest.php b/Test/Unit/Helper/DataTest.php similarity index 65% rename from Test/Unit/Helper/TruncateDecimalTest.php rename to Test/Unit/Helper/DataTest.php index 7dd74505..54b0e72c 100644 --- a/Test/Unit/Helper/TruncateDecimalTest.php +++ b/Test/Unit/Helper/DataTest.php @@ -7,7 +7,7 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use PHPUnit\Framework\TestCase; -class TruncateDecimalTest extends TestCase +class DataTest extends TestCase { /** * @var Data @@ -28,8 +28,8 @@ protected function setUp(): void */ public function testTruncateDecimal() { - $this->assertEquals($this->_dataHelper->truncateDecimal(100000.235), 100000); - $this->assertEquals($this->_dataHelper->truncateDecimal(100000.59), 100000); - $this->assertEquals($this->_dataHelper->truncateDecimal(100000.99), 100000); + $this->assertEquals(100000, $this->_dataHelper->truncateDecimal(100000.235)); + $this->assertEquals(100000, $this->_dataHelper->truncateDecimal(100000.59)); + $this->assertEquals(100000, $this->_dataHelper->truncateDecimal(100000.99)); } } diff --git a/Test/Unit/Helper/PhoneNumberFormatTest.php b/Test/Unit/Helper/PhoneNumberFormatTest.php new file mode 100644 index 00000000..ba501135 --- /dev/null +++ b/Test/Unit/Helper/PhoneNumberFormatTest.php @@ -0,0 +1,41 @@ +helper = $objectManager->getObject(PhoneNumberFormat::class); + } + + /** + * @return void + */ + public function testFormatPhoneNumber() + { + $this->assertEquals('+629876543219', $this->helper->formatNumber('9876543219', 'ID')); + $this->assertEquals('+6219876543219', $this->helper->formatNumber('019876543219', 'ID')); + $this->assertEquals('+62123456789', $this->helper->formatNumber('62-123-456-789', 'ID')); + $this->assertEquals('+6319876543219', $this->helper->formatNumber('198 765 432 19', 'PH')); + $this->assertEquals('+6319876543219', $this->helper->formatNumber('198.765.432-19', 'PH')); + $this->assertEquals('+6319876543219', $this->helper->formatNumber('+63198.765.432-19', 'PH')); + $this->assertEquals('+6319876543219', $this->helper->formatNumber('63198.765.432-19 ', 'PH')); + $this->assertEquals('+6319876543219', $this->helper->formatNumber('63198.765.432-19 ', '')); + $this->assertEquals('', $this->helper->formatNumber('', '')); + } +} diff --git a/composer.json b/composer.json index 1804303d..93cc6715 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "xendit/m2invoice", "description": "Xendit Payment Gateway Module", "type": "magento2-module", - "version": "10.0.4", + "version": "11.0.0", "license": [ "GPL-3.0" ], diff --git a/etc/adminhtml/direct_debit/dd_bdo_epay.xml b/etc/adminhtml/direct_debit/dd_bdo_epay.xml new file mode 100644 index 00000000..4cfb8e70 --- /dev/null +++ b/etc/adminhtml/direct_debit/dd_bdo_epay.xml @@ -0,0 +1,29 @@ + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/dd_bdo_epay/active + + + + payment/dd_bdo_epay/title + + + + payment/dd_bdo_epay/description + + + + validate-zero-or-greater + payment/dd_bdo_epay/min_order_total + + + + validate-zero-or-greater + payment/dd_bdo_epay/max_order_total + + + diff --git a/etc/adminhtml/direct_debit/dd_chinabank.xml b/etc/adminhtml/direct_debit/dd_chinabank.xml new file mode 100644 index 00000000..e7aab122 --- /dev/null +++ b/etc/adminhtml/direct_debit/dd_chinabank.xml @@ -0,0 +1,29 @@ + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/dd_chinabank/active + + + + payment/dd_chinabank/title + + + + payment/dd_chinabank/description + + + + validate-zero-or-greater + payment/dd_chinabank/min_order_total + + + + validate-zero-or-greater + payment/dd_chinabank/max_order_total + + + diff --git a/etc/adminhtml/ewallets/jeniuspay.xml b/etc/adminhtml/ewallets/jeniuspay.xml new file mode 100644 index 00000000..5e21a1f6 --- /dev/null +++ b/etc/adminhtml/ewallets/jeniuspay.xml @@ -0,0 +1,29 @@ + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/jeniuspay/active + + + + payment/jeniuspay/title + + + + payment/jeniuspay/description + + + + validate-zero-or-greater + payment/jeniuspay/min_order_total + + + + validate-zero-or-greater + payment/jeniuspay/max_order_total + + + diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index c1f23c2d..3c7f0280 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -177,6 +177,7 @@ + @@ -214,6 +215,7 @@ + @@ -224,6 +226,8 @@ + + diff --git a/etc/adminhtml/virtual_account/cimbva.xml b/etc/adminhtml/virtual_account/cimbva.xml new file mode 100644 index 00000000..7cdb27e3 --- /dev/null +++ b/etc/adminhtml/virtual_account/cimbva.xml @@ -0,0 +1,29 @@ + + + + + + + Magento\Config\Model\Config\Source\Yesno + payment/cimbva/active + + + + payment/cimbva/title + + + + payment/cimbva/description + + + + validate-zero-or-greater + payment/cimbva/min_order_total + + + + validate-zero-or-greater + payment/cimbva/max_order_total + + + diff --git a/etc/config.xml b/etc/config.xml index fc0f82bf..7d32e268 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -57,7 +57,7 @@ AstraPay Bayar pesanan dengan AstraPay melalui Xendit 100 - 10000000 + 20000000 1 1 1 @@ -162,6 +162,20 @@ 7 IDR + + 1 + initialize + Xendit\M2Invoice\Model\Payment\CIMBVA + Bank Transfer - CIMB + Bayar pesanan dengan transfer bank CIMB dengan virtual account melalui Xendit + 10000 + 50000000000 + 1 + 1 + 1 + 8 + IDR + 1 initialize @@ -216,6 +230,20 @@ 11 IDR + + 0 + initialize + Xendit\M2Invoice\Model\Payment\JeniusPay + JeniusPay + Bayar pesanan dengan JeniusPay melalui Xendit + 1000 + 10000000 + 1 + 1 + 1 + 11 + IDR + 1 initialize @@ -230,6 +258,34 @@ 12 IDR + + 0 + initialize + Xendit\M2Invoice\Model\Payment\DDBDOEpay + Direct Debit (BDO) + Pay for orders using Direct Debit (BDO) via Xendit + 1 + 50000 + 1 + 1 + 1 + 12 + PHP + + + 1 + initialize + Xendit\M2Invoice\Model\Payment\DDChinaBank + Direct Debit (ChinaBank) + Pay for orders using Direct Debit (ChinaBank) via Xendit + 1 + 20000 + 1 + 1 + 1 + 12 + PHP + 1 initialize diff --git a/etc/module.xml b/etc/module.xml index bb07c08e..f79b60e3 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,4 +1,4 @@ - + diff --git a/etc/payment.xml b/etc/payment.xml index d838a94e..b39bf137 100644 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -123,5 +123,17 @@ https://github.com/magento/magento2/blob/2.2.0-rc2.1/app/code/Magento/Multishipp 1 + + 1 + + + 1 + + + 1 + + + 1 + diff --git a/view/frontend/layout/multishipping_checkout_billing.xml b/view/frontend/layout/multishipping_checkout_billing.xml index 7d8d278c..6ca79ae7 100644 --- a/view/frontend/layout/multishipping_checkout_billing.xml +++ b/view/frontend/layout/multishipping_checkout_billing.xml @@ -46,6 +46,10 @@ Xendit_M2Invoice::multishipping/dd_rcbc.phtml Xendit_M2Invoice::multishipping/lbc.phtml Xendit_M2Invoice::multishipping/bssva.phtml + Xendit_M2Invoice::multishipping/jeniuspay.phtml + Xendit_M2Invoice::multishipping/dd_chinabank.phtml + Xendit_M2Invoice::multishipping/cimbva.phtml + Xendit_M2Invoice::multishipping/dd_bdo_epay.phtml diff --git a/view/frontend/templates/multishipping/cimbva.phtml b/view/frontend/templates/multishipping/cimbva.phtml new file mode 100644 index 00000000..0a3061b2 --- /dev/null +++ b/view/frontend/templates/multishipping/cimbva.phtml @@ -0,0 +1,34 @@ + + + diff --git a/view/frontend/templates/multishipping/dd_bdo_epay.phtml b/view/frontend/templates/multishipping/dd_bdo_epay.phtml new file mode 100644 index 00000000..26d2cd93 --- /dev/null +++ b/view/frontend/templates/multishipping/dd_bdo_epay.phtml @@ -0,0 +1,34 @@ + + + diff --git a/view/frontend/templates/multishipping/dd_chinabank.phtml b/view/frontend/templates/multishipping/dd_chinabank.phtml new file mode 100644 index 00000000..4c91fa41 --- /dev/null +++ b/view/frontend/templates/multishipping/dd_chinabank.phtml @@ -0,0 +1,34 @@ + + + diff --git a/view/frontend/templates/multishipping/jeniuspay.phtml b/view/frontend/templates/multishipping/jeniuspay.phtml new file mode 100644 index 00000000..2db066b6 --- /dev/null +++ b/view/frontend/templates/multishipping/jeniuspay.phtml @@ -0,0 +1,34 @@ + + + diff --git a/view/frontend/web/images/methods/cimbva.svg b/view/frontend/web/images/methods/cimbva.svg new file mode 100644 index 00000000..04d7091d --- /dev/null +++ b/view/frontend/web/images/methods/cimbva.svg @@ -0,0 +1 @@ + diff --git a/view/frontend/web/images/methods/dd_bdo_epay.svg b/view/frontend/web/images/methods/dd_bdo_epay.svg new file mode 100644 index 00000000..8918da36 --- /dev/null +++ b/view/frontend/web/images/methods/dd_bdo_epay.svg @@ -0,0 +1 @@ + diff --git a/view/frontend/web/images/methods/dd_chinabank.svg b/view/frontend/web/images/methods/dd_chinabank.svg new file mode 100644 index 00000000..10f85251 --- /dev/null +++ b/view/frontend/web/images/methods/dd_chinabank.svg @@ -0,0 +1 @@ + diff --git a/view/frontend/web/images/methods/jeniuspay.svg b/view/frontend/web/images/methods/jeniuspay.svg new file mode 100644 index 00000000..ee5aaf40 --- /dev/null +++ b/view/frontend/web/images/methods/jeniuspay.svg @@ -0,0 +1 @@ + diff --git a/view/frontend/web/js/view/payment/method-renderer.js b/view/frontend/web/js/view/payment/method-renderer.js index 6785d942..c9700377 100644 --- a/view/frontend/web/js/view/payment/method-renderer.js +++ b/view/frontend/web/js/view/payment/method-renderer.js @@ -161,6 +161,22 @@ define( { type: 'bssva', component: 'Xendit_M2Invoice/js/view/payment/method-renderer/bssva' + }, + { + type: 'jeniuspay', + component: 'Xendit_M2Invoice/js/view/payment/method-renderer/jeniuspay' + }, + { + type: 'dd_chinabank', + component: 'Xendit_M2Invoice/js/view/payment/method-renderer/dd_chinabank' + }, + { + type: 'cimbva', + component: 'Xendit_M2Invoice/js/view/payment/method-renderer/cimbva' + }, + { + type: 'dd_bdo_epay', + component: 'Xendit_M2Invoice/js/view/payment/method-renderer/dd_bdo_epay' } ); return Component.extend({}); diff --git a/view/frontend/web/js/view/payment/method-renderer/cimbva.js b/view/frontend/web/js/view/payment/method-renderer/cimbva.js new file mode 100644 index 00000000..9f8bfe46 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/cimbva.js @@ -0,0 +1,78 @@ +define( + [ + 'Magento_Checkout/js/view/payment/default', + 'mage/url', + 'Magento_Checkout/js/model/quote', + ], + function ( + Component, + url, + quote, + ) { + 'use strict'; + + var self; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/invoiceva', + redirectAfterPlaceOrder: false, + }, + + initialize: function() { + this._super(); + self = this; + }, + + getCode: function() { + return 'cimbva'; + }, + + getMethod: function() { + return 'CIMB'; + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + }, + + getTest: function() { + return '1'; + }, + + getDescription: function() { + return window.checkoutConfig.payment.cimbva.description; + }, + + getTestDescription: function () { + var environment = window.checkoutConfig.payment.xendit.xendit_env; + + if (environment !== 'test') { + return {}; + } + + return { + prefix: window.checkoutConfig.payment.xendit.test_prefix, + content: window.checkoutConfig.payment.xendit.test_content + }; + }, + + afterPlaceOrder: function () { + window.location.replace(url.build('xendit/checkout/invoice')); + }, + + validate: function() { + var billingAddress = quote.billingAddress(); + + self.messageContainer.clear(); + + if (!billingAddress) { + self.messageContainer.addErrorMessage({'message': 'Please enter your billing address'}); + return false; + } + + return true; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/dd_bdo_epay.js b/view/frontend/web/js/view/payment/method-renderer/dd_bdo_epay.js new file mode 100644 index 00000000..a6f50ad2 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/dd_bdo_epay.js @@ -0,0 +1,78 @@ +define( + [ + 'Magento_Checkout/js/view/payment/default', + 'mage/url', + 'Magento_Checkout/js/model/quote', + ], + function ( + Component, + url, + quote, + ) { + 'use strict'; + + var self; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/invoiceva', + redirectAfterPlaceOrder: false, + }, + + initialize: function() { + this._super(); + self = this; + }, + + getCode: function() { + return 'dd_bdo_epay'; + }, + + getMethod: function() { + return 'DD_BDO_EPAY'; + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + }, + + getTest: function() { + return '1'; + }, + + getDescription: function() { + return window.checkoutConfig.payment.dd_bdo_epay.description; + }, + + getTestDescription: function () { + var environment = window.checkoutConfig.payment.xendit.xendit_env; + + if (environment !== 'test') { + return {}; + } + + return { + prefix: window.checkoutConfig.payment.xendit.test_prefix, + content: window.checkoutConfig.payment.xendit.test_content + }; + }, + + afterPlaceOrder: function () { + window.location.replace(url.build('xendit/checkout/invoice')); + }, + + validate: function() { + var billingAddress = quote.billingAddress(); + + self.messageContainer.clear(); + + if (!billingAddress) { + self.messageContainer.addErrorMessage({'message': 'Please enter your billing address'}); + return false; + } + + return true; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/dd_chinabank.js b/view/frontend/web/js/view/payment/method-renderer/dd_chinabank.js new file mode 100644 index 00000000..e141b0c4 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/dd_chinabank.js @@ -0,0 +1,79 @@ +define( + [ + 'Magento_Checkout/js/view/payment/default', + 'mage/url', + 'Magento_Checkout/js/model/quote' + ], + function ( + Component, + url, + quote, + ) { + 'use strict'; + + var self; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/invoiceva', + redirectAfterPlaceOrder: false + }, + + initialize: function() { + this._super(); + self = this; + }, + + getCode: function() { + return 'dd_chinabank'; + }, + + getMethod: function() { + return 'DD_CHINABANK'; + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + }, + + getTest: function() { + return '1'; + }, + + getDescription: function() { + return window.checkoutConfig.payment.dd_chinabank.description; + }, + + getTestDescription: function () { + var environment = window.checkoutConfig.payment.xendit.xendit_env; + + if (environment !== 'test') { + return {}; + } + + return { + prefix: window.checkoutConfig.payment.xendit.test_prefix, + content: window.checkoutConfig.payment.xendit.test_content + }; + }, + + afterPlaceOrder: function () { + window.location.replace(url.build(`xendit/checkout/invoice`)); + }, + + validate: function() { + var billingAddress = quote.billingAddress(); + + self.messageContainer.clear(); + + if (!billingAddress) { + self.messageContainer.addErrorMessage({'message': 'Please enter your billing address'}); + return false; + } + + + return true; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/jeniuspay.js b/view/frontend/web/js/view/payment/method-renderer/jeniuspay.js new file mode 100644 index 00000000..aeb6a447 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/jeniuspay.js @@ -0,0 +1,79 @@ +define( + [ + 'Magento_Checkout/js/view/payment/default', + 'mage/url', + 'Magento_Checkout/js/model/quote' + ], + function ( + Component, + url, + quote, + ) { + 'use strict'; + + var self; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/invoiceva', + redirectAfterPlaceOrder: false + }, + + initialize: function() { + this._super(); + self = this; + }, + + getCode: function() { + return 'jeniuspay'; + }, + + getMethod: function() { + return 'JENIUSPAY'; + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + }, + + getTest: function() { + return '1'; + }, + + getDescription: function() { + return window.checkoutConfig.payment.jeniuspay.description; + }, + + getTestDescription: function () { + var environment = window.checkoutConfig.payment.xendit.xendit_env; + + if (environment !== 'test') { + return {}; + } + + return { + prefix: window.checkoutConfig.payment.xendit.test_prefix, + content: window.checkoutConfig.payment.xendit.test_content + }; + }, + + afterPlaceOrder: function () { + window.location.replace(url.build(`xendit/checkout/invoice`)); + }, + + validate: function() { + var billingAddress = quote.billingAddress(); + + self.messageContainer.clear(); + + if (!billingAddress) { + self.messageContainer.addErrorMessage({'message': 'Please enter your billing address'}); + return false; + } + + + return true; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/multishipping/cimbva.js b/view/frontend/web/js/view/payment/method-renderer/multishipping/cimbva.js new file mode 100644 index 00000000..ebce91e0 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/multishipping/cimbva.js @@ -0,0 +1,21 @@ +define( + [ + 'Xendit_M2Invoice/js/view/payment/method-renderer/cimbva' + ], + function ( + Component + ) { + 'use strict'; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/multishipping/description', + redirectAfterPlaceOrder: false, + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/multishipping/dd_bdo_epay.js b/view/frontend/web/js/view/payment/method-renderer/multishipping/dd_bdo_epay.js new file mode 100644 index 00000000..dee01947 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/multishipping/dd_bdo_epay.js @@ -0,0 +1,21 @@ +define( + [ + 'Xendit_M2Invoice/js/view/payment/method-renderer/dd_bdo_epay' + ], + function ( + Component + ) { + 'use strict'; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/multishipping/description', + redirectAfterPlaceOrder: false, + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/multishipping/dd_chinabank.js b/view/frontend/web/js/view/payment/method-renderer/multishipping/dd_chinabank.js new file mode 100644 index 00000000..1014baea --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/multishipping/dd_chinabank.js @@ -0,0 +1,21 @@ +define( + [ + 'Xendit_M2Invoice/js/view/payment/method-renderer/dd_chinabank' + ], + function ( + Component + ) { + 'use strict'; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/multishipping/description', + redirectAfterPlaceOrder: false + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + } + }); + } +); diff --git a/view/frontend/web/js/view/payment/method-renderer/multishipping/jeniuspay.js b/view/frontend/web/js/view/payment/method-renderer/multishipping/jeniuspay.js new file mode 100644 index 00000000..e6805a93 --- /dev/null +++ b/view/frontend/web/js/view/payment/method-renderer/multishipping/jeniuspay.js @@ -0,0 +1,21 @@ +define( + [ + 'Xendit_M2Invoice/js/view/payment/method-renderer/jeniuspay' + ], + function ( + Component + ) { + 'use strict'; + + return Component.extend({ + defaults: { + template: 'Xendit_M2Invoice/payment/multishipping/description', + redirectAfterPlaceOrder: false + }, + + getMethodImage: function () { + return window.checkoutConfig.payment[this.item.method].image; + } + }); + } +);