Compare commits

..

2 Commits

Author SHA1 Message Date
ndeet
9e87e5e124
Merge pull request #15 from ndeet/session-check
Some checks failed
Build release artifact. / Build release (release) Has been cancelled
Fix checkout in case session contains outdated order id; bump version.
2023-10-19 14:57:45 +02:00
ndeet
8d27778ced Fix checkout in case session contains outdated order id; bump version. 2023-10-19 14:41:25 +02:00
6 changed files with 25 additions and 2 deletions

View File

@ -25,6 +25,13 @@ class Btcpay extends \Opencart\System\Engine\Controller
true
);
if (isset($this->session->data['error_warning'])) {
$data['error_warning'] = $this->session->data['error_warning'];
unset($this->session->data['error_warning']);
} else {
$data['error_warning'] = '';
}
if ($useModal) {
$host = $this->config->get('payment_btcpay_url');
$data['btcpay_host'] = $host;
@ -63,6 +70,16 @@ class Btcpay extends \Opencart\System\Engine\Controller
$this->session->data['order_id']
);
if (empty($order_info)) {
if ($debug) {
$this->log->write('Could not load order passed by session, order id: ' . $this->session->data['order_id']);
}
$this->session->data['error_warning'] = $this->language->get('session_checkout_order_error');
$this->response->redirect(
$this->url->link('checkout/checkout', '', true)
);
}
$invoiceId = '';
$checkoutLink = '';

View File

@ -6,3 +6,4 @@ $_['invoice_expired_text'] = 'The invoice expired. Please try again or choose a
$_['invoice_closed_text'] = 'Payment aborted. Please try again or choose a different payment method.';
$_['invoice_failed_text'] = 'Payment aborted. Error processing the request. Please contact store owner if the problem persists.';
$_['order_payment_link'] = 'You can check your payment status here: ';
$_['session_checkout_order_error'] = 'Your cart order id could not be found, please try to log out and in again.';

View File

@ -1,3 +1,6 @@
{% if error_warning %}
<div class="alert alert-danger">{{ error_warning }}</div>
{% endif %}
<form action="{{ action }}" method="post">
<div class="buttons">
<div class="text-end">

View File

@ -13,6 +13,8 @@
if (data.invoiceId !== undefined) {
window.btcpay.setApiUrlPrefix('{{ btcpay_host }}');
window.btcpay.showInvoice(data.invoiceId);
} else {
showError('{{ invoice_failed_text }}');
}
let invoice_paid = false;
window.btcpay.onModalReceiveMessage(function (event) {

View File

@ -1,6 +1,6 @@
{
"name": "BTCPay Server payment gateway",
"version": "4.2.1",
"version": "4.2.2",
"license": "MIT",
"author": "BTCPay Server",
"link": "https://btcpayserver.org"

View File

@ -1,3 +1,3 @@
<?php
define('BTCPAY_OPENCART_EXTENSION_VERSION', '4.2.1');
define('BTCPAY_OPENCART_EXTENSION_VERSION', '4.2.2');