Commit 2a4a5862 by G

fix biome linting. overrides biome rules for specific utils files.

parent 7dc3387c
...@@ -50,11 +50,28 @@ ...@@ -50,11 +50,28 @@
} }
} }
}, },
"overrides": [
{
"include": ["src/utils/*"],
"linter": {
"rules": {
"style": {
"useFilenamingConvention": {
"level": "error",
"options": {
"filenameCases": ["camelCase", "export"]
}
}
}
}
}
}
],
"vcs": { "vcs": {
"enabled": true, "enabled": true,
"clientKind": "git" "clientKind": "git"
}, },
"files": { "files": {
"ignore": ["babel.config.js", "src/utils/*"] "ignore": ["babel.config.js"]
} }
} }
...@@ -2,67 +2,74 @@ import { LOG } from "@logger"; ...@@ -2,67 +2,74 @@ import { LOG } from "@logger";
import axiosRequest from "../axios-request"; import axiosRequest from "../axios-request";
export interface IorangePaymentStarter { export interface IorangePaymentStarter {
type_paiement : number, // biome-ignore lint/style/useNamingConvention: <api expect type_paiement>
marchand : "1", type_paiement: number;
service : "1", marchand: "1";
montant : number, service: "1";
commentaire : string, montant: number;
numero : string commentaire: string;
numero: string;
} }
export interface IorangeResponse {
export interface IOrangeResponse { status: number;
status : number, message: string;
message : string, // biome-ignore lint/style/useNamingConvention: <api expect pay_token>
pay_token : string, pay_token: string;
payment_url : string, // biome-ignore lint/style/useNamingConvention: <api expect payment_url>
notif_token : string, payment_url: string;
order_id : string, // biome-ignore lint/style/useNamingConvention: <api expect notif_token>
notif_token: string;
// biome-ignore lint/style/useNamingConvention: <api expect order_id>
order_id: string;
} }
type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED"; type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED";
export interface IorangePaymentStatus { export interface IorangePaymentStatus {
status : OrangeStatus, status: OrangeStatus;
code : number, code: number;
message : { message: {
status : OrangeStatus, status: OrangeStatus;
order_id : string, // biome-ignore lint/style/useNamingConvention: <api expect order_id>
txnid ?: string order_id: string;
} txnid?: string;
};
} }
const log = LOG.extend("orangePayment"); 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",
data: payload data: payload,
}); });
log.http("getTransactionsData |", JSON.stringify(response, null, 2)); log.http("getTransactionsData |", JSON.stringify(response, null, 2));
return response return response;
}; };
export const getTransactionStatus = async (orderId: string) => {
log.http("getTransactionStatus |", { orderId });
export const getTransactionStatus = async(orderId : string) => { try {
log.http("getTransactionStatus |", {orderId}); const response = await axiosRequest<IorangePaymentStatus>({
let response = await axiosRequest<IorangePaymentStatus>({ url: `/api/TransactionCheckStatus/${orderId}/`,
url: `/api/TransactionCheckStatus/${orderId}/`, method: "GET",
method: "GET", });
})
log.http("getTransactionStatus |", JSON.stringify(response, null, 2)); log.http("getTransactionStatus |", JSON.stringify(response, null, 2));
if (response.status === "INITIATED"){ if (response.status === "INITIATED") {
log.http("Payment is still in progress, throwing error for mutation to catch"); log.warn("Payment is still in progress, throwing error for mutation to catch");
throw new Error("Payment is still in progress"); throw new Error("Payment is still in progress");
} else { }
log.http("getTransactionStatus |", JSON.stringify(response, null, 2)); log.http("getTransactionStatus |", JSON.stringify(response, null, 2));
return response return response;
} } catch (error) {
} log.error("getTransactionStatus |", error);
\ No newline at end of file throw error;
}
};
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