Merge pull request #1596 from amitsharma322/gli-2908
Fixed: Show the payment option in the payment information on the checkout page when pay using the PayPal payment method.
This commit is contained in:
@@ -45,3 +45,15 @@
|
||||
@keyframes rotate {
|
||||
0% {transform: rotate(0deg);}
|
||||
100% {transform: rotate(360deg);}}
|
||||
|
||||
p.payment_module a#qlo_paypal_btn {
|
||||
background: url(../../img/paypal-payment-icon.png) 15px 8px no-repeat #fbfbfb;
|
||||
}
|
||||
|
||||
.qlo_paypal_methods_wrapper {
|
||||
text-align: center;
|
||||
padding: 20px 15px;
|
||||
background: #fbfbfb;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #d6d4d4;
|
||||
}
|
||||
|
||||
32
modules/qlopaypalcommerce/views/img/index.php
Normal file
32
modules/qlopaypalcommerce/views/img/index.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License version 3.0
|
||||
* that is bundled with this package in the file LICENSE.md
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* https://opensource.org/license/osl-3-0-php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to support@qloapps.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to a newer
|
||||
* versions in the future. If you wish to customize this module for your needs
|
||||
* please refer to https://store.webkul.com/customisation-guidelines for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright Since 2010 Webkul
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../../');
|
||||
exit;
|
||||
BIN
modules/qlopaypalcommerce/views/img/paypal-payment-icon.png
Normal file
BIN
modules/qlopaypalcommerce/views/img/paypal-payment-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -20,82 +20,114 @@
|
||||
* @license https://opensource.org/license/osl-3-0-php Open Software License version 3.0
|
||||
*}
|
||||
|
||||
<div id="paypal-button-container"></div>
|
||||
|
||||
<div id="wk-overlay" style="display:none;">
|
||||
<div class="wk-spinner"></div><br/>
|
||||
{l s='Please wait...' mod='qlopaypalcommerce'}
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-12">
|
||||
<p class="payment_module">
|
||||
<a id="qlo_paypal_btn" style="cursor:pointer;" href="javascript:void(0);"
|
||||
title="{l s='PayPal Checkout' mod='qlopaypalcommerce'}">
|
||||
{l s='PayPal Checkout' mod='qlopaypalcommerce'} <span>{l s='(Pay with PayPal Account or Cards)' mod='qlopaypalcommerce'}</span>
|
||||
</a>
|
||||
<div class="qlo_paypal_methods_wrapper" style="display:none;">
|
||||
<div id="qlo_paypal_container"></div>
|
||||
<div id="wk-overlay" style="display:none;">
|
||||
<div class="wk-spinner"></div><br />
|
||||
{l s='Please wait...' mod='qlopaypalcommerce'}
|
||||
</div>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
paypal.Buttons({
|
||||
env: pp_environment,
|
||||
style: {
|
||||
layout: 'vertical', // horizontal | vertical
|
||||
size: 'responsive', // medium | large | responsive
|
||||
shape: 'rect', // pill | rect
|
||||
color: 'gold' // gold | blue | silver | black,
|
||||
},
|
||||
commit: false,
|
||||
createOrder: function() {
|
||||
return fetch(create_order, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
'update': null,
|
||||
'flow': 'shortcut'
|
||||
}),
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).then(function(dataJson) {
|
||||
return dataJson.data.id;
|
||||
});
|
||||
},
|
||||
onApprove: function(data, actions) {
|
||||
$('#wk-overlay').show();
|
||||
$(document).ready(function() {
|
||||
var rendered = false;
|
||||
|
||||
return fetch(capture_order, {
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
orderID: data.orderID,
|
||||
getOrderData: true,
|
||||
}),
|
||||
method: "POST",
|
||||
}).then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(details) {
|
||||
if (details.id) {
|
||||
const postData = {
|
||||
key: "order_id",
|
||||
value: details.id
|
||||
$('#qlo_paypal_btn').on('click', function() {
|
||||
$(this).toggleClass("active");
|
||||
if (!rendered) {
|
||||
rendered = true;
|
||||
$(".qlo_paypal_methods_wrapper").slideDown();
|
||||
renderPayPalButton();
|
||||
} else {
|
||||
$(".qlo_paypal_methods_wrapper").slideToggle();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function renderPayPalButton() {
|
||||
paypal.Buttons({
|
||||
env: pp_environment,
|
||||
style: {
|
||||
layout: 'vertical', // horizontal | vertical
|
||||
size: 'responsive', // medium | large | responsive
|
||||
shape: 'rect', // pill | rect
|
||||
color: 'gold' // gold | blue | silver | black,
|
||||
},
|
||||
commit: false,
|
||||
createOrder: function() {
|
||||
return fetch(create_order, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
'update': null,
|
||||
'flow': 'shortcut'
|
||||
}),
|
||||
}).then(function(response) {
|
||||
return response.json();
|
||||
}).then(function(dataJson) {
|
||||
return dataJson.data.id;
|
||||
});
|
||||
},
|
||||
onApprove: function(data, actions) {
|
||||
$('#wk-overlay').show();
|
||||
|
||||
return fetch(capture_order, {
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
orderID: data.orderID,
|
||||
getOrderData: true,
|
||||
}),
|
||||
method: "POST",
|
||||
}).then(function(res) {
|
||||
return res.json();
|
||||
}).then(function(details) {
|
||||
if (details.id) {
|
||||
const postData = {
|
||||
key: "order_id",
|
||||
value: details.id
|
||||
};
|
||||
submitForm(capture_order, postData);
|
||||
} else if (details.details[0].issue === 'INSTRUMENT_DECLINED') {
|
||||
return actions.restart();
|
||||
} else {
|
||||
window.location.replace(error_order + '?err_name=' + details.details[0]
|
||||
.issue +
|
||||
'&err_msg=' + details.details[0].description);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: function(data) {
|
||||
let url = cancel_order,
|
||||
postData = {
|
||||
key: "error",
|
||||
value: JSON.stringify(data)
|
||||
};
|
||||
submitForm(capture_order, postData);
|
||||
} else if (details.details[0].issue === 'INSTRUMENT_DECLINED') {
|
||||
return actions.restart();
|
||||
} else {
|
||||
console.log(details);
|
||||
window.location.replace(error_order + '?err_name=' + details.details[0].issue + '&err_msg=' + details.details[0].description);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: function(data) {
|
||||
let url = cancel_order,
|
||||
postData = {
|
||||
key: "error",
|
||||
value: JSON.stringify(data)
|
||||
};
|
||||
submitForm(url, postData);
|
||||
},
|
||||
onError: function (error) {
|
||||
console.log(error.data.details[0].issue + ' : ' + error.data.details[0].description);
|
||||
window.location.replace(error_order + '?err_name=' + error.data.details[0].issue + '&err_msg=' + error.data.details[0].description);
|
||||
}
|
||||
}).render('#paypal-button-container');
|
||||
submitForm(url, postData);
|
||||
},
|
||||
onError: function(error) {
|
||||
window.location.replace(error_order + '?err_name=' + error.data.details[0].issue +
|
||||
'&err_msg=' +
|
||||
error.data.details[0].description);
|
||||
}
|
||||
}).render('#qlo_paypal_container');
|
||||
}
|
||||
|
||||
|
||||
function submitForm(url, data) {
|
||||
let form = document.createElement('form'),
|
||||
|
||||
input = document.createElement('input');
|
||||
input.name = data.key;
|
||||
input.value = data.value;
|
||||
@@ -107,4 +139,4 @@
|
||||
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user