Drupal: izbris odvečne kode in popravek funkcije za prekic Stripe naročila.

This commit is contained in:
Robert 2020-11-17 12:44:53 +01:00
parent 819d92e309
commit 29f739629e

View File

@ -822,7 +822,7 @@
) {
var parametri = window.location.search.substr(1);
jQuery.post('/d/nakupovanje-api/cancel_narocilo_stripe', parametri).done(function (val) {
jQuery.post('/d/nakupovanje-api/stripe_checkout_cancel', parametri).done(function (val) {
val = JSON.parse(val);
if (val.error) {
@ -848,12 +848,6 @@
});
}
// jQuery('.accordion-head').on('click', function(){
// var st = jQuery(this).attr("data-open");
//
// jQuery('.data-'+st).toggle();
// });
//Odpiranje funkcionalnosti pri paketih
jQuery('.accordion-head').on('click', function () {
jQuery(this).toggleClass('active');
@ -1278,15 +1272,6 @@ function oddajNarociloNaStreznik() {
return stripe.redirectToCheckout({ sessionId: val.session_id });
}
// else if (paymentMethod > 1) {
// document.cookie = "pdf=" + val.racun + ";expires=" + cas + ";path=/";
//
// // Glede na jezik preusmerimo na slovensko oz. angleško verzijo
// var urlRedirect = "/d/narocilo-pregled/racun/pdf";
// if (paymentLang == 'en') {
// urlRedirect = "/d/en/purchase/invoice/pdf";
// }
// }
window.location = urlRedirect;
}
@ -1295,23 +1280,6 @@ function oddajNarociloNaStreznik() {
});
}
// function preverimoZaVrstoPlacila() {
//
// if (jQuery('[name="payment_method"]:checked').val() == 3) {
//
// jQuery('.placilo-kartica').show();
// jQuery('#oddaj-stripe').show();
// jQuery('#oddaj-narocilo').hide();
//
// } else {
//
// jQuery('.placilo-kartica').hide();
// jQuery('#oddaj-stripe').hide();
// jQuery('#oddaj-narocilo').show();
//
// }
// }
function posodobiCenoPaketa() {
var paket = jQuery('[name="package_id"]:checked').val();
var trajanje = jQuery('[name="trajanje"]:checked').val();
@ -1372,87 +1340,3 @@ function posodobiCenoPaketa() {
function lang() {
return jQuery('[name="lang"]').val();
}
//Stripe payment
// function cardValidation() {
// var valid = true;
//
// jQuery('.error-field').removeClass('error-field');
//
// var name = jQuery('.placilo-kartica #stripe-name');
// var email = jQuery('#narocilo-paketa-podatki [name="email"]');
// var cardNumber = jQuery('.placilo-kartica #stripe-card-number');
// var month = jQuery('.placilo-kartica #stripe-month');
// var year = jQuery('.placilo-kartica #stripe-year');
// var cvc = jQuery('.placilo-kartica #stripe-cvc');
//
// jQuery("#stripe-error-message").html("").hide();
//
// if (name.val().trim() == "") {
// name.addClass('error-field');
// valid = false;
// }
// if (email.val().trim() == "") {
// valid = false;
// }
//
// if (cardNumber.val().trim() == "") {
// cardNumber.addClass('error-field');
// valid = false;
// }
//
// if (month.val().trim() == "") {
// month.addClass('error-field');
// valid = false;
// }
// if (year.val().trim() == "") {
// year.addClass('error-field');
// valid = false;
// }
// if (cvc.val().trim() == "") {
// cvc.addClass('error-field');
// valid = false;
// }
//
// if (valid == false) {
// var opozorilo = "Vsa polja so obvezna!";
// if (lang() == 'en') {
// opozorilo = "All Fields are required!";
// }
// jQuery("#stripe-error-message").html(opozorilo).show();
// }
//
// return valid;
// }
// function stripePay(narociloId) {
// var narociloId = narociloId || 0;
//
// // Create an instance of the Stripe object with your publishable API key
// var stripe = Stripe(jQuery('.placilo-kartica #stripe-token').val());
//
// return stripe.redirectToCheckout({ sessionId: narociloId });
// }
//callback to handle the response from stripe
// function stripeResponseHandler(status, response) {
// if (response.error) {
// //enable the submit button
// jQuery('#oddaj-stripe').show();
//
// jQuery("#loader").css("display", "none");
//
// //display the errors on the form
// jQuery("#stripe-error-message").html(response.error.message).show();
// } else {
// //get token id
// var token = response['id'];
//
// //insert the token into the form
// jQuery('#narocilo-paketa-podatki').append("<input type='hidden' name='stripe_id' value='" + token + "' />");
//
// //submit form to the server
// oddajNarociloNaStreznik();
// }
// }