From 1802125e5f9b038c9ec884513f0563f6a4d5cc4b Mon Sep 17 00:00:00 2001 From: G Date: Tue, 28 May 2024 17:03:03 +0000 Subject: [PATCH] transactions history query and type --- src/utils/requests/transactions.ts | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/utils/requests/transactions.ts 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; + } +}; -- libgit2 0.27.1