Browse Source
building id dynamically and live issue fixed (wrong build & category) booking by user & fixed the changes officerdashboard page for caretaker2
master
building id dynamically and live issue fixed (wrong build & category) booking by user & fixed the changes officerdashboard page for caretaker2
master
3 changed files with 124 additions and 125 deletions
-
49src/main/java/com/gcc/coworkspace/configuration/DataSourceConfig.java
-
11src/main/java/com/gcc/coworkspace/constants/AppConstants.java
-
181src/main/resources/templates/user/razor-pay.html
@ -1,11 +1,10 @@ |
|||||
package com.gcc.coworkspace.constants; |
package com.gcc.coworkspace.constants; |
||||
|
|
||||
public final class AppConstants { |
public final class AppConstants { |
||||
public static String key_id="rzp_live_ySI5Ns54Y7qOcJ"; |
|
||||
public static String key_secret="Nwf1TjhUtaskof8vePkRR8Sb"; |
|
||||
|
// public static String key_id="rzp_live_ySI5Ns54Y7qOcJ"; |
||||
|
// public static String key_secret="Nwf1TjhUtaskof8vePkRR8Sb"; |
||||
|
|
||||
|
|
||||
//uncomment for testing payment |
|
||||
//public static String key_id="rzp_test_tDkHFEqWXmuEi8"; |
|
||||
//public static String key_secret="cBQUjMcKZ4J6vmOKSyNZ92py"; |
|
||||
|
// uncomment for testing payment |
||||
|
public static String key_id = "rzp_test_tDkHFEqWXmuEi8"; |
||||
|
public static String key_secret = "cBQUjMcKZ4J6vmOKSyNZ92py"; |
||||
} |
} |
||||
@ -1,95 +1,96 @@ |
|||||
<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://code.jquery.com/jquery-3.6.0.min.js"></script> |
|
||||
|
<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://code.jquery.com/jquery-3.6.0.min.js"></script> |
||||
|
|
||||
<script type="text/javascript"> |
|
||||
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){ |
|
||||
let amt = response.amount; |
|
||||
console.log("FIRST:==>"); |
|
||||
console.log(response); |
|
||||
if(response.status=="created"){ |
|
||||
let options = { |
|
||||
"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){ |
|
||||
console.log("second==>\n"); |
|
||||
console.log(response); |
|
||||
console.log(response.razorpay_payment_id); |
|
||||
console.log(response.razorpay_order_id); |
|
||||
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); |
|
||||
}, |
|
||||
"prefill": { |
|
||||
"name": "", |
|
||||
"email": "", |
|
||||
"contact": "" |
|
||||
}, |
|
||||
"notes": { |
|
||||
"address": "Greater Chennai Corporation." |
|
||||
}, |
|
||||
"theme": { |
|
||||
"color": "#3399cc" |
|
||||
} |
|
||||
|
<script type="text/javascript"> |
||||
|
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) { |
||||
|
let amt = response.amount; |
||||
|
console.log("FIRST:==>"); |
||||
|
console.log(response); |
||||
|
if (response.status == "created") { |
||||
|
let options = { |
||||
|
// "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) { |
||||
|
console.log("second==>\n"); |
||||
|
console.log(response); |
||||
|
console.log(response.razorpay_payment_id); |
||||
|
console.log(response.razorpay_order_id); |
||||
|
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); |
||||
|
}, |
||||
|
"prefill": { |
||||
|
"name": "", |
||||
|
"email": "", |
||||
|
"contact": "" |
||||
|
}, |
||||
|
"notes": { |
||||
|
"address": "Greater Chennai Corporation." |
||||
|
}, |
||||
|
"theme": { |
||||
|
"color": "#3399cc" |
||||
|
} |
||||
}; |
}; |
||||
var rzp1 = new Razorpay(options); |
|
||||
rzp1.on('payment.failed', function (response){ |
|
||||
console.log(response.error.code); |
|
||||
console.log(response.error.description); |
|
||||
console.log(response.error.source); |
|
||||
console.log(response.error.step); |
|
||||
console.log(response.error.reason); |
|
||||
console.log(response.error.metadata.order_id); |
|
||||
console.log(response.error.metadata.payment_id); |
|
||||
}); |
|
||||
rzp1.open(); |
|
||||
|
var rzp1 = new Razorpay(options); |
||||
|
rzp1.on('payment.failed', function (response) { |
||||
|
console.log(response.error.code); |
||||
|
console.log(response.error.description); |
||||
|
console.log(response.error.source); |
||||
|
console.log(response.error.step); |
||||
|
console.log(response.error.reason); |
||||
|
console.log(response.error.metadata.order_id); |
||||
|
console.log(response.error.metadata.payment_id); |
||||
|
}); |
||||
|
rzp1.open(); |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
error: function (error) { |
||||
|
console.log(error); |
||||
|
alert("error"); |
||||
|
} |
||||
|
}) |
||||
|
}; |
||||
|
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) { |
||||
|
console.log("update payment in server"); |
||||
|
//alert(response); |
||||
|
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) { |
||||
|
swal("Failed`!", "We will check & contact you soon", "error"); |
||||
} |
} |
||||
}, |
|
||||
error:function(error){ |
|
||||
console.log(error); |
|
||||
alert("error"); |
|
||||
} |
|
||||
}) |
|
||||
}; |
|
||||
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){ |
|
||||
console.log("update payment in server"); |
|
||||
//alert(response); |
|
||||
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){ |
|
||||
swal("Failed`!", "We will check & contact you soon", "error"); |
|
||||
} |
|
||||
}); |
}); |
||||
}; |
|
||||
</script> |
|
||||
</header> |
|
||||
</html> |
|
||||
|
}; |
||||
|
</script> |
||||
|
</header> |
||||
|
|
||||
|
</html> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue