tonder-web-sdk 1.11.0-beta.3 → 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/.idea/aws.xml ADDED
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="accountSettings">
4
+ <option name="activeProfile" value="profile:default" />
5
+ <option name="activeRegion" value="us-east-1" />
6
+ <option name="recentlyUsedProfiles">
7
+ <list>
8
+ <option value="profile:default" />
9
+ </list>
10
+ </option>
11
+ <option name="recentlyUsedRegions">
12
+ <list>
13
+ <option value="us-east-1" />
14
+ </list>
15
+ </option>
16
+ </component>
17
+ </project>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,62 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="37fc62e5-7dd0-4a2e-b68c-304069cdf5bd" name="Changes" comment="">
5
+ <change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/src/classes/inlineCheckout.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/classes/inlineCheckout.js" afterDir="false" />
7
+ </list>
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="Git.Settings">
14
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
15
+ </component>
16
+ <component name="MarkdownSettingsMigration">
17
+ <option name="stateVersion" value="1" />
18
+ </component>
19
+ <component name="ProjectColorInfo"><![CDATA[{
20
+ "customColor": "",
21
+ "associatedIndex": 2
22
+ }]]></component>
23
+ <component name="ProjectId" id="2iy5RvaLleBBnn8yOfQNLpzKK66" />
24
+ <component name="ProjectViewState">
25
+ <option name="autoscrollFromSource" value="true" />
26
+ <option name="autoscrollToSource" value="true" />
27
+ <option name="hideEmptyMiddlePackages" value="true" />
28
+ <option name="openDirectoriesWithSingleClick" value="true" />
29
+ <option name="showLibraryContents" value="true" />
30
+ </component>
31
+ <component name="PropertiesComponent"><![CDATA[{
32
+ "keyToString": {
33
+ "RunOnceActivity.OpenProjectViewOnStart": "true",
34
+ "RunOnceActivity.ShowReadmeOnStart": "true",
35
+ "git-widget-placeholder": "Merging TNDR-1140",
36
+ "nodejs_package_manager_path": "npm",
37
+ "vue.rearranger.settings.migration": "true"
38
+ }
39
+ }]]></component>
40
+ <component name="SharedIndexes">
41
+ <attachedChunks>
42
+ <set>
43
+ <option value="bundled-python-sdk-50da183f06c8-2887949eec09-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-233.13135.95" />
44
+ </set>
45
+ </attachedChunks>
46
+ </component>
47
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
48
+ <component name="TaskManager">
49
+ <task active="true" id="Default" summary="Default task">
50
+ <changelist id="37fc62e5-7dd0-4a2e-b68c-304069cdf5bd" name="Changes" comment="" />
51
+ <created>1720449973301</created>
52
+ <option name="number" value="Default" />
53
+ <option name="presentableId" value="Default" />
54
+ <updated>1720449973301</updated>
55
+ <workItem from="1720449976262" duration="22000" />
56
+ </task>
57
+ <servers />
58
+ </component>
59
+ <component name="TypeScriptGeneratedFilesManager">
60
+ <option name="version" value="3" />
61
+ </component>
62
+ </project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.11.0-beta.3",
3
+ "version": "1.11.11",
4
4
  "description": "tonder sdk for integrations",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -237,30 +237,44 @@ 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
- const routerResponse = await startCheckoutRouter(
256
- this.baseUrl,
257
- this.apiKeyTonder,
258
- routerItems
259
- );
260
- globalLoader.remove()
261
- return routerResponse
264
+ try {
265
+ const routerResponse = await startCheckoutRouter(
266
+ this.baseUrl,
267
+ this.apiKeyTonder,
268
+ routerItems
269
+ );
270
+ return routerResponse
271
+ } catch (error) {
272
+ // throw error
273
+ } finally {
274
+ globalLoader.remove()
275
+ }
276
+ return response
262
277
  }
263
- return response
264
278
  }
265
279
 
266
280
  #mount(containerTonderCheckout) {
@@ -283,7 +297,7 @@ export class InlineCheckout {
283
297
  return await customerRegister(this.baseUrl, this.apiKeyTonder, customer, signal);
284
298
  }
285
299
 
286
- async #mountAPMs(){
300
+ async #mountAPMs() {
287
301
  try{
288
302
  const apms = await getCustomerAPMs(this.baseUrl, this.apiKeyTonder, "?status=active&page_size=10000");
289
303
  if(apms && apms['results'] && apms['results'].length > 0){
@@ -444,7 +458,7 @@ export class InlineCheckout {
444
458
  );
445
459
 
446
460
  const selected_apm = this.apmsData ? this.apmsData.find((iapm) => iapm.pk === this.radioChecked):{};
447
-
461
+
448
462
  // Checkout router
449
463
  const routerItems = {
450
464
  name: this.firstName || "",
@@ -468,7 +482,7 @@ export class InlineCheckout {
468
482
  metadata: this.metadata,
469
483
  browser_info: getBrowserInfo(),
470
484
  currency: this.currency,
471
- ...( !!selected_apm
485
+ ...( selected_apm && Object.keys(selected_apm).length > 0
472
486
  ? {payment_method: selected_apm.payment_method}
473
487
  : {card: cardTokens}
474
488
  )
@@ -178,7 +178,6 @@ export const cardTemplate = (data) => `
178
178
  .apms-list-container {
179
179
  display: flex;
180
180
  flex-direction: column;
181
- padding: ;
182
181
  gap: 33% 20px;
183
182
  max-height: 300px;
184
183
  overflow-y: auto;
@@ -340,8 +340,11 @@ export const getAPMType = (scheme_data) => {
340
340
  },
341
341
  };
342
342
 
343
- const default_image = "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png";
344
- return PAYMENT_METHODS_CATALOG[scheme] || default_image;
343
+ const _default = {
344
+ icon: "https://d35a75syrgujp0.cloudfront.net/payment_methods/store.png",
345
+ label: ""
346
+ };
347
+ return PAYMENT_METHODS_CATALOG[scheme] || _default;
345
348
  }
346
349
 
347
350
 
package/src/index-dev.js CHANGED
@@ -108,8 +108,7 @@ const inlineCheckout = new InlineCheckout({
108
108
  apiKey,
109
109
  returnUrl,
110
110
  successUrl,
111
- styles: customStyles,
112
- renderPaymentButton: true
111
+ styles: customStyles
113
112
  });
114
113
  inlineCheckout.configureCheckout({customer: checkoutData.customer})
115
114
  inlineCheckout.injectCheckout();