Skip to content

Commit

Permalink
Merge pull request #5 from appinlet/release/3.0.5
Browse files Browse the repository at this point in the history
Release/3.0.5
  • Loading branch information
appinlet authored May 16, 2021
2 parents 486e08e + 61b0c78 commit 886dc1b
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 76 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# PayWeb_OpenCart
## PayGate OpenCart plugin v3.0.4 for OpenCart v3.0.3.6
## PayGate OpenCart plugin v3.0.5 for OpenCart v3.0.3.7

This is the PayGate PayWeb3 plugin for OpenCart. Please feel free to contact the PayGate support team at support@paygate.co.za should you require any assistance.

## Installation
[![How To Setup PayGate PayWeb for OpenCart](https://appinlet.com/wp-content/uploads/2021/01/How-To-Setup-PayGate-PayWeb-for-OpenCart.jpg)](https://www.youtube.com/watch?v=vP457DVuhGc "How To Setup PayGate PayWeb for OpenCart")

Please navigate to the [releases page](https://github.com/PayGate/PayWeb_OpenCart/releases), download the latest release (v3.0.4) and unzip. You will then be able to follow the integration guide PDF which is included in the zip.
Please navigate to the [releases page](https://github.com/PayGate/PayWeb_OpenCart/releases), download the latest release (v3.0.5) and unzip. You will them be able to follow the integration guide PDF which is included in the zip.

## Collaboration

Expand Down
27 changes: 17 additions & 10 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
=====================================
Date : Version: Description
=====================================

2017-10-18: v3.0.0 : Initial release.
2018-06-29: v3.0.1 : Fix minor bug with GeoZone.
Fix auto install.
2018-11-27: v3.0.2 : Include order number in reference.
Improve order processing workflow.
Handle email not set on checkout.
2019-10-22: v3.0.3 : Retain checkout cart on failed transaction.
Test with 3.0.3.2.
2021-05-16: v3.0.5 : Tested on 3.0.3.7.
Improve clear or restore cart handling.
Remove iFrame option.
Add SnapScan to payment types.

2020-11-04: v3.0.4 : Combine iFrame and Redirect implementations.
Add 'Disable IPN' feature.
Add' Test Mode' feature.
Remove session in redirect callback for improved reliability.
Add 'Payment Types' feature.
Add 'Payment Types' feature.

2019-10-22: v3.0.3 : Retain checkout cart on failed transaction.
Test with 3.0.3.2.

2018-11-27: v3.0.2 : Include order number in reference.
Improve order processing workflow.
Handle email not set on checkout.

2018-06-29: v3.0.1 : Fix minor bug with GeoZone.
Fix auto install.

2017-10-18: v3.0.0 : Initial release.
12 changes: 5 additions & 7 deletions upload/admin/controller/extension/payment/paygate.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function index()
$data['entry_status'] = $this->language->get( 'entry_status' );
$data['entry_sort_order'] = $this->language->get( 'entry_sort_order' );
$data['entry_notify_redirect'] = $this->language->get( 'entry_notify_redirect' );
$data['entry_iframe'] = $this->language->get( 'entry_iframe' );

$data['tab_general'] = $this->language->get( 'tab_general' );
$data['tab_order_status'] = $this->language->get( 'tab_order_status' );
Expand Down Expand Up @@ -182,12 +181,6 @@ public function index()
$data['payment_paygate_notifyredirect'] = $this->config->get( 'payment_paygate_notifyredirect' );
}

if ( isset( $this->request->post['payment_paygate_iframe'] ) ) {
$data['payment_paygate_iframe'] = $this->request->post['payment_paygate_iframe'];
} else {
$data['payment_paygate_iframe'] = $this->config->get( 'payment_paygate_iframe' );
}

if ( isset( $this->request->post['payment_paygate_creditcardmethod'] ) ) {
$data['payment_paygate_creditcardmethod'] = $this->request->post['payment_paygate_creditcardmethod'];
} else {
Expand All @@ -205,6 +198,11 @@ public function index()
} else {
$data['payment_paygate_zappermethod'] = $this->config->get( 'payment_paygate_zappermethod' );
}
if ( isset( $this->request->post['payment_paygate_snapscanmethod'] ) ) {
$data['payment_paygate_snapscanmethod'] = $this->request->post['payment_paygate_snapscanmethod'];
} else {
$data['payment_paygate_snapscanmethod'] = $this->config->get( 'payment_paygate_snapscanmethod' );
}

if ( isset( $this->request->post['payment_paygate_mobicredmethod'] ) ) {
$data['payment_paygate_mobicredmethod'] = $this->request->post['payment_paygate_mobicredmethod'];
Expand Down
4 changes: 1 addition & 3 deletions upload/admin/language/en-gb/extension/payment/paygate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
$_['text_extension'] = 'Extensions';
$_['text_notify'] = 'Disabled';
$_['text_redirect'] = 'Enabled';
$_['text_iframe'] = 'iFrame';
$_['text_noframe'] = 'Redirect';
$_['text_testmode'] = 'Enabled';
$_['text_livemode'] = 'Disabled';
$_['text_methodyes'] = 'Enable Payment Type';
Expand All @@ -37,11 +35,11 @@
$_['entry_failed_status'] = 'Failed';
$_['entry_cancelled_status'] = 'Cancelled';
$_['entry_notify_redirect'] = 'Disable IPN';
$_['entry_iframe'] = 'Implementation';
$_['entry_testmode'] = 'Test Mode';
$_['entry_creditcardmethod'] = 'Enable Card on Checkout';
$_['entry_banktransfermethod'] = 'Enable SiD Secure EFT on Checkout';
$_['entry_zappermethod'] = 'Enable Zapper on Checkout';
$_['entry_snapscanmethod'] = 'Enable SnapScan on Checkout';
$_['entry_mobicredmethod'] = 'Enable Mobicred on Checkout';
$_['entry_momopaymethod'] = 'Enable MoMoPay on Checkout';
$_['entry_masterpassmethod'] = 'Enable MasterPass on Checkout';
Expand Down
28 changes: 14 additions & 14 deletions upload/admin/view/template/extension/payment/paygate.twig
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="input-iframe">{{ entry_iframe }}</label>
<div class="col-sm-10">
<select name="payment_paygate_iframe" id="input-iframe" class="form-control">
{% if payment_paygate_iframe == 'iframe' %}
<option value="iframe" selected="selected">{{ text_iframe }}</option>
<option value="noframe">{{ text_noframe }}</option>
{% else %}
<option value="iframe">{{ text_iframe }}</option>
<option value="noframe" selected="selected">{{ text_noframe }}</option>
{% endif %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"
for="input-sort-order">{{ entry_sort_order }}</label>
Expand Down Expand Up @@ -263,6 +249,20 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="input-snapscanmethod">{{ entry_snapscanmethod }}</label>
<div class="col-sm-8">
<select name="payment_paygate_snapscanmethod" id="input-snapscanmethod" class="form-control">
{% if payment_paygate_snapscanmethod == 'yes' %}
<option value="yes" selected="selected">{{ text_methodyes }}</option>
<option value="no">{{ text_methodno }}</option>
{% else %}
<option value="yes">{{ text_methodyes }}</option>
<option value="no" selected="selected">{{ text_methodno }}</option>
{% endif %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="input-mobicredmethod">{{ entry_mobicredmethod }}</label>
<div class="col-sm-8">
Expand Down
61 changes: 24 additions & 37 deletions upload/catalog/controller/extension/payment/paygate.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function index()
'title' => 'Zapper',
'img' => $imgs . 'zapper.svg',
],
'snapscanmethod' => [
'title' => 'SnapScan',
'img' => $imgs . 'snapscan.svg',
],
'mobicredmethod' => [
'title' => 'Mobicred',
'img' => $imgs . 'mobicred.svg',
Expand Down Expand Up @@ -88,6 +92,9 @@ public function index()
case 'zappermethod':
$PAY_METHOD_DETAIL = 'Zapper';
break;
case 'snapscanmethod':
$PAY_METHOD_DETAIL = 'SnapScan';
break;
case 'mobicredmethod':
$PAY_METHOD_DETAIL = 'Mobicred';
break;
Expand Down Expand Up @@ -115,7 +122,6 @@ public function index()
$reference = filter_var( $order_info['order_id'], FILTER_SANITIZE_STRING );
$amount = filter_var( $preAmount, FILTER_SANITIZE_NUMBER_INT );
$currency = '';
$useIframe = filter_var( $this->config->get( 'payment_paygate_iframe' ), FILTER_SANITIZE_STRING ) === 'iframe';

if ( $this->config->get( 'config_currency' ) != '' ) {
$currency = filter_var( $this->config->get( 'config_currency' ), FILTER_SANITIZE_STRING );
Expand Down Expand Up @@ -265,34 +271,8 @@ public function index()
}

if ( $order_info['payment_code'] === 'paygate' ) {
if ( $useIframe ) {
echo <<<HTML
<script type="text/javascript">
let style = document.createElement('link');
style.setAttribute('rel', 'stylesheet');
style.setAttribute('href', 'catalog/view/theme/paygate/stylesheet/stylesheet.css');
document.getElementsByTagName('head')[0].appendChild(style)
</script>
<div id="pw3PayPopup">
<div id="pw3PayPopupContent">
<form name="form" id="pw3form" class="form-horizontal text-left"
action="https://secure.paygate.co.za/payweb3/process.trans" method="post" target="pw3Iframe">
<input type="hidden" name="PAY_REQUEST_ID" value="$data[PAY_REQUEST_ID]"/>
<input type="hidden" name="CHECKSUM" value="$data[CHECKSUM]"/>
<div class="buttons" hidden>
<div class="pull-right"><input type="submit" value="Confirm" id="button-confirm"
class="btn btn-primary"/>
</div>
</div>
</form>
<iframe name="pw3Iframe" id="pw3PayPopupFrame" src="#"></iframe>
<script type="text/javascript">document.getElementById("pw3form").submit()</script>
</div>
</div>
HTML;
return;
} else {
echo <<<HTML
$this->cart->clear();
echo <<<HTML
<form name="form" id="pw3form" class="form-horizontal text-left"
action="https://secure.paygate.co.za/payweb3/process.trans" method="post">
<input type="hidden" name="PAY_REQUEST_ID" value="$data[PAY_REQUEST_ID]"/>
Expand All @@ -308,13 +288,8 @@ class="btn btn-primary"/>
<script type="text/javascript">$("#button-confirm").trigger('click');</script>
HTML;
return;
}
} else {
if ( $useIframe ) {
return $this->load->view( 'extension/payment/paygate', $data );
} else {
return $this->load->view( 'extension/payment/paygate_redirect', $data );
}
return $this->load->view( 'extension/payment/paygate_redirect', $data );
}
}

Expand Down Expand Up @@ -357,6 +332,7 @@ public function paygate_return()
$this->load->model( 'account/activity' );
$this->load->model( 'checkout/order' );
$order = $this->model_checkout_order->getOrder( $orderId );
$products = $this->model_checkout_order->getOrderProducts( $orderId );

if ( $this->customer->isLogged() ) {
$activity_data = array(
Expand Down Expand Up @@ -454,9 +430,20 @@ public function paygate_return()
$resultsComment = 'Transaction status verification failed. No transaction status. Please contact the shop owner to confirm transaction status.';
}

if ( $statusDesc == 'approved' ) {
$this->cart->clear();
if ( $statusDesc !== 'approved' ) {
// Restore the cart which has already been cleared
if(is_array($products)){
foreach ($products as $product){
$options = $this->model_checkout_order->getOrderOptions($orderId, $product['order_product_id']);
$option = [];
if(is_array($options) && count($options) > 0){
$option = $options;
}
$this->cart->add($product['product_id'], $product['quantity'], $option);
}
}
}

if ( $useRedirect ) {
$this->model_checkout_order->addOrderHistory(
$orderId,
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/model/extension/payment/paygate.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function getMethod( $address, $total )
'creditcardmethod' => 'Card',
'banktransfermethod' => 'SiD Secure EFT',
'zappermethod' => 'Zapper',
'snapscanmethod' => 'SnapScan',
'mobicredmethod' => 'Mobicred',
'momopaymethod' => 'MoMoPay',
'masterpassmethod' => 'MasterPass',
Expand Down
1 change: 1 addition & 0 deletions upload/catalog/view/theme/default/image/snapscan.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div id="pw3PayPopup">
<div id="pw3PayPopupContent">
<form name="form" id="pw3form" class="form-horizontal text-left"
action="{{ 'https://secure.paygate.co.za/payweb3/process.trans' }}" method="post" target="pw3Iframe">
action="{{ 'https://secure.paygate.co.za/payweb3/process.trans' }}" method="post" >
<input type="hidden" name="PAY_REQUEST_ID" value="{{ PAY_REQUEST_ID }}"/>
<input type="hidden" name="CHECKSUM" value="{{ CHECKSUM }}"/>
<div class="buttons">
Expand All @@ -20,7 +20,6 @@
</div>
</div>
</form>
<iframe name="pw3Iframe" id="pw3PayPopupFrame" src="#"></iframe>
<script type="text/javascript">{{ document.getElementById("pw3form").submit() }}</script>
<script type="text/javascript">$("#button-confirm").hide();</script>
<script type="text/javascript">$("#button-confirm").trigger('click');</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</label>
</td>
<td>
<td align="right">
<img height="20px" src="{{ pay_method.img }}" alt="{{ pay_method.title }}">
</td>
</tr>
Expand Down

0 comments on commit 886dc1b

Please sign in to comment.