Initial commit

This commit is contained in:
2019-11-20 07:44:43 +01:00
commit 5bf49c4a81
41188 changed files with 5459177 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
// init in-context
document.addEventListener("DOMContentLoaded", function(){
$(document).on('click', '#desc-order-partial_refund', function(){
if ($('#doPartialRefundPaypal').length == 0) {
var newCheckBox = '<p class="checkbox"><label for="doPartialRefundPaypal">\n' +
'<input type="checkbox" id="doPartialRefundPaypal" name="doPartialRefundPaypal">\n' +
chb_paypal_refund + '</label></p>';
$('button[name=partialRefund]').parent('.partial_refund_fields').prepend(newCheckBox);
}
});
});

View File

@@ -0,0 +1,45 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
// init in-context
document.addEventListener("DOMContentLoaded", function(){ window.paypalCheckoutReady = function() {
paypal.checkout.setup(merchant_id, {
environment: environment,
});
};
});
function ECInContext() {
paypal.checkout.initXO();
$.support.cors = true;
$.ajax({
url: url_token,
type: "GET",
success: function (json) {
if (json.success) {
var url = paypal.checkout.urlPrefix +json.token;
paypal.checkout.startFlow(url);
} else {
paypal.checkout.closeFlow();
window.location.replace(json.redirect_link);
}
},
error: function (responseData, textStatus, errorThrown) {
alert("Error in ajax post"+responseData.statusText);
paypal.checkout.closeFlow();
}
});
}

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2019 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-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 license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;

View File

@@ -0,0 +1,17 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function() {
$('.page-order-confirmation #order-details ul').append($('#paypal_transaction_id'));
});

View File

