Skip to content

Commit

Permalink
Merge pull request #65 from mollie/1.3.5
Browse files Browse the repository at this point in the history
1.3.5 - Giropay, EPS, uncancel and iDEAL issuer fix
  • Loading branch information
Marvin-Magmodules authored Jun 29, 2018
2 parents 3795316 + bf0dc3e commit 2d70fc7
Show file tree
Hide file tree
Showing 16 changed files with 264 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ public function getAllActiveMethods($storeId)
'mollie_methods_paysafecard',
'mollie_methods_sofort',
'mollie_methods_inghomepay',
'mollie_methods_giropay',
'mollie_methods_eps',
'mollie_methods_giftcard'
];

Expand Down
33 changes: 33 additions & 0 deletions Model/Methods/Eps.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright © 2018 Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Model\Mollie;

/**
* Class Eps
*
* @package Mollie\Payment\Model\Methods
*/
class Eps extends Mollie
{

/**
* Payment method code
*
* @var string
*/
protected $_code = 'mollie_methods_eps';

/**
* Info instructions block path
*
* @var string
*/
protected $_infoBlockType = 'Mollie\Payment\Block\Info\Base';

}
33 changes: 33 additions & 0 deletions Model/Methods/Giropay.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* Copyright © 2018 Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Model\Mollie;

/**
* Class Giropay
*
* @package Mollie\Payment\Model\Methods
*/
class Giropay extends Mollie
{

/**
* Payment method code
*
* @var string
*/
protected $_code = 'mollie_methods_giropay';

/**
* Info instructions block path
*
* @var string
*/
protected $_infoBlockType = 'Mollie\Payment\Block\Info\Base';

}
26 changes: 26 additions & 0 deletions Model/Mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,10 @@ public function processTransaction($orderId, $type = 'webhook')

