Amount mismatch error

This commit is contained in:
Kallesh B S 2025-09-12 17:37:58 +05:30
parent c1f03cdf43
commit 905c2263e5

View File

@ -1716,9 +1716,11 @@ export class CarnetApplicationService {
const approve_result = await this.OrderDetails({ P_ORDERID: body.P_ORDERID }); const approve_result = await this.OrderDetails({ P_ORDERID: body.P_ORDERID });
const formattedAmount = await this.formatAmount(body.P_PRICE);
if (approve_result.data.id === body.P_ORDERID if (approve_result.data.id === body.P_ORDERID
&& approve_result.data.status === "APPROVED" && approve_result.data.status === "APPROVED"
&& approve_result.data.purchase_units[0]?.amount?.value === body.P_PRICE + "" && approve_result.data.purchase_units[0]?.amount?.value === formattedAmount + ""
) { ) {
await this.SaveHistory({ await this.SaveHistory({
P_APPLICATIONNAME: body.P_APPLICATIONNAME, P_APPLICATIONNAME: body.P_APPLICATIONNAME,
@ -1768,7 +1770,7 @@ export class CarnetApplicationService {
P_PAYMENTERROR: `Error while validating user approval` P_PAYMENTERROR: `Error while validating user approval`
}); });
throw new InternalServerException(); throw new InternalServerException("failed to save approved status");
} }
} catch (error: any) { } catch (error: any) {