|
@@ -28,6 +28,11 @@ class CustomerValidator
|
|
|
'password' => 'min:6|required',
|
|
'password' => 'min:6|required',
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
|
|
+ // Trim phone first so the unique check and the stored value always match.
|
|
|
|
|
+ if ($customer->phone !== null) {
|
|
|
|
|
+ $customer->phone = trim($customer->phone);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$data = [
|
|
$data = [
|
|
|
'first_name' => $customer->first_name,
|
|
'first_name' => $customer->first_name,
|
|
|
'last_name' => $customer->last_name,
|
|
'last_name' => $customer->last_name,
|
|
@@ -115,7 +120,8 @@ class CustomerValidator
|
|
|
* spaces, hyphens, dots or parentheses):
|
|
* spaces, hyphens, dots or parentheses):
|
|
|
* +1 2123165641, +86 138 0013 8000, (212) 316-5641, 2123165641
|
|
* +1 2123165641, +86 138 0013 8000, (212) 316-5641, 2123165641
|
|
|
*
|
|
*
|
|
|
- * Returns the normalized number (e.g. "+12123165641") for storage.
|
|
|
|
|
|
|
+ * Returns the phone as-is (trimmed). Separators are preserved, so the
|
|
|
|
|
+ * stored value keeps the user's original formatting, e.g. "+1 530 996 4115".
|
|
|
*
|
|
*
|
|
|
* @throws InvalidInputException
|
|
* @throws InvalidInputException
|
|
|
*/
|
|
*/
|
|
@@ -141,8 +147,8 @@ class CustomerValidator
|
|
|
throw new InvalidInputException(__('bagistoapi::app.graphql.customer.phone-invalid-format'));
|
|
throw new InvalidInputException(__('bagistoapi::app.graphql.customer.phone-invalid-format'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Normalize for storage: optional leading "+" followed by plain digits.
|
|
|
|
|
- return (str_starts_with($phone, '+') ? '+' : '').$digits;
|
|
|
|
|
|
|
+ // No separator stripping: keep the user's input (trimmed) exactly as-is.
|
|
|
|
|
+ return $phone;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|