structure payment

This commit is contained in:
hamid zarghami
2026-02-24 11:47:57 +03:30
parent d65fa8cd2d
commit 7a34e74e02
5 changed files with 52 additions and 1 deletions
+1 -1
View File
@@ -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" />
+14
View File
@@ -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",
}
+15
View File
@@ -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;
};
+9
View File
@@ -0,0 +1,9 @@
import type { PaymentGatewayEnum, PaymentMethodEnum } from "../enum/Enum";
export type PayInvoiceParamsType = {
amount: number;
method: PaymentMethodEnum;
gateway: PaymentGatewayEnum;
description: string;
attachments: string[];
};