diff --git a/CHANGELOG.md b/CHANGELOG.md index 0921af507..a6a5e53cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - Fix a bug: unable to update title of availability after admin remove a machine/plan in calendar - Fix a bug: unable to access files from the public folder (like example.csv) - Fix a bug: unable to return to the statistics tab +- Fix a bug: payment schedule by check result in error if payment mean was not changed - Updated react-modal to 3.16.1 - Updated tiptap editor and its dependencies to 2.0.0-beta.204 - [TODO DEPLOY] `rails db:seed` diff --git a/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx b/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx index 3923f2adf..54cb1d437 100644 --- a/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx +++ b/app/frontend/src/javascript/components/payment/local-payment/local-payment-form.tsx @@ -1,5 +1,5 @@ -import { FormEvent, useEffect, useState } from 'react'; import * as React from 'react'; +import { FormEvent, useEffect, useState } from 'react'; import Select from 'react-select'; import { useTranslation } from 'react-i18next'; import { GatewayFormProps } from '../abstract-payment-modal'; @@ -11,6 +11,7 @@ import { PaymentSchedule } from '../../../models/payment-schedule'; import { HtmlTranslate } from '../../base/html-translate'; import CheckoutAPI from '../../../api/checkout'; import { SelectOption } from '../../../models/select'; +import { PaymentMethod } from '../../../models/payment'; const ALL_SCHEDULE_METHODS = ['card', 'check', 'transfer'] as const; type scheduleMethod = typeof ALL_SCHEDULE_METHODS[number]; @@ -28,6 +29,9 @@ export const LocalPaymentForm: React.FC = ({ onSubmit, onSucce useEffect(() => { setMethod(cart.payment_method || 'check'); + if (cart.payment_method === '') { + cart.payment_method = PaymentMethod.Check; + } }, [cart]); /**