Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 56x 41x 56x 56x 44x 44x 56x 41x 41x 36x 56x 31x 31x 2x 2x 31x 2x 31x 1x 1x 1x 1x | import { customInstance } from "@services/api";
import { buildMerchantEndpoints } from "@services/api/utils.api";
import { parseTransactionData } from "../hooks";
import { parseRow, parseTransfer } from "../transactions.helpers";
import { format } from "date-fns";
const getTransactionData = (id?: string) =>
customInstance({
url: buildMerchantEndpoints(`transactions/${id}`),
method: "GET",
});
const getTransferData = (id?: string) =>
customInstance({
url: buildMerchantEndpoints(`transfers/${id}`),
method: "GET",
});
export const processTransactionData = (data: any) => {
const formattedData = parseTransactionData({ data: [data] });
return parseRow(formattedData.data[0]);
};
export const getTransaction = async (thxId?: string, isTransfer?: boolean) => {
Iif (isTransfer) {
const data = await getTransferData(thxId);
return parseTransfer(data);
} else {
const data = await getTransactionData(thxId);
return processTransactionData(data);
}
};
export const getStatus = (displayStatus: string, processingState: string) => {
let status = displayStatus;
if (displayStatus === "Money Transfer") {
if (processingState === "approved") status = "Successful";
if (processingState === "failed") status = "Failed";
}
if (displayStatus === "Network fees" || displayStatus === "Assessment fees")
status = processingState;
return status.toLowerCase();
};
export function formatTimestamp(timestamp: number) {
const date = new Date(timestamp);
const formattedDate = format(date, "MMM d, yyyy");
const formattedTime = format(date, "HH:mm");
return {
formattedDate,
formattedTime,
};
}
|