tonder-web-sdk 1.16.3 → 1.16.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.16.3",
3
+ "version": "1.16.5",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -70,10 +70,9 @@ export class BaseInlineCheckout {
70
70
  this.#setCheckoutData(data);
71
71
  const response = await this._checkout(data);
72
72
  this.process3ds.setPayload(response);
73
- this.callBack(response);
74
- const payload = await this.#handle3dsRedirect(response);
75
- if (payload) {
76
- resolve(response);
73
+ const result = await this.#handle3dsRedirect(response);
74
+ if (result) {
75
+ resolve(result);
77
76
  }
78
77
  } catch (error) {
79
78
  reject(error);
@@ -282,7 +282,7 @@ export class InlineCheckout extends BaseInlineCheckout {
282
282
  const response = await this.payment();
283
283
  this.callBack(response);
284
284
  } catch (error) {
285
- console.error("Payment error:", error);
285
+ this.callBack({ error: error });
286
286
  }
287
287
  };
288
288
 
package/src/index-dev.js CHANGED
@@ -134,7 +134,7 @@ function setupInlineCheckout() {
134
134
  showSaved: true, // Usar para mostrar/ocultar el listado de tarjetas guardadas
135
135
  },
136
136
  paymentButton: {
137
- show: false, // Usar para mostrar/ocultar el boton de pago
137
+ show: true, // Usar para mostrar/ocultar el boton de pago
138
138
  showAmount: true, // Usar para concatener el monto junto al texto del botón de pago
139
139
  text: "Pagar", // Usar para cambiar el texto del botón de pago
140
140
  },
@@ -149,6 +149,14 @@ function setupInlineCheckout() {
149
149
  show: true, // Usar para mostrar/ocultar el formulario de tarjeta
150
150
  },
151
151
  },
152
+ callBack: async response => {
153
+ console.log("Payment response", JSON.stringify(response, null, 2));
154
+ if (response.error) {
155
+ console.log("Payment error", response.error?.details);
156
+ return;
157
+ }
158
+ alert("Payment success");
159
+ },
152
160
  callbacks: {
153
161
  // Usar para definir la acción a ejecutar cuando el usuario de click en el botón Cancelar
154
162
  onCancel: () => {