@@ -0,0 +1,233 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function(){
if ($('section#checkout-payment-step').hasClass('js-current-step')) {
initBraintreeCard();
}
});
var bt_hosted_fileds;
var bt_client_instance;
function initBraintreeCard() {
braintree.client.create({
authorization: authorization
}, function (clientErr, clientInstance) {
if (clientErr) {
$('#bt-card-error-msg').show().text(bt_translations.client);
return;
}
braintree.hostedFields.create({
client: clientInstance,
styles: {
'input': {
'color': '#999999',
'font-size': '14px',
'font-family': 'PayPal Forward, sans-serif'
}
},
fields: {
number: {
selector: "#card-number",
placeholder: bt_translations.card_nmb
},
cvv: {
selector: "#cvv",
placeholder: bt_translations.cvc
},
expirationDate: {
selector: "#expiration-date",
placeholder: bt_translations.date
}
}
},function (hostedFieldsErr, hostedFieldsInstance) {
if (hostedFieldsErr) {
$('#bt-card-error-msg').show().text(bt_translations.hosted);
return;
}
hostedFieldsInstance.on('empty', function (event) {
$('.braintree-card #card-image').removeClass();
});
hostedFieldsInstance.on('cardTypeChange', function (event) {
// Change card bg depending on card type
if (event.cards.length === 1) {
$('.braintree-card #card-image').removeClass().addClass(event.cards[0].type);
}
});
hostedFieldsInstance.on('blur', function (event) {
var popup_message = '';
var blur_field_info = event.fields[event.emittedBy];
if (blur_field_info.isEmpty) {
popup_message = bt_translations[event.emittedBy]+' '+bt_translations.empty_field;
} else if (!blur_field_info.isValid) {
popup_message = bt_translations.invalid+' '+bt_translations[event.emittedBy];
}
if (popup_message) {
$('#bt-card-error-msg').show().text(popup_message);
} else {
$('#bt-card-error-msg').hide();
}
});
bt_hosted_fileds = hostedFieldsInstance;
bt_client_instance = clientInstance;
});
});
}
function BTSubmitPayment() {
var bt_form = document.querySelector('#braintree-form');
// use vaulted card
if ($('select[name=bt_vaulting_token]').val()) {
if (check3DS) {
braintree.threeDSecure.create({
client: bt_client_instance
}, function (ThreeDSecureerror,threeDSecure) {
if(ThreeDSecureerror)
{
switch (ThreeDSecureerror.code) {
case 'THREEDS_HTTPS_REQUIRED':
popup_message = bt_translations.https;
break;
default:
popup_message = bt_translations.load_3d;
}
$('#bt-card-error-msg').show().text(popup_message);
return false;
}
threeDSecure.verifyCard({
amount: bt_amount,
nonce: $('select[name=bt_vaulting_token] option:checked').data('nonce'),
addFrame: function (err, iframe) {
$.fancybox.open([
{
type: 'inline',
autoScale: true,
minHeight: 30,
content: '<p class="braintree-iframe">'+iframe.outerHTML+'</p>'
}
]);
},
removeFrame: function () {
}
}, function (err, three_d_secure_response) {
if (err) {
var popup_message = '';
switch (err.code) {
case 'CLIENT_REQUEST_ERROR':
popup_message = bt_translations.request_problem;
break;
default:
popup_message = bt_translations.failed_3d;
}
$('#bt-card-error-msg').show().text(popup_message);
return false;
}
bt_form.submit()
return;
});
});
} else {
bt_form.submit();
return;
}
} else {
bt_hosted_fileds.tokenize(function (tokenizeErr, payload) {
if (tokenizeErr) {
var popup_message = '';
switch (tokenizeErr.code) {
case 'HOSTED_FIELDS_FIELDS_EMPTY':
popup_message = bt_translations.empty;
break;
case 'HOSTED_FIELDS_FIELDS_INVALID':
popup_message = bt_translations.invalid+tokenizeErr.details.invalidFieldKeys;
break;
case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
popup_message = bt_translations.token;
break;
case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
popup_message = bt_translations.network;
break;
default:
popup_message = bt_translations.tkn_failed;
}
$('#bt-card-error-msg').show().text(popup_message);
return false;
}
if (check3DS) {
braintree.threeDSecure.create({
client: bt_client_instance
}, function (ThreeDSecureerror,threeDSecure) {
if(ThreeDSecureerror)
{
switch (ThreeDSecureerror.code) {
case 'THREEDS_HTTPS_REQUIRED':
popup_message = bt_translations.https;
break;
default:
popup_message = bt_translations.load_3d;
}
$('#bt-card-error-msg').show().text(popup_message);
return false;
}
threeDSecure.verifyCard({
nonce: payload.nonce,
amount: bt_amount,
addFrame: function (err, iframe) {
$.fancybox.open([
{
type: 'inline',
autoScale: true,
minHeight: 30,
content: '<p class="braintree-iframe">'+iframe.outerHTML+'</p>'
}
]);
},
removeFrame: function () {
}
}, function (err, three_d_secure_response) {
if (err) {
var popup_message = '';
switch (err.code) {
case 'CLIENT_REQUEST_ERROR':
popup_message = bt_translations.request_problem;
break;
default:
popup_message = bt_translations.failed_3d;
}
$('#bt-card-error-msg').show().text(popup_message);
return false;
}
document.querySelector('#braintree-form #payment_method_nonce').value = three_d_secure_response.nonce;
document.querySelector('#braintree-form #braintree_card_type').value = payload.details.cardType;
bt_form.submit()
});
});
} else {
document.querySelector('#braintree-form #payment_method_nonce').value = payload.nonce;
bt_form.submit();
}
});
}
}

View File

