Skip to content

Commit

Permalink
Merge pull request #13 from paynl/feature/PLUG-171
Browse files Browse the repository at this point in the history
Feature/plug 171
  • Loading branch information
woutse authored Jul 23, 2020
2 parents 29761bc + f1f3804 commit d15521f
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 18 deletions.
28 changes: 28 additions & 0 deletions paynl_paymentmethods/controllers/front/notification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

class paynl_paymentmethodsNotificationModuleFrontController extends ModuleFrontController
{

public function initContent()
{
if ($_GET['redirect'] == 1) {
Tools::redirect('index.php?controller=order');
}

$errorMessage = $this->context->cookie->redirect_errors;
$link = Context::getContext()->link->getModuleLink('paynl_paymentmethods', 'notification') . '&redirect=1';

$message = $this->module->l('Probably the order amount is too low or too high for this paymentmethod') . '.</br>';
$message .= $this->module->l('Please try again, or choose another paymentmethod') . '.</br>';
$message .= $this->module->l('Click on the link to continue');

$this->context->smarty->assign('title', $this->module->l('Unfortenately something went wrong'));
$this->context->smarty->assign('proceedurl', $link);
$this->context->smarty->assign('proceed_message', $this->module->l('Proceed'));
$this->context->smarty->assign('messsage', $message);
$this->context->smarty->assign('error_message', $errorMessage);

$this->setTemplate('notification.tpl');
}

}
3 changes: 2 additions & 1 deletion paynl_paymentmethods/controllers/front/payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ public function initContent()
Tools::redirect($result['transaction']['paymentURL']);

} catch (Exception $e) {
echo $e->getMessage();
$this->context->cookie->__set('redirect_errors', $e->getMessage());
Tools::redirect(Context::getContext()->link->getModuleLink('paynl_paymentmethods', 'notification'));
}
//betaling starten
}
Expand Down
26 changes: 12 additions & 14 deletions paynl_paymentmethods/paynl_paymentmethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct()
{
$this->name = 'paynl_paymentmethods';
$this->tab = 'payments_gateways';
$this->version = '3.5.5';
$this->version = '3.5.6';
$this->_postErrors = array();
$this->module_key = '6c2f48f238008e8f68271f5e4763d308';

Expand Down Expand Up @@ -257,23 +257,21 @@ public function hookPayment($params)
$apiGetservice->setApiToken($token);
$apiGetservice->setServiceId($serviceId);

$activeProfiles = $apiGetservice->doRequest();
$activeProfiles = $activeProfiles['paymentOptions'];


$paymentaddress = new Address($params['cart']->id_address_invoice);
$countryid = $paymentaddress->id_country;
$activeProfiles = array();

// Only the profiles of the target country should remain in this array :). (Only when the count is > 0, otherwise it might indicate problems)
if (count($countryExceptions) > 0) {
if (isset($countryExceptions[$countryid])) {
foreach ($activeProfiles as $id => $profile) {
if ( ! isset($countryExceptions[$countryid][$profile['id']])) {
unset($activeProfiles[$id]);
}
}
}
# Only show the paymentmethods which are selected in the settings of the PAY. module
if (isset($countryExceptions[$countryid]) && is_array($countryExceptions[$countryid])) {
$activeProfiles = $apiGetservice->doRequest();
$activeProfiles = $activeProfiles['paymentOptions'];

foreach ($activeProfiles as $id => $profile) {
if (!isset($countryExceptions[$countryid][$profile['id']])) {
unset($activeProfiles[$id]);
}
}
}

// Order remaining profiles based by order...
asort($methodOrder);
Expand Down
8 changes: 8 additions & 0 deletions paynl_paymentmethods/views/templates/front/notification.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<div class="row">
<div id="center_column" class="center_column col-xs-12 col-sm-12">
<h1 class="page-heading bottom-indent">{$title}</h1>
<p>{$messsage}</p>
<p><a href="{$proceedurl}">{$proceed_message}</a></p>
<br><br>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="row">
<div class="row">
<div id="center_column" class="center_column col-xs-12 col-sm-12">
<h1 class="page-heading bottom-indent">Fout bij betaling</h1>
<p>Neem a.u.b. contact met ons op.</p>
Expand Down
4 changes: 2 additions & 2 deletions paynl_paymentmethods/views/templates/front/return_paid.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="row">
<div class="row">
<div id="center_column" class="center_column col-xs-12 col-sm-12">
<h1 class="page-heading bottom-indent">Bedankt voor uw bestelling</h1>
<p>Uw bestelling is ontvangen en zal wordeasdfasdfn verwerkt.</p>
<p>Uw bestelling is ontvangen en zal worden verwerkt.</p>
</div>
</div>

0 comments on commit d15521f

Please sign in to comment.