diff --git a/src/utils/requests/transactions.ts b/src/utils/requests/transactions.ts new file mode 100644 index 0000000..d15f37a --- /dev/null +++ b/src/utils/requests/transactions.ts @@ -0,0 +1,42 @@ +import { LOG } from "@logger"; +import axiosRequest from "../axios-request"; +import type { PaymentCode } from "./Types"; + +const log = LOG.extend("transactions"); + +export interface Transaction { + // biome-ignore lint/style/useNamingConvention: + type_paiement: number; + // biome-ignore lint/style/useNamingConvention: + type_paiement_label: PaymentCode; + marchand: string; + // biome-ignore lint/style/useNamingConvention: + marchand_name: string; + service: string; + montant: number; + date: string; + commentaire: string; + etat: boolean; + status: "SUCCESS" | "INITIATED" | "FAILED"; + reference: string; + // biome-ignore lint/style/useNamingConvention: + transaction_id: number; + // biome-ignore lint/style/useNamingConvention: + marchand_code: string; +} + +export const getTransactionsHistory = async (): Promise => { + log.http("getTransactionsHistory"); + try { + const response = await axiosRequest({ + url: "/transactions/", + }); + + log.http("getTransactionsHistory |", JSON.stringify(response, null, 2)); + + return response; + } catch (error) { + log.error("getTransactionsHistory |", error); + throw error; + } +};