node-paytmpg 7.2.6 → 7.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -695,7 +695,20 @@ class PaymentController {
|
|
|
695
695
|
console.log(`Razorpay webhook payment order=${razorpay_order_id} payid=${razorpay_payment_id} status=${status}`);
|
|
696
696
|
const reqBody = req.rawBody;
|
|
697
697
|
const signature = req.headers["x-razorpay-signature"];
|
|
698
|
-
|
|
698
|
+
console.log("Razorpay webhook signature:", signature);
|
|
699
|
+
console.log("Razorpay rawBody:", reqBody);
|
|
700
|
+
console.log("Razorpay SECRET:", config.SECRET);
|
|
701
|
+
if (signature === undefined) {
|
|
702
|
+
res.status(400).send({ message: "Missing Razorpay signature" });
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
let signatureValid;
|
|
706
|
+
try {
|
|
707
|
+
signatureValid = razorpay_1.default.validateWebhookSignature(reqBody, signature, config.SECRET);
|
|
708
|
+
}
|
|
709
|
+
catch (e) {
|
|
710
|
+
signatureValid = false;
|
|
711
|
+
}
|
|
699
712
|
if (signatureValid) {
|
|
700
713
|
if (event === events[0]) {
|
|
701
714
|
req.body.STATUS = "TXN_SUCCESS";
|
package/dist/package.json
CHANGED