File: /var/www/selfanalyse/wp-content/plugins/psychometrics/js/psy_checkout.js
jQuery(document).on('click', '#place_order', function () {
jQuery("#step-1").hide(500);
var slotID = jQuery("#slot_info").val();
var planID = jQuery("#plan_info").val();
var category = jQuery("#category").val();
var payMethod = jQuery("#payMethod").val();
var pageUrl = jQuery("#pageUrl").val();
var discount_id = jQuery("#discount_id").val();
var txn_type = jQuery("#txn_type").val();
var arr = {
encode_ref: slotID,
encode_type: planID,
category: category,
payMethod: payMethod,
discount_id: discount_id,
txn_type: txn_type
}
var url = '/wp-content/plugins/psychometrics/razorpay/api_psy_product_checkout.php';
jQuery.ajax({
url: url,
type: 'POST',
data: JSON.stringify(arr),
contentType: 'application/json; charset=utf-8',
success: function (data) {
if (data.status == '1') {
jQuery("#step-1").hide(500);
jQuery("#step-2").show(500);
jQuery("#razorpay_resp_id").val(data.razorpay_resp_id)
jQuery("#razorpay_resp_id2").val(data.cookie_save.order_id)
jQuery("#msg").html(data.message);
var options = data.cookie_save;
/**
* The entire list of Checkout fields is available at
* https://docs.razorpay.com/docs/checkout-form#checkout-fields
*/
options.handler = function (response) {
document.getElementById('razorpay_payment_id').value = response.razorpay_payment_id;
document.getElementById('razorpay_signature').value = response.razorpay_signature;
document.razorpayform.submit();
};
// Boolean whether to show image inside a white frame. (default: true)
options.theme.image_padding = false;
options.modal = {
ondismiss: function () {
window.location.href=pageUrl;
},
// Boolean indicating whether pressing escape key
// should close the checkout form. (default: true)
escape: false,
// Boolean indicating whether clicking translucent blank
// space outside checkout form should close the form. (default: false)
backdropclose: false
};
var rzp = new Razorpay(options);
rzp.open();
// e.preventDefault();
} else {
jQuery("#loading").removeClass("loading_image");
jQuery("#step-2").show(500);
jQuery("#msg").html(data.message);
// toastr.error(data.message);
}
}
});
});