mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 06:28:12 +00:00
fix: etrade phone verification
This commit is contained in:
@@ -197,6 +197,7 @@ export default function CompanyProfileForm({
|
|||||||
companyEmail: "",
|
companyEmail: "",
|
||||||
companyPhone: "",
|
companyPhone: "",
|
||||||
companyAddress: "",
|
companyAddress: "",
|
||||||
|
etradePhone: "",
|
||||||
tinNumber: "",
|
tinNumber: "",
|
||||||
vatNumber: "",
|
vatNumber: "",
|
||||||
ownerPassportNumber: "",
|
ownerPassportNumber: "",
|
||||||
@@ -279,6 +280,14 @@ export default function CompanyProfileForm({
|
|||||||
// setting region/zone/woreda/kebele/houseNo above is enough — no need to
|
// setting region/zone/woreda/kebele/houseNo above is enough — no need to
|
||||||
// compose it here. companyPhone is derived below (identity → eTrade →
|
// compose it here. companyPhone is derived below (identity → eTrade →
|
||||||
// account), not set directly here.
|
// account), not set directly here.
|
||||||
|
// etradePhone is the raw number eTrade returned for this TIN — kept as its
|
||||||
|
// own field (distinct from companyPhone, which prefers the Fayda-verified
|
||||||
|
// owner's phone) so the backend's "matches eTrade's current record" check
|
||||||
|
// always compares against what eTrade actually said, not the owner's phone.
|
||||||
|
setValue(
|
||||||
|
"etradePhone",
|
||||||
|
data.managerPhone || data.regularPhone || data.mobilePhone,
|
||||||
|
);
|
||||||
|
|
||||||
setEtradeOwner({
|
setEtradeOwner({
|
||||||
name: data.managerName,
|
name: data.managerName,
|
||||||
@@ -303,6 +312,7 @@ export default function CompanyProfileForm({
|
|||||||
setValue("woreda", "");
|
setValue("woreda", "");
|
||||||
setValue("kebele", "");
|
setValue("kebele", "");
|
||||||
setValue("houseNo", "");
|
setValue("houseNo", "");
|
||||||
|
setValue("etradePhone", "");
|
||||||
setEtradeOwner(null);
|
setEtradeOwner(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export function stepPayload(
|
|||||||
woreda: d.woreda,
|
woreda: d.woreda,
|
||||||
kebele: d.kebele,
|
kebele: d.kebele,
|
||||||
houseNo: d.houseNo,
|
houseNo: d.houseNo,
|
||||||
etradePhone: d.companyPhone,
|
etradePhone: d.etradePhone,
|
||||||
};
|
};
|
||||||
case "personnel":
|
case "personnel":
|
||||||
return {
|
return {
|
||||||
@@ -101,6 +101,7 @@ export function toFormValues(p: ProfileResponse): FormData {
|
|||||||
companyEmail: p.companyEmail ?? "",
|
companyEmail: p.companyEmail ?? "",
|
||||||
companyPhone: p.companyPhone ?? "",
|
companyPhone: p.companyPhone ?? "",
|
||||||
companyAddress: p.companyAddress ?? "",
|
companyAddress: p.companyAddress ?? "",
|
||||||
|
etradePhone: p.etradePhone ?? "",
|
||||||
tinNumber: tin,
|
tinNumber: tin,
|
||||||
vatNumber: p.vatNumber ?? "",
|
vatNumber: p.vatNumber ?? "",
|
||||||
ownerPassportNumber: p.identity?.owner.passportNumber ?? "",
|
ownerPassportNumber: p.identity?.owner.passportNumber ?? "",
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ export const onboardingSchema = z.object({
|
|||||||
// Derived from the eTrade address parts (kebele/woreda/zone/region); no
|
// Derived from the eTrade address parts (kebele/woreda/zone/region); no
|
||||||
// standalone input — the granular fields live in the registration section.
|
// standalone input — the granular fields live in the registration section.
|
||||||
companyAddress: z.string().optional(),
|
companyAddress: z.string().optional(),
|
||||||
|
// Raw phone from the eTrade lookup itself — kept separate from companyPhone
|
||||||
|
// (which shows the Fayda-verified owner's phone once verified) so the two
|
||||||
|
// can diverge without the backend's eTrade-authenticity check misfiring.
|
||||||
|
etradePhone: z.string().optional(),
|
||||||
tinNumber: z.string().regex(/^\d{10}$/, "TIN must be exactly 10 digits"),
|
tinNumber: z.string().regex(/^\d{10}$/, "TIN must be exactly 10 digits"),
|
||||||
vatNumber: z
|
vatNumber: z
|
||||||
.string()
|
.string()
|
||||||
@@ -124,6 +128,7 @@ export const stepFields: Record<CompanyStep, (keyof FormData)[]> = {
|
|||||||
"companyEmail",
|
"companyEmail",
|
||||||
"companyPhone",
|
"companyPhone",
|
||||||
"companyAddress",
|
"companyAddress",
|
||||||
|
"etradePhone",
|
||||||
"tinNumber",
|
"tinNumber",
|
||||||
"vatNumber",
|
"vatNumber",
|
||||||
"ownerPassportNumber",
|
"ownerPassportNumber",
|
||||||
|
|||||||
Reference in New Issue
Block a user