|
|
|
@ -1,32 +1,32 @@ |
|
|
|
<html> |
|
|
|
<header> |
|
|
|
<html> |
|
|
|
<header> |
|
|
|
<script src="https://checkout.razorpay.com/v1/checkout.js"></script> |
|
|
|
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> |
|
|
|
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> |
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
const paymentStart=(id)=>{ |
|
|
|
console.log("payment started :-"+id); |
|
|
|
const paymentStart = (id) => { |
|
|
|
console.log("payment started :-" + id); |
|
|
|
$.ajax({ |
|
|
|
url:'/muthalvarpadaippagam/book/api/create_order', |
|
|
|
data:{id:id}, |
|
|
|
type:'POST', |
|
|
|
dataType:'json', |
|
|
|
success:function(response){ |
|
|
|
url: '/muthalvarpadaippagam/book/api/create_order', |
|
|
|
data: { id: id }, |
|
|
|
type: 'POST', |
|
|
|
dataType: 'json', |
|
|
|
success: function (response) { |
|
|
|
let amt = response.amount; |
|
|
|
console.log("FIRST:==>"); |
|
|
|
console.log(response); |
|
|
|
if(response.status=="created"){ |
|
|
|
if (response.status == "created") { |
|
|
|
let options = { |
|
|
|
"key": "[[${keyId}]]", |
|
|
|
//"key" : "rzp_test_tDkHFEqWXmuEi8", // Enter the Key ID generated from the Dashboard |
|
|
|
// "key": "[[${keyId}]]", |
|
|
|
"key": "rzp_test_tDkHFEqWXmuEi8", // Enter the Key ID generated from the Dashboard |
|
|
|
"amount": response.amount, // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise |
|
|
|
"currency": "INR", |
|
|
|
"name": "Greater Chennai Corporation", |
|
|
|
"description": "Co-workspace Transaction", |
|
|
|
"image": "https://upload.wikimedia.org/wikipedia/commons/a/a8/Chennai_Corporation_Emblem.png", |
|
|
|
"order_id": response.id, //This is a sample Order ID. Pass the `id` obtained in the response of Step 1 |
|
|
|
"handler": function (response){ |
|
|
|
"handler": function (response) { |
|
|
|
console.log("second==>\n"); |
|
|
|
console.log(response); |
|
|
|
console.log(response.razorpay_payment_id); |
|
|
|
@ -34,7 +34,7 @@ |
|
|
|
console.log(response.razorpay_signature); |
|
|
|
console.log("payment success"); |
|
|
|
alert("congrates !payment successfull"); |
|
|
|
updatePaymentInServer(response.razorpay_payment_id,response.razorpay_order_id,"paid",id,amt); |
|
|
|
updatePaymentInServer(response.razorpay_payment_id, response.razorpay_order_id, "paid", id, amt); |
|
|
|
}, |
|
|
|
"prefill": { |
|
|
|
"name": "", |
|
|
|
@ -49,7 +49,7 @@ |
|
|
|
} |
|
|
|
}; |
|
|
|
var rzp1 = new Razorpay(options); |
|
|
|
rzp1.on('payment.failed', function (response){ |
|
|
|
rzp1.on('payment.failed', function (response) { |
|
|
|
console.log(response.error.code); |
|
|
|
console.log(response.error.description); |
|
|
|
console.log(response.error.source); |
|
|
|
@ -62,34 +62,35 @@ |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
error:function(error){ |
|
|
|
error: function (error) { |
|
|
|
console.log(error); |
|
|
|
alert("error"); |
|
|
|
} |
|
|
|
}) |
|
|
|
}; |
|
|
|
function updatePaymentInServer(payment_id,order_id,status,id,amt){ |
|
|
|
function updatePaymentInServer(payment_id, order_id, status, id, amt) { |
|
|
|
$.ajax({ |
|
|
|
url:'/muthalvarpadaippagam/book/api/Confirm', |
|
|
|
data:JSON.stringify({payment_id:payment_id,order_id:order_id,status:status,id:id,amount:amt}), |
|
|
|
contentType:'application/json', |
|
|
|
type:'POST', |
|
|
|
dataType:'json', |
|
|
|
success:function(response){ |
|
|
|
url: '/muthalvarpadaippagam/book/api/Confirm', |
|
|
|
data: JSON.stringify({ payment_id: payment_id, order_id: order_id, status: status, id: id, amount: amt }), |
|
|
|
contentType: 'application/json', |
|
|
|
type: 'POST', |
|
|
|
dataType: 'json', |
|
|
|
success: function (response) { |
|
|
|
console.log("update payment in server"); |
|
|
|
//alert(response); |
|
|
|
if(response != "error"){ |
|
|
|
window.location.href = "/muthalvarpadaippagam/bookingQRCode?booking_id="+response; |
|
|
|
}else{ |
|
|
|
if (response != "error") { |
|
|
|
window.location.href = "/muthalvarpadaippagam/bookingQRCode?booking_id=" + response; |
|
|
|
} else { |
|
|
|
alert("please contact GCC. If amount is debited from your account!!\nThank You"); |
|
|
|
window.location.href = "/muthalvarpadaippagam"; |
|
|
|
} |
|
|
|
}, |
|
|
|
error:function(error){ |
|
|
|
error: function (error) { |
|
|
|
swal("Failed`!", "We will check & contact you soon", "error"); |
|
|
|
} |
|
|
|
}); |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</header> |
|
|
|
</html> |
|
|
|
</header> |
|
|
|
|
|
|
|
</html> |