Commit af2d9222 by Arjun Jhukal

updated the card expiration date format

parent a7b4c8f6
...@@ -12,7 +12,6 @@ interface RenderFieldsProps { ...@@ -12,7 +12,6 @@ interface RenderFieldsProps {
} }
export const RenderFields = ({ field, formik }: RenderFieldsProps) => { export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
// Get the actual field object from payment_fields array
const fieldIndex = formik.values.payment_fields?.findIndex( const fieldIndex = formik.values.payment_fields?.findIndex(
(f: MasspayPaymentFields) => f.token === field.token (f: MasspayPaymentFields) => f.token === field.token
); );
...@@ -32,7 +31,6 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -32,7 +31,6 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
formattedValue = dayjs(value as Dayjs).format("YYYY-MM-DD"); formattedValue = dayjs(value as Dayjs).format("YYYY-MM-DD");
} }
// Update the value in the payment_fields array
if (fieldIndex !== -1) { if (fieldIndex !== -1) {
const updatedFields = [...formik.values.payment_fields]; const updatedFields = [...formik.values.payment_fields];
updatedFields[fieldIndex] = { updatedFields[fieldIndex] = {
...@@ -127,6 +125,27 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -127,6 +125,27 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
); );
case "date": case "date":
if (field.type === "CardExpiration") {
return (
<div className="input__field text-left">
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
<OutlinedInput
fullWidth
id={field.token}
name={`payment_fields.${field.token}`}
value={fieldValue}
onChange={(e) => handleChange(e.target.value)}
onBlur={handleBlur}
error={Boolean(fieldError)}
placeholder={field.expected_value}
/>
{fieldError && (
<FormHelperText error>{fieldError}</FormHelperText>
)}
</div>
)
}
else {
return ( return (
<div className="input__field text-left"> <div className="input__field text-left">
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel> <InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
...@@ -223,6 +242,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -223,6 +242,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
</LocalizationProvider> </LocalizationProvider>
</div> </div>
); );
}
default: default:
return ( return (
......
...@@ -65,7 +65,7 @@ export interface MasspayPaymentFields { ...@@ -65,7 +65,7 @@ export interface MasspayPaymentFields {
is_required: boolean; is_required: boolean;
label: string; label: string;
validation: string; validation: string;
type: "BillReferenceNumber" | "BankAccountType" | "BankAccountNumber" | "BankRoutingNumber" | "SocialSecurity" | "DateOfBirth" | "Address1" | "IDSelfieCollection"; type: "BillReferenceNumber" | "BankAccountType" | "BankAccountNumber" | "BankRoutingNumber" | "SocialSecurity" | "DateOfBirth" | "Address1" | "IDSelfieCollection" | "CardExpiration";
expected_value: string; expected_value: string;
value: string; value: string;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment