Skip to content

Commit 5b9bfca

Browse files
authored
Merge pull request #121 from xendit/TPI-6671/cashalo-magento
Implement new payment: Cashalo
2 parents ecb82eb + 07d40b6 commit 5b9bfca

File tree

19 files changed

+254
-17
lines changed

19 files changed

+254
-17
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 3.6.0 (2022-03-22)
4+
Features:
5+
- Add new PH payment: Cashalo
6+
37
## 3.5.0 (2022-03-08)
48
Improvements:
59
- Code refactoring

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ To activate this feature, you need to follow this additional steps:
8484
- PayLater
8585
- Kredivo
8686
- BillEase (PH)
87+
- Cashalo (PH)
8788
- Direct Debit
8889
- BRI
8990
- 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.5.0'
113+
'x-plugin-version' => '3.6.0'
114114
];
115115

116116
if ($preferredMethod !== null) {

Xendit/M2Invoice/Helper/Data.php

+1
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ public function xenditPaymentMethod($payment)
470470
"dp_palawan" => "dp_palawan",
471471
"dp_mlhuillier" => "dp_mlhuillier",
472472
"dp_ecpay_loan" => "dp_ecpay_loan",
473+
"cashalo" => "cashalo",
473474
];
474475

475476
$response = false;

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

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public function toOptionArray($isMultiselect = false)
4949
['value' => 'dp_palawan', 'label' => __('Palawan Express Pera Padala')],
5050
['value' => 'dp_mlhuillier', 'label' => __('M Lhuillier')],
5151
['value' => 'dp_ecpay_loan', 'label' => __('ECPay Loans')],
52+
['value' => 'cashalo', 'label' => __('Cashalo')],
5253
];
5354

5455
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 Cashalo
9+
* @package Xendit\M2Invoice\Model\Payment
10+
*/
11+
class Cashalo 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 = 'cashalo';
26+
protected $methodCode = 'CASHALO';
27+
}

Xendit/M2Invoice/Model/Ui/ConfigProvider.php

+7
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,13 @@ public function getConfig()
278278
'description' => $this->xenditHelper->getPaymentDescription('bsiva'),
279279
'image' => $this->xenditHelper->getPaymentImage('bsiva')
280280
],
281+
'cashalo' => [
282+
'title' => $this->xenditHelper->getPaymentTitle("cashalo"),
283+
'min_order_amount' => $this->xenditHelper->getPaymentMinOrderAmount("cashalo"),
284+
'max_order_amount' => $this->xenditHelper->getPaymentMaxOrderAmount("cashalo"),
285+
'description' => $this->xenditHelper->getPaymentDescription("cashalo"),
286+
'image' => $this->xenditHelper->getPaymentImage('cashalo')
287+
],
281288
]
282289
];
283290

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.5.0",
5+
"version": "3.6.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="cashalo" translate="label" type="text" sortOrder="160" showInDefault="1" showInWebsite="1" showInStore="1">
4+
<label>Cashalo</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/cashalo/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/cashalo/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/cashalo/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/cashalo/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/cashalo/max_order_total</config_path>
27+
</field>
28+
</group>
29+
</include>

Xendit/M2Invoice/etc/adminhtml/system.xml

+6-5
Original file line numberDiff line numberDiff line change
@@ -105,39 +105,39 @@
105105
<label>Enable</label>
106106
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
107107
</field>
108-
<field id="xendit_env" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
108+
<field id="xendit_env" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
109109
<label>Payment Mode</label>
110110
<source_model>Xendit\M2Invoice\Model\Adminhtml\Source\EnvRadioBtn</source_model>
111111
<comment>
112112
Choose live to perform real transaction
113113
</comment>
114114
<attribute type="shared">1</attribute>
115115
</field>
116-
<field id="test_public_key" translate="label" type="obscure" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
116+
<field id="test_public_key" translate="label" type="obscure" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
117117
<label>Test - Public Key</label>
118118
<comment>
119119
Public API key provided by Xendit Dashboard
120120
</comment>
121121
<attribute type="shared">1</attribute>
122122
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
123123
</field>
124-
<field id="test_private_key" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
124+
<field id="test_private_key" translate="label" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
125125
<label>Test - Private Key</label>
126126
<comment>
127127
Secret API key provided by Xendit Dashboard
128128
</comment>
129129
<attribute type="shared">1</attribute>
130130
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
131131
</field>
132-
<field id="public_key" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
132+
<field id="public_key" translate="label" type="obscure" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
133133
<label>Public Key</label>
134134
<comment>
135135
Public API key provided by Xendit Dashboard
136136
</comment>
137137
<attribute type="shared">1</attribute>
138138
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
139139
</field>
140-
<field id="private_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
140+
<field id="private_key" translate="label" type="obscure" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="1">
141141
<label>Private Key</label>
142142
<comment>
143143
Secret API key provided by Xendit Dashboard
@@ -219,6 +219,7 @@
219219
<attribute type="expanded">0</attribute>
220220
<include path="Xendit_M2Invoice::paylater/kredivo.xml"/>
221221
<include path="Xendit_M2Invoice::paylater/billease.xml"/>
222+
<include path="Xendit_M2Invoice::paylater/cashalo.xml"/>
222223
</group>
223224
</group>
224225

Xendit/M2Invoice/etc/config.xml

+23-9
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,20 @@
301301
<sort_order>20</sort_order>
302302
<currency>PHP</currency>
303303
</billease>
304+
<cashalo>
305+
<active>1</active>
306+
<payment_action>initialize</payment_action>
307+
<model>Xendit\M2Invoice\Model\Payment\Cashalo</model>
308+
<title>Cashalo</title>
309+
<description>Pay for orders using Cashalo via Xendit</description>
310+
<min_order_total>1500</min_order_total>
311+
<max_order_total>4500</max_order_total>
312+
<is_gateway>1</is_gateway>
313+
<can_initialize>1</can_initialize>
314+
<can_use_checkout>1</can_use_checkout>
315+
<sort_order>21</sort_order>
316+
<currency>PHP</currency>
317+
</cashalo>
304318
<cebuana>
305319
<active>1</active>
306320
<payment_action>initialize</payment_action>
@@ -312,7 +326,7 @@
312326
<is_gateway>1</is_gateway>
313327
<can_initialize>1</can_initialize>
314328
<can_use_checkout>1</can_use_checkout>
315-
<sort_order>21</sort_order>
329+
<sort_order>22</sort_order>
316330
<currency>PHP</currency>
317331
</cebuana>
318332
<dd_bpi>
@@ -326,7 +340,7 @@
326340
<is_gateway>1</is_gateway>
327341
<can_initialize>1</can_initialize>
328342
<can_use_checkout>1</can_use_checkout>
329-
<sort_order>22</sort_order>
343+
<sort_order>23</sort_order>
330344
<currency>PHP</currency>
331345
</dd_bpi>
332346
<dd_ubp>
@@ -340,7 +354,7 @@
340354
<is_gateway>1</is_gateway>
341355
<can_initialize>1</can_initialize>
342356
<can_use_checkout>1</can_use_checkout>
343-
<sort_order>23</sort_order>
357+
<sort_order>24</sort_order>
344358
<currency>PHP</currency>
345359
</dd_ubp>
346360
<dp_ecpay_loan>
@@ -354,7 +368,7 @@
354368
<is_gateway>1</is_gateway>
355369
<can_initialize>1</can_initialize>
356370
<can_use_checkout>1</can_use_checkout>
357-
<sort_order>24</sort_order>
371+
<sort_order>25</sort_order>
358372
<currency>PHP</currency>
359373
</dp_ecpay_loan>
360374
<gcash>
@@ -368,7 +382,7 @@
368382
<is_gateway>1</is_gateway>
369383
<can_initialize>1</can_initialize>
370384
<can_use_checkout>1</can_use_checkout>
371-
<sort_order>25</sort_order>
385+
<sort_order>26</sort_order>
372386
<currency>PHP</currency>
373387
</gcash>
374388
<grabpay>
@@ -382,7 +396,7 @@
382396
<is_gateway>1</is_gateway>
383397
<can_initialize>1</can_initialize>
384398
<can_use_checkout>1</can_use_checkout>
385-
<sort_order>26</sort_order>
399+
<sort_order>27</sort_order>
386400
<currency>PHP</currency>
387401
</grabpay>
388402
<dp_mlhuillier>
@@ -396,7 +410,7 @@
396410
<is_gateway>1</is_gateway>
397411
<can_initialize>1</can_initialize>
398412
<can_use_checkout>1</can_use_checkout>
399-
<sort_order>27</sort_order>
413+
<sort_order>28</sort_order>
400414
<currency>PHP</currency>
401415
</dp_mlhuillier>
402416
<dp_palawan>
@@ -410,7 +424,7 @@
410424
<is_gateway>1</is_gateway>
411425
<can_initialize>1</can_initialize>
412426
<can_use_checkout>1</can_use_checkout>
413-
<sort_order>28</sort_order>
427+
<sort_order>29</sort_order>
414428
<currency>PHP</currency>
415429
</dp_palawan>
416430
<paymaya>
@@ -424,7 +438,7 @@
424438
<is_gateway>1</is_gateway>
425439
<can_initialize>1</can_initialize>
426440
<can_use_checkout>1</can_use_checkout>
427-
<sort_order>29</sort_order>
441+
<sort_order>30</sort_order>
428442
<currency>PHP</currency>
429443
</paymaya>
430444
</payment>

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

Xendit/M2Invoice/etc/payment.xml

+3
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,8 @@ https://github.com/magento/magento2/blob/2.2.0-rc2.1/app/code/Magento/Multishipp
9696
<method name='dp_ecpay_loan'>
9797
<allow_multiple_address>1</allow_multiple_address>
9898
</method>
99+
<method name='cashalo'>
100+
<allow_multiple_address>1</allow_multiple_address>
101+
</method>
99102
</methods>
100103
</payment>

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

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<item name="dp_ecpay_loan" xsi:type="string">Xendit_M2Invoice::multishipping/dp_ecpay_loan.phtml</item>
3838
<item name="bjbva" xsi:type="string">Xendit_M2Invoice::multishipping/bjbva.phtml</item>
3939
<item name="bsiva" xsi:type="string">Xendit_M2Invoice::multishipping/bsiva.phtml</item>
40+
<item name="cashalo" xsi:type="string">Xendit_M2Invoice::multishipping/cashalo.phtml</item>
4041
</argument>
4142
</arguments>
4243
</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: 'cashalo'
15+
};
16+
layout([
17+
{
18+
component: 'Xendit_M2Invoice/js/view/payment/method-renderer/multishipping/cashalo',
19+
name: 'payment_method_cashalo',
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 -->

Xendit/M2Invoice/view/frontend/web/images/methods/cashalo.svg

+10
Loading

Xendit/M2Invoice/view/frontend/web/js/view/payment/method-renderer.js

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ define(
126126
type: 'bsiva',
127127
component: 'Xendit_M2Invoice/js/view/payment/method-renderer/bsiva'
128128
},
129+
{
130+
type: 'cashalo',
131+
component: 'Xendit_M2Invoice/js/view/payment/method-renderer/cashalo'
132+
},
129133
);
130134
return Component.extend({});
131135
}

0 commit comments

Comments
 (0)