Skip to content

Commit

Permalink
Hide default payment approved message when it is not. (#26)
Browse files Browse the repository at this point in the history
## [3.8.2 (2023-10-27)](3.8.1...3.8.2)

### Added

- Hide default payment approved message when it is not.
  • Loading branch information
freddiegar authored Oct 27, 2023
1 parent 7e310ec commit 3309ee7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [3.8.2 (2023-10-27)](https://github.com/placetopay/prestashop-placetopay/compare/3.8.1...3.8.2)

### Added

- Hide default payment approved message when it is not.

## [3.8.1 (2023-08-23)](https://github.com/placetopay/prestashop-placetopay/compare/3.8.0...3.8.1)

### Added
Expand Down
11 changes: 8 additions & 3 deletions src/Models/PlacetoPayPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class PlacetoPayPayment extends PaymentModule
const PAGE_HOME = '';

const MIN_VERSION_PS = '1.6.1.0';
const MAX_VERSION_PS = '1.7.8.8';
const MAX_VERSION_PS = '1.7.8.10';

/**
* @var string
Expand All @@ -122,7 +122,7 @@ class PlacetoPayPayment extends PaymentModule
public function __construct()
{
$this->name = getModuleName();
$this->version = '3.8.1';
$this->version = '3.8.2';

$this->tab = 'payments_gateways';

Expand Down Expand Up @@ -2260,6 +2260,7 @@ final private function getStatusPayment(RedirectInformation $response): int
final private function getPaymentPSEList($customerId)
{
$orders = self::getCustomerOrders($customerId);
$isPaid = false;

if ($orders) {
foreach ($orders as &$order) {
Expand All @@ -2268,13 +2269,17 @@ final private function getPaymentPSEList($customerId)
$order['virtual'] = $myOrder->isVirtual(false);
}
}

$lastOrder = new Order((int)$orders[0]['id_order']);
$isPaid = $lastOrder->getCurrentOrderState()->paid;
}

$this->context->smarty->assign([
'orders' => $orders,
'invoiceAllowed' => (int)Configuration::get('PS_INVOICE'),
'reorderingAllowed' => !(bool)Configuration::get('PS_DISALLOW_HISTORY_REORDERING'),
'slowValidation' => Tools::isSubmit('slowvalidation')
'slowValidation' => Tools::isSubmit('slowvalidation'),
'isPaid' => $isPaid
]);

return $this->display($this->getThisModulePath(), fixPath('/views/templates/front/history.tpl'));
Expand Down
7 changes: 7 additions & 0 deletions views/templates/front/history.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
{/capture}

<h1 class="page-heading bottom-indent">{l s='Order history'}</h1>
{if !$isPaid}
<style>
#content-hook_order_confirmation {
display: none;
}
</style>
{/if}
<p class="info-title">{l s='Here are the orders you\'ve placed since your account was created.'}</p>
{if $slowValidation}
<p class="alert alert-warning">{l s='If you have just placed an order, it may take a few minutes for it to be validated. Please refresh this page if your order is missing.'}</p>
Expand Down

0 comments on commit 3309ee7

Please sign in to comment.