@infrab4a/connect-angular 5.8.0 → 5.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1399,10 +1399,24 @@ class CheckoutService {
1399
1399
  })));
1400
1400
  }
1401
1401
  selectShippingAddress(address) {
1402
+ const formattedAddress = {
1403
+ ...address,
1404
+ zip: this.formatZip(address.zip),
1405
+ };
1402
1406
  return this.getCheckout().pipe(concatMap((checkout) => {
1403
- return this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({ id: checkout.id, shippingAddress: address, billingAddress: address }));
1407
+ return this.repositoriesFacade.checkoutRepository.update(Checkout.toInstance({
1408
+ id: checkout.id,
1409
+ shippingAddress: formattedAddress,
1410
+ billingAddress: formattedAddress,
1411
+ }));
1404
1412
  }));
1405
1413
  }
1414
+ formatZip(zip) {
1415
+ if (!zip)
1416
+ return zip;
1417
+ const digits = zip.replace(/\D/g, '');
1418
+ return digits;
1419
+ }
1406
1420
  getAvailableShippingForProduct(productShipping) {
1407
1421
  return this.dependenciesFacade.httpClient.post(`${this.checkoutUrl}/checkoutGetAvailableShipping`, {
1408
1422
  checkoutId: null,