Skip to content

Commit

Permalink
Optimize user experience in express checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-zhang-awx committed May 8, 2024
1 parent be5b9b7 commit 9d18aca
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions Model/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,6 @@ public function postAddress(): string
throw new Exception(__('Country is required.'));
}
$city = $this->request->getParam('city');
if (!$city) {
throw new Exception(__('City is required.'));
}

$region = $this->request->getParam('region');
$postcode = $this->request->getParam('postcode');
Expand Down Expand Up @@ -514,12 +511,6 @@ public function postAddress(): string
}
$address->setPostcode($postcode);

$errors = $this->countryValidator->validate($address);
$isPostcodeValid = $this->postcodeValidator->isValid($address->getCountryId(), $postcode);
if (count($errors) || !$isPostcodeValid) {
throw new Exception(__('Please check the shipping address information.'));
}

$methods = $this->shipmentEstimation->estimateByExtendedAddress($cartId, $address);

$res = [];
Expand Down Expand Up @@ -593,11 +584,11 @@ public function validateAddresses()
$quote = $this->checkoutHelper->getQuote();
$errors = $this->shippingAddressValidationRule->validate($quote);
if ($errors and $errors[0]->getErrors()) {
throw new Exception(__("Please check the shipping address information."));
throw new Exception(__(implode(' ', $errors[0]->getErrors())));
}
$errors = $this->billingAddressValidationRule->validate($quote);
if ($errors and $errors[0]->getErrors()) {
throw new Exception(__("Please check the billing address information."));
throw new Exception(__(implode(' ', $errors[0]->getErrors())));
}
return 'ok';
}
Expand Down

0 comments on commit 9d18aca

Please sign in to comment.