From 1b9b5f306becc508e49adaa72b9d15bed5cc8dc0 Mon Sep 17 00:00:00 2001 From: Bruce Atkinson Date: Thu, 5 Nov 2020 02:43:12 +0200 Subject: [PATCH 1/2] 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. --- README.md | 4 +- .../controller/extension/payment/paygate.php | 98 ++- .../en-gb/extension/payment/paygate.php | 48 +- upload/admin/view/image/payment/paygate.gif | Bin 2303 -> 0 bytes upload/admin/view/image/payment/paygate.png | Bin 0 -> 1203 bytes .../template/extension/payment/paygate.twig | 141 ++++- .../controller/extension/payment/paygate.php | 558 +++++++++++++----- .../language/en-gb/checkout/paygate.php | 6 +- .../en-gb/extension/payment/paygate.php | 6 +- .../model/extension/payment/paygate.php | 24 +- .../theme/default/image/mastercard-visa.svg | 1 + .../view/theme/default/image/masterpass.svg | 1 + .../view/theme/default/image/mobicred.svg | 1 + .../view/theme/default/image/momopay.svg | 1 + .../view/theme/default/image/paygate.gif | Bin 2634 -> 0 bytes .../view/theme/default/image/paygate.png | Bin 0 -> 1203 bytes .../catalog/view/theme/default/image/sid.svg | 1 + .../view/theme/default/image/zapper.svg | 1 + .../template/checkout/payment_method.twig | 47 ++ .../template/common/paygate_success.twig | 31 + .../template/extension/payment/paygate.twig | 52 +- .../payment/paygate_payment_method.twig | 43 ++ .../extension/payment/paygate_redirect.twig | 36 ++ .../theme/paygate/stylesheet/stylesheet.css | 65 ++ 24 files changed, 936 insertions(+), 229 deletions(-) delete mode 100755 upload/admin/view/image/payment/paygate.gif create mode 100644 upload/admin/view/image/payment/paygate.png create mode 100644 upload/catalog/view/theme/default/image/mastercard-visa.svg create mode 100644 upload/catalog/view/theme/default/image/masterpass.svg create mode 100644 upload/catalog/view/theme/default/image/mobicred.svg create mode 100644 upload/catalog/view/theme/default/image/momopay.svg delete mode 100755 upload/catalog/view/theme/default/image/paygate.gif create mode 100644 upload/catalog/view/theme/default/image/paygate.png create mode 100644 upload/catalog/view/theme/default/image/sid.svg create mode 100644 upload/catalog/view/theme/default/image/zapper.svg create mode 100755 upload/catalog/view/theme/default/template/checkout/payment_method.twig create mode 100755 upload/catalog/view/theme/default/template/common/paygate_success.twig create mode 100755 upload/catalog/view/theme/default/template/extension/payment/paygate_payment_method.twig create mode 100755 upload/catalog/view/theme/default/template/extension/payment/paygate_redirect.twig create mode 100755 upload/catalog/view/theme/paygate/stylesheet/stylesheet.css diff --git a/README.md b/README.md index b1c6ff7..2581f0f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # PayWeb_OpenCart -## PayGate OpenCart plugin v3.0.3 for OpenCart v3.0.3.2 +## PayGate OpenCart plugin v3.0.4 for OpenCart v3.0.3.6 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://www.appinlet.com/wp-content/uploads/2018/09/OpenCart-Integration.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.3) and unzip. You will them 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.4) and unzip. You will them be able to follow the integration guide PDF which is included in the zip. ## Collaboration diff --git a/upload/admin/controller/extension/payment/paygate.php b/upload/admin/controller/extension/payment/paygate.php index b5c54ee..c65b814 100755 --- a/upload/admin/controller/extension/payment/paygate.php +++ b/upload/admin/controller/extension/payment/paygate.php @@ -1,11 +1,13 @@ request->server['REQUEST_METHOD'] == 'POST' ) && $this->validate() ) { $this->model_setting_setting->editSetting( 'payment_paygate', $this->request->post ); $this->session->data['success'] = $this->language->get( 'text_success' ); - $this->response->redirect( $this->url->link( 'marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true ) ); + $this->response->redirect( + $this->url->link( + 'marketplace/extension', + 'user_token=' . $this->session->data['user_token'] . '&type=payment', + true + ) + ); } $data['heading_title'] = $this->language->get( 'heading_title' ); @@ -38,6 +46,8 @@ public function index() $data['entry_geo_zone'] = $this->language->get( 'entry_geo_zone' ); $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' ); @@ -65,16 +75,32 @@ public function index() $data['breadcrumbs'][] = array( 'text' => $this->language->get( 'text_extension' ), - 'href' => $this->url->link( 'marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true ), + 'href' => $this->url->link( + 'marketplace/extension', + 'user_token=' . $this->session->data['user_token'] . '&type=payment', + true + ), ); $data['breadcrumbs'][] = array( 'text' => $this->language->get( 'heading_title' ), - 'href' => $this->url->link( 'extension/payment/paygate', 'user_token=' . $this->session->data['user_token'], true ), + 'href' => $this->url->link( + 'extension/payment/paygate', + 'user_token=' . $this->session->data['user_token'], + true + ), ); - $data['action'] = $this->url->link( 'extension/payment/paygate', 'user_token=' . $this->session->data['user_token'], true ); - $data['cancel'] = $this->url->link( 'marketplace/extension', 'user_token=' . $this->session->data['user_token'] . '&type=payment', true ); + $data['action'] = $this->url->link( + 'extension/payment/paygate', + 'user_token=' . $this->session->data['user_token'], + true + ); + $data['cancel'] = $this->url->link( + 'marketplace/extension', + 'user_token=' . $this->session->data['user_token'] . '&type=payment', + true + ); if ( isset( $this->request->post['payment_paygate_total'] ) ) { $data['payment_paygate_total'] = $this->request->post['payment_paygate_total']; @@ -91,19 +117,25 @@ public function index() if ( isset( $this->request->post['payment_paygate_success_order_status_id'] ) ) { $data['payment_paygate_success_order_status_id'] = $this->request->post['payment_paygate_success_order_status_id']; } else { - $data['payment_paygate_success_order_status_id'] = $this->config->get( 'payment_paygate_success_order_status_id' ); + $data['payment_paygate_success_order_status_id'] = $this->config->get( + 'payment_paygate_success_order_status_id' + ); } if ( isset( $this->request->post['payment_paygate_failed_order_status_id'] ) ) { $data['payment_paygate_failed_order_status_id'] = $this->request->post['payment_paygate_failed_order_status_id']; } else { - $data['payment_paygate_failed_order_status_id'] = $this->config->get( 'payment_paygate_failed_order_status_id' ); + $data['payment_paygate_failed_order_status_id'] = $this->config->get( + 'payment_paygate_failed_order_status_id' + ); } if ( isset( $this->request->post['payment_paygate_cancelled_order_status_id'] ) ) { $data['payment_paygate_cancelled_order_status_id'] = $this->request->post['payment_paygate_cancelled_order_status_id']; } else { - $data['payment_paygate_cancelled_order_status_id'] = $this->config->get( 'payment_paygate_cancelled_order_status_id' ); + $data['payment_paygate_cancelled_order_status_id'] = $this->config->get( + 'payment_paygate_cancelled_order_status_id' + ); } $this->load->model( 'localisation/order_status' ); @@ -144,6 +176,54 @@ public function index() $data['payment_paygate_merchant_key'] = $this->config->get( 'payment_paygate_merchant_key' ); } + if ( isset( $this->request->post['payment_paygate_notifyredirect'] ) ) { + $data['payment_paygate_notifyredirect'] = $this->request->post['payment_paygate_notifyredirect']; + } else { + $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 { + $data['payment_paygate_creditcardmethod'] = $this->config->get( 'payment_paygate_creditcardmethod' ); + } + + if ( isset( $this->request->post['payment_paygate_banktransfermethod'] ) ) { + $data['payment_paygate_banktransfermethod'] = $this->request->post['payment_paygate_banktransfermethod']; + } else { + $data['payment_paygate_banktransfermethod'] = $this->config->get( 'payment_paygate_banktransfermethod' ); + } + + if ( isset( $this->request->post['payment_paygate_zappermethod'] ) ) { + $data['payment_paygate_zappermethod'] = $this->request->post['payment_paygate_zappermethod']; + } else { + $data['payment_paygate_zappermethod'] = $this->config->get( 'payment_paygate_zappermethod' ); + } + + if ( isset( $this->request->post['payment_paygate_mobicredmethod'] ) ) { + $data['payment_paygate_mobicredmethod'] = $this->request->post['payment_paygate_mobicredmethod']; + } else { + $data['payment_paygate_mobicredmethod'] = $this->config->get( 'payment_paygate_mobicredmethod' ); + } + + if ( isset( $this->request->post['payment_paygate_momopaymethod'] ) ) { + $data['payment_paygate_momopaymethod'] = $this->request->post['payment_paygate_momopaymethod']; + } else { + $data['payment_paygate_momopaymethod'] = $this->config->get( 'payment_paygate_momopaymethod' ); + } + + if ( isset( $this->request->post['payment_paygate_masterpassmethod'] ) ) { + $data['payment_paygate_masterpassmethod'] = $this->request->post['payment_paygate_masterpassmethod']; + } else { + $data['payment_paygate_masterpassmethod'] = $this->config->get( 'payment_paygate_masterpassmethod' ); + } + $data['header'] = $this->load->controller( 'common/header' ); $data['column_left'] = $this->load->controller( 'common/column_left' ); $data['footer'] = $this->load->controller( 'common/footer' ); diff --git a/upload/admin/language/en-gb/extension/payment/paygate.php b/upload/admin/language/en-gb/extension/payment/paygate.php index 2916df9..3d0459a 100755 --- a/upload/admin/language/en-gb/extension/payment/paygate.php +++ b/upload/admin/language/en-gb/extension/payment/paygate.php @@ -1,9 +1,9 @@ PayGate PayWeb v3'; -$_['entry_merchant_id'] = 'PayGate ID:'; -$_['entry_merchant_key'] = 'PayGate Encryption Key:'; -$_['entry_success_status'] = 'Successful Order status:'; -$_['entry_failed_status'] = 'Failed Order Status:'; -$_['entry_cancelled_status'] = 'Cancelled Order Status:'; +$_['entry_total'] = 'Total'; +$_['entry_order_status'] = 'Initial'; +$_['entry_geo_zone'] = 'Geo Zone'; +$_['entry_status'] = 'Status'; +$_['entry_sort_order'] = 'Sort Order'; +$_['text_paygate'] = 'PayGate'; +$_['entry_merchant_id'] = 'PayGate ID'; +$_['entry_merchant_key'] = 'Encryption Key'; +$_['entry_success_status'] = 'Successful'; +$_['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_mobicredmethod'] = 'Enable Mobicred on Checkout'; +$_['entry_momopaymethod'] = 'Enable MoMoPay on Checkout'; +$_['entry_masterpassmethod'] = 'Enable MasterPass on Checkout'; // Tab $_['tab_general'] = 'General'; -$_['tab_order_status'] = 'Order status'; +$_['tab_order_status'] = 'Order Status'; +$_['tab_pay_methods'] = 'Payment Types'; // Help $_['help_total'] = 'The checkout total the order must reach before this payment method becomes active.'; // Error -$_['error_permission'] = 'Warning: You do not have permission to modify the PayGate payment method!'; \ No newline at end of file +$_['error_permission'] = 'Warning: You do not have permission to modify the PayGate payment method!'; diff --git a/upload/admin/view/image/payment/paygate.gif b/upload/admin/view/image/payment/paygate.gif deleted file mode 100755 index 85698a19bbf08f3a9651ed7fe2f9a026a91427a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2303 zcmcIl`#aP98~GeY!utbX$#GHQ)w2ZP{zjQI5UTIk`3EXM2K=ete%u2 z31uA!5lJOFNJuA2B^@5mm+!ah`47JLFZcVt-}m);U9Z=Dy|1?`&BdC;ECjH?EC2w+ zU}f`=C01d}$Pp`ScxbyQO?!ckQ|xNj__fsi(AI-E`e8$lBY3YQ3!fA#KQU>q#Fm+c zifz%{e_iK5t3%K+r{GLyPUe>Iob9|^kElFP!71;!Lf?d1BS+Sndrp4(;+^74?THP;rI+tkTG4%2F{o(cp&pRK!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k8x=$x?>6^>^Aup76|7h#-usgkPk=CU1c8j%U?)creU20d} zD|h*%nqrna3-zYYnkV&h@6T=991iaJ*w~giYu7qHvn!hW8+M#NV#;OBe5&D59J9a# zlLc>gHf>71_Y#GYZd4jfwP* zDde*$=nZExpJ>zDAnTCUVC?TNaN2a{4%a&F1Lr>5edoBzuwi-Llh%Yof-WCl2+ldx zv~e9{#w71Q2iLh4MLqj{`oO!3C;x}YYML9JPdV1wv&%VJcS#=e3S)=<$D3ld4+r@rs{r^;^X<5woL`F{{ tab_general }}
  • {{ tab_order_status }}
  • +
  • {{ tab_pay_methods }}
  • @@ -62,6 +63,20 @@ value="{{ payment_paygate_merchant_key }}" class="form-control">
    +
    + +
    + +
    +
    @@ -89,7 +104,35 @@ {% else %} - {% endif %} + {% endif %} + +
    + +
    + +
    + +
    +
    +
    + +
    +
    @@ -173,10 +216,100 @@ + +
    +
    +

    Enabled payment types must also be enabled on your PayGate account. Click here to find out more.

    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    -{{ footer }} \ No newline at end of file +{{ footer }} diff --git a/upload/catalog/controller/extension/payment/paygate.php b/upload/catalog/controller/extension/payment/paygate.php index aa0bf20..5a88a55 100755 --- a/upload/catalog/controller/extension/payment/paygate.php +++ b/upload/catalog/controller/extension/payment/paygate.php @@ -1,6 +1,6 @@ model_checkout_order->getOrder( $this->session->data['order_id'] ); + if ( empty( $_POST ) && $order_info['payment_code'] === 'paygate' ) { + // Add enabled payment methods as checkout options + $imgs = 'catalog/view/theme/default/image/'; + $paymethods = [ + 'creditcardmethod' => [ + 'title' => 'Card', + 'img' => $imgs . 'mastercard-visa.svg', + ], + 'banktransfermethod' => [ + 'title' => 'SiD Secure EFT', + 'img' => $imgs . 'sid.svg', + ], + 'zappermethod' => [ + 'title' => 'Zapper', + 'img' => $imgs . 'zapper.svg', + ], + 'mobicredmethod' => [ + 'title' => 'Mobicred', + 'img' => $imgs . 'mobicred.svg', + ], + 'momopaymethod' => [ + 'title' => 'MoMoPay', + 'img' => $imgs . 'momopay.svg', + ], + 'masterpassmethod' => [ + 'title' => 'MasterPass', + 'img' => $imgs . 'masterpass.svg', + ], + ]; + $pms = []; + foreach ( $paymethods as $key => $paymethod ) { + $setting = 'payment_paygate_' . $key; + if ( $this->config->get( $setting ) === 'yes' ) { + $pms[] = ['method' => $key, 'title' => $paymethod['title'], 'img' => $paymethod['img']]; + } + } + if ( !empty( $pms ) ) { + return $this->load->view( + 'extension/payment/paygate_payment_method', + [ + 'pay_methods' => $pms, + 'action' => $this->url->link( + 'extension/payment/paygate/index', + '', + true + ), + ] + ); + } + } elseif ( isset( $_POST['paygate_pay_method'] ) ) { + $PAY_METHOD = 'EW'; + $PAY_METHOD_DETAIL = $_POST['paygate_pay_method']; + switch ( $_POST['paygate_pay_method'] ) { + case 'creditcardmethod'; + $PAY_METHOD = 'CC'; + $PAY_METHOD_DETAIL = ''; + break; + case 'banktransfermethod': + $PAY_METHOD = 'BT'; + $PAY_METHOD_DETAIL = 'SID'; + break; + case 'zappermethod': + $PAY_METHOD_DETAIL = 'Zapper'; + break; + case 'mobicredmethod': + $PAY_METHOD_DETAIL = 'Mobicred'; + break; + case 'momopaymethod': + $PAY_METHOD_DETAIL = 'Momopay'; + break; + case 'masterpassmethod': + $PAY_METHOD_DETAIL = 'MasterPass'; + break; + } + } + if ( $order_info ) { + // Test mode or live credentials + $this->testmode = $this->config->get( 'payment_paygate_testmode' ) === 'test'; + $paygateID = $this->testmode ? '10011072130' : filter_var( + $this->config->get( 'payment_paygate_merchant_id' ), + FILTER_SANITIZE_STRING + ); + $encryption_key = $this->testmode ? 'secret' : $this->config->get( 'payment_paygate_merchant_key' ); + $preAmount = number_format( $order_info['total'], 2, '', '' ); $dateTime = new DateTime(); $time = $dateTime->format( 'YmdHis' ); - $paygateID = filter_var( $this->config->get( 'payment_paygate_merchant_id' ), FILTER_SANITIZE_STRING ); $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 ); @@ -38,22 +123,32 @@ public function index() $currency = filter_var( $this->currency->getCode(), FILTER_SANITIZE_STRING ); } - $returnUrl = filter_var( $this->url->link( 'extension/payment/paygate/paygate_return', '', true ), FILTER_SANITIZE_URL ); + $returnUrl = filter_var( + $this->url->link( 'extension/payment/paygate/paygate_return', '', true ), + FILTER_SANITIZE_URL + ); + $returnUrl .= '/' . $reference; $transDate = filter_var( date( 'Y-m-d H:i:s' ), FILTER_SANITIZE_STRING ); $locale = filter_var( 'en', FILTER_SANITIZE_STRING ); $country = filter_var( $order_info['payment_iso_code_3'], FILTER_SANITIZE_STRING ); $email = filter_var( $order_info['email'], FILTER_SANITIZE_EMAIL ); // Check if email empty due to some custom themes displaying this on the same page $email = empty( $email ) ? $this->config->get( 'config_email' ) : $email; - $payMethod = ''; - $payMethodDetail = ''; - $notifyUrl = filter_var( $this->url->link( 'extension/payment/paygate/notify_handler', '', true ), FILTER_SANITIZE_URL ); + $payMethod = isset( $PAY_METHOD ) ? $PAY_METHOD : ''; + $payMethodDetail = isset( $PAY_METHOD_DETAIL ) ? $PAY_METHOD_DETAIL : ''; + + // Add notify if enabled + if ( $this->config->get( 'payment_paygate_notifyredirect' ) === 'notify' ) { + $notifyUrl = filter_var( + $this->url->link( 'extension/payment/paygate/notify_handler', '', true ), + FILTER_SANITIZE_URL + ); + } $userField1 = $order_info['order_id']; - $userField2 = ''; - $userField3 = 'opencart-v3.0.3.2'; + $userField2 = $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname']; + $userField3 = 'opencart-v3.0.4'; $doVault = ''; $vaultID = ''; - $encryption_key = $this->config->get( 'payment_paygate_merchant_key' ); $checksum_source = $paygateID . $reference . $amount . $currency . $returnUrl . $transDate; if ( $locale ) { @@ -71,7 +166,7 @@ public function index() if ( $payMethodDetail ) { $checksum_source .= $payMethodDetail; } - if ( $notifyUrl ) { + if ( isset( $notifyUrl ) ) { $checksum_source .= $notifyUrl; } if ( $userField1 ) { @@ -104,17 +199,19 @@ public function index() 'EMAIL' => $email, 'PAY_METHOD' => $payMethod, 'PAY_METHOD_DETAIL' => $payMethodDetail, - 'NOTIFY_URL' => $notifyUrl, - 'USER1' => $userField1, - 'USER2' => $userField2, - 'USER3' => $userField3, - 'VAULT' => $doVault, - 'VAULT_ID' => $vaultID, - 'CHECKSUM' => $checksum, ); - $CHECKSUM = null; - $PAY_REQUEST_ID = null; - $fields_string = ''; + if ( $this->config->get( 'payment_paygate_notifyredirect' ) === 'notify' ) { + $initiateData['NOTIFY_URL'] = $notifyUrl; + } + $initiateData['USER1'] = $userField1; + $initiateData['USER2'] = $userField2; + $initiateData['USER3'] = $userField3; + $initiateData['VAULT'] = $doVault; + $initiateData['VAULT_ID'] = $vaultID; + $initiateData['CHECKSUM'] = $checksum; + $CHECKSUM = null; + $PAY_REQUEST_ID = null; + $fields_string = ''; // Url-ify the data for the POST foreach ( $initiateData as $key => $value ) { @@ -136,157 +233,266 @@ public function index() curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields_string ); // Execute post - $result = curl_exec( $ch ); + $r = curl_exec( $ch ); // Close connection curl_close( $ch ); - parse_str( $result ); + $result = []; + parse_str( $r, $result ); - if ( isset( $ERROR ) ) { - print_r( 'Error trying to initiate a transaction, paygate error code: ' . $ERROR . '. Log support ticket to shop owner' ); + if ( isset( $result['ERROR'] ) ) { + print_r( + 'Error trying to initiate a transaction, paygate error code: ' . $result['ERROR'] . '. Log support ticket to shop owner' + ); die(); } - $data['CHECKSUM'] = $CHECKSUM; - $data['PAY_REQUEST_ID'] = $PAY_REQUEST_ID; + $data['CHECKSUM'] = $result['CHECKSUM']; + $data['PAY_REQUEST_ID'] = $result['PAY_REQUEST_ID']; $this->session->data['REFERENCE'] = $time; } else { - print_r( 'Order could not be found, order_id: ' . $this->session->data['order_id'] . '. Log support ticket to shop owner' ); + print_r( + 'Order could not be found, order_id: ' . $this->session->data['order_id'] . '. Log support ticket to shop owner' + ); die(); } - return $this->load->view( 'extension/payment/paygate', $data ); + if ( $order_info['payment_code'] === 'paygate' ) { + if ( $useIframe ) { + echo << + 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) + +
    +
    +
    + + + +
    + + +
    +
    +HTML; + return; + } else { + echo << + + +
    +
    +
    +
    + + + + +HTML; + return; + } + } else { + if ( $useIframe ) { + return $this->load->view( 'extension/payment/paygate', $data ); + } else { + return $this->load->view( 'extension/payment/paygate_redirect', $data ); + } + } } + /** + * Handles redirect response from PayGate + * Is always received + * Handle according to config setting for Notify/Redirect + * + * Must use part of this to get to correct checkout page in notify case, + * but don't process the order + */ public function paygate_return() { $this->load->language( 'checkout/paygate' ); $statusDesc = ''; $status = ''; - if ( isset( $this->session->data['order_id'] ) ) { + // Check for test / live modes + $this->testmode = $this->config->get( 'payment_paygate_testmode' ) === 'test'; + $paygateID = $this->testmode ? '10011072130' : filter_var( + $this->config->get( 'payment_paygate_merchant_id' ), + FILTER_SANITIZE_STRING + ); + $encryption_key = $this->testmode ? 'secret' : $this->config->get( 'payment_paygate_merchant_key' ); + + $useRedirect = $this->config->get( 'payment_paygate_notifyredirect' ) === 'redirect'; + + // Get order Id from query string as backup if session fails + $m = []; + preg_match( '/^.*\/(\d+)$/', $_GET['route'], $m ); + $orderId = 0; + if ( count( $m ) > 1 ) { + $orderId = (int) $m[1]; + } elseif ( isset( $this->session->data['order_id'] ) ) { + $orderId = (int) $this->session->data['order_id']; + } + if ( $orderId !== 0 ) { // Add to activity log $this->load->model( 'account/activity' ); + $this->load->model( 'checkout/order' ); + $order = $this->model_checkout_order->getOrder( $orderId ); if ( $this->customer->isLogged() ) { $activity_data = array( 'customer_id' => $this->customer->getId(), 'name' => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(), - 'order_id' => $this->session->data['order_id'], + 'order_id' => $orderId, ); $this->model_account_activity->addActivity( 'order_account', $activity_data ); } else { $activity_data = array( - 'name' => $this->session->data['guest']['firstname'] . ' ' . $this->session->data['guest']['lastname'], - 'order_id' => $this->session->data['order_id'], + 'name' => $order['firstname'] . ' ' . $order['lastname'], + 'order_id' => $orderId, ); $this->model_account_activity->addActivity( 'order_guest', $activity_data ); } - $paygateID = filter_var( $this->config->get( 'payment_paygate_merchant_id' ), FILTER_SANITIZE_STRING ); - $pay_request_id = filter_var( $_POST['PAY_REQUEST_ID'], FILTER_SANITIZE_STRING ); - $reference = filter_var( $this->session->data['order_id'], FILTER_SANITIZE_STRING ); - $encryption_key = $this->config->get( 'payment_paygate_merchant_key' ); - $checksum = md5( $paygateID . $pay_request_id . $reference . $encryption_key ); - $queryData = array( - 'PAYGATE_ID' => $paygateID, - 'PAY_REQUEST_ID' => $pay_request_id, - 'REFERENCE' => $reference, - 'CHECKSUM' => $checksum, - ); - $TRANSACTION_STATUS = null; - $PAY_METHOD_DETAIL = null; - $fields_string = null; + if ( $useRedirect ) { + // Query to verify response data + $pay_request_id = filter_var( $_POST['PAY_REQUEST_ID'], FILTER_SANITIZE_STRING ); + $reference = $orderId; + $checksum = md5( $paygateID . $pay_request_id . $reference . $encryption_key ); + $queryData = array( + 'PAYGATE_ID' => $paygateID, + 'PAY_REQUEST_ID' => $pay_request_id, + 'REFERENCE' => $reference, + 'CHECKSUM' => $checksum, + ); - // Url-ify the data for the POST - foreach ( $queryData as $key => $value ) { - $fields_string .= $key . '=' . $value . '&'; - } + // Url-ify the data for the POST + $fields_string = ''; + foreach ( $queryData as $key => $value ) { + $fields_string .= $key . '=' . $value . '&'; + } - rtrim( $fields_string, '&' ); + rtrim( $fields_string, '&' ); - // Open connection - $ch = curl_init(); + // Open connection + $ch = curl_init(); - // Set the url, number of POST vars, POST data - curl_setopt( $ch, CURLOPT_POST, 1 ); - curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); - curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false ); - curl_setopt( $ch, CURLOPT_URL, 'https://secure.paygate.co.za/payweb3/query.trans' ); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); - curl_setopt( $ch, CURLOPT_POST, count( $queryData ) ); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields_string ); + // Set the url, number of POST vars, POST data + curl_setopt( $ch, CURLOPT_POST, 1 ); + curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, true ); + curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, 2 ); + curl_setopt( $ch, CURLOPT_URL, 'https://secure.paygate.co.za/payweb3/query.trans' ); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $fields_string ); - unset( $this->session->data['REFERENCE'] ); + unset( $this->session->data['REFERENCE'] ); - // Execute post - $result = curl_exec( $ch ); + // Execute post + $r = curl_exec( $ch ); + $error = curl_error( $ch ); - // Close connection - curl_close( $ch ); - parse_str( $result ); - $pay_method_desc = ''; + // Close connection + curl_close( $ch ); + $result = []; + if ( isset( $r ) && $r != '' ) { + parse_str( $r, $result ); + } + $pay_method_desc = ''; + } else { + // Use transaction status for redirecting in browser only + $result = $_POST; + } - if ( isset( $PAY_METHOD_DETAIL ) && $PAY_METHOD_DETAIL != '' ) { - $pay_method_desc = ', using a payment method of ' . $PAY_METHOD_DETAIL; + if ( isset( $result['PAY_METHOD_DETAIL'] ) && $result['PAY_METHOD_DETAIL'] != '' ) { + $pay_method_desc = ', using a payment method of ' . $result['PAY_METHOD_DETAIL']; } - $orderStatusId = '7'; - $resultsComment = ''; + $orderStatusId = '7'; // Mapping pg transactions status with open card statuses - if ( isset( $TRANSACTION_STATUS ) ) { + if ( isset( $result['TRANSACTION_STATUS'] ) ) { $status = 'ok'; - if ( $TRANSACTION_STATUS == 0 ) { + if ( $result['TRANSACTION_STATUS'] == 0 ) { $orderStatusId = 1; $statusDesc = 'pending'; - } else if ( $TRANSACTION_STATUS == 1 ) { + } elseif ( $result['TRANSACTION_STATUS'] == 1 ) { $orderStatusId = $this->config->get( 'payment_paygate_success_order_status_id' ); $statusDesc = 'approved'; - } else if ( $TRANSACTION_STATUS == 2 ) { + } elseif ( $result['TRANSACTION_STATUS'] == 2 ) { $orderStatusId = $this->config->get( 'payment_paygate_failed_order_status_id' ); $statusDesc = 'declined'; - } else if ( $TRANSACTION_STATUS == 4 ) { + } elseif ( $result['TRANSACTION_STATUS'] == 4 ) { $orderStatusId = $this->config->get( 'payment_paygate_cancelled_order_status_id' ); $statusDesc = 'cancelled'; } - - $resultsComment = "Returned from PayGate with a status of " . $statusDesc . $pay_method_desc; + if ( $useRedirect ) { + $resultsComment = "Redirect response from PayGate with a status of " . $statusDesc . $pay_method_desc; + } } else { $orderStatusId = 1; $statusDesc = 'pending'; - $resultsComment = 'Transaction status verification failed. Please contact the shop owner to confirm transaction status.'; + $resultsComment = 'Transaction status verification failed. No transaction status. Please contact the shop owner to confirm transaction status.'; } - $this->load->model( 'checkout/order' ); if ( $statusDesc == 'approved' ) { $this->cart->clear(); } - $this->model_checkout_order->addOrderHistory( $this->session->data['order_id'], $orderStatusId, $resultsComment, true ); - unset( $this->session->data['shipping_method'] ); - unset( $this->session->data['shipping_methods'] ); - unset( $this->session->data['payment_method'] ); - unset( $this->session->data['payment_methods'] ); - unset( $this->session->data['guest'] ); - unset( $this->session->data['comment'] ); - unset( $this->session->data['order_id'] ); - unset( $this->session->data['coupon'] ); - unset( $this->session->data['reward'] ); - unset( $this->session->data['voucher'] ); - unset( $this->session->data['vouchers'] ); - unset( $this->session->data['totals'] ); + if ( $useRedirect ) { + $this->model_checkout_order->addOrderHistory( + $orderId, + $orderStatusId, + $resultsComment, + true + ); + unset( $this->session->data['shipping_method'] ); + unset( $this->session->data['shipping_methods'] ); + unset( $this->session->data['payment_method'] ); + unset( $this->session->data['payment_methods'] ); + unset( $this->session->data['guest'] ); + unset( $this->session->data['comment'] ); + unset( $this->session->data['order_id'] ); + unset( $this->session->data['coupon'] ); + unset( $this->session->data['reward'] ); + unset( $this->session->data['voucher'] ); + unset( $this->session->data['vouchers'] ); + unset( $this->session->data['totals'] ); + } + } else { + $sessionOrderId = isset( $this->session->data['order_id'] ) ? $this->session->data['order_id'] : 'Session data not set'; } if ( $status == 'ok' ) { $data['heading_title'] = sprintf( $this->language->get( 'heading_title' ), $statusDesc ); $this->document->setTitle( $data['heading_title'] ); } else { - $data['heading_title'] = sprintf( 'Transaction status verification failed. Please contact the shop owner to confirm transaction status.' ); + $data['heading_title'] = sprintf( + 'Transaction status verification failed. Status not ok. Please contact the shop owner to confirm transaction status.' + ); + $data['heading_title'] .= json_encode( $_POST ); + $data['heading_title'] .= json_encode( $result ); + $data['heading_title'] .= 'Curl error: ' . $error; + $data['heading_title'] .= 'Curl response: ' . $r; + $data['heading_title'] .= 'Session data: ' . $sessionOrderId; $this->document->setTitle( $data['heading_title'] ); } @@ -312,9 +518,18 @@ public function paygate_return() ); if ( $this->customer->isLogged() ) { - $data['text_message'] = sprintf( $this->language->get( 'text_customer' ), $this->url->link( 'account/account', '', 'SSL' ), $this->url->link( 'account/order', '', 'SSL' ), $this->url->link( 'account/download', '', 'SSL' ), $this->url->link( 'information/contact' ) ); + $data['text_message'] = sprintf( + $this->language->get( 'text_customer' ), + $this->url->link( 'account/account', '', 'SSL' ), + $this->url->link( 'account/order', '', 'SSL' ), + $this->url->link( 'account/download', '', 'SSL' ), + $this->url->link( 'information/contact' ) + ); } else { - $data['text_message'] = sprintf( $this->language->get( 'text_guest' ), $this->url->link( 'information/contact' ) ); + $data['text_message'] = sprintf( + $this->language->get( 'text_guest' ), + $this->url->link( 'information/contact' ) + ); } $data['button_continue'] = $this->language->get( 'button_continue' ); @@ -326,80 +541,98 @@ public function paygate_return() $data['footer'] = $this->load->controller( 'common/footer' ); $data['header'] = $this->load->controller( 'common/header' ); - $this->response->setOutput( $this->load->view( 'common/success', $data ) ); + $this->response->setOutput( $this->load->view( 'common/paygate_success', $data ) ); } + /** + * Handles notify response from PayGate + * Controlled by Redirect/Notify setting in config + */ public function notify_handler() { - // Notify PayGate that information has been received - echo 'OK'; - - $errors = false; - if ( isset( $ERROR ) ) { - $errors = true; - } - - $transaction_status = ''; - $order_id = ''; - $pay_method_detail = ''; - $pay_method_desc = ''; - $checkSumParams = ''; - $notify_checksum = ''; - $post_data = ''; - - if ( !$errors ) { - foreach ( $_POST as $key => $val ) { - if ( $key == 'PAYGATE_ID' ) { - $checkSumParams .= $this->config->get( 'payment_paygate_merchant_id' ); - } - - if ( $key != 'CHECKSUM' && $key != 'PAYGATE_ID' ) { - $checkSumParams .= $val; - } - - if ( $key == 'CHECKSUM' ) { - $notify_checksum = $val; - } - - if ( $key == 'TRANSACTION_STATUS' ) { - $transaction_status = $val; - } - - if ( $key == 'USER1' ) { - $order_id = $val; - } - - if ( $key == 'PAY_METHOD_DETAIL' ) { - $pay_method_desc = ', using a payment method of ' . $val; - } - } + // Shouldn't be able to get here in redirect as notify url is not set in redirect mode + if ( $this->config->get( 'payment_paygate_notifyredirect' ) === 'notify' ) { + // Notify PayGate that information has been received + echo 'OK'; + + // Check for test / live modes + $this->testmode = $this->config->get( 'payment_paygate_testmode' ) === 'test'; + $paygateID = $this->testmode ? '10011072130' : filter_var( + $this->config->get( 'payment_paygate_merchant_id' ), + FILTER_SANITIZE_STRING + ); + $encryption_key = $this->testmode ? 'secret' : $this->config->get( 'payment_paygate_merchant_key' ); - $checkSumParams .= $this->config->get( 'payment_paygate_merchant_key' ); - $checkSumParams = md5( $checkSumParams ); - if ( $checkSumParams != $notify_checksum ) { + $errors = false; + if ( isset( $ERROR ) ) { $errors = true; } - $orderStatusId = 7; + $transaction_status = ''; + $order_id = ''; + $pay_method_detail = ''; + $pay_method_desc = ''; + $checkSumParams = ''; + $notify_checksum = ''; + $post_data = ''; if ( !$errors ) { - if ( $transaction_status == 0 ) { - $orderStatusId = 1; - $statusDesc = 'pending'; - } else if ( $transaction_status == 1 ) { - $orderStatusId = 2; - $statusDesc = 'approved'; - } else if ( $transaction_status == 2 ) { - $orderStatusId = 8; - $statusDesc = 'declined'; - } else if ( $transaction_status == 4 ) { - $orderStatusId = 7; - $statusDesc = 'cancelled'; + foreach ( $_POST as $key => $val ) { + if ( $key == 'PAYGATE_ID' ) { + $checkSumParams .= $paygateID; + } + + if ( $key != 'CHECKSUM' && $key != 'PAYGATE_ID' ) { + $checkSumParams .= $val; + } + + if ( $key == 'CHECKSUM' ) { + $notify_checksum = $val; + } + + if ( $key == 'TRANSACTION_STATUS' ) { + $transaction_status = $val; + } + + if ( $key == 'USER1' ) { + $order_id = $val; + } + + if ( $key == 'PAY_METHOD_DETAIL' ) { + $pay_method_desc = ', using a payment method of ' . $val; + } + } + + $checkSumParams .= $encryption_key; + $checkSumParams = md5( $checkSumParams ); + if ( $checkSumParams != $notify_checksum ) { + $errors = true; } - $resultsComment = "Notify from PayGate with a status of " . $statusDesc . $pay_method_desc; - $this->load->model( 'checkout/order' ); - $this->model_checkout_order->addOrderHistory( $order_id, $orderStatusId, $resultsComment, true ); + $orderStatusId = 7; + + if ( !$errors ) { + if ( $transaction_status == 0 ) { + $orderStatusId = 1; + $statusDesc = 'pending'; + } elseif ( $transaction_status == 1 ) { + $orderStatusId = $this->config->get( 'payment_paygate_success_order_status_id' ); + $statusDesc = 'approved'; + } elseif ( $transaction_status == 2 ) { + $orderStatusId = $this->config->get( 'payment_paygate_failed_order_status_id' ); + $statusDesc = 'declined'; + } elseif ( $transaction_status == 4 ) { + $orderStatusId = $this->config->get( 'payment_paygate_cancelled_order_status_id' ); + $statusDesc = 'cancelled'; + } + + $resultsComment = "Notify response from PayGate with a status of " . $statusDesc . $pay_method_desc; + $this->load->model( 'checkout/order' ); + if ( $statusDesc == 'approved' ) { + $this->cart->clear(); + } + $this->model_checkout_order->addOrderHistory( $order_id, $orderStatusId, $resultsComment, true ); + } } } } @@ -409,7 +642,12 @@ public function confirm() if ( $this->session->data['payment_method']['code'] == 'paygate' ) { $this->load->model( 'checkout/order' ); $comment = 'Redirected to PayGate'; - $this->model_checkout_order->addOrderHistory( $this->session->data['order_id'], $this->config->get( 'payment_paygate_order_status_id' ), $comment, true ); + $this->model_checkout_order->addOrderHistory( + $this->session->data['order_id'], + $this->config->get( 'payment_paygate_order_status_id' ), + $comment, + true + ); } } diff --git a/upload/catalog/language/en-gb/checkout/paygate.php b/upload/catalog/language/en-gb/checkout/paygate.php index 9999cfd..c663e29 100755 --- a/upload/catalog/language/en-gb/checkout/paygate.php +++ b/upload/catalog/language/en-gb/checkout/paygate.php @@ -1,9 +1,9 @@ You can view your order history by going to the my account page and by clicking on history.

    If your purchase has an associated download, you can go to the account downloads page to view them.

    Please direct any questions you have to the store owner.

    Thanks for shopping with us online!

    '; -$_['text_guest'] = '

    Please direct any questions you have to the store owner.

    Thanks for shopping with us online!

    '; \ No newline at end of file +$_['text_guest'] = '

    Please direct any questions you have to the store owner.

    Thanks for shopping with us online!

    '; diff --git a/upload/catalog/language/en-gb/extension/payment/paygate.php b/upload/catalog/language/en-gb/extension/payment/paygate.php index 545827a..08a06e7 100755 --- a/upload/catalog/language/en-gb/extension/payment/paygate.php +++ b/upload/catalog/language/en-gb/extension/payment/paygate.php @@ -1,12 +1,12 @@ PayGate'; \ No newline at end of file +$_['text_paygate_checkout'] = 'Pay now using PayGate'; diff --git a/upload/catalog/model/extension/payment/paygate.php b/upload/catalog/model/extension/payment/paygate.php index 1757ae8..7ac65af 100755 --- a/upload/catalog/model/extension/payment/paygate.php +++ b/upload/catalog/model/extension/payment/paygate.php @@ -1,9 +1,9 @@ 'Card', + 'banktransfermethod' => 'SiD Secure EFT', + 'zappermethod' => 'Zapper', + 'mobicredmethod' => 'Mobicred', + 'momopaymethod' => 'MoMoPay', + 'masterpassmethod' => 'MasterPass', + ]; + $pm = []; + foreach ( $paymethods as $key => $paymethod ) { + $setting = 'payment_paygate_' . $key; + if ( $this->config->get( $setting ) === 'yes' ) { + $pm[] = ['method' => $key, 'title' => $paymethod]; + } + } + $method_data['pay_methods'] = $pm; + return $method_data; } -} \ No newline at end of file +} diff --git a/upload/catalog/view/theme/default/image/mastercard-visa.svg b/upload/catalog/view/theme/default/image/mastercard-visa.svg new file mode 100644 index 0000000..ccd49a7 --- /dev/null +++ b/upload/catalog/view/theme/default/image/mastercard-visa.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/upload/catalog/view/theme/default/image/masterpass.svg b/upload/catalog/view/theme/default/image/masterpass.svg new file mode 100644 index 0000000..b12d5ab --- /dev/null +++ b/upload/catalog/view/theme/default/image/masterpass.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/upload/catalog/view/theme/default/image/mobicred.svg b/upload/catalog/view/theme/default/image/mobicred.svg new file mode 100644 index 0000000..be10134 --- /dev/null +++ b/upload/catalog/view/theme/default/image/mobicred.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/upload/catalog/view/theme/default/image/momopay.svg b/upload/catalog/view/theme/default/image/momopay.svg new file mode 100644 index 0000000..7ba27c0 --- /dev/null +++ b/upload/catalog/view/theme/default/image/momopay.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/upload/catalog/view/theme/default/image/paygate.gif b/upload/catalog/view/theme/default/image/paygate.gif deleted file mode 100755 index 911187a4925bf236770f8b1e839fdd3e0c574de9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2634 zcmb7Fc{G%58-FZALo~@N6}^v{L5gOv59%3PLyc^aHetrT3Utc~^He(Kb@;f~5y)Ga=%b?Vb5x&(F`!`$ zeQ`#9cw>Ln6aH!>y1Ge#hDm^?X`t50AgxnD1TsU%ELit+h@N@KF^kaS7NL-37-SVr zv<}xl6Jc;B!qDal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uQiw3xKvTFxc2v6eK2RreA~z?m*s91@DWjyMz)D}gyu4hm+*mKaC|%#s($Z4jz)0W7NVg~@ zO}Dr*uOzWTH?LS(38dL2wK%ybv!En1KM!h11>BIlVyGK{uFs<3h{ zN=+u5bvF7amf3;$K$qJg{FR!Q zVyjdH^wU$z@V&rP;_d0;7~*mK?WOS9vm7Ma9!_7T;VZB);r+UGdHOH)|NnPS{gGh) zT5V_1(}vA^`5gr2OU`k8x=$x?>6^>^Aup76|7h#-usgkPk=CU1c8j%U?)creU20d} zD|h*%nqrna3-zYYnkV&h@6T=991iaJ*w~giYu7qHvn!hW8+M#NV#;OBe5&D59J9a# zlLc>gHf>71_Y#GYZd4jfwP* zDde*$=nZExpJ>zDAnTCUVC?TNaN2a{4%a&F1Lr>5edoBzuwi-Llh%Yof-WCl2+ldx zv~e9{#w71Q2iLh4MLqj{`oO!3C;x}YYML9JPdV1wv&%VJcS#=e3S)=<$D3ld4+r@rs{r^;^X<5woL`F \ No newline at end of file diff --git a/upload/catalog/view/theme/default/image/zapper.svg b/upload/catalog/view/theme/default/image/zapper.svg new file mode 100644 index 0000000..a67401a --- /dev/null +++ b/upload/catalog/view/theme/default/image/zapper.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/upload/catalog/view/theme/default/template/checkout/payment_method.twig b/upload/catalog/view/theme/default/template/checkout/payment_method.twig new file mode 100755 index 0000000..8b692c4 --- /dev/null +++ b/upload/catalog/view/theme/default/template/checkout/payment_method.twig @@ -0,0 +1,47 @@ +{% if error_warning %} +
    {{ error_warning }} +
    +{% endif %} +{% if payment_methods %} +

    {{ text_payment_method }}

    + {% for payment_method in payment_methods %} +
    + +
    + {% endfor %} +{% endif %} +

    {{ text_comments }}

    +

    + +

    +{% if text_agree %} +
    +
    {{ text_agree }} + {% if agree %} + + {% else %} + + {% endif %} +   + +
    +
    +{% else %} +
    +
    + +
    +
    +{% endif %} diff --git a/upload/catalog/view/theme/default/template/common/paygate_success.twig b/upload/catalog/view/theme/default/template/common/paygate_success.twig new file mode 100755 index 0000000..a0f8983 --- /dev/null +++ b/upload/catalog/view/theme/default/template/common/paygate_success.twig @@ -0,0 +1,31 @@ +{{ header }} +
    + +
    {{ column_left }} + {% if column_left and column_right %} + {% set class = 'col-sm-6' %} + {% elseif column_left or column_right %} + {% set class = 'col-sm-9' %} + {% else %} + {% set class = 'col-sm-12' %} + {% endif %} +
    {{ content_top }} +

    {{ heading_title }}

    + {{ text_message }} + + {{ content_bottom }}
    + {{ column_right }}
    +
    + +{{ footer }} \ No newline at end of file diff --git a/upload/catalog/view/theme/default/template/extension/payment/paygate.twig b/upload/catalog/view/theme/default/template/extension/payment/paygate.twig index 9b69479..59f820b 100755 --- a/upload/catalog/view/theme/default/template/extension/payment/paygate.twig +++ b/upload/catalog/view/theme/default/template/extension/payment/paygate.twig @@ -1,36 +1,28 @@ {# - # Copyright (c) 2019 PayGate (Pty) Ltd + # Copyright (c) 2020 PayGate (Pty) Ltd # # Author: App Inlet (Pty) Ltd - # + # # Released under the GNU General Public License #} -
    - - -
    -
    -
    + +
    +
    + + + +
    +
    +
    +
    + + + + +
    - -