@@ -0,0 +1,110 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function(){
if ($('section#checkout-payment-step').hasClass('js-current-step')) {
initPaypalBraintree('checkout');
}
$(document).on('change', 'input[name=save_account_in_vault]', function(){
$('#paypal-button').html('');
if ($(this).is(':checked')) {
initPaypalBraintree('vault');
} else {
initPaypalBraintree('checkout');
}
});
});
function initPaypalBraintree(flow) {
var paypal_bt_form = document.querySelector('#paypal-braintree-form');
braintree.client.create({
authorization: paypal_braintree.authorization
}, function (clientErr, clientInstance) {
// Stop if there was a problem creating the client.
// This could happen if there is a network error or if the authorization
// is invalid.
if (clientErr) {
console.error('Error creating client:', clientErr);
return;
}
// Create a PayPal Checkout component.
braintree.paypalCheckout.create({
client: clientInstance
}, function (paypalCheckoutErr, paypalCheckoutInstance) {
// Stop if there was a problem creating PayPal Checkout.
// This could happen if there was a network error or if it's incorrectly
// configured.
if (paypalCheckoutErr) {
$('#bt-paypal-error-msg').show().text(paypalCheckoutErr);
return;
}
paypal.Button.render({
env: paypal_braintree.mode, // 'production' or 'sandbox'
payment: function () {
return paypalCheckoutInstance.createPayment({
flow: flow,
amount : paypal_braintree.amount,
currency : paypal_braintree.currency,
billingAgreementDescription: '',
enableShippingAddress: false,
shippingAddressEditable: false
});
},
onAuthorize: function (data, actions) {
return paypalCheckoutInstance.tokenizePayment(data)
.then(function (payload) {
// Submit `payload.nonce` to your server.
document.querySelector('input#paypal_payment_method_nonce').value = payload.nonce;
$('#paypal-button').hide();
$('#bt-paypal-error-msg').hide();
$('#paypal-vault-info').show().append(payload.details.firstName+' '+payload.details.lastName+' '+payload.details.email);
});
},
onCancel: function (data) {
// $('#bt-paypal-error-msg').show().text('checkout.js payment cancelled'+JSON.stringify(data, 0, 2)+'');
},
onError: function (err) {
$('#bt-paypal-error-msg').show().text(err);
}
}, '#paypal-button').then(function (e) {
});
$('#payment-confirmation button').click(function(event){
payment_selected = $('input[name=payment-option]:checked').attr('id');
if (!$('#pay-with-'+payment_selected+'-form .payment_module').hasClass('paypal-braintree')) {
return true;
}
if (!document.querySelector('input#paypal_payment_method_nonce').value && !$('select[name=pbt_vaulting_token]').val()) {
event.preventDefault();
event.stopPropagation();
$('#bt-paypal-error-msg').show().text(paypal_braintree.translations.empty_nonce);
}
});
});
});
}

View File

@@ -0,0 +1,66 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
var ppp;
$(document).ready(function() {
if ($('section#checkout-payment-step').hasClass('js-current-step')) {
if (ppp_mode == 'sandbox')
showPui = true
else
showPui = false
ppp = PAYPAL.apps.PPP({
"approvalUrl": ppp_approval_url,
"placeholder": "ppplus",
"mode": ppp_mode,
"language": ppp_language_iso_code,
"country": ppp_country_iso_code,
"buttonLocation": "outside",
"useraction": "continue",
"showPuiOnSandbox": showPui,
});
}
});
exec_ppp_payment = true;
function doPatchPPP() {
if (exec_ppp_payment) {
exec_ppp_payment = false;
$.fancybox.open({
content : '<div id="popup-ppp-waiting"><p>'+waiting_redirection+'</p></div>',
closeClick : false,
height : "auto",
helpers : {
overlay : {
closeClick: false
}
},
});
$.ajax({
type : 'POST',
url : ajax_patch_url,
dataType: 'json',
success : function (json) {
if (json.success) {
ppp.doCheckout();
} else {
window.location.replace(json.redirect_link);
}
},
error : function (xhr, ajaxOptions, thrownError) {
}
});
}
}

View File

