Skip to content

Commit

Permalink
bancomat -> bancomatpay
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed May 16, 2024
1 parent 1c15ca8 commit f859be3
Show file tree
Hide file tree
Showing 24 changed files with 149 additions and 65 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/templates/magento/configure-mollie.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#
# Copyright Magmodules.eu. All rights reserved.
# See COPYING.txt for license details.
#

if [ -z "$MOLLIE_API_KEY_TEST" ]; then
echo "Variable \$MOLLIE_API_KEY_TEST is not set"
exit 1
Expand All @@ -23,7 +28,7 @@ bin/magento config:set payment/mollie_methods_paypal/active 1 &
bin/magento config:set payment/mollie_methods_przelewy24/active 1 &
bin/magento config:set payment/mollie_methods_alma/active 1 &
bin/magento config:set payment/mollie_methods_bancontact/active 1 &
bin/magento config:set payment/mollie_methods_bancomat/active 1 &
bin/magento config:set payment/mollie_methods_bancomatpay/active 1 &
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 &
Expand Down
2 changes: 1 addition & 1 deletion Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ public function getAllActiveMethods($storeId)
$methodCodes = [
'mollie_methods_applepay',
'mollie_methods_alma',
'mollie_methods_bancomat',
'mollie_methods_bancomatpay',
'mollie_methods_bancontact',
'mollie_methods_banktransfer',
'mollie_methods_belfius',
Expand Down
10 changes: 5 additions & 5 deletions Model/Methods/Bancomat.php → Model/Methods/Bancomatpay.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright © 2018 Magmodules.eu. All rights reserved.
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

Expand All @@ -9,16 +9,16 @@
use Mollie\Payment\Model\Mollie;

/**
* Class Bancomat
* Class Bancomatpay
*
* @package Mollie\Payment\Model\Methods
*/
class Bancomat extends Mollie
class Bancomatpay extends Mollie
{
/**
* Payment method code
*
* @var string
*/
const CODE = 'mollie_methods_bancomat';
const CODE = 'mollie_methods_bancomatpay';
}
2 changes: 1 addition & 1 deletion Model/MollieConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MollieConfigProvider implements ConfigProviderInterface
private $methodCodes = [
'mollie_methods_applepay',
'mollie_methods_alma',
'mollie_methods_bancomat',
'mollie_methods_bancomatpay',
'mollie_methods_bancontact',
'mollie_methods_banktransfer',
'mollie_methods_belfius',
Expand Down
2 changes: 1 addition & 1 deletion Service/Mollie/PaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct(
private $methods = [
'mollie_methods_applepay',
'mollie_methods_alma',
'mollie_methods_bancomat',
'mollie_methods_bancomatpay',
'mollie_methods_bancontact',
'mollie_methods_banktransfer',
'mollie_methods_belfius',
Expand Down
2 changes: 1 addition & 1 deletion Test/End-2-end/cypress/e2e/magento/checkout.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Checkout usage', () => {
const availableMethods = Cypress.env('mollie_available_methods');
[
'alma',
'bancomat',
'bancomatpay',
'bancontact',
'banktransfer',
'belfius',
Expand Down
60 changes: 60 additions & 0 deletions Test/End-2-end/cypress/e2e/magento/methods/bancomatpay.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

import CheckoutPaymentPage from "Pages/frontend/CheckoutPaymentPage";
import VisitCheckoutPaymentCompositeAction from "CompositeActions/VisitCheckoutPaymentCompositeAction";
import MollieHostedPaymentPage from "Pages/mollie/MollieHostedPaymentPage";
import CheckoutSuccessPage from "Pages/frontend/CheckoutSuccessPage";
import OrdersPage from "Pages/backend/OrdersPage";
import CartPage from "Pages/frontend/CartPage";

const checkoutPaymentPage = new CheckoutPaymentPage();
const visitCheckoutPayment = new VisitCheckoutPaymentCompositeAction();
const mollieHostedPaymentPage = new MollieHostedPaymentPage();
const checkoutSuccessPage = new CheckoutSuccessPage();
const ordersPage = new OrdersPage();
const cartPage = new CartPage();

if (Cypress.env('mollie_available_methods').includes('bancomatpay')) {
describe('Check that bancomatpay behaves as expected', () => {
[
{status: 'paid', orderStatus: 'Processing', title: 'C3190598: Validate the submission of an order with Bancomat Pay as payment method and payment mark as "Paid"'},
{status: 'failed', orderStatus: 'Canceled', title: 'C3190599: Validate the submission of an order with Bancomat Pay as payment method and payment mark as "Failed" '},
{status: 'expired', orderStatus: 'Canceled', title: 'C3190600: Validate the submission of an order with Bancomat Pay as payment method and payment mark as "Expired" '},
{status: 'canceled', orderStatus: 'Canceled', title: 'C3190601: Validate the submission of an order with Bancomat Pay as payment method and payment mark as "Cancelled" '},
].forEach((testCase) => {
it(testCase.title, () => {
visitCheckoutPayment.visit();

cy.intercept('mollie/checkout/redirect/paymentToken/*').as('mollieRedirect');

checkoutPaymentPage.selectPaymentMethod('Bancomat Pay');
checkoutPaymentPage.placeOrder();

mollieHostedPaymentPage.selectStatus(testCase.status);

if (testCase.status === 'paid') {
checkoutSuccessPage.assertThatOrderSuccessPageIsShown();
}

if (testCase.status === 'canceled') {
cartPage.assertCartPageIsShown();
}

cy.backendLogin();

cy.get('@order-id').then((orderId) => {
ordersPage.openOrderById(orderId);
});

if (testCase.status === 'expired') {
ordersPage.callFetchStatus();
}

ordersPage.assertOrderStatusIs(testCase.orderStatus);
});
});
})
}
2 changes: 1 addition & 1 deletion Test/Integration/Etc/Config/MethodsConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function methods(): array
return [
['mollie_methods_applepay'],
['mollie_methods_alma'],
['mollie_methods_bancomat'],
['mollie_methods_bancomatpay'],
['mollie_methods_bancontact'],
['mollie_methods_banktransfer'],
['mollie_methods_belfius'],
Expand Down
2 changes: 1 addition & 1 deletion Test/Integration/Helper/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getMethodCodeDataProvider()

'applepay' => ['mollie_methods_applepay', 'applepay'],
'alma' => ['mollie_methods_alma', 'alma'],
'bancomat' => ['mollie_methods_bancomat', 'bancomat'],
'bancomatpay' => ['mollie_methods_bancomatpay', 'bancomatpay'],
'bancontact' => ['mollie_methods_bancontact', 'bancontact'],
'banktransfer' => ['mollie_methods_banktransfer', 'banktransfer'],
'belfius' => ['mollie_methods_belfius', 'belfius'],
Expand Down
12 changes: 0 additions & 12 deletions Test/Integration/Model/Methods/BancomatTest.php

This file was deleted.

16 changes: 16 additions & 0 deletions Test/Integration/Model/Methods/BancomatpayTest.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\Bancomatpay;

class BancomatpayTest extends AbstractMethodTest
{
protected $instance = Bancomatpay::class;

protected $code = 'bancomatpay';
}
2 changes: 1 addition & 1 deletion Test/Integration/Model/MollieConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testGetConfig()

$this->assertArrayHasKey('mollie_methods_applepay', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_alma', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_bancomat', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_bancomatpay', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_bancontact', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_banktransfer', $result['payment']['image']);
$this->assertArrayHasKey('mollie_methods_belfius', $result['payment']['image']);
Expand Down
2 changes: 1 addition & 1 deletion Test/Integration/Service/Config/PaymentFeeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function isAvailableForMethodProvider()
return [
['mollie_methods_applepay', true],
['mollie_methods_alma', true],
['mollie_methods_bancomat', true],
['mollie_methods_bancomatpay', true],
['mollie_methods_bancontact', true],
['mollie_methods_banktransfer', true],
['mollie_methods_belfius', true],
Expand Down
2 changes: 1 addition & 1 deletion etc/adminhtml/methods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<include path="Mollie_Payment::methods/applepay.xml"/>
<include path="Mollie_Payment::methods/alma.xml"/>
<include path="Mollie_Payment::methods/bancontact.xml"/>
<include path="Mollie_Payment::methods/bancomat.xml"/>
<include path="Mollie_Payment::methods/bancomatpay.xml"/>
<include path="Mollie_Payment::methods/banktransfer.xml"/>
<include path="Mollie_Payment::methods/belfius.xml"/>
<include path="Mollie_Payment::methods/billie.xml"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright Magmodules.eu. All rights reserved.
~ See COPYING.txt for license details.
-->

<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_bancomat" translate="label" type="text" sortOrder="30" showInDefault="1"
<group id="mollie_methods_bancomatpay" translate="label" type="text" sortOrder="30" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Bancomat Pay</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_bancomat/active</config_path>
<config_path>payment/mollie_methods_bancomatpay/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_bancomat/title</config_path>
<config_path>payment/mollie_methods_bancomatpay/title</config_path>
<depends>
<field id="active">1</field>
</depends>
Expand All @@ -22,7 +27,7 @@
showInStore="1">
<label>Method</label>
<source_model>Mollie\Payment\Model\Adminhtml\Source\Method</source_model>
<config_path>payment/mollie_methods_bancomat/method</config_path>
<config_path>payment/mollie_methods_bancomatpay/method</config_path>
<depends>
<field id="active">1</field>
</depends>
Expand All @@ -32,7 +37,7 @@
</field>
<field id="payment_description" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Description</label>
<config_path>payment/mollie_methods_bancomat/payment_description</config_path>
<config_path>payment/mollie_methods_bancomatpay/payment_description</config_path>
<comment model="Mollie\Payment\Model\Adminhtml\Comment\AvailableDescriptionVariables"/>
<depends>
<field id="method">payment</field>
Expand All @@ -43,7 +48,7 @@
showInStore="1">
<label>Days to expire</label>
<frontend_class>validate-digits-range digits-range-1-365</frontend_class>
<config_path>payment/mollie_methods_bancomat/days_before_expire</config_path>
<config_path>payment/mollie_methods_bancomatpay/days_before_expire</config_path>
<depends>
<field id="active">1</field>
<field id="method">order</field>
Expand All @@ -54,7 +59,7 @@
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_bancomat/allowspecific</config_path>
<config_path>payment/mollie_methods_bancomatpay/allowspecific</config_path>
<depends>
<field id="active">1</field>
</depends>
Expand All @@ -64,31 +69,31 @@
<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_bancomat/specificcountry</config_path>
<config_path>payment/mollie_methods_bancomatpay/specificcountry</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/mollie_methods_bancomat/min_order_total</config_path>
<config_path>payment/mollie_methods_bancomatpay/min_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="90" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/mollie_methods_bancomat/max_order_total</config_path>
<config_path>payment/mollie_methods_bancomatpay/max_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="payment_surcharge_type" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge</label>
<config_path>payment/mollie_methods_bancomat/payment_surcharge_type</config_path>
<config_path>payment/mollie_methods_bancomatpay/payment_surcharge_type</config_path>
<source_model>Mollie\Payment\Model\Adminhtml\Source\PaymentFeeType</source_model>
<depends>
<field id="active">1</field>
Expand All @@ -97,7 +102,7 @@
<field id="payment_surcharge_fixed_amount" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge fixed amount</label>
<config_path>payment/mollie_methods_bancomat/payment_surcharge_fixed_amount</config_path>
<config_path>payment/mollie_methods_bancomatpay/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>
Expand All @@ -108,7 +113,7 @@
<field id="payment_surcharge_percentage" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge percentage</label>
<config_path>payment/mollie_methods_bancomat/payment_surcharge_percentage</config_path>
<config_path>payment/mollie_methods_bancomatpay/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>
Expand All @@ -119,7 +124,7 @@
<field id="payment_surcharge_limit" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Payment Surcharge limit</label>
<config_path>payment/mollie_methods_bancomat/payment_surcharge_limit</config_path>
<config_path>payment/mollie_methods_bancomatpay/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>
Expand All @@ -131,7 +136,7 @@
<field id="payment_surcharge_tax_class" translate="label" type="select" sortOrder="140" showInDefault="1"
showInWebsite="1" showInStore="1">
<label>Payment Surcharge Tax Class</label>
<config_path>payment/mollie_methods_bancomat/payment_surcharge_tax_class</config_path>
<config_path>payment/mollie_methods_bancomatpay/payment_surcharge_tax_class</config_path>
<source_model>\Magento\Tax\Model\TaxClass\Source\Product</source_model>
<depends>
<field id="active">1</field>
Expand All @@ -142,7 +147,7 @@
showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/mollie_methods_bancomat/sort_order</config_path>
<config_path>payment/mollie_methods_bancomatpay/sort_order</config_path>
<depends>
<field id="active">1</field>
</depends>
Expand Down
11 changes: 8 additions & 3 deletions etc/config.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<?xml version="1.0"?>
<!--
~ Copyright Magmodules.eu. All rights reserved.
~ See COPYING.txt for license details.
-->

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<payment>
Expand Down Expand Up @@ -109,9 +114,9 @@
<can_authorize_vault>0</can_authorize_vault>
<can_edit>1</can_edit>
</mollie_methods_bancontact>
<mollie_methods_bancomat>
<mollie_methods_bancomatpay>
<active>1</active>
<model>Mollie\Payment\Model\Methods\Bancomat</model>
<model>Mollie\Payment\Model\Methods\Bancomatpay</model>
<title>Bancomat Pay</title>
<payment_description>{ordernumber}</payment_description>
<method>payment</method>
Expand All @@ -127,7 +132,7 @@
<can_authorize>0</can_authorize>
<can_authorize_vault>0</can_authorize_vault>
<can_edit>1</can_edit>
</mollie_methods_bancomat>
</mollie_methods_bancomatpay>
<mollie_methods_banktransfer>
<active>1</active>
<model>Mollie\Payment\Model\Methods\Banktransfer</model>
Expand Down
Loading

0 comments on commit f859be3

Please sign in to comment.