From 1404531c93080e569f030489697e2484cb83ebcf Mon Sep 17 00:00:00 2001 From: Amol Thite Date: Wed, 30 Sep 2020 16:34:20 +0530 Subject: [PATCH] Task #57 chore: Add bolt checkout --- .../en-GB/en-GB.plg_payment_payumoney.ini | 6 +- code/plugins/payumoney/payumoney.php | 6 +- code/plugins/payumoney/payumoney.xml | 54 +++--- .../plugins/payumoney/payumoney/tmpl/bolt.php | 178 ++++++++++++++++++ 4 files changed, 216 insertions(+), 28 deletions(-) create mode 100755 code/plugins/payumoney/payumoney/tmpl/bolt.php diff --git a/code/plugins/payumoney/en-GB/en-GB.plg_payment_payumoney.ini b/code/plugins/payumoney/en-GB/en-GB.plg_payment_payumoney.ini index c17e17bc..c82011ca 100755 --- a/code/plugins/payumoney/en-GB/en-GB.plg_payment_payumoney.ini +++ b/code/plugins/payumoney/en-GB/en-GB.plg_payment_payumoney.ini @@ -12,9 +12,13 @@ PAYUMONEY_PINFO="Payment For Order %s" PAYUMONEY_NO="No" PAYUMONEY_YES="Yes" PAYUMONEY_KEY="Merchant Key" -PAYUMONEY_KEY_DESC="You can get this Merchant Key from your Payu account" +PAYUMONEY_KEY_DESC="You can get this Merchant Key from your PayU account" ; store log PLG_PAYUMONEY_NO="No" PLG_PAYUMONEY_YES="Yes" PLG_PAYUMONEY_WRITE_LOG="Log payment gateway responses" PLG_PAYUMONEY_WRITE_LOG_DESC="Turn this on only if payment not working correctly & you want do debug it." +PAYUMONEY_LAYOUT="Checkout Layout" +PAYUMONEY_LAYOUT_DESC="Plugin layout for the payment. Bolt checkout will bring on-site payment experience." +PAYUMONEY_LAYOUT_REDIRECTION="Redirection (Off-site)" +PAYUMONEY_LAYOUT_BOLT="Bolt (On-site)" diff --git a/code/plugins/payumoney/payumoney.php b/code/plugins/payumoney/payumoney.php index b6ced46b..561a3007 100755 --- a/code/plugins/payumoney/payumoney.php +++ b/code/plugins/payumoney/payumoney.php @@ -14,6 +14,7 @@ use Joomla\CMS\Filesystem\File; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\String\StringHelper; +use Joomla\CMS\HTML\HTMLHelper; require_once JPATH_SITE . '/plugins/payment/payumoney/payumoney/helper.php'; @@ -53,7 +54,8 @@ class PlgPaymentPayuMoney extends CMSPlugin public function buildLayoutPath($layout) { $app = Factory::getApplication(); - $coreFile = dirname(__FILE__) . '/' . $this->_name . '/tmpl/default.php'; + + $coreFile = dirname(__FILE__) . '/' . $this->_name . '/tmpl/' . $layout . '.php'; $override = JPATH_BASE . '/' . 'templates' . '/' . $app->getTemplate() . '/html/plugins/' . $this->_type . '/' . $this->_name . '/' . $layout . '.php'; @@ -81,6 +83,8 @@ public function buildLayoutPath($layout) public function buildLayout($vars, $layout = 'default') { // Load the layout & push variables + $layout = $this->params->get('layout', 'default'); + ob_start(); $layout = $this->buildLayoutPath($layout); diff --git a/code/plugins/payumoney/payumoney.xml b/code/plugins/payumoney/payumoney.xml index 7ea360f0..b938c705 100755 --- a/code/plugins/payumoney/payumoney.xml +++ b/code/plugins/payumoney/payumoney.xml @@ -1,12 +1,12 @@ - + Payment - PayU Biz Techjoomla 28th Aug 2016 - + http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - - + + 1.0 PayU payment plugin @@ -16,34 +16,36 @@ en-GB/en-GB.plg_payment_payumoney.ini - - - + - - - + + + - - + + - - +
- - - - - - - - - - - -
+ + + + + + + + + + + + + + + +
+ diff --git a/code/plugins/payumoney/payumoney/tmpl/bolt.php b/code/plugins/payumoney/payumoney/tmpl/bolt.php new file mode 100755 index 00000000..b052086a --- /dev/null +++ b/code/plugins/payumoney/payumoney/tmpl/bolt.php @@ -0,0 +1,178 @@ + + * @copyright Copyright (C) 2009 - 2020 Techjoomla. All rights reserved. + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL + */ + +defined('_JEXEC') or die('Restricted access'); + +use Joomla\CMS\Language\Text; + +$sandbox = $this->params->get('sandbox', 0); + +if ($sandbox) +{ +?> + + + +item_name = Text::sprintf('PAYUMONEY_PINFO', $vars->order_id); +$txnid = $vars->order_id; + +$posted = array(); +$posted['key'] = trim($vars->key); +$posted['txnid'] = $txnid; +$posted['amount'] = $vars->amount; +$posted['productinfo'] = trim($vars->item_name); +$posted['firstname'] = isset($vars->user_firstname) ? trim($vars->user_firstname) : 'First_name'; +$posted['email'] = $vars->user_email; +$posted['phone'] = $vars->phone; +$posted['curl'] = $vars->cancel_return; +$posted['surl'] = $vars->url; +$posted['furl'] = $vars->url; + +$posted['udf1'] = $vars->order_id; +$posted['udf2'] = isset($vars->udf2) ? trim($vars->udf2) : ''; +$posted['udf3'] = isset($vars->udf3) ? trim($vars->udf3) : ''; +$posted['udf4'] = isset($vars->udf4) ? trim($vars->udf4) : ''; + +$posted['udf5'] = isset($vars->udf5) ? trim($vars->udf5) : ''; +$posted['udf6'] = isset($vars->udf6) ? trim($vars->udf6) : ''; +$posted['udf7'] = isset($vars->udf7) ? trim($vars->udf7) : ''; +$posted['udf8'] = isset($vars->udf8) ? trim($vars->udf8) : ''; +$posted['udf9'] = isset($vars->udf9) ? trim($vars->udf9) : ''; +$posted['udf10'] = isset($vars->udf10) ? trim($vars->udf10) : ''; + +$hashSequence = "key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10"; +$hashVarsSeq = explode('|', $hashSequence); +$hash_string = ''; + +foreach ($hashVarsSeq as $hash_var) +{ + $hash_string .= isset($posted[$hash_var]) ? $posted[$hash_var] : ''; + $hash_string .= '|'; +} + +$hash_string .= $vars->salt; +$hash = strtolower(hash('sha512', $hash_string)); + +?> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ +