Commit db5ab177 by G

had to suddenly add basic token auth because koffi couldn't be bothered to warn me.

parent 1efc9808
import { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axios-request";
import { IpaginatedResponse, IpaymentType } from "./Types";
import type { IpaginatedResponse, IpaymentType } from "./Types";
const basictoken = base64.encode("admin:admin");
const log = LOG.extend("getPaymentTypes");
const getPaymentTypes = async () => {
......@@ -8,11 +11,13 @@ const getPaymentTypes = async () => {
const response = await axiosRequest<IpaginatedResponse<IpaymentType[]>>({
url: "/operateur/",
method: "GET",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
});
log.http(JSON.stringify(response, null, 2));
return response
return response;
};
export default getPaymentTypes;
import { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axios-request";
export interface IorangePaymentStarter {
......@@ -24,6 +25,8 @@ export interface IorangeResponse {
order_id: string;
}
const basictoken = base64.encode("admin:admin");
type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED";
export interface IorangePaymentStatus {
status: OrangeStatus;
......@@ -40,10 +43,15 @@ const log = LOG.extend("orangePayment");
export const getTransactionsData = async (payload: IorangePaymentStarter) => {
log.http("getTransactionsData", payload);
// const basictoken = base64.encode("admin:admin");
const response = await axiosRequest<IorangeResponse>({
url: "/transactions/",
method: "POST",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
data: payload,
});
......@@ -59,6 +67,10 @@ export const getTransactionStatus = async (orderId: string) => {
const response = await axiosRequest<IorangePaymentStatus>({
url: `/api/TransactionCheckStatus/${orderId}/`,
method: "GET",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
});
log.http("getTransactionStatus |", JSON.stringify(response, null, 2));
......
import { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axios-request";
import type { PaymentCode } from "./Types";
......@@ -26,10 +27,16 @@ export interface Transaction {
}
export const getTransactionsHistory = async (): Promise<Transaction[]> => {
const basictoken = base64.encode("admin:admin");
log.http("getTransactionsHistory");
try {
const response = await axiosRequest<Transaction[]>({
url: "/transactions/",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
});
log.http("getTransactionsHistory |", JSON.stringify(response, null, 2));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment