Skip to content

Commit

Permalink
Feature: Added Blik
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Mar 18, 2024
1 parent fa60d53 commit 946dcfa
Show file tree
Hide file tree
Showing 29 changed files with 280 additions and 8 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/templates/magento/configure-mollie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ bin/magento config:set payment/mollie_general/type test &
# Enable all payment methods
bin/magento config:set payment/mollie_methods_applepay/active 1 &
bin/magento config:set payment/mollie_methods_banktransfer/active 1 &
bin/magento config:set payment/mollie_methods_billie/active 1 &
bin/magento config:set payment/mollie_methods_blik/active 1 &
bin/magento config:set payment/mollie_methods_creditcard/active 1 &
bin/magento config:set payment/mollie_methods_giftcard/active 1 &
bin/magento config:set payment/mollie_methods_ideal/active 1 &
Expand All @@ -24,7 +26,6 @@ bin/magento config:set payment/mollie_methods_belfius/active 1 &
bin/magento config:set payment/mollie_methods_eps/active 1 &
bin/magento config:set payment/mollie_methods_giropay/active 1 &
bin/magento config:set payment/mollie_methods_klarnapaylater/active 1 &
bin/magento config:set payment/mollie_methods_billie/active 1 &
bin/magento config:set payment/mollie_methods_paymentlink/active 1 &
bin/magento config:set payment/mollie_methods_paysafecard/active 1 &
bin/magento config:set payment/mollie_methods_pointofsale/active 1 &
Expand All @@ -40,10 +41,16 @@ bin/magento config:set payment/mollie_methods_ideal/add_qr 1 &
bin/magento config:set payment/mollie_general/use_webhooks disabled &

# Configure currency for the swiss store view
bin/magento config:set currency/options/allow EUR,CHF &
bin/magento config:set currency/options/allow EUR,CHF,PLN &

# Swiss scope
bin/magento config:set currency/options/default CHF --scope=ch &
bin/magento config:set payment/mollie_general/currency 0 --scope=ch &

# Polish scope
bin/magento config:set currency/options/default PLN --scope=pl &
bin/magento config:set payment/mollie_general/currency 0 --scope=pl &

wait

if grep -q Magento_TwoFactorAuth "app/etc/config.php"; then
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/templates/magento/merge-config.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,16 @@ $magentoConfig['scopes'] = [
'website_id' => '1',
'group_id' => '1',
'name' => 'Swiss',
'sort_order' => '0',
'sort_order' => '1',
'is_active' => '1'
],
'pl' => [
'store_id' => '3',
'code' => 'pl',
'website_id' => '1',
'group_id' => '1',
'name' => 'Poland',
'sort_order' => '2',
'is_active' => '1'
]
]
Expand Down
1 change: 1 addition & 0 deletions Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@ public function getAllActiveMethods($storeId)
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
Expand Down
24 changes: 24 additions & 0 deletions Model/Methods/Blik.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Model\Mollie;

