@infrab4a/connect-angular 3.4.0-beta.6 → 3.4.0-beta.8

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.
@@ -1228,7 +1228,7 @@
1228
1228
  this.apiUrl = apiUrl;
1229
1229
  this.homeService = homeService;
1230
1230
  }
1231
- ShippingService.prototype.getMensShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
1231
+ ShippingService.prototype.getShippingMethods = function (shop, zip, weightGrams, totalPrice, personId, subscriptionPlan) {
1232
1232
  var _this = this;
1233
1233
  return rxjs.combineLatest([
1234
1234
  this.homeService.getHomeData(),
@@ -1239,27 +1239,35 @@
1239
1239
  var shippingMethods = shippingMethodsResponse.result;
1240
1240
  if (!shippingMethods.length)
1241
1241
  return [];
1242
+ shippingMethods = shippingMethods.map(function (s) {
1243
+ if (s.ShippingCompanyName == 'Same Day EG')
1244
+ s.ShippingCompanyName = 'Same Day';
1245
+ else
1246
+ return s;
1247
+ });
1242
1248
  var datasSameDayNotAvaliable = datas.sameDayNotAvaliable;
1243
- console.log('params que checgou', shop, zip, weightGrams, totalPrice, personId, subscriptionPlan);
1244
- console.log('shippingMethods', shippingMethods);
1245
- console.log('datas isHolidays', _this.isHolidays(datasSameDayNotAvaliable));
1246
1249
  if (_this.isHolidays(datasSameDayNotAvaliable)) {
1247
1250
  shippingMethods = shippingMethods.filter(function (method) { return method.ShippingCompanyName !== 'Same Day'; });
1248
1251
  }
1249
- if (totalPrice >= 200 || _this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1250
- return shippingMethods.map(function (s) {
1252
+ if (totalPrice >= 200) {
1253
+ shippingMethods = shippingMethods.map(function (s) {
1251
1254
  if (s.serviceName !== 'Same Day')
1252
1255
  return Object.assign(Object.assign({}, s), { totalPrice: 0 });
1253
1256
  else
1254
1257
  return s;
1255
1258
  });
1256
1259
  }
1257
- if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
1258
- return shippingMethods.map(function (s) {
1259
- if (s.serviceName !== 'Same Day')
1260
+ if (_this.isFreeShippingBySubscription(shop, subscriptionPlan)) {
1261
+ shippingMethods = shippingMethods.map(function (s) {
1262
+ if (s.serviceName == 'Same Day')
1260
1263
  return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1261
1264
  else
1262
- return s;
1265
+ return Object.assign(Object.assign({}, s), { totalPrice: 0 });
1266
+ });
1267
+ }
1268
+ if (_this.isHalfShippingBySubscription(shop, subscriptionPlan)) {
1269
+ shippingMethods = shippingMethods.map(function (s) {
1270
+ return Object.assign(Object.assign({}, s), { totalPrice: s.totalPrice / 2 });
1263
1271
  });
1264
1272
  }
1265
1273
  return shippingMethods;