@@ -208,10 +208,10 @@ public function save(CustomerInterface $customer, $passwordHash = null)
208
208
$ delegatedNewOperation = !$ customer ->getId () ? $ this ->delegatedStorage ->consumeNewOperation () : null ;
209
209
$ prevCustomerData = $ prevCustomerDataArr = null ;
210
210
if ($ customer ->getDefaultBilling ()) {
211
- $ this ->validateDefaultAddress ($ customer , AbstractAddress:: TYPE_BILLING );
211
+ $ this ->validateDefaultAddress ($ customer , CustomerInterface:: DEFAULT_BILLING );
212
212
}
213
213
if ($ customer ->getDefaultShipping ()) {
214
- $ this ->validateDefaultAddress ($ customer , AbstractAddress:: TYPE_SHIPPING );
214
+ $ this ->validateDefaultAddress ($ customer , CustomerInterface:: DEFAULT_SHIPPING );
215
215
}
216
216
if ($ customer ->getId ()) {
217
217
$ prevCustomerData = $ this ->getById ($ customer ->getId ());
@@ -578,19 +578,21 @@ private function validateDefaultAddress(
578
578
CustomerInterface $ customer ,
579
579
string $ defaultAddressType
580
580
): void {
581
- $ addressId = $ defaultAddressType === AbstractAddress:: TYPE_BILLING ? $ customer ->getDefaultBilling ()
581
+ $ addressId = $ defaultAddressType === CustomerInterface:: DEFAULT_BILLING ? $ customer ->getDefaultBilling ()
582
582
: $ customer ->getDefaultShipping ();
583
-
583
+ // echo "$defaultAddressType"; exit;
584
584
if ($ customer ->getAddresses ()) {
585
585
foreach ($ customer ->getAddresses () as $ address ) {
586
586
if ((int ) $ addressId === (int ) $ address ->getId ()) {
587
587
return ;
588
588
}
589
589
}
590
590
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
+ )
594
596
);
595
597
}
596
598
}
0 commit comments