| Server IP : 13.126.101.145 / Your IP : 216.73.217.33 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ip-11-115-0-196 6.8.0-1039-aws #41~22.04.1-Ubuntu SMP Thu Sep 11 10:54:48 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.3.17 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/rentals_updated/wp-content/plugins/woocommerce-billdesk-plugin/ |
Upload File : |
async function InvokeSdk() {
var data = billdesk_wc_checkout_vars;
var config = await getSdkConfig();
data.handler = function (payment) {
document.getElementById('billdesk_billdesk_id').value =
payment.billdesk_payment_id;
};
//this is the function of sdk library
//window.loadBillDeskSdk(config)
loadSdk(config);
}
function loadSdk(config) {
if (typeof window.loadBillDeskSdk == "function") {
window.loadBillDeskSdk(config);
} else {
console.log("function is undefined");
setTimeout(function () {
loadSdk(config);
}, 500);
}
}
async function getSdkConfig() {
var data1 = billdesk_wc_checkout_vars;
console.log('IN order Wooresponse', data1.order_id);
let wooorderid = document.getElementById("wooorderid").value;
console.log('IN order wooorder_id', wooorderid);
const flowtype = "payments";
let response = document.getElementById("woo-res").value;
console.log(response);
let childWindow = document.getElementById("childWindow").value;
console.log('IN Child window', childWindow);
let payment_category = document.getElementById("payment_category").value;
console.log('IN payment_category', payment_category);
let retry_count = document.getElementById("retry_count").value;
console.log('IN retry_count', retry_count);
let responsebody = JSON.parse(response);
console.log('CCC', responsebody.additional_info.additional_info1);
console.log(responsebody.links);
console.log(responsebody);
const flowConfig = {
merchantId: responsebody.mercid,
bdOrderId: responsebody.bdorderid,
authToken: responsebody.links[1].headers.authorization,
//retryCount: 1, //optional default 3
}
if (childWindow != 'yes') {
flowConfig.childWindow = false;
}
else {
flowConfig.childWindow = true;
}
var pay_category = payment_category.split(",").map(item => item.trim());
if (payment_category === "" || payment_category === null) {
} else {
var pref = {
"payment_categories": pay_category
}
if (pay_category[0].length != '0') {
flowConfig.prefs = pref;
}
}
console.log('Pay Cat', flowConfig.prefs);
flowConfig.retryCount = parseInt(retry_count);
if (retry_count === '0') {
flowConfig.retryCount = 0;
} else {
flowConfig.retryCount = parseInt(retry_count);
}
console.log('retryCount', flowConfig.retryCount);
const responseCallback = function (response) {
console.log(response);
console.log(response.status);
/* if (response.status == '111'){
alert("Model close by user " );
document.getElementById("txcode").value = response.status;
return true;
} */
console.log('IN WOO window', wooorderid);
if (response.txnResponse) {
console.log('Response', response.txnResponse);
console.log('Response', response.txnResponse.encrypted_response);
if (response.txnResponse.encrypted_response) {
document.getElementById("encrypted_response").value = response.txnResponse.encrypted_response;
//alert(response.txnResponse.encrypted_response);
}
else if (response.txnResponse.transaction_response) {
document.getElementById("transaction_response").value = response.txnResponse.transaction_response;
console.log(response.txnResponse.transaction_response);
}
else if (response.txnResponse.transaction_response.transaction_error_desc) {
document.getElementById("failure_reason").value = response.txnResponse.transaction_response.transaction_error_desc;
console.log(response.txnResponse.transaction_error_desc);
}
}
else {
return false;
}
//document.billdeskform.submit();
document.getElementById("billdesk_form").submit();
return true;
}
const sdkConfig = {
responseHandler: responseCallback,
merchantLogo: $('#merchant_logo').val(),
flowConfig: flowConfig,
flowType: flowtype
}
return Promise.resolve(sdkConfig);
};
$(document).ready(function (event) {
InvokeSdk()
//event.preventDefault();
return false;
});