Skip to content

Commit

Permalink
Merge pull request #249 from flickmatch/multiple-payments-fix
Browse files Browse the repository at this point in the history
Fixed multiple payments problem.
  • Loading branch information
abhimanyu-fm authored Jun 9, 2024
2 parents 7f181d8 + a758fa5 commit 56a3967
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ public class RazorPaymentCallbackController {
@Value("${razorpay.key.secret}")
private String secret;


// @Autowired
// WhatsAppProxy whatsAppProxy;

// @PostMapping("/processRazorPayment")
// @PostMapping("/processRazorPayment")
@RequestMapping(value = "/processRazorPayment", method = RequestMethod.POST,consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public ResponseEntity<?> processRazorCallback(@RequestParam("razorpay_order_id") String orderId,
@RequestParam("razorpay_payment_id") String paymentId,
Expand All @@ -63,9 +64,14 @@ public ResponseEntity<?> processRazorCallback(@RequestParam("razorpay_order_id")

boolean status = Utils.verifyPaymentSignature(options, secret);
if(status) {
eventBuilder.joinEventRazorPayment(paymentRequest);
paymentRequestBuilder.updatePaymentRequestStatus(paymentRequest, true);
log.info("Player joined event successfully.");
if(PAID_STATUS.equals(paymentRequest.getStatus())) {
log.info("Ignoring duplicate payments.");
}
else {
eventBuilder.joinEventRazorPayment(paymentRequest);
paymentRequestBuilder.updatePaymentRequestStatus(paymentRequest, true);
log.info("Player joined event successfully.");
}
}

else {
Expand Down

0 comments on commit 56a3967

Please sign in to comment.