Skip to content

Commit

Permalink
Improve return page
Browse files Browse the repository at this point in the history
  • Loading branch information
mollierobbert committed Mar 30, 2015
1 parent e34530b commit 4ad2660
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 123 deletions.
10 changes: 6 additions & 4 deletions admin/view/template/payment/mollie.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@
</td>
<td>
<?php
// Hide the checkbox in case of an error, but don't remove the input entirely to make sure we keep our setting.
$show_checkbox = TRUE;
if (!mb_strlen($mollie_api_key) || !empty($error_api_key))
{
$show_checkbox = FALSE;
echo $text_missing_api_key;
}
elseif (!$payment_method['allowed'])
{
$show_checkbox = FALSE;
echo $text_activate_payment_method;
}
else
{
?>
<input type="checkbox" name="mollie_<?php echo $module_id ?>_status"<?php if ($payment_method['status']) { ?> checked<?php } ?> style="cursor:pointer" />
<?php } ?>
<input type="checkbox" name="mollie_<?php echo $module_id ?>_status"<?php if ($payment_method['status']) { ?> checked<?php } ?> style="cursor:pointer<?php if (!$show_checkbox) { ?>; display:none<?php } ?>" />
</td>
<td>
<input type="text" name="mollie_<?php echo $module_id ?>_sort_order" value="<?php clean_echo($payment_method['sort_order']) ?>" style="text-align:right; max-width:60px" />
Expand Down
10 changes: 6 additions & 4 deletions admin/view/template/payment/mollie_2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,21 @@
</div>
<div class="col-sm-4">
<?php
// Hide the checkbox in case of an error, but don't remove the input entirely to make sure we keep our setting.
$show_checkbox = TRUE;
if (!mb_strlen($mollie_api_key) || !empty($error_api_key))
{
$show_checkbox = FALSE;
echo $text_missing_api_key;
}
elseif (!$payment_method['allowed'])
{
$show_checkbox = FALSE;
echo $text_activate_payment_method;
}
else
{
?>
<input type="checkbox" name="mollie_<?php echo $module_id ?>_status"<?php if ($payment_method['status']) { ?> checked<?php } ?> style="cursor:pointer" />
<?php } ?>
<input type="checkbox" name="mollie_<?php echo $module_id ?>_status"<?php if ($payment_method['status']) { ?> checked<?php } ?> style="cursor:pointer<?php if (!$show_checkbox) { ?>; display:none<?php } ?>" />
</div>
<div class="col-sm-3">
<input type="text" name="mollie_<?php echo $module_id ?>_sort_order" value="<?php clean_echo($payment_method['sort_order']) ?>" class="form-control" style="text-align:right; max-width:60px" />
Expand Down
83 changes: 55 additions & 28 deletions catalog/controller/payment/mollie/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public function payment ()

$amount = round($amount, 2);
$description = str_replace("%", $order['order_id'], html_entity_decode($this->config->get("mollie_ideal_description"), ENT_QUOTES, "UTF-8"));
$return_url = $this->url->link("payment/mollie_" . static::MODULE_NAME . "/callback", "utm_nooverride=1", "SSL");
$return_url = $this->url->link("payment/mollie_" . static::MODULE_NAME . "/callback", "", "SSL");
$issuer = $this->getIssuer();

try
Expand Down Expand Up @@ -379,42 +379,33 @@ public function callback ()
// Now that the customer has returned to our web site, check if we already know if the payment has succeeded. If the payment is all good, we need to clear the cart.
if ($order && $order["order_status_id"] == $this->config->get("mollie_ideal_processing_status_id"))
{
// Redirect to 'success' page.
$this->redirect($this->url->link("checkout/success", "", "SSL"));
return;
}

// When an order could be found, check if Mollie has reported the new status. When the order status is still pending, the report is not delivered yet.
elseif ($order && $order['order_status_id'] == $this->config->get("mollie_ideal_pending_status_id"))
{
$data['message_title'] = $this->language->get("heading_unknown");
$data['message_text'] = $this->language->get("msg_unknown");

if ($this->cart)
{
$this->cart->clear();
}
}

// When no order could be found the session has probably expired. The payment has failed.
else
{
$data['message_title'] = $this->language->get("heading_failed");
$data['message_text'] = $this->language->get("msg_failed");
// Show a 'transaction pending' page.
return $this->showReturnPage(
$this->language->get("heading_unknown"),
$this->language->get("msg_unknown"),
NULL,
FALSE
);
}

$this->document->setTitle($this->language->get("ideal_title"));

$this->setBreadcrumbs($data);

// Render HTML output.
$this->renderTemplate("mollie_return", $data, array(
"column_left",
"column_right",
"content_top",
"content_bottom",
"footer",
"header",
));
// Show a 'transaction failed' page.
return $this->showReturnPage(
$this->language->get("heading_failed"),
$this->language->get("msg_failed")
);
}

/**
Expand All @@ -433,19 +424,55 @@ protected function setBreadcrumbs (&$data)

/**
* @param $message
*
* @return string
*/
protected function showErrorPage ($message)
{
$this->load->language("payment/mollie");

$this->log->write("Error setting up transaction with Mollie: {$message}.");

$data['mollie_error'] = $message;
$data['message'] = $this->language;
return $this->showReturnPage(
$this->language->get("heading_error"),
$this->language->get("text_error"),
$message
);
}

/**
* Render a return page.
*
* @param string $title The title of the status page.
* @param string $body The status message.
* @param string|NULL $api_error Show an API error, if applicable.
* @param bool $show_retry_button Show a retry button that redirects the customer back to the checkout page.
*
* @return string
*/
protected function showReturnPage ($title, $body, $api_error = NULL, $show_retry_button = TRUE)
{
$this->load->language("payment/mollie");

$data['message_title'] = $title;
$data['message_text'] = $body;

if ($api_error)
{
$data['mollie_error'] = $api_error;
}

if ($show_retry_button)
{
$data['checkout_url'] = $this->url->link("checkout/checkout", "", "SSL");
$data['button_retry'] = $this->language->get("button_retry");
}

$this->document->setTitle($this->language->get("ideal_title"));

// Breadcrumbs
$this->setBreadcrumbs($data);

// Render HTML output
return $this->renderTemplate("mollie_payment_error", $data, array(
return $this->renderTemplate("mollie_return", $data, array(
"column_left",
"column_right",
"content_top",
Expand Down
19 changes: 13 additions & 6 deletions catalog/language/dutch/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@
$_['ideal_title'] = 'Uw betaling';
$_['text_title'] = 'Online betalen';
$_['text_redirected'] = 'De klant is doorgestuurd naar het betaalscherm';
$_['msg_failed'] = 'De betaling is mislukt.';
$_['msg_unknown'] = 'We hebben uw betaling nog niet ontvangen. Wij zullen een bevestigingsmail versturen op het moment dat de betaling binnen is.';
$_['heading_failed'] = 'Uw betaling is niet voltooid';
$_['heading_unknown'] = 'Wij wachten nog op uw betaling';
$_['heading_error'] = 'Er is een fout opgetreden bij het opzetten van de betaling.';
$_['text_error'] = 'Er is een fout opgetreden tijdens het opzetten van de betaling bij Mollie:';
$_['text_issuer'] = 'Kies uw bank';
$_['button_retry'] = 'Opnieuw proberen af te rekenen';

// Status page: payment failed (e.g. cancelled).
$_['heading_failed'] = 'Uw betaling is niet voltooid';
$_['msg_failed'] = 'Helaas is de betaling mislukt. Klik op onderstaande knop om terug te keren naar het afrekenscherm.';

// Status page: payment pending.
$_['heading_unknown'] = 'We wachten nog op uw betaling';
$_['msg_unknown'] = 'We hebben uw betaling nog niet ontvangen. Wij zullen een bevestigingsmail versturen op het moment dat de betaling binnen is.';

// Status page: API failure.
$_['heading_error'] = 'Er is een fout opgetreden bij het opzetten van de betaling';
$_['text_error'] = 'Er is een fout opgetreden bij het opzetten van de betaling bij Mollie. Klik op onderstaande knop om terug te keren naar het afrekenscherm.';

// Response
$_['response_success'] = 'De betaling is ontvangen';
Expand Down
17 changes: 12 additions & 5 deletions catalog/language/english/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@
$_['ideal_title'] = 'Your payment';
$_['text_title'] = 'Pay online';
$_['text_redirected'] = 'The client has been referred to the payment screen';
$_['msg_failed'] = 'Unfortunately your payment has failed.';
$_['msg_unknown'] = 'Your payment has not been received yet. We will send you a confirmation email the moment the payment is received.';
$_['text_issuer'] = 'Select your bank';
$_['button_retry'] = 'Return to checkout page';

// Status page: payment failed (e.g. cancelled).
$_['heading_failed'] = 'Your payment has not been completed';
$_['msg_failed'] = 'Unfortunately your payment has failed. Please click the button below to return to the checkout page and retry setting up a payment.';

// Status page: payment pending.
$_['heading_unknown'] = 'Your payment is pending';
$_['heading_error'] = 'An error occurred when setting up the payment.';
$_['text_error'] = 'An error occurred when setting up the payment with Mollie:';
$_['text_issuer'] = 'Select your bank';
$_['msg_unknown'] = 'Your payment has not been received yet. We will send you a confirmation email the moment the payment is received.';

// Status page: API failure.
$_['heading_error'] = 'An error occurred when setting up the payment';
$_['text_error'] = 'An error occurred when setting up the payment with Mollie. Click the button below to return to the checkout page.';

// Response
$_['response_success'] = 'The payment is received';
Expand Down
15 changes: 11 additions & 4 deletions catalog/language/french/payment/mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@
$_['ideal_title'] = 'Votre paiement';
$_['text_title'] = 'Payez en ligne';
$_['text_redirected'] = 'Le client a été renvoyé à l\'écran de paiement';
$_['msg_failed'] = 'Malheureusement, votre paiement est échoué.';
$_['msg_unknown'] = 'Votre paiement n\'a pas encore été reçu. Nous vous enverrons un e-mail de confirmation au moment où le paiement est reçu.';
$_['text_issuer'] = 'Selectionnez votre banque:';
$_['button_retry'] = 'Retour à la page de paiement';

// Status page: payment failed (e.g. cancelled).
$_['heading_failed'] = 'Votre paiement n\'a pas été achevée';
$_['msg_failed'] = 'Malheureusement, votre paiement est échoué.';

// Status page: payment pending.
$_['heading_unknown'] = 'Votre paiement est en attente';
$_['heading_error'] = 'Une erreur s\'est produite lors de la mise en place du paiement.';
$_['msg_unknown'] = 'Votre paiement n\'a pas encore été reçu. Nous vous enverrons un e-mail de confirmation au moment où le paiement est reçu.';

// Status page: API failure.
$_['heading_error'] = 'Une erreur s\'est produite lors de la mise en place du paiement';
$_['text_error'] = 'Une erreur s\'est produite lors de la mise en place du paiement avec Mollie:';
$_['text_issuer'] = 'Selectionnez votre banque:';

// Response
$_['response_success'] = 'Le paiement est reçu';
Expand Down

This file was deleted.

This file was deleted.

8 changes: 8 additions & 0 deletions catalog/view/theme/default/template/payment/mollie_return.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
<br/>

<p><?php clean_echo($message_text) ?></p>

<?php if (isset($mollie_error)) { ?>
<p><code><?php clean_echo($mollie_error) ?></code></p>
<?php } ?>

<?php if (isset($button_retry)) { ?>
<p><a href="<?php clean_echo($checkout_url) ?>" class="button btn btn-primary"><?php clean_echo($button_retry) ?></a></p>
<?php } ?>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
<br/>

<p><?php clean_echo($message_text) ?></p>

<?php if (isset($mollie_error)) { ?>
<p><code><?php clean_echo($mollie_error) ?></code></p>
<?php } ?>

<?php if (isset($button_retry)) { ?>
<p><a href="<?php clean_echo($checkout_url) ?>" class="button btn btn-primary"><?php clean_echo($button_retry) ?></a></p>
<?php } ?>
<?php echo $content_bottom ?>
</div>
<?php echo $column_right ?>
Expand Down

0 comments on commit 4ad2660

Please sign in to comment.