tonder-web-sdk 1.16.3 → 1.16.6-beta.DEV-1433.2
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/README.md +22 -25
- package/package.json +10 -3
- package/types/common.d.ts +4 -0
- package/v1/bundle.min.js +1 -18
- package/.env-example +0 -1
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -8
- package/.prettierrc +0 -10
- package/cypress/e2e/1-getting-started/todo.cy.js +0 -143
- package/cypress/e2e/2-advanced-examples/actions.cy.js +0 -299
- package/cypress/e2e/2-advanced-examples/aliasing.cy.js +0 -39
- package/cypress/e2e/2-advanced-examples/assertions.cy.js +0 -176
- package/cypress/e2e/2-advanced-examples/connectors.cy.js +0 -98
- package/cypress/e2e/2-advanced-examples/cookies.cy.js +0 -118
- package/cypress/e2e/2-advanced-examples/cypress_api.cy.js +0 -185
- package/cypress/e2e/2-advanced-examples/files.cy.js +0 -85
- package/cypress/e2e/2-advanced-examples/location.cy.js +0 -32
- package/cypress/e2e/2-advanced-examples/misc.cy.js +0 -104
- package/cypress/e2e/2-advanced-examples/navigation.cy.js +0 -56
- package/cypress/e2e/2-advanced-examples/network_requests.cy.js +0 -163
- package/cypress/e2e/2-advanced-examples/querying.cy.js +0 -114
- package/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js +0 -201
- package/cypress/e2e/2-advanced-examples/storage.cy.js +0 -110
- package/cypress/e2e/2-advanced-examples/traversal.cy.js +0 -121
- package/cypress/e2e/2-advanced-examples/utilities.cy.js +0 -108
- package/cypress/e2e/2-advanced-examples/viewport.cy.js +0 -58
- package/cypress/e2e/2-advanced-examples/waiting.cy.js +0 -30
- package/cypress/e2e/2-advanced-examples/window.cy.js +0 -22
- package/cypress/fixtures/example.json +0 -5
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -20
- package/cypress.config.js +0 -9
- package/eslint.config.mjs +0 -15
- package/index.js.example +0 -50
- package/samples/react/README.md +0 -70
- package/samples/react/build/asset-manifest.json +0 -16
- package/samples/react/build/favicon.ico +0 -0
- package/samples/react/build/index.html +0 -1
- package/samples/react/build/logo192.png +0 -0
- package/samples/react/build/logo512.png +0 -0
- package/samples/react/build/manifest.json +0 -25
- package/samples/react/build/robots.txt +0 -3
- package/samples/react/build/static/css/main.073c9b0a.css +0 -2
- package/samples/react/build/static/css/main.073c9b0a.css.map +0 -1
- package/samples/react/build/static/js/787.b83ed06f.chunk.js +0 -2
- package/samples/react/build/static/js/787.b83ed06f.chunk.js.map +0 -1
- package/samples/react/build/static/js/main.0a848807.js +0 -3
- package/samples/react/build/static/js/main.0a848807.js.LICENSE.txt +0 -39
- package/samples/react/build/static/js/main.0a848807.js.map +0 -1
- package/samples/react/build/static/media/sdk-icons.b491623214b2af4cccdb.png +0 -0
- package/samples/react/package-lock.json +0 -28973
- package/samples/react/package.json +0 -44
- package/samples/react/public/favicon.ico +0 -0
- package/samples/react/public/index.html +0 -43
- package/samples/react/public/logo192.png +0 -0
- package/samples/react/public/logo512.png +0 -0
- package/samples/react/public/manifest.json +0 -25
- package/samples/react/public/robots.txt +0 -3
- package/samples/react/src/App.css +0 -38
- package/samples/react/src/App.js +0 -22
- package/samples/react/src/App.test.js +0 -8
- package/samples/react/src/assets/img/sdk-icons.png +0 -0
- package/samples/react/src/components/Cart.js +0 -29
- package/samples/react/src/components/ProductCard.js +0 -27
- package/samples/react/src/context/CartContext.js +0 -116
- package/samples/react/src/index.css +0 -13
- package/samples/react/src/index.js +0 -17
- package/samples/react/src/logo.svg +0 -1
- package/samples/react/src/reportWebVitals.js +0 -13
- package/samples/react/src/screens/Checkout.js +0 -82
- package/samples/react/src/screens/Store.js +0 -21
- package/samples/react/src/setupTests.js +0 -5
- package/samples/react/src/storeProducts.js +0 -30
- package/src/classes/3dsHandler.js +0 -199
- package/src/classes/BaseInlineCheckout.js +0 -303
- package/src/classes/LiteInlineCheckout.js +0 -217
- package/src/classes/checkout.js +0 -129
- package/src/classes/globalLoader.js +0 -31
- package/src/classes/inlineCheckout.js +0 -713
- package/src/data/apmApi.js +0 -38
- package/src/data/businessApi.js +0 -16
- package/src/data/cardApi.js +0 -134
- package/src/data/checkoutApi.js +0 -92
- package/src/data/customerApi.js +0 -32
- package/src/data/index.js +0 -17
- package/src/data/openPayApi.js +0 -16
- package/src/data/skyflowApi.js +0 -16
- package/src/helpers/skyflow.js +0 -370
- package/src/helpers/styles.js +0 -90
- package/src/helpers/template-skeleton.js +0 -59
- package/src/helpers/template.js +0 -1104
- package/src/helpers/utils.js +0 -257
- package/src/helpers/validations.js +0 -53
- package/src/index-dev.js +0 -329
- package/src/index.html +0 -180
- package/src/index.js +0 -21
- package/src/shared/catalog/commonLogosCatalog.js +0 -7
- package/src/shared/catalog/paymentMethodsCatalog.js +0 -246
- package/src/shared/constants/colors.js +0 -15
- package/src/shared/constants/displayMode.js +0 -4
- package/src/shared/constants/fieldPathNames.js +0 -4
- package/src/shared/constants/htmlTonderIds.js +0 -18
- package/src/shared/constants/messages.js +0 -11
- package/src/shared/constants/paymentMethodAPM.js +0 -63
- package/src/shared/constants/tonderUrl.js +0 -8
- package/webpack.config.js +0 -77
package/README.md
CHANGED
|
@@ -98,16 +98,16 @@ inlineCheckout.verify3dsTransaction().then((response) => {
|
|
|
98
98
|
const response = await inlineCheckout.payment(checkoutData);
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
###
|
|
101
|
+
### LiteCheckout
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
LiteCheckout allows you to build a custom checkout interface using Tonder's core functionality.
|
|
104
104
|
|
|
105
105
|
```javascript
|
|
106
|
-
import {
|
|
106
|
+
import { LiteCheckout } from "tonder-web-sdk";
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
```javascript
|
|
110
|
-
const
|
|
110
|
+
const liteCheckout = new LiteCheckout({
|
|
111
111
|
apiKey: "your-api-key", // Your api key getted from Tonder Dashboard
|
|
112
112
|
returnUrl: "http://your-website.com/checkout",
|
|
113
113
|
});
|
|
@@ -117,37 +117,37 @@ const LiteInlineCheckout = new LiteInlineCheckout({
|
|
|
117
117
|
inlineCheckout.configureCheckout({ customer: { email: "example@email.com" } });
|
|
118
118
|
|
|
119
119
|
// Initialize the checkout
|
|
120
|
-
await
|
|
120
|
+
await liteCheckout.injectCheckout();
|
|
121
121
|
```
|
|
122
122
|
|
|
123
123
|
```javascript
|
|
124
124
|
// Retrieve customer's saved cards
|
|
125
|
-
const cards = await
|
|
125
|
+
const cards = await liteCheckout.getCustomerCards();
|
|
126
126
|
```
|
|
127
127
|
|
|
128
128
|
```javascript
|
|
129
129
|
// Save a new card
|
|
130
|
-
const newCard = await
|
|
130
|
+
const newCard = await liteCheckout.saveCustomerCard(cardData);
|
|
131
131
|
```
|
|
132
132
|
|
|
133
133
|
```javascript
|
|
134
134
|
// Remove a saved card
|
|
135
|
-
await
|
|
135
|
+
await liteCheckout.removeCustomerCard(cardId);
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
```javascript
|
|
139
139
|
// Get available payment methods
|
|
140
|
-
const paymentMethods = await
|
|
140
|
+
const paymentMethods = await liteCheckout.getCustomerPaymentMethods();
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
```javascript
|
|
144
144
|
// Process a payment
|
|
145
|
-
const paymentResponse = await
|
|
145
|
+
const paymentResponse = await liteCheckout.payment(paymentData);
|
|
146
146
|
```
|
|
147
147
|
|
|
148
148
|
```javascript
|
|
149
149
|
// Verify a 3DS transaction
|
|
150
|
-
const verificationResult = await
|
|
150
|
+
const verificationResult = await liteCheckout.verify3dsTransaction();
|
|
151
151
|
```
|
|
152
152
|
|
|
153
153
|
## Configuration
|
|
@@ -179,9 +179,6 @@ interface IInlineCheckoutOptions extends IInlineCheckoutBaseOptions {
|
|
|
179
179
|
```
|
|
180
180
|
</details>
|
|
181
181
|
|
|
182
|
-
> **Important Note about SaveCard functionality**:
|
|
183
|
-
> To properly implement the SaveCard feature, you must use a SecureToken. For detailed implementation instructions and best practices, please refer to our official documentation on [How to use SecureToken for secure card saving](https://docs.tonder.io/integration/sdks/secure-token#how-to-use-securetoken-for-secure-card-saving).
|
|
184
|
-
|
|
185
182
|
### Inline Callbacks Structure
|
|
186
183
|
|
|
187
184
|
| Callback | Required | Parameters | Description | Return |
|
|
@@ -349,15 +346,15 @@ When calling the `payment` method, use the following data structure:
|
|
|
349
346
|
|
|
350
347
|
- **metadata**: Object for including any additional information about the transaction. This can be used for internal references or tracking.
|
|
351
348
|
|
|
352
|
-
- **card**: (for
|
|
349
|
+
- **card**: (for LiteCheckout) Object containing card information. This is used differently depending on whether it's a new card or a saved card:
|
|
353
350
|
|
|
354
351
|
- For a new card: Include `card_number`, `cvv`, `expiration_month`, `expiration_year`, and `cardholder_name`.
|
|
355
352
|
- For a saved card: Include only the `skyflow_id` of the saved card.
|
|
356
353
|
- This is only used when not paying with a payment_method.
|
|
357
354
|
|
|
358
|
-
- **payment_method**: (for
|
|
355
|
+
- **payment_method**: (for LiteCheckout) String indicating the alternative payment method to be used (e.g., "Spei"). This is only used when not paying with a card.
|
|
359
356
|
|
|
360
|
-
Note: The exact fields required may vary depending on whether you're using InlineCheckout or
|
|
357
|
+
Note: The exact fields required may vary depending on whether you're using InlineCheckout or LiteCheckout, and the specific payment method being used.
|
|
361
358
|
|
|
362
359
|
```javascript
|
|
363
360
|
const paymentData = {
|
|
@@ -409,7 +406,7 @@ const paymentData = {
|
|
|
409
406
|
|
|
410
407
|
## Field Validation Functions
|
|
411
408
|
|
|
412
|
-
For
|
|
409
|
+
For LiteCheckout implementations, the SDK provides validation functions to ensure the integrity of card data before submitting:
|
|
413
410
|
|
|
414
411
|
- `validateCardNumber(cardNumber)`: Validates the card number using the Luhn algorithm.
|
|
415
412
|
- `validateCardholderName(name)`: Checks if the cardholder name is valid.
|
|
@@ -454,7 +451,7 @@ if (
|
|
|
454
451
|
- `payment(data)`: Process a payment
|
|
455
452
|
- `verify3dsTransaction()`: Verify a 3DS transaction
|
|
456
453
|
|
|
457
|
-
###
|
|
454
|
+
### LiteCheckout Methods
|
|
458
455
|
|
|
459
456
|
- `configureCheckout(data)`: Set initial checkout data
|
|
460
457
|
- `injectCheckout()`: Initialize the checkout
|
|
@@ -596,16 +593,16 @@ import { LiteInlineCheckout } from "tonder-web-sdk";
|
|
|
596
593
|
const apiKey = "your-api-key";
|
|
597
594
|
const returnUrl = "http://your-website.com/checkout";
|
|
598
595
|
|
|
599
|
-
const
|
|
596
|
+
const liteCheckout = new LiteInlineCheckout({
|
|
600
597
|
mode: "development",
|
|
601
598
|
apiKey,
|
|
602
599
|
returnUrl,
|
|
603
600
|
});
|
|
604
601
|
|
|
605
|
-
|
|
606
|
-
|
|
602
|
+
liteCheckout.configureCheckout({ customer: { email: "example@email.com" } });
|
|
603
|
+
liteCheckout.injectCheckout();
|
|
607
604
|
|
|
608
|
-
|
|
605
|
+
liteCheckout.verify3dsTransaction().then((response) => {
|
|
609
606
|
console.log("Verify 3ds response", response);
|
|
610
607
|
});
|
|
611
608
|
|
|
@@ -623,7 +620,7 @@ document
|
|
|
623
620
|
|
|
624
621
|
try {
|
|
625
622
|
const paymentData = { ...checkoutData, card: cardData };
|
|
626
|
-
const response = await
|
|
623
|
+
const response = await liteCheckout.payment(paymentData);
|
|
627
624
|
console.log("Payment response:", response);
|
|
628
625
|
alert("Payment successful");
|
|
629
626
|
} catch (error) {
|
|
@@ -835,7 +832,7 @@ export class TonderService {
|
|
|
835
832
|
// Add more functions, for example for lite sdk: get payment methods
|
|
836
833
|
|
|
837
834
|
// getCustomerPaymentMethods(): Promise<IPaymentMethod[]> {
|
|
838
|
-
// return this.
|
|
835
|
+
// return this.liteCheckout.getCustomerPaymentMethods();
|
|
839
836
|
// }
|
|
840
837
|
}
|
|
841
838
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tonder-web-sdk",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.6-beta.DEV-1433.2",
|
|
4
4
|
"description": "tonder sdk for integrations",
|
|
5
|
-
"main": "src/index.js",
|
|
6
5
|
"scripts": {
|
|
7
6
|
"start": "webpack-dev-server",
|
|
8
7
|
"build": "webpack --config webpack.config.js --mode production",
|
|
@@ -12,7 +11,14 @@
|
|
|
12
11
|
"lint:fix": "eslint 'src/**/*.js' --fix"
|
|
13
12
|
},
|
|
14
13
|
"author": "",
|
|
14
|
+
"main": "v1/bundle.min.js",
|
|
15
15
|
"types": "types/index.d.ts",
|
|
16
|
+
"files": [
|
|
17
|
+
"v1",
|
|
18
|
+
"types",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
16
22
|
"license": "ISC",
|
|
17
23
|
"dependencies": {
|
|
18
24
|
"accordion-js": "^3.4.0",
|
|
@@ -38,7 +44,8 @@
|
|
|
38
44
|
"terser-webpack-plugin": "^5.3.10",
|
|
39
45
|
"webpack": "^5.75.0",
|
|
40
46
|
"webpack-cli": "^5.0.1",
|
|
41
|
-
"webpack-dev-server": "^4.11.1"
|
|
47
|
+
"webpack-dev-server": "^4.11.1",
|
|
48
|
+
"webpack-obfuscator": "^3.5.1"
|
|
42
49
|
},
|
|
43
50
|
"lint-staged": {
|
|
44
51
|
"**/*.{js,jsx,ts,tsx}": [
|
package/types/common.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface IInlineCheckoutBaseOptions {
|
|
|
6
6
|
apiKey: string;
|
|
7
7
|
returnUrl: string;
|
|
8
8
|
callBack?: (response: any) => void;
|
|
9
|
+
signatures?:{
|
|
10
|
+
transaction?: string;
|
|
11
|
+
customer?: string;
|
|
12
|
+
}
|
|
9
13
|
}
|
|
10
14
|
|
|
11
15
|
export interface IConfigureCheckout extends Partial<IProcessPaymentRequest> {
|