tonder-web-sdk 1.11.1 → 1.11.11

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.11.1",
3
+ "version": "1.11.11",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -237,20 +237,29 @@ export class InlineCheckout {
237
237
  }
238
238
 
239
239
  async verify3dsTransaction () {
240
+ globalLoader.show()
240
241
  const result3ds = await this.process3ds.verifyTransactionStatus()
241
242
  const resultCheckout = await this.resumeCheckout(result3ds)
242
243
  this.process3ds.setPayload(resultCheckout)
243
- if (resultCheckout?.is_route_finished && resultCheckout?.provider === 'tonder') {
244
- return resultCheckout
245
- }
244
+ globalLoader.remove()
246
245
  return this.handle3dsRedirect(resultCheckout)
247
246
  }
248
247
 
248
+
249
249
  async resumeCheckout(response) {
250
- if (["Failed", "Declined", "Cancelled"].includes(response?.status)) {
250
+ // Stop the routing process if the transaction is either hard declined or successful
251
+ if (response?.decline?.error_type === "Hard") {
252
+ return response
253
+ }
254
+
255
+ if (["Success", "Authorized"].includes(response?.transaction_status)) {
256
+ return response;
257
+ }
258
+
259
+ if (response) {
251
260
  globalLoader.show()
252
261
  const routerItems = {
253
- checkout_id: response.checkout?.id,
262
+ checkout_id: response?.checkout?.id,
254
263
  };
255
264
  try {
256
265
  const routerResponse = await startCheckoutRouter(
@@ -260,12 +269,12 @@ export class InlineCheckout {
260
269
  );
261
270
  return routerResponse
262
271
  } catch (error) {
263
- throw error
272
+ // throw error
264
273
  } finally {
265
274
  globalLoader.remove()
266
275
  }
276
+ return response
267
277
  }
268
- return response
269
278
  }
270
279
 
271
280
  #mount(containerTonderCheckout) {
@@ -288,7 +297,7 @@ export class InlineCheckout {
288
297
  return await customerRegister(this.baseUrl, this.apiKeyTonder, customer, signal);
289
298
  }
290
299
 
291
- async #mountAPMs(){
300
+ async #mountAPMs() {
292
301
  try{
293
302
  const apms = await getCustomerAPMs(this.baseUrl, this.apiKeyTonder, "?status=active&page_size=10000");
294
303
  if(apms && apms['results'] && apms['results'].length > 0){