Commit 2a4a5862 by G

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

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