@@ -208,10 +208,10 @@ public function save(CustomerInterface $customer, $passwordHash = null)
208208 $ delegatedNewOperation = !$ customer ->getId () ? $ this ->delegatedStorage ->consumeNewOperation () : null ;
209209 $ prevCustomerData = $ prevCustomerDataArr = null ;
210210 if ($ customer ->getDefaultBilling ()) {
211- $ this ->validateDefaultAddress ($ customer , AbstractAddress:: TYPE_BILLING );
211+ $ this ->validateDefaultAddress ($ customer , CustomerInterface:: DEFAULT_BILLING );
212212 }
213213 if ($ customer ->getDefaultShipping ()) {
214- $ this ->validateDefaultAddress ($ customer , AbstractAddress:: TYPE_SHIPPING );
214+ $ this ->validateDefaultAddress ($ customer , CustomerInterface:: DEFAULT_SHIPPING );
215215 }
216216 if ($ customer ->getId ()) {
217217 $ prevCustomerData = $ this ->getById ($ customer ->getId ());
@@ -578,19 +578,21 @@ private function validateDefaultAddress(
578578 CustomerInterface $ customer ,
579579 string $ defaultAddressType
580580 ): void {
581- $ addressId = $ defaultAddressType === AbstractAddress:: TYPE_BILLING ? $ customer ->getDefaultBilling ()
581+ $ addressId = $ defaultAddressType === CustomerInterface:: DEFAULT_BILLING ? $ customer ->getDefaultBilling ()
582582 : $ customer ->getDefaultShipping ();
583-
583+ // echo "$defaultAddressType"; exit;
584584 if ($ customer ->getAddresses ()) {
585585 foreach ($ customer ->getAddresses () as $ address ) {
586586 if ((int ) $ addressId === (int ) $ address ->getId ()) {
587587 return ;
588588 }
589589 }
590590
591- throw InputException::invalidFieldValue (
592- $ defaultAddressType === AbstractAddress::TYPE_BILLING ? 'default_billing ' : 'default_shipping ' ,
593- $ addressId
591+ throw new InputException (
592+ __ (
593+ 'The %fieldName value is invalid. Set the correct value and try again. ' ,
594+ ['fieldName ' => $ defaultAddressType ]
595+ )
594596 );
595597 }
596598 }
0 commit comments