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 { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axios-request"; 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 log = LOG.extend("getPaymentTypes");
const getPaymentTypes = async () => { const getPaymentTypes = async () => {
log.http("getPaymentTypes"); log.http("getPaymentTypes");
const response = await axiosRequest<IpaginatedResponse<IpaymentType[]>>({ const response = await axiosRequest<IpaginatedResponse<IpaymentType[]>>({
url: "/operateur/", url: "/operateur/",
method: "GET", method: "GET",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
}); });
log.http(JSON.stringify(response, null, 2)); log.http(JSON.stringify(response, null, 2));
return response return response;
}; };
export default getPaymentTypes;
export default getPaymentTypes;
\ No newline at end of file
import { LOG } from "@logger"; import { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axios-request"; import axiosRequest from "../axios-request";
export interface IorangePaymentStarter { export interface IorangePaymentStarter {
...@@ -24,6 +25,8 @@ export interface IorangeResponse { ...@@ -24,6 +25,8 @@ export interface IorangeResponse {
order_id: string; order_id: string;
} }
const basictoken = base64.encode("admin:admin");
type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED"; type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED";
export interface IorangePaymentStatus { export interface IorangePaymentStatus {
status: OrangeStatus; status: OrangeStatus;
...@@ -40,10 +43,15 @@ const log = LOG.extend("orangePayment"); ...@@ -40,10 +43,15 @@ const log = LOG.extend("orangePayment");
export const getTransactionsData = async (payload: IorangePaymentStarter) => { export const getTransactionsData = async (payload: IorangePaymentStarter) => {
log.http("getTransactionsData", payload); log.http("getTransactionsData", payload);
// const basictoken = base64.encode("admin:admin"); // const basictoken = base64.encode("admin:admin");
const response = await axiosRequest<IorangeResponse>({ const response = await axiosRequest<IorangeResponse>({
url: "/transactions/", url: "/transactions/",
method: "POST", method: "POST",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
data: payload, data: payload,
}); });
...@@ -59,6 +67,10 @@ export const getTransactionStatus = async (orderId: string) => { ...@@ -59,6 +67,10 @@ export const getTransactionStatus = async (orderId: string) => {
const response = await axiosRequest<IorangePaymentStatus>({ const response = await axiosRequest<IorangePaymentStatus>({
url: `/api/TransactionCheckStatus/${orderId}/`, url: `/api/TransactionCheckStatus/${orderId}/`,
method: "GET", method: "GET",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
}); });
log.http("getTransactionStatus |", JSON.stringify(response, null, 2)); log.http("getTransactionStatus |", JSON.stringify(response, null, 2));
......
import { LOG } from "@logger"; import { LOG } from "@logger";
import base64 from "react-native-base64";
import axiosRequest from "../axios-request"; import axiosRequest from "../axios-request";
import type { PaymentCode } from "./Types"; import type { PaymentCode } from "./Types";
...@@ -26,10 +27,16 @@ export interface Transaction { ...@@ -26,10 +27,16 @@ export interface Transaction {
} }
export const getTransactionsHistory = async (): Promise<Transaction[]> => { export const getTransactionsHistory = async (): Promise<Transaction[]> => {
const basictoken = base64.encode("admin:admin");
log.http("getTransactionsHistory"); log.http("getTransactionsHistory");
try { try {
const response = await axiosRequest<Transaction[]>({ const response = await axiosRequest<Transaction[]>({
url: "/transactions/", url: "/transactions/",
headers: {
// biome-ignore lint/style/useNamingConvention: <explanation>
Authorization: `Basic ${basictoken}`,
},
}); });
log.http("getTransactionsHistory |", JSON.stringify(response, null, 2)); 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