Commit f1e4dee6 by Arjun Jhukal

changed the withdrawl logic

parent 522a1c8f
import { TransactionStatusProps } from "@/components/pages/dashboard/adminDashboard/transaction/TransactionTable";
import { QueryParams } from "@/types/config";
import { DepositListProps, DepositProps, DepositResponseProps } from "@/types/transaction";
import { GlobalResponse, QueryParams } from "@/types/config";
import { DepositListProps, DepositProps, DepositResponseProps, MasspayPaymentFields, MasspayPaymentMethods } from "@/types/transaction";
import { createApi } from "@reduxjs/toolkit/query/react";
import { baseQuery } from "./baseQuery";
// Define proper request/response types
interface SubmitMassPayRequest {
token: string;
body: {
amount: number;
game_provider: string;
values?: { token: string; value: string }[];
};
}
interface MassPayFieldsResponse {
data: MasspayPaymentFields[];
success: boolean;
message: string;
}
interface MassPayMethodsResponse {
data: MasspayPaymentMethods[];
success: boolean;
message: string;
}
export const transactionApi = createApi({
reducerPath: "transactionApi",
baseQuery: baseQuery,
......@@ -81,7 +103,36 @@ export const transactionApi = createApi({
},
providesTags: ["Withdrawl", "Deposit"]
}),
getMassPayPaymentMethods: builder.query<MassPayMethodsResponse, void>({
query: () => ({
url: `/api/payment`,
method: "GET"
})
}),
getMassPayPaymentFields: builder.mutation<MassPayFieldsResponse, { token: string }>({
query: ({ token }) => ({
url: `/api/payment/fields?token=${token}`,
method: "GET"
})
}),
submitMassPayPaymentFields: builder.mutation<GlobalResponse, SubmitMassPayRequest>({
query: ({ token, body }) => ({
url: `/api/payment/fields?token=${token}`,
method: "POST",
body
}),
invalidatesTags: ["Withdrawl"]
}),
})
})
export const { useDepositMutation, useGetAllDepositQuery, useWithdrawlMutation, useGetAllWithdrawlQuery, useGetAllTransactionQuery } = transactionApi;
\ No newline at end of file
export const {
useDepositMutation,
useGetAllDepositQuery,
useWithdrawlMutation,
useGetAllWithdrawlQuery,
useGetAllTransactionQuery,
useGetMassPayPaymentFieldsMutation,
useGetMassPayPaymentMethodsQuery,
useSubmitMassPayPaymentFieldsMutation
} = transactionApi;
\ No newline at end of file
......@@ -14,7 +14,7 @@ export interface DepositUrlProps {
amount: number;
currency: string;
payment_url: string;
merchant_id:string;
merchant_id: string;
}
......@@ -48,3 +48,22 @@ export interface DepositListProps {
success: boolean;
message: string;
}
export interface MasspayPaymentMethods {
id: number;
name: string;
destination_token: string;
fee: number;
}
export interface MasspayPaymentFields {
input_type: "text" | "options" | "date";
token: string;
is_optional: boolean;
is_required: boolean;
label: string;
validation: string;
type: "BillReferenceNumber" | "BankAccountType" | "BankAccountNumber" | "BankRoutingNumber" | "SocialSecurity" | "DateOfBirth" | "Address1";
expected_value: string;
value: string;
}
\ 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