phonepe #26
@ -82,7 +82,7 @@ export const registerClient = onRequest({
|
||||
phoneNumber: formattedPhoneNumber,
|
||||
};
|
||||
|
||||
await admin.firestore().collection('client_profile').doc(clientUid).set(clientData);
|
||||
await admin.firestore().collection('client_profiles').doc(clientUid).set(clientData);
|
||||
|
||||
return res.status(201).json({
|
||||
success: true,
|
||||
|
||||
@ -27,14 +27,12 @@ export const phonePeWebhook = onRequest({
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate expected authorization value
|
||||
const credentialString = `${username}:${password}`;
|
||||
const expectedAuth = crypto
|
||||
.createHash('sha256')
|
||||
.update(credentialString)
|
||||
.digest('hex');
|
||||
|
||||
// PhonePe may send the header with a prefix like "SHA256 " or just the hash
|
||||
const receivedAuth = authHeader.replace(/^SHA256\s+/i, '');
|
||||
|
||||
if (receivedAuth.toLowerCase() !== expectedAuth.toLowerCase()) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user