You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
272 lines
8.8 KiB
272 lines
8.8 KiB
<script type="text/javascript">
|
|
var token = "";
|
|
token = "[[${token}]]"
|
|
//console.log(token);
|
|
|
|
var txansactionId = "";
|
|
txansactionId = "[[${txansactionId}]]"
|
|
//console.log(txansactionId);
|
|
|
|
var amount = "";
|
|
amount = "[[${amount}]]"
|
|
//console.log(amount);
|
|
|
|
var merchantId = "";
|
|
merchantId = "[[${merchantId}]]"
|
|
//console.log(merchantId);
|
|
|
|
var ConsumerId = "";
|
|
ConsumerId = "[[${consumerId}]]"
|
|
//console.log(ConsumerId);
|
|
|
|
var ConsumerMobileNo = "";
|
|
ConsumerMobileNo = "[[${consumerMobileNo}]]"
|
|
//console.log(ConsumerMobileNo);
|
|
|
|
var ConsumerEmailId = "";
|
|
ConsumerEmailId = "[[${consumerEmailId}]]"
|
|
//console.log(ConsumerEmailId);
|
|
|
|
|
|
$(document).ready(function () {
|
|
function handleResponse(res) {
|
|
if (typeof res != "undefined" && typeof res.paymentMethod != "undefined" && typeof res.paymentMethod.paymentTransaction != "undefined" && typeof res.paymentMethod.paymentTransaction.statusCode != "undefined" && res.paymentMethod.paymentTransaction.statusCode == "0300") {
|
|
// success block
|
|
//console.log("Success ");
|
|
//console.log(res);
|
|
} else if (typeof res != "undefined" && typeof res.paymentMethod != "undefined" && typeof res.paymentMethod.paymentTransaction != "undefined" && typeof res.paymentMethod.paymentTransaction.statusCode != "undefined" && res.paymentMethod.paymentTransaction.statusCode == "0398") {
|
|
// initiated block
|
|
//console.log("Initiated ");
|
|
//console.log(res);
|
|
} else {
|
|
//console.log("error ");
|
|
//console.log(res);
|
|
// error block
|
|
}
|
|
};
|
|
|
|
$(document).off("click", "#btnSubmit").on("click", "#btnSubmit", function (e) {
|
|
e.preventDefault();
|
|
|
|
var reqJson = {
|
|
"features": {
|
|
"enableAbortResponse": true,
|
|
"enableExpressPay": true,
|
|
"enableInstrumentDeRegistration": true,
|
|
"enableMerTxnDetails": true,
|
|
"enableNewWindowFlow": true //for hybrid applications please disable this by passing false
|
|
},
|
|
"consumerData": {
|
|
"deviceId": "WEBSH2", //possible values "WEBSH1" or "WEBSH2"
|
|
"token": token,
|
|
"returnUrl": "/communityhall/payment/response", //merchant response page URL
|
|
"responseHandler": handleResponse,
|
|
"paymentMode": "all",
|
|
"merchantLogoUrl": "https://upload.wikimedia.org/wikipedia/commons/a/a8/Chennai_Corporation_Emblem.png", //provided merchant logo will be displayed
|
|
"merchantName": "Greater Chennai Corporation",
|
|
"merchantMsg": "Community Hall Booking",
|
|
"merchantId": merchantId,
|
|
"currency": "INR",
|
|
"consumerId": consumerId,
|
|
"consumerMobileNo": consumerMobileNo,
|
|
"consumerEmailId": consumerEmailId,
|
|
"txnId": txansactionId, //Unique merchant transaction ID
|
|
"items": [{
|
|
"itemId": "FIRST",
|
|
"amount": amount,
|
|
"comAmt": "0"
|
|
}],
|
|
"customStyle": {
|
|
"PRIMARY_COLOR_CODE": "#45beaa", //merchant primary color code
|
|
"SECONDARY_COLOR_CODE": "#FFFFFF", //provide merchant's suitable color code
|
|
"BUTTON_COLOR_CODE_1": "#2d8c8c", //merchant's button background color code
|
|
"BUTTON_COLOR_CODE_2": "#FFFFFF" //provide merchant's suitable color code for button text
|
|
}
|
|
}
|
|
};
|
|
//console.log(reqJson);
|
|
$.pnCheckout(reqJson);
|
|
if (reqJson.features.enableNewWindowFlow) {
|
|
pnCheckoutShared.openNewWindow();
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
function paymentStart(counterUserId, counterBookingId, counterOption) {
|
|
|
|
//alert(this.userId);
|
|
if (counterOption) {
|
|
this.userId = counterUserId;
|
|
this.bookingId = counterBookingId;
|
|
} else {
|
|
if (this.userId == 0) {
|
|
alert("Please Login & Retry");
|
|
return false;
|
|
}
|
|
if (this.bookingId == 0) {
|
|
alert("Please try retry booking");
|
|
return false;
|
|
}
|
|
}
|
|
if (this.userId != 0 && this.bookingId != 0) {
|
|
var userIdd = userId;
|
|
var bookingIdd = bookingId;
|
|
//console.log("userIdd:-" + userIdd);
|
|
//console.log("bookingIdd:-" + bookingIdd);
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/communityhall/payment/api/payment-request',
|
|
data: {'userId': userIdd, 'bookingId': bookingIdd},
|
|
success: function (response) {
|
|
// console.log(response);
|
|
if (response.error) {
|
|
alert("please Contact Admin..")
|
|
} else {
|
|
|
|
txansactionId = response.txansactionId;
|
|
consumerMobileNo = response.consumerMobileNo;
|
|
consumerEmailId = response.consumerEmailId;
|
|
token = response.token;
|
|
merchantId = response.merchantId;
|
|
consumerId = response.consumerId;
|
|
amount = response.amount;
|
|
//console.log(txansactionId);
|
|
//console.log(consumerMobileNo);
|
|
//console.log(token);
|
|
//console.log(merchantId);
|
|
//console.log(consumerId);
|
|
//console.log(amount);
|
|
$("#btnSubmit").click();
|
|
|
|
}
|
|
},
|
|
error: function () {
|
|
//console.log("Error");// Handle error here
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
alert("please logout & retry")
|
|
}
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
function extrapaymentStart(userId, bookingId) {
|
|
if (this.userId != 0 && this.bookingId != 0) {
|
|
var userIdd = userId;
|
|
var bookingIdd = bookingId;
|
|
//console.log("userIdd:-" + userIdd);
|
|
//console.log("bookingIdd:-" + bookingIdd);
|
|
$.ajax({
|
|
type: "POST",
|
|
url: '/communityhall/payment/api/additionaldamage-payment-request',
|
|
data: {'userId': userIdd, 'bookingId': bookingIdd},
|
|
success: function (response) {
|
|
// console.log(response);
|
|
if (response.error) {
|
|
alert("please Contact Admin..")
|
|
} else {
|
|
|
|
txansactionId = response.txansactionId;
|
|
consumerMobileNo = response.consumerMobileNo;
|
|
consumerEmailId = response.consumerEmailId;
|
|
token = response.token;
|
|
merchantId = response.merchantId;
|
|
consumerId = response.consumerId;
|
|
amount = response.amount;
|
|
//console.log(txansactionId);
|
|
//console.log(consumerMobileNo);
|
|
//console.log(token);
|
|
//console.log(merchantId);
|
|
//console.log(consumerId);
|
|
//console.log(amount);
|
|
$("#extrapaymentbtnSubmit").click();
|
|
|
|
}
|
|
},
|
|
error: function () {
|
|
//console.log("Error");// Handle error here
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
alert("please logout & retry")
|
|
}
|
|
return false;
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
function handleResponseED(res) {
|
|
if (typeof res != "undefined" && typeof res.paymentMethod != "undefined" && typeof res.paymentMethod.paymentTransaction != "undefined" && typeof res.paymentMethod.paymentTransaction.statusCode != "undefined" && res.paymentMethod.paymentTransaction.statusCode == "0300") {
|
|
// success block
|
|
//console.log("Success ");
|
|
//console.log(res);
|
|
} else if (typeof res != "undefined" && typeof res.paymentMethod != "undefined" && typeof res.paymentMethod.paymentTransaction != "undefined" && typeof res.paymentMethod.paymentTransaction.statusCode != "undefined" && res.paymentMethod.paymentTransaction.statusCode == "0398") {
|
|
// initiated block
|
|
//console.log("Initiated ");
|
|
//console.log(res);
|
|
} else {
|
|
//console.log("error ");
|
|
//console.log(res);
|
|
// error block
|
|
}
|
|
};
|
|
|
|
$(document).off("click", "#extrapaymentbtnSubmit").on("click", "#extrapaymentbtnSubmit", function (e) {
|
|
e.preventDefault();
|
|
|
|
// console.log(txansactionId);
|
|
// console.log(consumerMobileNo);
|
|
// console.log(token);
|
|
// console.log(merchantId);
|
|
// console.log(consumerId);
|
|
// console.log(amount);
|
|
|
|
|
|
var reqJson = {
|
|
"features": {
|
|
"enableAbortResponse": true,
|
|
"enableExpressPay": true,
|
|
"enableInstrumentDeRegistration": true,
|
|
"enableMerTxnDetails": true,
|
|
"enableNewWindowFlow": true //for hybrid applications please disable this by passing false
|
|
},
|
|
"consumerData": {
|
|
"deviceId": "WEBSH2", //possible values "WEBSH1" or "WEBSH2"
|
|
"token": token,
|
|
"returnUrl": "/communityhall/payment/additionaldamage-response", //merchant response page URL
|
|
"responseHandler": handleResponseED,
|
|
"paymentMode": "all",
|
|
"merchantLogoUrl": "https://upload.wikimedia.org/wikipedia/commons/a/a8/Chennai_Corporation_Emblem.png", //provided merchant logo will be displayed
|
|
"merchantName": "Greater Chennai Corporation",
|
|
"merchantMsg": "Community Hall Booking",
|
|
"merchantId": merchantId,
|
|
"currency": "INR",
|
|
"consumerId": consumerId,
|
|
"consumerMobileNo": consumerMobileNo,
|
|
"consumerEmailId": consumerEmailId,
|
|
"txnId": txansactionId, //Unique merchant transaction ID
|
|
"items": [{
|
|
"itemId": "FIRST",
|
|
"amount": amount,
|
|
"comAmt": "0"
|
|
}],
|
|
"customStyle": {
|
|
"PRIMARY_COLOR_CODE": "#45beaa", //merchant primary color code
|
|
"SECONDARY_COLOR_CODE": "#FFFFFF", //provide merchant's suitable color code
|
|
"BUTTON_COLOR_CODE_1": "#2d8c8c", //merchant's button background color code
|
|
"BUTTON_COLOR_CODE_2": "#FFFFFF" //provide merchant's suitable color code for button text
|
|
}
|
|
}
|
|
};
|
|
$.pnCheckout(reqJson);
|
|
if (reqJson.features.enableNewWindowFlow) {
|
|
pnCheckoutShared.openNewWindow();
|
|
}
|
|
});
|
|
});
|
|
|
|
</script>
|