mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
28 lines
915 B
TypeScript
28 lines
915 B
TypeScript
import { create } from 'zustand';
|
|
|
|
interface PaymentState {
|
|
paymentIntentId: string | null;
|
|
paymentStatus: 'PENDING' | 'PROCESSING' | 'REQUIRES_ACTION' | 'SUCCEEDED' | 'FAILED' | null;
|
|
selectedCurrency: 'ETB' | 'DJF' | 'USD';
|
|
|
|
setPaymentIntent: (id: string) => void;
|
|
updateStatus: (status: 'PENDING' | 'PROCESSING' | 'REQUIRES_ACTION' | 'SUCCEEDED' | 'FAILED') => void;
|
|
setCurrency: (currency: 'ETB' | 'DJF' | 'USD') => void;
|
|
clearPayment: () => void;
|
|
}
|
|
|
|
export const usePaymentStore = create<PaymentState>((set) => ({
|
|
paymentIntentId: null,
|
|
paymentStatus: null,
|
|
selectedCurrency: 'ETB',
|
|
|
|
setPaymentIntent: (id) => set({ paymentIntentId: id }),
|
|
updateStatus: (status) => set({ paymentStatus: status }),
|
|
setCurrency: (currency) => set({ selectedCurrency: currency }),
|
|
clearPayment: () => set({
|
|
paymentIntentId: null,
|
|
paymentStatus: null,
|
|
selectedCurrency: 'ETB',
|
|
}),
|
|
}));
|