Skip to content

Commit 5ba8b22

Browse files
authored
Merge pull request #125 from xendit/TPI-6923/implement-uangme-magento
Implement uangme magento
2 parents 8f56b33 + 2d0f13f commit 5ba8b22

File tree

19 files changed

+359
-4
lines changed

19 files changed

+359
-4
lines changed

CHANGELOG.md

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

3+
## 3.8.0 (2022-05-09)
4+
Features:
5+
- Add new IDR payment: Uangme
6+
37
## 3.7.0 (2022-04-06)
48
Features:
59
- Add new PH payment: ShopeePay
10+
611
## 3.6.0 (2022-03-22)
712
Features:
813
- Add new PH payment: Cashalo

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ To activate this feature, you need to follow this additional steps:
8585
- Kredivo
8686
- BillEase (PH)
8787
- Cashalo (PH)
88+
- Uangme
8889
- Direct Debit
8990
- BRI
9091
- BPI (PH)

Xendit/M2Invoice/Helper/ApiRequest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function getHeaders($isPublicRequest, $preferredMethod = null, $customHe
110110
'Content-Type' => 'application/json',
111111
'x-plugin-name' => 'MAGENTO2',
112112
'user-agent' => 'Magento 2 Module',
113-
'x-plugin-version' => '3.6.0'
113+
'x-plugin-version' => '3.8.0'
114114
];
115115

116116
if ($preferredMethod !== null) {

Xendit/M2Invoice/Helper/Data.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\Filesystem\Driver\File;
1414
use Magento\Framework\Stdlib\DateTime\DateTimeFactory;
1515
use Magento\Framework\UrlInterface;
16+
use Magento\Framework\View\Asset\Repository as AssetRepository;
1617
use Magento\Quote\Model\QuoteFactory;
1718
use Magento\Quote\Model\QuoteManagement;
1819
use Magento\Sales\Model\Order;
@@ -22,7 +23,6 @@
2223
use Magento\Sales\Model\Service\InvoiceService;
2324
use Magento\Store\Model\ScopeInterface;
2425
use Magento\Store\Model\StoreManagerInterface;
25-
use Magento\Framework\View\Asset\Repository as AssetRepository;
2626
use Xendit\M2Invoice\Model\Payment\Xendit;
2727

2828
/**
@@ -479,6 +479,7 @@ public function xenditPaymentMethod($payment)
479479
"dp_ecpay_loan" => "dp_ecpay_loan",
480480
"cashalo" => "cashalo",
481481
"shopeepayph" => "shopeepayph",
482+
"uangme" => "uangme",
482483
];
483484

484485
$response = false;

Xendit/M2Invoice/Model/Adminhtml/Source/ChosenMethod.php

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function toOptionArray($isMultiselect = false)
5151
['value' => 'dp_ecpay_loan', 'label' => __('ECPay Loans')],
5252
['value' => 'cashalo', 'label' => __('Cashalo')],
5353
['value' => 'shopeepayph', 'label' => __('ShopeePay')],
54+
['value' => 'uangme', 'label' => __('Uangme')],
5455
];
5556

5657
if (!$isMultiselect) {
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Xendit\M2Invoice\Model\Payment;
4+
5+
use Magento\Quote\Api\Data\CartInterface;
6+
7+
/**
8+
* Class Uangme
9+
* @package Xendit\M2Invoice\Model\Payment
10+
*/
11+
class Uangme extends AbstractInvoice
12+
{
13+
/**
14+
* Payment Method feature
15+
*
16+
* @var bool
17+
*/
18+
protected $_isInitializeNeeded = true;
19+
20+
/**
21+
* Payment code
22+
*
23+
* @var string
24+
*/
25+
protected $_code = 'uangme';
26+
protected $methodCode = 'UANGME';
27+
}

Xendit/M2Invoice/Model/Ui/ConfigProvider.php

+7
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,13 @@ public function getConfig()
292292
'description' => $this->xenditHelper->getPaymentDescription("shopeepayph"),
293293
'image' => $this->xenditHelper->getPaymentImage('shopeepay')
294294
],
295+
'uangme' => [
296+
'title' => $this->xenditHelper->getPaymentTitle("uangme"),
297+
'min_order_amount' => $this->xenditHelper->getPaymentMinOrderAmount("uangme"),
298+
'max_order_amount' => $this->xenditHelper->getPaymentMaxOrderAmount("uangme"),
299+
'description' => $this->xenditHelper->getPaymentDescription("uangme"),
300+
'image' => $this->xenditHelper->getPaymentImage('uangme')
301+
],
295302
]
296303
];
297304