@@ -0,0 +1,92 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
// init incontext
document.addEventListener("DOMContentLoaded", function(){
var ec_sc_qty_wanted = $('#quantity_wanted').val();
var ec_sc_productId = $('#paypal_payment_form_cart input[name="id_product"]').val();
EcCheckProductAvailability(ec_sc_qty_wanted, ec_sc_productId, $('#es_cs_product_attribute').val());
prestashop.on('updatedProduct', function(e, xhr, settings) {
EcCheckProductAvailability(ec_sc_qty_wanted, ec_sc_productId, e.id_product_attribute);
});
if (typeof ec_sc_in_context != "undefined" && ec_sc_in_context) {
window.paypalCheckoutReady = function () {
paypal.checkout.setup(merchant_id, {
environment: ec_sc_environment,
});
};
}
});
function EcCheckProductAvailability(qty, productId, id_product_attribute) {
$.ajax({
url: sc_init_url,
type: "POST",
data: 'checkAvailability=1&source_page=product&id_product='+productId+'&quantity='+qty+'&product_attribute='+id_product_attribute,
success: function (json) {
if (json.success) {
$('#container_express_checkout').show();
} else {
$('#container_express_checkout').hide();
}
},
error: function (responseData, textStatus, errorThrown) {
}
});
}
function setInput()
{
$('#paypal_quantity').val($('[name="qty"]').val());
var combination = [];
var re = /group\[([0-9]+)\]/;
$.each($('#add-to-cart-or-refresh').serializeArray(),function(key, item){
if(res = item.name.match(re))
{
combination.push(res[1]+':'+item.value);
}
});
$('#paypal_url_page').val(document.location.href);
$('#paypal_combination').val(combination.join('|'));
if (typeof ec_sc_in_context != "undefined" && ec_sc_in_context) {
ECSInContext(combination);
} else {
$('#paypal_payment_form_cart').submit();
}
}
function ECSInContext(combination) {
paypal.checkout.initXO();
$.support.cors = true;
$.ajax({
url: ec_sc_action_url,
type: "GET",
data: 'getToken=1&source_page=product&id_product='+$('#paypal_payment_form_cart input[name="id_product"]').val()+'&quantity='+$('[name="qty"]').val()+'&combination='+combination.join('|'),
success: function (json) {
if (json.success) {
var url = paypal.checkout.urlPrefix +json.token;
paypal.checkout.startFlow(url);
} else {
paypal.checkout.closeFlow();
window.location.replace(json.redirect_link);
}
},
error: function (responseData, textStatus, errorThrown) {
alert("Error in ajax post"+responseData.statusText);
paypal.checkout.closeFlow();
}
});
}

View File

@@ -0,0 +1,77 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
// init incontext
document.addEventListener("DOMContentLoaded", function(){
if (typeof ec_sc_in_context != "undefined" && ec_sc_in_context) {
window.paypalCheckoutReady = function () {
paypal.checkout.setup(merchant_id, {
environment: ec_sc_environment,
});
};
}
prestashop.on('updateCart', function (event) {
EcCheckProductAvailability();
});
});
function EcCheckProductAvailability() {
$.ajax({
url: sc_init_url,
type: "POST",
data: 'checkAvailability=1&source_page=cart',
success: function (json) {
if (json.success) {
$('#container_express_checkout').show();
} else {
$('#container_express_checkout').hide();
}
},
error: function (responseData, textStatus, errorThrown) {
}
});
}
function setInput()
{
$('#paypal_url_page').val(document.location.href);
if (typeof ec_sc_in_context != "undefined" && ec_sc_in_context) {
ECSInContext();
} else {
$('#paypal_payment_form_cart').submit();
}
}
function ECSInContext() {
paypal.checkout.initXO();
$.support.cors = true;
$.ajax({
url: ec_sc_action_url,
type: "GET",
data: 'getToken=1',
success: function (data) {
if (data.success == true) {
var url = paypal.checkout.urlPrefix + data.token;
paypal.checkout.startFlow(url);
}
},
error: function (responseData, textStatus, errorThrown) {
alert("Error in ajax post"+responseData.statusText);
paypal.checkout.closeFlow();
}
});
}

View File

@@ -0,0 +1,27 @@
/**
* 2007-2019 PrestaShop
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2019 PrestaShop SA
* @license http://addons.prestashop.com/en/content/12-terms-and-conditions-of-use
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function(){
if ($('section#checkout-payment-step').hasClass('js-current-step')) {
$('.payment-options div').hide();
if ($('input[data-module-name=express_checkout_schortcut]').length > 0) {
$('input[data-module-name=express_checkout_schortcut]').click();
$('.payment-options').append($('#paypal-es-checked').show());
} else if($('input[data-module-name=paypal_plus_schortcut]').length > 0) {
$('input[data-module-name=paypal_plus_schortcut]').click();
$('.payment-options').append($('#paypal-ppp-checked').show());
}
}
});