/**
* Class Blik
*
* @package Mollie\Payment\Model\Methods
*/
class Blik extends Mollie
{
/**
* Payment method code
*
* @var string
*/
const CODE = 'mollie_methods_blik';
}
1 change: 1 addition & 0 deletions Model/MollieConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class MollieConfigProvider implements ConfigProviderInterface
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Mollie requires no minimum costs, no fixed contracts, no hidden costs. At Mollie
- Bank transfer
- Belfius Pay Button
- Billie
- Blik
- Credit card (VISA, MasterCard, Maestro and American Express)
- EPS
- Gift cards (Webshop Giftcard, Podium Cadeaukaart, VVV Cadeaukaart, YourGift etc.)
Expand Down
1 change: 1 addition & 0 deletions Service/Mollie/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function __construct(
'mollie_methods_banktransfer',
'mollie_methods_belfius',
'mollie_methods_billie',
'mollie_methods_blik',
'mollie_methods_creditcard',
'mollie_methods_directdebit',
'mollie_methods_eps',
Expand Down
1 change: 1 addition & 0 deletions Test/Integration/Etc/Config/MethodsConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public function methods(): array
['mollie_methods_banktransfer'],
['mollie_methods_belfius'],
['mollie_methods_billie'],
['mollie_methods_blik'],
['mollie_methods_creditcard'],
['mollie_methods_directdebit'],
['mollie_methods_eps'],
Expand Down
1 change: 1 addition & 0 deletions Test/Integration/Helper/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public function getMethodCodeDataProvider()
'banktransfer' => ['mollie_methods_banktransfer', 'banktransfer'],
'belfius' => ['mollie_methods_belfius', 'belfius'],
'billie' => ['mollie_methods_billie', 'billie'],
'blik' => ['mollie_methods_blik', 'blik'],
'creditcard' => ['mollie_methods_creditcard', 'creditcard'],
'directdebit' => ['mollie_methods_directdebit', 'directdebit'],
'eps' => ['mollie_methods_eps', 'eps'],
Expand Down
16 changes: 16 additions & 0 deletions Test/Integration/Model/Methods/BlikTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* * See COPYING.txt for license details.
*/

namespace Mollie\Payment\Test\Integration\Model\Methods;

use Mollie\Payment\Model\Methods\Billie;

class BlikTest extends AbstractMethodTest
{
protected $instance = Billie::class;

protected $code = 'billie';
}
1 change: 1 addition & 0 deletions Test/Integration/Model/MollieConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function testGetConfig()
$this->assertArrayHasKey('mollie_methods_banktransfer', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_belfius', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_billie', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_blik', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_creditcard', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_directdebit', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_eps', $result['payment']['image']);
Expand Down
1 change: 1 addition & 0 deletions Test/Integration/Service/Config/PaymentFeeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function isAvailableForMethodProvider()
['mollie_methods_banktransfer', true],
['mollie_methods_belfius', true],
['mollie_methods_billie', true],
['mollie_methods_blik', true],
['mollie_methods_creditcard', true],
['mollie_methods_directdebit', true],
['mollie_methods_eps', true],
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"belfius",
"belfius direct net",
"billie",
"blik",
"cbc",
"creditcard",
"directdebit",
Expand Down
1 change: 1 addition & 0 deletions etc/adminhtml/methods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<include path="Mollie_Payment::methods/banktransfer.xml"/>
<include path="Mollie_Payment::methods/belfius.xml"/>
<include path="Mollie_Payment::methods/billie.xml"/>
<include path="Mollie_Payment::methods/blik.xml"/>
<include path="Mollie_Payment::methods/creditcard.xml"/>
<include path="Mollie_Payment::methods/directdebit.xml"/>
<include path="Mollie_Payment::methods/eps.xml"/>
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/methods/applepay.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="mollie_methods_applepay" translate="label" type="text" sortOrder="20" showInDefault="1"
<group id="mollie_methods_applepay" translate="label" type="text" sortOrder="10" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Apple Pay</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/methods/bancontact.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="mollie_methods_bancontact" translate="label" type="text" sortOrder="30" showInDefault="1"
<group id="mollie_methods_bancontact" translate="label" type="text" sortOrder="20" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Bancontact</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/methods/banktransfer.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="mollie_methods_banktransfer" translate="label" type="text" sortOrder="40" showInDefault="1"
<group id="mollie_methods_banktransfer" translate="label" type="text" sortOrder="30" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Banktransfer</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/methods/belfius.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="mollie_methods_belfius" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"
<group id="mollie_methods_belfius" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Belfius</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/methods/billie.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="mollie_methods_billie" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"
<group id="mollie_methods_billie" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Billie</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
Expand Down
131 changes: 131 additions & 0 deletions etc/adminhtml/methods/blik.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
<?xml version="1.0" encoding="UTF-8"?>
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="mollie_methods_blik" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Blik</label>
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/mollie_methods_blik/active</config_path>
</field>
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Title</label>
<config_path>payment/mollie_methods_blik/title</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="30" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment from Applicable Countries</label>
<source_model>Magento\Payment\Model\Config\Source\Allspecificcountries</source_model>
<config_path>payment/mollie_methods_blik/allowspecific</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="40" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment from Specific Countries</label>
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
<can_be_empty>1</can_be_empty>
<config_path>payment/mollie_methods_blik/specificcountry</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/mollie_methods_blik/min_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/mollie_methods_blik/max_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="payment_surcharge_type" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge</label>
<config_path>payment/mollie_methods_blik/payment_surcharge_type</config_path>
<source_model>Mollie\Payment\Model\Adminhtml\Source\PaymentFeeType</source_model>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="payment_surcharge_fixed_amount" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge fixed amount</label>
<config_path>payment/mollie_methods_blik/payment_surcharge_fixed_amount</config_path>
<backend_model>Mollie\Payment\Model\Adminhtml\Backend\VerifiyPaymentFee</backend_model>
<frontend_class>validate-not-negative-number</frontend_class>
<depends>
<field id="active">1</field>
<field id="payment_surcharge_type" separator=",">fixed_fee,fixed_fee_and_percentage</field>
</depends>
</field>
<field id="payment_surcharge_percentage" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge percentage</label>
<config_path>payment/mollie_methods_blik/payment_surcharge_percentage</config_path>
<backend_model>Mollie\Payment\Model\Adminhtml\Backend\VerifiyPaymentFee</backend_model>
<frontend_class>validate-number-range number-range-0-10</frontend_class>
<depends>
<field id="active">1</field>
<field id="payment_surcharge_type" separator=",">percentage,fixed_fee_and_percentage</field>
</depends>
</field>
<field id="payment_surcharge_limit" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge limit</label>
<config_path>payment/mollie_methods_blik/payment_surcharge_limit</config_path>
<comment><![CDATA[Enter the maximum amount of payment surchage to should be charged to the customer.]]></comment>
<backend_model>Mollie\Payment\Model\Adminhtml\Backend\VerifiyPaymentFee</backend_model>
<frontend_class>validate-not-negative-number</frontend_class>
<depends>
<field id="active">1</field>
<field id="payment_surcharge_type" separator=",">percentage,fixed_fee_and_percentage</field>
</depends>
</field>
<field id="payment_surcharge_tax_class" translate="label" type="select" sortOrder="110" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment Surcharge Tax Class</label>
<config_path>payment/mollie_methods_blik/payment_surcharge_tax_class</config_path>
<source_model>\Magento\Tax\Model\TaxClass\Source\Product</source_model>
<depends>
<field id="active">1</field>
<field id="payment_surcharge_type" separator=",">fixed_fee,percentage,fixed_fee_and_percentage</field>
</depends>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/mollie_methods_blik/sort_order</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="days_before_expire" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Days to expire</label>
<frontend_class>validate-digits-range digits-range-1-365</frontend_class>
<config_path>payment/mollie_methods_blik/days_before_expire</config_path>
<depends>
<field id="active">1</field>
<field id="method">order</field>
</depends>
<comment><![CDATA[How many days before orders for this method becomes expired? Leave empty to use default
expiration (28 days).]]></comment>
</field>
</group>
</include>
19 changes: 19 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,25 @@
<can_authorize_vault>0</can_authorize_vault>
<can_edit>1</can_edit>
</mollie_methods_billie>
<mollie_methods_blik>
<active>1</active>
<model>Mollie\Payment\Model\Methods\Blik</model>
<title>Blik</title>
<payment_description>{ordernumber}</payment_description>
<method>payment</method>
<payment_action>order</payment_action>
<allowspecific>0</allowspecific>
<instructions/>
<can_use_checkout>1</can_use_checkout>
<can_order>1</can_order>
<can_refund>1</can_refund>
<can_refund_partial_per_invoice>1</can_refund_partial_per_invoice>
<can_use_internal>0</can_use_internal>
<can_cancel>1</can_cancel>
<can_authorize>1</can_authorize>
<can_authorize_vault>0</can_authorize_vault>
<can_edit>1</can_edit>
</mollie_methods_blik>
<mollie_methods_creditcard>
<active>1</active>
<model>Mollie\Payment\Model\Methods\Creditcard</model>
Expand Down
Loading

0 comments on commit 946dcfa

Please sign in to comment.