Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# PayWeb_PrestaShop

## Paygate PrestaShop Plugin v1.9.0 for PrestaShop v8.2.0
## Paygate PrestaShop Plugin v1.9.1 for PrestaShop v9.0.0

This is the Paygate PayWeb3 plugin for PrestaShop. Please feel free to contact the Payfast support team at
support@payfast.help should you require any assistance.

## Installation

1. **Download the Latest Release**
- Visit the [releases page](https://github.com/Paygate/PayWeb_PrestaShop/releases) and
download [paygate.zip](https://github.com/Paygate/PayWeb_PrestaShop/releases/download/v1.9.0/paygate.zip).
download [paygate.zip](https://github.com/Armysarge/PayWeb_PrestaShop/releases/download/v1.9.1/paygate.zip).

2. **Install the Plugin**
- Access your PrestaShop admin panel.
Expand Down
25 changes: 14 additions & 11 deletions paygate/classes/methods.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ class PaygateMethodsList

public function getPaygateMethodsList(): array
{
$context = Context::getContext();
$moduleUrl = $context->link->getBaseLink() . 'modules/paygate/';

return [
'creditcard' => [
'name' => 'paygate-paymethod',
'label' => 'Card',
'img' => '../modules/paygate/assets/images/mastercard-visa.svg',
'img' => $moduleUrl . 'assets/images/mastercard-visa.svg',
'ptype' => 'CC',
'ptypedetail' => 'Credit Card',
'type' => 'radio',
Expand All @@ -27,7 +30,7 @@ public function getPaygateMethodsList(): array
'banktransfer' => [
'name' => 'paygate-paymethod',
'label' => 'Bank Transfer',
'img' => '../modules/paygate/assets/images/sid.svg',
'img' => $moduleUrl . 'assets/images/sid.svg',
'ptype' => 'BT',
'ptypedetail' => 'SID',
'type' => 'radio',
Expand All @@ -36,71 +39,71 @@ public function getPaygateMethodsList(): array
'zapper' => [
'name' => 'paygate-paymethod',
'label' => 'Zapper',
'img' => '../modules/paygate/assets/images/zapper.svg',
'img' => $moduleUrl . 'assets/images/zapper.svg',
'ptype' => 'EW',
'ptypedetail' => 'Zapper',
'type' => 'radio',
],
'snapscan' => [
'name' => 'paygate-paymethod',
'label' => 'SnapScan',
'img' => '../modules/paygate/assets/images/snapscan.svg',
'img' => $moduleUrl . 'assets/images/snapscan.svg',
'ptype' => 'EW',
'ptypedetail' => 'SnapScan',
'type' => 'radio',
],
'paypal' => [
'name' => 'paygate-paymethod',
'label' => 'PayPal',
'img' => '../modules/paygate/assets/images/paypal.svg',
'img' => $moduleUrl . 'assets/images/paypal.svg',
'ptype' => 'EW',
'ptypedetail' => 'PayPal',
'type' => 'radio',
],
'mobicred' => [
'name' => 'paygate-paymethod',
'label' => 'MobiCred',
'img' => '../modules/paygate/assets/images/mobicred.svg',
'img' => $moduleUrl . 'assets/images/mobicred.svg',
'ptype' => 'EW',
'ptypedetail' => 'Mobicred',
'type' => 'radio',
],
'momopay' => [
'name' => 'paygate-paymethod',
'label' => 'MomoPay',
'img' => '../modules/paygate/assets/images/momopay.svg',
'img' => $moduleUrl . 'assets/images/momopay.svg',
'ptype' => 'EW',
'ptypedetail' => 'Momopay',
'type' => 'radio',
],
'scantopay' => [
'name' => 'paygate-paymethod',
'label' => 'ScanToPay',
'img' => '../modules/paygate/assets/images/scan-to-pay.svg',
'img' => $moduleUrl . 'assets/images/scan-to-pay.svg',
'ptype' => 'EW',
'ptypedetail' => 'MasterPass',
'type' => 'radio',
],
'applepay' => [
'name' => 'paygate-paymethod',
'label' => 'ApplePay',
'img' => '../modules/paygate/assets/images/apple-pay.svg',
'img' => $moduleUrl . 'assets/images/apple-pay.svg',
'ptype' => 'CC',
'ptypedetail' => 'Applepay',
'type' => 'radio',
],
'rcs' => [
'name' => 'paygate-paymethod',
'label' => 'RCS',
'img' => '../modules/paygate/assets/images/rcs.svg',
'img' => $moduleUrl . 'assets/images/rcs.svg',
'ptype' => 'CC',
'ptypedetail' => 'RCS',
'type' => 'radio',
],
'samsungpay' => [
'name' => 'paygate-paymethod',
'label' => 'SamsungPay',
'img' => '../modules/paygate/assets/images/samsung-pay.svg',
'img' => $moduleUrl . 'assets/images/samsung-pay.svg',
'ptype' => 'EW',
'ptypedetail' => 'Samsungpay',
'type' => 'radio',
Expand Down
82 changes: 58 additions & 24 deletions paygate/paygate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct()
require_once _PS_MODULE_DIR_ . 'paygate/classes/methods.php';
$this->name = 'paygate';
$this->tab = 'payments_gateways';
$this->version = '1.9.0';
$this->version = '1.9.1';
$this->author = 'Paygate';
$this->controllers = array('payment', 'validation');

Expand Down Expand Up @@ -70,10 +70,10 @@ public function install(): bool
`id_vault` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
`id_customer` INT UNSIGNED NOT NULL,
`vault_id` VARCHAR(40) NOT NULL,
`first_six` VARCHAR(10) NOT NULL,
`first_six` VARCHAR(10) NOT NULL,
`last_four` VARCHAR(10) NOT NULL,
`expiry` VARCHAR(10) NOT NULL
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;
'
);

Expand Down Expand Up @@ -184,7 +184,7 @@ public function hookPaymentOptions($params): array
if (!window.ApplePaySession) {
// Apple Pay is not available, so let's hide the specific input element
const applePayElement = document.querySelector('input[value="applepay"]');

if (applePayElement) {
const parentP = applePayElement.closest('tr');
if (parentP) {
Expand All @@ -200,7 +200,7 @@ public function hookPaymentOptions($params): array

});

</script
</script>
HTML;

$paymentOption = new PaymentOption();
Expand All @@ -213,6 +213,34 @@ public function hookPaymentOptions($params): array
return [$paymentOption];
}

/**
* Hook for payment return page
*
* @param array $params
* @return string
*/
public function hookPaymentReturn($params): string
{
if (!$this->active) {
return '';
}

$order = $params['order'];

if (!Validate::isLoadedObject($order)) {
return '';
}

$this->smarty->assign([
'shop_name' => $this->context->shop->name,
'reference' => $order->reference,
'contact_url' => $this->context->link->getPageLink('contact', true),
'status' => 'ok',
]);

return $this->fetch('module:paygate/views/templates/hook/payment_return.tpl');
}

/**
* @throws PrestaShopDatabaseException
* @throws Exception
Expand Down Expand Up @@ -402,6 +430,8 @@ public function getContent(): string

public function renderForm(): string
{
$moduleUrl = $this->context->link->getBaseLink() . 'modules/' . $this->name . '/';

$fields_form = array(
'form' => array(
'legend' => array(
Expand Down Expand Up @@ -480,57 +510,57 @@ public function renderForm(): string
'query' => array(
array(
'id' => 'creditcard',
'name' => 'Credit Cards<img src="../modules/paygate/assets/images/mastercard-visa.svg" alt="Credit Cards" style="height: 15px; margin-left: 10px;">',
'name' => 'Credit Cards<img src="' . $moduleUrl . 'assets/images/mastercard-visa.svg" alt="Credit Cards" style="height: 15px; margin-left: 10px;">',
'val' => 'creditcard',
),
array(
'id' => 'banktransfer',
'name' => 'Bank Transfer<img src="../modules/paygate/assets/images/sid.svg" alt="Bank Transfer" style="height: 15px; margin-left: 10px;">',
'name' => 'Bank Transfer<img src="' . $moduleUrl . 'assets/images/sid.svg" alt="Bank Transfer" style="height: 15px; margin-left: 10px;">',
'val' => 'banktransfer',
),
array(
'id' => 'zapper',
'name' => 'Zapper<img src="../modules/paygate/assets/images/zapper.svg" alt="Zapper" style="height: 15px; margin-left: 10px;">',
'name' => 'Zapper<img src="' . $moduleUrl . 'assets/images/zapper.svg" alt="Zapper" style="height: 15px; margin-left: 10px;">',
'val' => 'zapper',
),
array(
'id' => 'snapscan',
'name' => 'SnapScan<img src="../modules/paygate/assets/images/snapscan.svg" alt="SnapScan" style="height: 15px; margin-left: 10px;">',
'name' => 'SnapScan<img src="' . $moduleUrl . 'assets/images/snapscan.svg" alt="SnapScan" style="height: 15px; margin-left: 10px;">',
'val' => 'snapscan',
),
array(
'id' => 'paypal',
'name' => 'PayPal<img src="../modules/paygate/assets/images/paypal.svg" alt="PayPal" style="height: 15px; margin-left: 10px;">',
'name' => 'PayPal<img src="' . $moduleUrl . 'assets/images/paypal.svg" alt="PayPal" style="height: 15px; margin-left: 10px;">',
'val' => 'paypal',
),
array(
'id' => 'mobicred',
'name' => 'MobiCred<img src="../modules/paygate/assets/images/mobicred.svg" alt="MobiCred" style="height: 15px; margin-left: 10px;">',
'name' => 'MobiCred<img src="' . $moduleUrl . 'assets/images/mobicred.svg" alt="MobiCred" style="height: 15px; margin-left: 10px;">',
'val' => 'mobicred',
),
array(
'id' => 'momopay',
'name' => 'MomoPay<img src="../modules/paygate/assets/images/momopay.svg" alt="MomoPay" style="height: 15px; margin-left: 10px;">',
'name' => 'MomoPay<img src="' . $moduleUrl . 'assets/images/momopay.svg" alt="MomoPay" style="height: 15px; margin-left: 10px;">',
'val' => 'momopay',
),
array(
'id' => 'scantopay',
'name' => 'ScanToPay<img src="../modules/paygate/assets/images/scan-to-pay.svg" alt="ScanToPay" style="height: 15px; margin-left: 10px;">',
'name' => 'ScanToPay<img src="' . $moduleUrl . 'assets/images/scan-to-pay.svg" alt="ScanToPay" style="height: 15px; margin-left: 10px;">',
'val' => 'scantopay',
),
array(
'id' => 'applepay',
'name' => 'ApplePay<img src="../modules/paygate/assets/images/apple-pay.svg" alt="ApplePay" style="height: 15px; margin-left: 10px;">',
'name' => 'ApplePay<img src="' . $moduleUrl . 'assets/images/apple-pay.svg" alt="ApplePay" style="height: 15px; margin-left: 10px;">',
'val' => 'applepay',
),
array(
'id' => 'rcs',
'name' => 'RCS<img src="../modules/paygate/assets/images/rcs.svg" alt="RCS" style="height: 15px; margin-left: 10px;">',
'name' => 'RCS<img src="' . $moduleUrl . 'assets/images/rcs.svg" alt="RCS" style="height: 15px; margin-left: 10px;">',
'val' => 'rcs',
),
array(
'id' => 'samsungpay',
'name' => 'SamsungPay<img src="../modules/paygate/assets/images/samsung-pay.svg" alt="SamsungPay" style="height: 15px; margin-left: 10px;">',
'name' => 'SamsungPay<img src="' . $moduleUrl . 'assets/images/samsung-pay.svg" alt="SamsungPay" style="height: 15px; margin-left: 10px;">',
'val' => 'samsungpay',
),
),
Expand Down Expand Up @@ -1099,14 +1129,18 @@ private function _postProcess(): void
*/
public function hookDisplayCustomerAccount(): false|string
{
$this->context->smarty->assign(
'card',
$this->context->link->getModuleLink('paygate', 'payvault'),
);
$this->context->smarty->assign(
'tokenization',
Configuration::get('PAYGATE_PAY_VAULT'),
);
// Only show if PayVault is enabled
if ((int)Configuration::get('PAYGATE_PAY_VAULT') !== 1) {
return '';
}

$this->context->smarty->assign([
'card' => [
'value' => $this->context->link->getModuleLink('paygate', 'payvault'),
],
'tokenization' => (int)Configuration::get('PAYGATE_PAY_VAULT'),
'base_dir' => _PS_BASE_URL_.__PS_BASE_URI__,
]);

return $this->context->smarty
->fetch('module:paygate/views/templates/front/payvault.tpl');
Expand Down
2 changes: 1 addition & 1 deletion paygate/views/templates/front/payvault.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Released under the GNU General Public License
*}
<a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" id="paygatecards" href="{$base_dir}/module/paygate/payvault" title="My cards">
<a class="col-lg-4 col-md-6 col-sm-6 col-xs-12" id="paygatecards" href="{$card.value|escape:'html':'UTF-8'}" title="My cards">
<span class="link-item">
<i class="material-icons" style="padding-left: 55px;">creditcard</i>
My Cards
Expand Down
21 changes: 21 additions & 0 deletions paygate/views/templates/hook/payment_return.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{*
* Copyright (c) 2025 Payfast (Pty) Ltd
*
* Author: App Inlet (Pty) Ltd
*
* Released under the GNU General Public License
*}

<div class="box">
<h3 class="page-subheading">{l s='Your order on %s is complete.' sprintf=[$shop_name] d='Modules.Paygate.Shop'}</h3>
<p>
<strong>{l s='Your order reference:' d='Modules.Paygate.Shop'}</strong>
<span>{$reference}</span>
</p>
<p>
{l s='An email has been sent with this information.' d='Modules.Paygate.Shop'}
<br>
{l s='If you have questions, comments or concerns, please contact our' d='Modules.Paygate.Shop'}
<a href="{$contact_url}">{l s='expert customer support team' d='Modules.Paygate.Shop'}</a>.
</p>
</div>