if (!$payment->getIsTransactionClosed() && $type == 'webhook') {

if ($order->isCanceled()) {
$order = $this->uncancelOrder($order);
}

if (abs($amount - $orderAmount['value']) < 0.01) {
$payment->setTransactionId($transactionId);
$payment->setCurrencyCode($order->getBaseCurrencyCode());
Expand Down Expand Up @@ -501,6 +505,28 @@ protected function cancelOrder($order, $status = null)
return false;
}

/**
* @param \Magento\Sales\Model\Order $order
*
* @return \Magento\Sales\Model\Order
*/
public function uncancelOrder($order)
{
try {
$status = $this->mollieHelper->getStatusPending($order->getStoreId());
$message = __('Order uncanceled by webhook.');
$order->setState(Order::STATE_NEW);
$order->addStatusToHistory($status, $message, true)->save();
foreach ($order->getAllItems() as $item) {
$item->setQtyCanceled(0)->save();
}
} catch (\Exception $e) {
$this->mollieHelper->addTolog('error', $e->getMessage());
}

return $order;
}

/**
* @param DataObject $data
*
Expand Down
2 changes: 2 additions & 0 deletions Model/MollieConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class MollieConfigProvider implements ConfigProviderInterface
'mollie_methods_paysafecard',
'mollie_methods_sofort',
'mollie_methods_inghomepay',
'mollie_methods_giropay',
'mollie_methods_eps',
'mollie_methods_giftcard'
];
/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mollie/magento2",
"description": "Mollie Payment Module for Magento 2",
"version": "1.3.4",
"version": "1.3.5",
"require": {
"php": "~5.6.5|7.0.2|7.0.4|~7.0.6|~7.1.0",
"mollie/mollie-api-php": "^2.0"
Expand Down
2 changes: 2 additions & 0 deletions etc/adminhtml/methods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@
<include path="Mollie_Payment::methods/paysafecard.xml"/>
<include path="Mollie_Payment::methods/sofort.xml"/>
<include path="Mollie_Payment::methods/inghomepay.xml"/>
<include path="Mollie_Payment::methods/giropay.xml"/>
<include path="Mollie_Payment::methods/eps.xml"/>
<include path="Mollie_Payment::methods/giftcard.xml"/>
</include>
66 changes: 66 additions & 0 deletions etc/adminhtml/methods/eps.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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_eps" translate="label" type="text" sortOrder="14" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>EPS</label>
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/mollie_methods_eps/active</config_path>
</field>
<field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Title</label>
<config_path>payment/mollie_methods_eps/title</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="96" 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_eps/allowspecific</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="97" 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_eps/specificcountry</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/mollie_methods_eps/min_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/mollie_methods_eps/max_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/mollie_methods_eps/sort_order</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
</group>
</include>
2 changes: 1 addition & 1 deletion etc/adminhtml/methods/giftcard.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_giftcard" translate="label" type="text" sortOrder="13" showInDefault="1" showInWebsite="1"
<group id="mollie_methods_giftcard" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Giftcard</label>
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
Expand Down
66 changes: 66 additions & 0 deletions etc/adminhtml/methods/giropay.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?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_giropay" translate="label" type="text" sortOrder="13" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Giropay</label>
<field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Enabled</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<config_path>payment/mollie_methods_giropay/active</config_path>
</field>
<field id="title" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Title</label>
<config_path>payment/mollie_methods_giropay/title</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="96" 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_giropay/allowspecific</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="specificcountry" translate="label" type="multiselect" sortOrder="97" 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_giropay/specificcountry</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="min_order_total" translate="label" type="text" sortOrder="98" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Minimum Order Total</label>
<config_path>payment/mollie_methods_giropay/min_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="max_order_total" translate="label" type="text" sortOrder="99" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Maximum Order Total</label>
<config_path>payment/mollie_methods_giropay/max_order_total</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
<field id="sort_order" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Sort Order</label>
<frontend_class>validate-number</frontend_class>
<config_path>payment/mollie_methods_giropay/sort_order</config_path>
<depends>
<field id="active">1</field>
</depends>
</field>
</group>
</include>
16 changes: 16 additions & 0 deletions etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@
<allowspecific>0</allowspecific>
<instructions/>
</mollie_methods_inghomepay>
<mollie_methods_giropay>
<active>0</active>
<model>Mollie\Payment\Model\Methods\Giropay</model>
<title>Giropay</title>
<payment_action>order</payment_action>
<allowspecific>0</allowspecific>
<instructions/>
</mollie_methods_giropay>
<mollie_methods_eps>
<active>0</active>
<model>Mollie\Payment\Model\Methods\Eps</model>
<title>EPS</title>
<payment_action>order</payment_action>
<allowspecific>0</allowspecific>
<instructions/>
</mollie_methods_eps>
<mollie_methods_giftcard>
<active>0</active>
<model>Mollie\Payment\Model\Methods\Giftcard</model>
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mollie_Payment" setup_version="1.3.4" />
<module name="Mollie_Payment" setup_version="1.3.5" />
</config>
6 changes: 6 additions & 0 deletions etc/payment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<method name="mollie_methods_inghomepay">
<allow_multiple_address>0</allow_multiple_address>
</method>
<method name="mollie_methods_giropay">
<allow_multiple_address>0</allow_multiple_address>
</method>
<method name="mollie_methods_eps">
<allow_multiple_address>0</allow_multiple_address>
</method>
<method name="mollie_methods_giftcard">
<allow_multiple_address>0</allow_multiple_address>
</method>
Expand Down
6 changes: 6 additions & 0 deletions view/frontend/layout/checkout_index_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<item name="mollie_methods_inghomepay" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="mollie_methods_giropay" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="mollie_methods_eps" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
<item name="mollie_methods_giftcard" xsi:type="array">
<item name="isBillingAddressRequired" xsi:type="boolean">true</item>
</item>
Expand Down
2 changes: 2 additions & 0 deletions view/frontend/web/js/view/payment/method-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ define(
{type: 'mollie_methods_paysafecard', component: defaultComponent},
{type: 'mollie_methods_sofort', component: defaultComponent},
{type: 'mollie_methods_inghomepay', component: defaultComponent},
{type: 'mollie_methods_giropay', component: defaultComponent},
{type: 'mollie_methods_eps', component: defaultComponent},
{type: 'mollie_methods_giftcard', component: giftcardComponent}
];
$.each(methods, function (k, method) {
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/view/payment/method-renderer/ideal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ define(
{
defaults: {
template: 'Mollie_Payment/payment/ideal',
selectedIssuer: ko.observable()
selectedIssuer: null
},
getIssuers: function () {
return checkoutConfig.issuers[this.item.method];
Expand Down

0 comments on commit 2d70fc7

Please sign in to comment.