structure payment
This commit is contained in:
@@ -182,7 +182,7 @@ const TicketSection: FC = () => {
|
||||
<div className="w-full h-12 bg-white border border-border rounded-xl flex items-center px-3 gap-3 mt-3">
|
||||
<button
|
||||
onClick={togglePlayPause}
|
||||
className="w-8 h-8 rounded-full bg-black flex items-center justify-center flex-shrink-0"
|
||||
className="w-8 h-8 rounded-full bg-black flex items-center justify-center shrink-0"
|
||||
>
|
||||
{isPlaying ? (
|
||||
<Pause size={16} color="#fff" variant="Bold" />
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
export const enum PaymentMethodEnum {
|
||||
Online = "Online",
|
||||
Cash = "Cash",
|
||||
Credit = "Credit",
|
||||
}
|
||||
export const enum PaymentStatusEnum {
|
||||
Pending = "pending",
|
||||
Paid = "paid",
|
||||
Failed = "failed",
|
||||
Refunded = "refunded",
|
||||
}
|
||||
export const enum PaymentGatewayEnum {
|
||||
ZarinPal = "zarinpal",
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import * as api from "../service/PaymentService";
|
||||
import type { PayInvoiceParamsType } from "../types/Types";
|
||||
|
||||
export const usePayInvoice = () => {
|
||||
return useMutation({
|
||||
mutationFn: ({
|
||||
invoiceId,
|
||||
params,
|
||||
}: {
|
||||
invoiceId: string;
|
||||
params: PayInvoiceParamsType;
|
||||
}) => api.payInvoice(invoiceId, params),
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
import axios from "@/config/axios";
|
||||
import type { PayInvoiceParamsType } from "../types/Types";
|
||||
|
||||
export const payInvoice = async (
|
||||
invoiceId: string,
|
||||
params: PayInvoiceParamsType,
|
||||
) => {
|
||||
const { data } = await axios.post(
|
||||
`/public/payments/invoice/${invoiceId}/pay`,
|
||||
params,
|
||||
);
|
||||
return data;
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { PaymentGatewayEnum, PaymentMethodEnum } from "../enum/Enum";
|
||||
|
||||
export type PayInvoiceParamsType = {
|
||||
amount: number;
|
||||
method: PaymentMethodEnum;
|
||||
gateway: PaymentGatewayEnum;
|
||||
description: string;
|
||||
attachments: string[];
|
||||
};
|
||||
Reference in New Issue
Block a user