ng-easycommerce 0.0.422 → 0.0.423

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.
package/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ # version: 0.0.423
2
+ - Fix decidir CyberSource.
3
+
4
+ - Manejo de mensajes backend en metodo de pago decidir.
5
+
1
6
  # version: 0.0.422
2
7
  - Fix para retornar (ready)==true en login 200 siempre.
3
8
 
@@ -209,14 +209,21 @@
209
209
  modo && (modo == 'prod' && (modo = false) || modo == 'test' && (modo = true))
210
210
  !modo && (modo = window.location.host.includes('easycommerce'))
211
211
 
212
- !cybersource && (cybersource = true)
213
-
214
212
  const decidir = new Decidir(modo && urlSandbox || urlProduccion, cybersource);
215
213
  decidir.setPublishableKey(publicApiKey);
216
214
  decidir.setTimeout(5000);
217
215
 
218
216
  let form = document.querySelector('#formulario');
219
217
 
218
+ const setMessageInStore = (response) => {
219
+ if (response.hasOwnProperty('message')) {
220
+ localStorage.setItem('message',response.message)
221
+ }
222
+ if (response.hasOwnProperty('subMessage')) {
223
+ localStorage.setItem('subMessage',response.subMessage)
224
+ }
225
+ }
226
+
220
227
  const sendToken = (data) => {
221
228
  try {
222
229
  fetch(dataRedirect, {
@@ -232,6 +239,7 @@
232
239
  })
233
240
  .then(response => {
234
241
  console.log('Success:', response)
242
+ setMessageInStore(response)
235
243
  if (response.hasOwnProperty('status')) {
236
244
  if (response.status == 'approved' || response.status == 'partially_authorized') {
237
245
  processResponse(response)
@@ -13179,14 +13179,13 @@
13179
13179
  };
13180
13180
  var DecidirEcComponent = /** @class */ (function (_super) {
13181
13181
  __extends$13(DecidirEcComponent, _super);
13182
- function DecidirEcComponent(renderer, connection, toastrService, consts, cartService, toastr, activedRoute, sanitizer, modalService, paramsService) {
13182
+ function DecidirEcComponent(renderer, connection, toastrService, consts, cartService, activedRoute, sanitizer, modalService, paramsService) {
13183
13183
  var _this = _super.call(this) || this;
13184
13184
  _this.renderer = renderer;
13185
13185
  _this.connection = connection;
13186
13186
  _this.toastrService = toastrService;
13187
13187
  _this.consts = consts;
13188
13188
  _this.cartService = cartService;
13189
- _this.toastr = toastr;
13190
13189
  _this.activedRoute = activedRoute;
13191
13190
  _this.sanitizer = sanitizer;
13192
13191
  _this.modalService = modalService;
@@ -13206,17 +13205,25 @@
13206
13205
  localStorage.removeItem('state');
13207
13206
  localStorage.removeItem('dataRedirect');
13208
13207
  localStorage.removeItem('dataDecidir');
13208
+ localStorage.removeItem('message');
13209
+ localStorage.removeItem('subMessage');
13209
13210
  };
13210
13211
  _this.clickClose = function () {
13211
13212
  _this.closeModal = 'cancel';
13212
13213
  _this.modalRef.hide();
13213
13214
  _this.processError('Se cancelo el pago con Decidir');
13214
13215
  };
13216
+ _this.showMessage = function () {
13217
+ var message = localStorage.getItem('message') || undefined;
13218
+ var subMessage = localStorage.getItem('subMessage') || undefined;
13219
+ message && _this.toastrService.show(message, {}, '', { closeButton: true, timeOut: 6000 });
13220
+ subMessage && _this.toastrService.show(subMessage, {}, '', { closeButton: true, timeOut: 6000 });
13221
+ };
13215
13222
  _this.callState = function () {
13216
13223
  try {
13217
13224
  var state = _this.closeModal != '' ? _this.closeModal : localStorage.getItem('state');
13218
13225
  _this.loading = true;
13219
- state && console.log(state);
13226
+ state && _this.showMessage();
13220
13227
  if (state) {
13221
13228
  _this.loading = false;
13222
13229
  _this.clearStorageState();
@@ -13290,7 +13297,6 @@
13290
13297
  { type: ToastService },
13291
13298
  { type: Constants },
13292
13299
  { type: CartService },
13293
- { type: ToastService },
13294
13300
  { type: router.ActivatedRoute },
13295
13301
  { type: platformBrowser.DomSanitizer },
13296
13302
  { type: modal.BsModalService },