mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import { CbeQueryRequestDto } from "../dto/cbe-query-request.dto";
|
|
import { CbeQueryResponseDto } from "../dto/cbe-query-response.dto";
|
|
|
|
export function mapQuerySuccess(
|
|
request: CbeQueryRequestDto,
|
|
input: { amountMajor: number; fullName: string; paymentReason: string },
|
|
): CbeQueryResponseDto {
|
|
const amount = input.amountMajor.toFixed(2);
|
|
return {
|
|
Destination_Api_Name: request.Destination_Api_Name,
|
|
End_To_End_Txn_Id: request.End_To_End_Txn_Id,
|
|
Bill_Id: request.Bill_Id,
|
|
Total_Amount: amount,
|
|
Penalty_Amount: "0.00",
|
|
Bill_Amount: amount,
|
|
First_Name: "",
|
|
Last_Name: "",
|
|
Full_Name: input.fullName,
|
|
Payment_Reason: input.paymentReason,
|
|
Tin_Number: "",
|
|
Credit_Acct_Number: "",
|
|
Transaction_Type: "",
|
|
Timestamp: new Date().toISOString(),
|
|
Status: "SUCCESS",
|
|
Response_Code: "0",
|
|
Response_Description: "Success",
|
|
Additional_Fields: [],
|
|
};
|
|
}
|
|
|
|
export function mapQueryFailure(
|
|
request: CbeQueryRequestDto,
|
|
description: string,
|
|
): CbeQueryResponseDto {
|
|
return {
|
|
Destination_Api_Name: request.Destination_Api_Name,
|
|
End_To_End_Txn_Id: request.End_To_End_Txn_Id,
|
|
Bill_Id: request.Bill_Id,
|
|
Total_Amount: "",
|
|
Penalty_Amount: "",
|
|
Bill_Amount: "",
|
|
First_Name: "",
|
|
Last_Name: "",
|
|
Full_Name: "",
|
|
Payment_Reason: "",
|
|
Tin_Number: "",
|
|
Credit_Acct_Number: "",
|
|
Transaction_Type: "",
|
|
Timestamp: new Date().toISOString(),
|
|
Status: "FAILED",
|
|
Response_Code: "3",
|
|
Response_Description: description,
|
|
Additional_Fields: [],
|
|
};
|
|
}
|