Skip to content

Commit

Permalink
Merge pull request #25 from logeecom/4.1-4.x
Browse files Browse the repository at this point in the history
Release version 2.0.5
  • Loading branch information
pkrstojevic-logeecom authored Jan 21, 2021
2 parents a4ba7b3 + 2172ea4 commit 0517ba4
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
use Mollie\BusinessLogic\Http\DTO\Amount;
use Mollie\BusinessLogic\Http\DTO\Orders\Order;
use Mollie\BusinessLogic\Http\DTO\Orders\OrderLine;
use Mollie\BusinessLogic\Integration\Event\IntegrationOrderCanceledEvent;
use Mollie\BusinessLogic\Integration\Event\IntegrationOrderLineChangedEvent;
use Mollie\BusinessLogic\Integration\Event\IntegrationOrderTotalChangedEvent;
use Mollie\BusinessLogic\Notifications\NotificationHub;
use Mollie\BusinessLogic\Notifications\NotificationText;
use Mollie\BusinessLogic\OrderReference\OrderReferenceService;
use Mollie\BusinessLogic\PaymentMethod\Model\PaymentMethodConfig;
use Mollie\Gambio\Utility\MollieModuleChecker;
Expand Down Expand Up @@ -71,7 +72,11 @@ private function handleOrderCancel()
{
try {
$orderId = $_POST['gm_multi_status'][0];
$this->_getEventBus()->fire(new IntegrationOrderCanceledEvent($orderId));
NotificationHub::pushInfo(
new NotificationText('mollie.payment.integration.event.notification.order_cancel.title'),
new NotificationText('mollie.payment.integration.event.notification.order_cancel.description'),
$orderId
);
} catch (Exception $exception) {
$langKey = 'mollie.payment.integration.event.notification.order_cancel_error.description';
$this->pushMessage('error', $langKey, $exception);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php

use Mollie\BusinessLogic\Integration\Event\IntegrationOrderCanceledEvent;
use Mollie\Infrastructure\ServiceRegister;
use Mollie\Infrastructure\Utility\Events\EventBus;
use Mollie\BusinessLogic\Notifications\NotificationHub;
use Mollie\BusinessLogic\Notifications\NotificationText;

require_once DIR_FS_CATALOG . '/GXModules/Mollie/Mollie/autoload.php';

Expand Down Expand Up @@ -33,10 +32,13 @@ public function cancelOrder(
StringType $comment = null
) {
try {
/** @var EventBus $eventBus */
$eventBus = ServiceRegister::getService(EventBus::CLASS_NAME);
foreach ($orderIds as $orderId) {
$eventBus->fire(new IntegrationOrderCanceledEvent($orderId));

NotificationHub::pushInfo(
new NotificationText('mollie.payment.integration.event.notification.order_cancel.title'),
new NotificationText('mollie.payment.integration.event.notification.order_cancel.description'),
$orderId
);
}

parent::cancelOrder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
'mollie.payment.integration.event.notification.order_cancel_error.title' => 'Synchronisatie van winkelwijziging mislukt',
'mollie.payment.integration.event.notification.order_cancel_error.description' => 'De bestelling van Mollie kan niet worden geannuleerd. Reactie Mollie API: {api_message}',

'mollie.payment.integration.event.notification.order_cancel.title' => 'Order cancel event detected',
'mollie.payment.integration.event.notification.order_cancel.description' => 'Order cancel is not supported, so this change is not synchronized to the Mollie',

'mollie.payment.integration.event.notification.billing_address_change_error.title' => 'Synchronisatie van winkelwijziging mislukt',
'mollie.payment.integration.event.notification.billing_address_change_error.description' => 'Het factuuradres van de Mollie-bestelling kan niet worden bijgewerkt. Reactie Mollie API: {api_message}',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
'mollie.payment.integration.event.notification.order_cancel_error.title' => 'Shop change synchronization failed',
'mollie.payment.integration.event.notification.order_cancel_error.description' => 'Failed to cancel Mollie order. Mollie api response {api_message}',

'mollie.payment.integration.event.notification.order_cancel.title' => 'Order cancel event detected',
'mollie.payment.integration.event.notification.order_cancel.description' => 'Order cancel is not supported, so this change is not synchronized to the Mollie',

'mollie.payment.integration.event.notification.billing_address_change_error.title' => 'Shop change synchronization failed',
'mollie.payment.integration.event.notification.billing_address_change_error.description' => 'Failed to update billing address on Mollie order. Mollie api response {api_message}',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
'mollie.payment.integration.event.notification.order_cancel_error.title' => 'La synchronisation du changement de magasin a échoué',
'mollie.payment.integration.event.notification.order_cancel_error.description' => "Échec de l'annulation de la commande Mollie. Réponse de l'api Mollie {api_message}",

'mollie.payment.integration.event.notification.order_cancel.title' => 'Order cancel event detected',
'mollie.payment.integration.event.notification.order_cancel.description' => 'Order cancel is not supported, so this change is not synchronized to the Mollie',

'mollie.payment.integration.event.notification.billing_address_change_error.title' => 'La synchronisation du changement de magasin a échoué',
'mollie.payment.integration.event.notification.billing_address_change_error.description' => "Échec de la mise à jour de l'adresse de facturation de la commande Mollie. Réponse de l'api Mollie {api_message}",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
'mollie.payment.integration.event.notification.order_cancel_error.title' => 'Synchronisieren von Shop-Änderungen fehlgeschlagen',
'mollie.payment.integration.event.notification.order_cancel_error.description' => 'Mollie-Bestellung konnte nicht storniert werden. Antwort Mollie-API {api_message}',

'mollie.payment.integration.event.notification.order_cancel.title' => 'Order cancel event detected',
'mollie.payment.integration.event.notification.order_cancel.description' => 'Order cancel is not supported, so this change is not synchronized to the Mollie',

'mollie.payment.integration.event.notification.billing_address_change_error.title' => 'Synchronisieren von Shop-Änderungen fehlgeschlagen',
'mollie.payment.integration.event.notification.billing_address_change_error.description' => 'Aktualisieren der Rechnungsadresse für die Mollie-Bestellung fehlgeschlagen. Antwort Mollie-API {api_message}',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
class ConfigurationService extends Configuration
{
const MOLLIE_GAMBIO_VERSION = '2.0.4';
const MOLLIE_GAMBIO_VERSION = '2.0.5';

/**
* @inheritDoc
Expand Down
9 changes: 9 additions & 0 deletions GXModules/Mollie/Mollie/Shop/Javascripts/mollie-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ var MollieComponents = window.MollieComponents || {};

function getSelectedMethod() {
let selectedMethod = document.querySelector('input[name=payment]:checked');
if (!selectedMethod && isCreditCardOnlyPayment()) {
selectedMethod = document.querySelector('input[name=payment]');
}

return selectedMethod ? selectedMethod.value : null;
}
Expand Down Expand Up @@ -149,6 +152,12 @@ var MollieComponents = window.MollieComponents || {};
function isMounted() {
return document.querySelectorAll('.mollie-component').length > 0;
}

function isCreditCardOnlyPayment() {
let paymentMethods = document.querySelectorAll('li.list-group-item');

return paymentMethods.length === 1 && paymentMethods[0].classList.contains('mollie_creditcard');
}
}

MollieComponents.creditCard = new CreditCardService();
Expand Down
12 changes: 11 additions & 1 deletion GXModules/Mollie/Mollie/Shop/Javascripts/mollie-credit-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,24 @@
return selectedMethod.value === 'mollie_creditcard';
}

selectedMethod = document.querySelector('input[name=payment]');
if (selectedMethod.type === 'hidden') {
return selectedMethod.value === 'mollie_creditcard';
}

return false;
}

function mountIfActive() {
let creditCardWrapper = document.querySelector('.mollie_creditcard');
if (creditCardWrapper && creditCardWrapper.classList.contains('active')) {
let isActive = creditCardWrapper.classList.contains('active') || isCreditCardOnlyPayment();
if (creditCardWrapper && isActive) {
MollieComponents.creditCard.mount(cardWrapper);
}
}

function isCreditCardOnlyPayment() {
return paymentMethods.length === 1 && paymentMethods[0].classList.contains('mollie_creditcard');
}
});
})();
2 changes: 1 addition & 1 deletion GXModules/Mollie/Mollie/Shop/Styles/mollie-credit-card.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.mollie-component-wrapper .form-group--verificationCode {
position: relative;
min-height: 52px;
margin-bottom: 0;
margin: 0;
}

.mollie-component-wrapper label {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{block name="module_checkout_payment_block_list"}
<link rel="stylesheet" href="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Styles/mollie-credit-card.css">
<link rel="stylesheet" href="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Styles/mollie-issuers.css">
<script src="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Javascripts/mollie-applepay.js"></script>
<script src="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Javascripts/mollie-components.js"></script>
<script src="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Javascripts/mollie-credit-card.js"></script>
<script src="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Javascripts/mollie-issuers.js"></script>
<script src="https://js.mollie.com/v1/mollie.js"></script>
<link rel="stylesheet" href="{php} echo \Mollie\Gambio\Utility\UrlProvider::getPluginUrl(){/php}Shop/Styles/mollie-applepay.css">

{$smarty.block.parent}

{/block}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ The payment methods are disabled by default in your account so you firstly need
6. **Check if there is any information in the logfile `Toolbox` » `Show logs`**

# Release notes
*2.0.5*
- Bugfix: Fix issues with mollie components when it is only payment method.
- Bugfix: Add assets files on the checkout for Honeygrid theme.

*2.0.4*
- Bugfix: Use first available language for status name fallback instead of English.

Expand Down

0 comments on commit 0517ba4

Please sign in to comment.