@tonder.io/ionic-full-sdk 0.0.22-beta → 0.0.23-beta

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.io/ionic-full-sdk",
3
- "version": "0.0.22-beta",
3
+ "version": "0.0.23-beta",
4
4
  "description": "Tonder ionic full SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.js",
@@ -11,6 +11,7 @@ export class ThreeDSHandler {
11
11
  apiKey?: string
12
12
  payload?: any
13
13
  successUrl?: Location | string
14
+ localStorageKey: string = "verify_transaction_status_url"
14
15
 
15
16
  constructor({
16
17
  payload = null,
@@ -24,6 +25,18 @@ export class ThreeDSHandler {
24
25
  this.successUrl = successUrl
25
26
  }
26
27
 
28
+ setStorageItem (data: any) {
29
+ return localStorage.setItem(this.localStorageKey, JSON.stringify(data))
30
+ }
31
+
32
+ getStorageItem () {
33
+ return localStorage.getItem(this.localStorageKey)
34
+ }
35
+
36
+ removeStorageItem () {
37
+ return localStorage.removeItem(this.localStorageKey)
38
+ }
39
+
27
40
  saveVerifyTransactionUrl() {
28
41
  const url = this.payload?.next_action?.redirect_to_url?.verify_transaction_status_url
29
42
  if (url) {
@@ -46,14 +59,14 @@ export class ThreeDSHandler {
46
59
  // Expires after 20 minutes
47
60
  expires: now.getTime() + 20 * 60 * 1000
48
61
  }
49
- localStorage.setItem('verify_transaction_status', JSON.stringify(item))
62
+ this.setStorageItem(item)
50
63
  } catch (error) {
51
64
  console.log('error: ', error)
52
65
  }
53
66
  }
54
67
 
55
68
  getUrlWithExpiration() {
56
- const status = localStorage.getItem("verify_transaction_status");
69
+ const status = this.getStorageItem();
57
70
  if(status) {
58
71
  const item = JSON.parse(status)
59
72
  if (!item) return
@@ -70,11 +83,11 @@ export class ThreeDSHandler {
70
83
  }
71
84
 
72
85
  removeVerifyTransactionUrl() {
73
- localStorage.removeItem("verify_transaction_status_url")
86
+ return this.removeStorageItem()
74
87
  }
75
88
 
76
89
  getVerifyTransactionUrl() {
77
- return localStorage.getItem("verify_transaction_status_url")
90
+ return this.getStorageItem()
78
91
  }
79
92
 
80
93
  loadIframe() {