Xendit/M2Invoice/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": "3.6.0",
5+
"version": "3.8.0",
66
"license": [
77
"GPL-3.0"
88
],
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0"?>
2+
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
3+
<group id="uangme" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="1">
4+
<label>Uangme</label>
5+
<field id="active" translate="label comment" sortOrder="1" type="select" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
6+
<label>Enable</label>
7+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
8+
<config_path>payment/uangme/active</config_path>
9+
</field>
10+
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
11+
<label>Title</label>
12+
<config_path>payment/uangme/title</config_path>
13+
</field>
14+
<field id="description" translate="label" type="textarea" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
15+
<label>Description</label>
16+
<config_path>payment/uangme/description</config_path>
17+
</field>
18+
<field id="min_order_total" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
19+
<label>Minimum Order Total</label>
20+
<frontend_class>validate-zero-or-greater</frontend_class>
21+
<config_path>payment/uangme/min_order_total</config_path>
22+
</field>
23+
<field id="max_order_total" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
24+
<label>Maximum Order Total</label>
25+
<frontend_class>validate-zero-or-greater</frontend_class>
26+
<config_path>payment/uangme/max_order_total</config_path>
27+
</field>
28+
</group>
29+
</include>

Xendit/M2Invoice/etc/adminhtml/system.xml

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
<include path="Xendit_M2Invoice::paylater/kredivo.xml"/>
222222
<include path="Xendit_M2Invoice::paylater/billease.xml"/>
223223
<include path="Xendit_M2Invoice::paylater/cashalo.xml"/>
224+
<include path="Xendit_M2Invoice::paylater/uangme.xml"/>
224225
</group>
225226
</group>
226227

Xendit/M2Invoice/etc/config.xml

+14
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,20 @@
455455
<sort_order>31</sort_order>
456456
<currency>PHP</currency>
457457
</shopeepayph>
458+
<uangme>
459+
<active>1</active>
460+
<payment_action>initialize</payment_action>
461+
<model>Xendit\M2Invoice\Model\Payment\Uangme</model>
462+
<title>UangMe</title>
463+
<description>Bayar pesanan dengan Uangme melalui Xendit</description>
464+
<min_order_total>20000</min_order_total>
465+
<max_order_total>20000000</max_order_total>
466+
<is_gateway>1</is_gateway>
467+
<can_initialize>1</can_initialize>
468+
<can_use_checkout>1</can_use_checkout>
469+
<sort_order>32</sort_order>
470+
<currency>IDR</currency>
471+
</uangme>
458472
</payment>
459473
</default>
460474
</config>

Xendit/M2Invoice/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="3.6.0" active="true"></module>
3+
<module name="Xendit_M2Invoice" setup_version="3.8.0" active="true"></module>
44
</config>

Xendit/M2Invoice/etc/payment.xml

+3
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,8 @@ https://github.com/magento/magento2/blob/2.2.0-rc2.1/app/code/Magento/Multishipp
102102
<method name='cashalo'>
103103
<allow_multiple_address>1</allow_multiple_address>
104104
</method>
105+
<method name='uangme'>
106+
<allow_multiple_address>1</allow_multiple_address>
107+
</method>
105108
</methods>
106109
</payment>

Xendit/M2Invoice/view/frontend/layout/multishipping_checkout_billing.xml

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<item name="bsiva" xsi:type="string">Xendit_M2Invoice::multishipping/bsiva.phtml</item>
4040
<item name="cashalo" xsi:type="string">Xendit_M2Invoice::multishipping/cashalo.phtml</item>
4141
<item name="shopeepayph" xsi:type="string">Xendit_M2Invoice::multishipping/shopeepayph.phtml</item>
42+
<item name="uangme" xsi:type="string">Xendit_M2Invoice::multishipping/uangme.phtml</item>
4243
</argument>
4344
</arguments>
4445
</referenceBlock>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
?>
7+
<script>
8+
require([
9+
'uiLayout',
10+
'jquery'
11+
], function (layout, $) {
12+
$(function () {
13+
var paymentMethodData = {
14+
method: 'uangme'
15+
};
16+
layout([
17+
{
18+
component: 'Xendit_M2Invoice/js/view/payment/method-renderer/multishipping/uangme',
19+
name: 'payment_method_uangme',
20+
method: paymentMethodData.method,
21+
item: paymentMethodData
22+
}
23+
]);
24+
25+
if(window.checkoutConfig.payment[paymentMethodData.method].image != ""){
26+
$("label[for=p_method_"+paymentMethodData.method+"]")
27+
.prepend('<img class="xendit-payment-icon" src="'+window.checkoutConfig.payment[paymentMethodData.method].image+'" />');
28+
}
29+
30+
$('body').trigger('contentUpdated');
31+
})
32+
})
33+
</script>
34+
<!-- ko template: getTemplate() --><!-- /ko -->

0 commit comments

Comments
 (0)