@paynext/sdk 0.0.97 → 0.0.98

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/dist/index.es.js CHANGED
@@ -5961,10 +5961,7 @@ class od {
5961
5961
  var i, r;
5962
5962
  return (r = (i = this.config.state.checkout.getState()).onCheckoutAttempt) == null ? void 0 : r.call(i, t);
5963
5963
  }
5964
- }), this.success = new rd(e.state.translate), this.success.addClassName(Z.hidden), this.error = new Ht(
5965
- e.state.translate,
5966
- e.state.checkout.getState().errorMessageText
5967
- ), this.error.hide(), this.container.append(this.loader.render(), this.buttons.render(), this.form.render()), this.checkout = document.createElement("div"), this.checkout.classList.add(Z.checkout), this.checkout.append(this.container, this.error.render(), this.success.render());
5964
+ }), this.success = new rd(e.state.translate), this.success.addClassName(Z.hidden), this.error = new Ht(e.state.translate, e.state.checkout.getState().errorMessageText), this.error.hide(), this.container.append(this.loader.render(), this.buttons.render(), this.form.render()), this.checkout = document.createElement("div"), this.checkout.classList.add(Z.checkout), this.checkout.append(this.container, this.error.render(), this.success.render());
5968
5965
  }
5969
5966
  // init
5970
5967
  init() {
@@ -6079,19 +6076,19 @@ class od {
6079
6076
  // handle success
6080
6077
  handleSuccess(e) {
6081
6078
  return E(this, null, function* () {
6082
- var r, s;
6079
+ var s, a;
6083
6080
  if (this.isLoading) return;
6084
6081
  this.hideError(), this.setLoading(!0);
6085
6082
  const t = this.config.state.checkout.getState(), i = this.config.state.translate.messages();
6083
+ let r;
6086
6084
  try {
6087
- const a = yield Pr(e, t.environment, t.apiVersion);
6088
- if (a.error)
6089
- throw new Error(((r = a.error) == null ? void 0 : r.message) || i.status.error);
6090
- if (a.three_ds_session_id) {
6085
+ if (r = yield Pr(e, t.environment, t.apiVersion), r.error)
6086
+ throw new Error(((s = r.error) == null ? void 0 : s.message) || i.status.error);
6087
+ if (r.three_ds_session_id) {
6091
6088
  yield this.config.service.ev.initThreeDs({
6092
- threeDsId: a.three_ds_session_id,
6089
+ threeDsId: r.three_ds_session_id,
6093
6090
  onSuccess: () => {
6094
- this.setLoading(!1), this.handleSuccess(D(y({}, e), { threeDsSessionId: a.three_ds_session_id }));
6091
+ this.setLoading(!1), this.handleSuccess(D(y({}, e), { threeDsSessionId: r == null ? void 0 : r.three_ds_session_id }));
6095
6092
  },
6096
6093
  // ToDo: When user close window we don't should show error
6097
6094
  // onError: () => {
@@ -6105,26 +6102,27 @@ class od {
6105
6102
  // })
6106
6103
  // },
6107
6104
  onError: () => {
6108
- this.handleError(a.status_reason);
6105
+ this.handleError(r == null ? void 0 : r.status_reason);
6109
6106
  }
6110
6107
  });
6111
6108
  return;
6112
6109
  }
6113
- if (a.payment_status === It.FAILED || a.payment_status === It.DECLINED) {
6114
- this.handleError(a.status_reason);
6110
+ if (r.payment_status === It.FAILED || r.payment_status === It.DECLINED) {
6111
+ this.handleError(r.status_reason);
6115
6112
  return;
6116
6113
  }
6117
- yield this.showSuccess(), (s = t.onCheckoutComplete) == null || s.call(t, a), this.setLoading(!1);
6118
- } catch (a) {
6119
- this.handleError({
6114
+ yield this.showSuccess(), this.setLoading(!1);
6115
+ } catch (o) {
6116
+ return this.handleError({
6120
6117
  status: "failed",
6121
6118
  status_reason: {
6122
6119
  advice_code: "try_again_later",
6123
6120
  decline_code: Mt.GENERIC_DECLINE,
6124
- message: a.message || a
6121
+ message: o.message || o
6125
6122
  }
6126
6123
  });
6127
6124
  }
6125
+ (a = t.onCheckoutComplete) == null || a.call(t, r);
6128
6126
  });
6129
6127
  }
6130
6128
  // show success