1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-21 15:54:22 +01:00

(bug) set settlement by cash by default for local payment mean

This commit is contained in:
Du Peng 2024-03-08 18:09:53 +01:00
parent 58e3097da2
commit 0e554d22ff
3 changed files with 7 additions and 4 deletions

View File

@ -2,6 +2,8 @@
## Next release ## Next release
- Fix a bug: set settlement by cash by default for local payment mean
## v6.3.15 2024 February 29 ## v6.3.15 2024 February 29
- Fix a bug: unable to generate invoice for payment by check/transfer - Fix a bug: unable to generate invoice for payment by check/transfer

View File

@ -13,7 +13,7 @@ import CheckoutAPI from '../../../api/checkout';
import { SelectOption } from '../../../models/select'; import { SelectOption } from '../../../models/select';
import { PaymentMethod } from '../../../models/payment'; import { PaymentMethod } from '../../../models/payment';
const ALL_SCHEDULE_METHODS = ['card', 'check', 'transfer'] as const; const ALL_SCHEDULE_METHODS = ['card', 'check', 'transfer', 'cash'] as const;
type scheduleMethod = typeof ALL_SCHEDULE_METHODS[number]; type scheduleMethod = typeof ALL_SCHEDULE_METHODS[number];
/** /**
@ -24,13 +24,13 @@ type scheduleMethod = typeof ALL_SCHEDULE_METHODS[number];
export const LocalPaymentForm: React.FC<GatewayFormProps> = ({ onSubmit, onSuccess, onError, children, className, paymentSchedule, cart, updateCart, customer, operator, formId, order }) => { export const LocalPaymentForm: React.FC<GatewayFormProps> = ({ onSubmit, onSuccess, onError, children, className, paymentSchedule, cart, updateCart, customer, operator, formId, order }) => {
const { t } = useTranslation('admin'); const { t } = useTranslation('admin');
const [method, setMethod] = useState<scheduleMethod>('check'); const [method, setMethod] = useState<scheduleMethod>('cash');
const [onlinePaymentModal, setOnlinePaymentModal] = useState<boolean>(false); const [onlinePaymentModal, setOnlinePaymentModal] = useState<boolean>(false);
useEffect(() => { useEffect(() => {
setMethod(cart.payment_method || 'check'); setMethod(cart.payment_method || 'cash');
if (cart.payment_method === '') { if (cart.payment_method === '') {
cart.payment_method = PaymentMethod.Check; cart.payment_method = PaymentMethod.Cash;
} }
}, [cart]); }, [cart]);

View File

@ -19,6 +19,7 @@ export enum PaymentMethod {
Card = 'card', Card = 'card',
Check = 'check', Check = 'check',
Transfer = 'transfer', Transfer = 'transfer',
Cash = 'cash',
Other = '' Other = ''
} }