@tonder.io/ionic-full-sdk 0.0.9 → 0.0.10-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/.gitlab-ci.yml +18 -18
- package/README.md +448 -448
- package/cypress.config.js +9 -9
- package/index.js.example +49 -49
- package/package.json +27 -27
- package/rollup.config.js +14 -14
- package/src/classes/3dsHandler.ts +101 -101
- package/src/classes/checkout.ts +147 -147
- package/src/classes/inlineCheckout.ts +553 -553
- package/src/helpers/skyflow.ts +172 -172
- package/src/helpers/styles.ts +60 -60
- package/src/helpers/template.ts +295 -295
- package/src/helpers/utils.ts +135 -135
- package/src/index-dev.js +120 -120
- package/src/index.html +57 -57
- package/src/index.ts +6 -6
- package/src/types/commons.ts +42 -42
- package/src/types/skyflow.ts +40 -40
- package/tsconfig.json +22 -22
- package/dist/classes/3dsHandler.d.ts +0 -20
- package/dist/classes/checkout.d.ts +0 -39
- package/dist/classes/inlineCheckout.d.ts +0 -68
- package/dist/data/api.d.ts +0 -18
- package/dist/helpers/skyflow.d.ts +0 -14
- package/dist/helpers/styles.d.ts +0 -1
- package/dist/helpers/template.d.ts +0 -21
- package/dist/helpers/utils.d.ts +0 -21
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -1
- package/dist/types/commons-ds.d.ts +0 -40
- package/dist/types/commons.d.ts +0 -40
- package/dist/types/skyflow.d.ts +0 -39
- package/dist/types/skyflow.ds.d.ts +0 -39
package/cypress.config.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const { defineConfig } = require("cypress");
|
|
2
|
-
|
|
3
|
-
module.exports = defineConfig({
|
|
4
|
-
e2e: {
|
|
5
|
-
setupNodeEvents(on, config) {
|
|
6
|
-
// implement node event listeners here
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
});
|
|
1
|
+
const { defineConfig } = require("cypress");
|
|
2
|
+
|
|
3
|
+
module.exports = defineConfig({
|
|
4
|
+
e2e: {
|
|
5
|
+
setupNodeEvents(on, config) {
|
|
6
|
+
// implement node event listeners here
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
});
|
package/index.js.example
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { Checkout } from './classes/checkout'
|
|
2
|
-
export {
|
|
3
|
-
Checkout,
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const config = {
|
|
7
|
-
url: "http://localhost:8081/#/",
|
|
8
|
-
apiKey: "e0f89d5328398b93634f56ba06c9474ec9388d5e",
|
|
9
|
-
type: "payment",
|
|
10
|
-
backgroundColor: "#F34616",
|
|
11
|
-
color: "#F3F7F6"
|
|
12
|
-
}
|
|
13
|
-
const tonderCheckout = new Checkout(config)
|
|
14
|
-
const params = {
|
|
15
|
-
shippingCost: "129.99",
|
|
16
|
-
email: "fuentesc91@gmail.com"
|
|
17
|
-
}
|
|
18
|
-
tonderCheckout.setOrder(params)
|
|
19
|
-
|
|
20
|
-
let products = {products: [
|
|
21
|
-
{
|
|
22
|
-
name: 'first product',
|
|
23
|
-
price_unit: 120.99,
|
|
24
|
-
quantity: 1
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: 'second product',
|
|
28
|
-
price_unit: 12.99,
|
|
29
|
-
}
|
|
30
|
-
]}
|
|
31
|
-
|
|
32
|
-
tonderCheckout.setOrder(products)
|
|
33
|
-
|
|
34
|
-
products = {products: [
|
|
35
|
-
{
|
|
36
|
-
name: 'first product',
|
|
37
|
-
price_unit: 120.99,
|
|
38
|
-
quantity: 3
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: 'second product',
|
|
42
|
-
price_unit: 12.99,
|
|
43
|
-
}
|
|
44
|
-
]}
|
|
45
|
-
|
|
46
|
-
tonderCheckout.setOrder(products)
|
|
47
|
-
|
|
48
|
-
console.log(tonderCheckout.getUrlParams())
|
|
49
|
-
|
|
1
|
+
import { Checkout } from './classes/checkout'
|
|
2
|
+
export {
|
|
3
|
+
Checkout,
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const config = {
|
|
7
|
+
url: "http://localhost:8081/#/",
|
|
8
|
+
apiKey: "e0f89d5328398b93634f56ba06c9474ec9388d5e",
|
|
9
|
+
type: "payment",
|
|
10
|
+
backgroundColor: "#F34616",
|
|
11
|
+
color: "#F3F7F6"
|
|
12
|
+
}
|
|
13
|
+
const tonderCheckout = new Checkout(config)
|
|
14
|
+
const params = {
|
|
15
|
+
shippingCost: "129.99",
|
|
16
|
+
email: "fuentesc91@gmail.com"
|
|
17
|
+
}
|
|
18
|
+
tonderCheckout.setOrder(params)
|
|
19
|
+
|
|
20
|
+
let products = {products: [
|
|
21
|
+
{
|
|
22
|
+
name: 'first product',
|
|
23
|
+
price_unit: 120.99,
|
|
24
|
+
quantity: 1
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'second product',
|
|
28
|
+
price_unit: 12.99,
|
|
29
|
+
}
|
|
30
|
+
]}
|
|
31
|
+
|
|
32
|
+
tonderCheckout.setOrder(products)
|
|
33
|
+
|
|
34
|
+
products = {products: [
|
|
35
|
+
{
|
|
36
|
+
name: 'first product',
|
|
37
|
+
price_unit: 120.99,
|
|
38
|
+
quantity: 3
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'second product',
|
|
42
|
+
price_unit: 12.99,
|
|
43
|
+
}
|
|
44
|
+
]}
|
|
45
|
+
|
|
46
|
+
tonderCheckout.setOrder(products)
|
|
47
|
+
|
|
48
|
+
console.log(tonderCheckout.getUrlParams())
|
|
49
|
+
|
|
50
50
|
tonderCheckout.mountButton({ buttonText: 'Proceder al pago' })
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tonder.io/ionic-full-sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Tonder ionic full SDK",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc -noEmit && rollup --config"
|
|
9
|
-
},
|
|
10
|
-
"author": "",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@tonder.io/ionic-lite-sdk": "^0.0.16",
|
|
14
|
-
"crypto-js": "^4.1.1",
|
|
15
|
-
"skyflow-js": "^1.34.1"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
19
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
20
|
-
"@types/crypto-js": "^4.2.2",
|
|
21
|
-
"@types/node": "^20.11.5",
|
|
22
|
-
"cypress": "^13.6.2",
|
|
23
|
-
"rollup": "^4.9.6",
|
|
24
|
-
"ts-loader": "^9.5.1",
|
|
25
|
-
"typescript": "^5.3.3"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tonder.io/ionic-full-sdk",
|
|
3
|
+
"version": "0.0.10-beta",
|
|
4
|
+
"description": "Tonder ionic full SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc -noEmit && rollup --config"
|
|
9
|
+
},
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@tonder.io/ionic-lite-sdk": "^0.0.16",
|
|
14
|
+
"crypto-js": "^4.1.1",
|
|
15
|
+
"skyflow-js": "^1.34.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
19
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
20
|
+
"@types/crypto-js": "^4.2.2",
|
|
21
|
+
"@types/node": "^20.11.5",
|
|
22
|
+
"cypress": "^13.6.2",
|
|
23
|
+
"rollup": "^4.9.6",
|
|
24
|
+
"ts-loader": "^9.5.1",
|
|
25
|
+
"typescript": "^5.3.3"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/rollup.config.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const typescript = require('@rollup/plugin-typescript');
|
|
2
|
-
const terser = require('@rollup/plugin-terser');
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
input: './src/index.ts',
|
|
6
|
-
output: {
|
|
7
|
-
dir: 'dist',
|
|
8
|
-
format: 'es',
|
|
9
|
-
plugins: [terser()]
|
|
10
|
-
},
|
|
11
|
-
plugins: [
|
|
12
|
-
typescript()
|
|
13
|
-
],
|
|
14
|
-
external: ["skyflow-js", "crypto-js", "@tonder.io/ionic-lite-sdk"]
|
|
1
|
+
const typescript = require('@rollup/plugin-typescript');
|
|
2
|
+
const terser = require('@rollup/plugin-terser');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
input: './src/index.ts',
|
|
6
|
+
output: {
|
|
7
|
+
dir: 'dist',
|
|
8
|
+
format: 'es',
|
|
9
|
+
plugins: [terser()]
|
|
10
|
+
},
|
|
11
|
+
plugins: [
|
|
12
|
+
typescript()
|
|
13
|
+
],
|
|
14
|
+
external: ["skyflow-js", "crypto-js", "@tonder.io/ionic-lite-sdk"]
|
|
15
15
|
};
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
type ThreeDSHandlerContructor = {
|
|
2
|
-
payload?: any,
|
|
3
|
-
apiKey?: string,
|
|
4
|
-
baseUrl?: string,
|
|
5
|
-
successUrl?: Location | string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export class ThreeDSHandler {
|
|
9
|
-
|
|
10
|
-
baseUrl?: string
|
|
11
|
-
apiKey?: string
|
|
12
|
-
payload?: any
|
|
13
|
-
successUrl?: Location | string
|
|
14
|
-
|
|
15
|
-
constructor({
|
|
16
|
-
payload = null,
|
|
17
|
-
apiKey,
|
|
18
|
-
baseUrl,
|
|
19
|
-
successUrl
|
|
20
|
-
}: ThreeDSHandlerContructor) {
|
|
21
|
-
this.baseUrl = baseUrl,
|
|
22
|
-
this.apiKey = apiKey,
|
|
23
|
-
this.payload = payload,
|
|
24
|
-
this.successUrl = successUrl
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
saveVerifyTransactionUrl() {
|
|
28
|
-
const url = this.payload?.next_action?.redirect_to_url?.verify_transaction_status_url
|
|
29
|
-
if (url) {
|
|
30
|
-
localStorage.setItem("verify_transaction_status_url", url)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
removeVerifyTransactionUrl() {
|
|
35
|
-
localStorage.removeItem("verify_transaction_status_url")
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getVerifyTransactionUrl() {
|
|
39
|
-
return localStorage.getItem("verify_transaction_status_url")
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
redirectTo3DS() {
|
|
43
|
-
const url = this.payload?.next_action?.redirect_to_url?.url
|
|
44
|
-
if (url) {
|
|
45
|
-
this.saveVerifyTransactionUrl();
|
|
46
|
-
return true
|
|
47
|
-
} else {
|
|
48
|
-
console.log('No redirection found');
|
|
49
|
-
return false
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Returns an object
|
|
54
|
-
// https://example.com/?name=John&age=30&city=NewYork
|
|
55
|
-
// { name: "John", age: "30", city: "NewYork" }
|
|
56
|
-
getURLParameters() {
|
|
57
|
-
const parameters: any = {};
|
|
58
|
-
const urlParams: any = new URLSearchParams(window.location.search);
|
|
59
|
-
|
|
60
|
-
for (const [key, value] of urlParams) {
|
|
61
|
-
parameters[key] = value;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return parameters;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async verifyTransactionStatus() {
|
|
68
|
-
const verifyUrl = this.getVerifyTransactionUrl();
|
|
69
|
-
|
|
70
|
-
if (verifyUrl) {
|
|
71
|
-
const url = `${this.baseUrl}${verifyUrl}`;
|
|
72
|
-
try {
|
|
73
|
-
const response = await fetch(url, {
|
|
74
|
-
method: "GET",
|
|
75
|
-
headers: {
|
|
76
|
-
"Content-Type": "application/json",
|
|
77
|
-
Authorization: `Token ${this.apiKey}`,
|
|
78
|
-
},
|
|
79
|
-
// body: JSON.stringify(data),
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
if (response.status === 200) {
|
|
83
|
-
this.removeVerifyTransactionUrl();
|
|
84
|
-
//@ts-ignore
|
|
85
|
-
window.location = this.successUrl
|
|
86
|
-
console.log('La transacción se verificó con éxito.');
|
|
87
|
-
return response;
|
|
88
|
-
} else {
|
|
89
|
-
console.error('La verificación de la transacción falló.');
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error('Error al verificar la transacción:', error);
|
|
94
|
-
return error;
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
console.log('No verify_transaction_status_url found');
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
1
|
+
type ThreeDSHandlerContructor = {
|
|
2
|
+
payload?: any,
|
|
3
|
+
apiKey?: string,
|
|
4
|
+
baseUrl?: string,
|
|
5
|
+
successUrl?: Location | string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class ThreeDSHandler {
|
|
9
|
+
|
|
10
|
+
baseUrl?: string
|
|
11
|
+
apiKey?: string
|
|
12
|
+
payload?: any
|
|
13
|
+
successUrl?: Location | string
|
|
14
|
+
|
|
15
|
+
constructor({
|
|
16
|
+
payload = null,
|
|
17
|
+
apiKey,
|
|
18
|
+
baseUrl,
|
|
19
|
+
successUrl
|
|
20
|
+
}: ThreeDSHandlerContructor) {
|
|
21
|
+
this.baseUrl = baseUrl,
|
|
22
|
+
this.apiKey = apiKey,
|
|
23
|
+
this.payload = payload,
|
|
24
|
+
this.successUrl = successUrl
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
saveVerifyTransactionUrl() {
|
|
28
|
+
const url = this.payload?.next_action?.redirect_to_url?.verify_transaction_status_url
|
|
29
|
+
if (url) {
|
|
30
|
+
localStorage.setItem("verify_transaction_status_url", url)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
removeVerifyTransactionUrl() {
|
|
35
|
+
localStorage.removeItem("verify_transaction_status_url")
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getVerifyTransactionUrl() {
|
|
39
|
+
return localStorage.getItem("verify_transaction_status_url")
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
redirectTo3DS() {
|
|
43
|
+
const url = this.payload?.next_action?.redirect_to_url?.url
|
|
44
|
+
if (url) {
|
|
45
|
+
this.saveVerifyTransactionUrl();
|
|
46
|
+
return true
|
|
47
|
+
} else {
|
|
48
|
+
console.log('No redirection found');
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Returns an object
|
|
54
|
+
// https://example.com/?name=John&age=30&city=NewYork
|
|
55
|
+
// { name: "John", age: "30", city: "NewYork" }
|
|
56
|
+
getURLParameters() {
|
|
57
|
+
const parameters: any = {};
|
|
58
|
+
const urlParams: any = new URLSearchParams(window.location.search);
|
|
59
|
+
|
|
60
|
+
for (const [key, value] of urlParams) {
|
|
61
|
+
parameters[key] = value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return parameters;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async verifyTransactionStatus() {
|
|
68
|
+
const verifyUrl = this.getVerifyTransactionUrl();
|
|
69
|
+
|
|
70
|
+
if (verifyUrl) {
|
|
71
|
+
const url = `${this.baseUrl}${verifyUrl}`;
|
|
72
|
+
try {
|
|
73
|
+
const response = await fetch(url, {
|
|
74
|
+
method: "GET",
|
|
75
|
+
headers: {
|
|
76
|
+
"Content-Type": "application/json",
|
|
77
|
+
Authorization: `Token ${this.apiKey}`,
|
|
78
|
+
},
|
|
79
|
+
// body: JSON.stringify(data),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
if (response.status === 200) {
|
|
83
|
+
this.removeVerifyTransactionUrl();
|
|
84
|
+
//@ts-ignore
|
|
85
|
+
window.location = this.successUrl
|
|
86
|
+
console.log('La transacción se verificó con éxito.');
|
|
87
|
+
return response;
|
|
88
|
+
} else {
|
|
89
|
+
console.error('La verificación de la transacción falló.');
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('Error al verificar la transacción:', error);
|
|
94
|
+
return error;
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
console.log('No verify_transaction_status_url found');
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|