@tonder.io/ionic-full-sdk 0.0.22-beta → 0.0.24-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/dist/classes/3dsHandler.d.ts +4 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/classes/3dsHandler.ts +17 -7
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
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
|
-
|
|
86
|
+
return this.removeStorageItem()
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
getVerifyTransactionUrl() {
|
|
77
|
-
return
|
|
90
|
+
return this.getStorageItem()
|
|
78
91
|
}
|
|
79
92
|
|
|
80
93
|
loadIframe() {
|
|
@@ -141,9 +154,6 @@ export class ThreeDSHandler {
|
|
|
141
154
|
|
|
142
155
|
handleSuccessTransaction(response: any) {
|
|
143
156
|
this.removeVerifyTransactionUrl();
|
|
144
|
-
if(this.successUrl) {
|
|
145
|
-
window.location = this.successUrl as Location;
|
|
146
|
-
}
|
|
147
157
|
console.log('Transacción autorizada exitosamente.');
|
|
148
158
|
return response;
|
|
149
159
|
}
|