tonder-web-sdk 1.16.1 → 1.16.6-beta.DEV-1433.1

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.
Files changed (105) hide show
  1. package/README.md +134 -40
  2. package/package.json +29 -6
  3. package/types/card.d.ts +17 -17
  4. package/types/checkout.d.ts +85 -87
  5. package/types/common.d.ts +8 -2
  6. package/types/customer.d.ts +10 -10
  7. package/types/index.d.ts +9 -11
  8. package/types/inlineCheckout.d.ts +81 -61
  9. package/types/liteInlineCheckout.d.ts +78 -83
  10. package/types/paymentMethod.d.ts +17 -17
  11. package/types/transaction.d.ts +94 -94
  12. package/v1/bundle.min.js +1 -18
  13. package/.env-example +0 -1
  14. package/cypress/e2e/1-getting-started/todo.cy.js +0 -143
  15. package/cypress/e2e/2-advanced-examples/actions.cy.js +0 -299
  16. package/cypress/e2e/2-advanced-examples/aliasing.cy.js +0 -39
  17. package/cypress/e2e/2-advanced-examples/assertions.cy.js +0 -176
  18. package/cypress/e2e/2-advanced-examples/connectors.cy.js +0 -98
  19. package/cypress/e2e/2-advanced-examples/cookies.cy.js +0 -118
  20. package/cypress/e2e/2-advanced-examples/cypress_api.cy.js +0 -185
  21. package/cypress/e2e/2-advanced-examples/files.cy.js +0 -85
  22. package/cypress/e2e/2-advanced-examples/location.cy.js +0 -32
  23. package/cypress/e2e/2-advanced-examples/misc.cy.js +0 -104
  24. package/cypress/e2e/2-advanced-examples/navigation.cy.js +0 -56
  25. package/cypress/e2e/2-advanced-examples/network_requests.cy.js +0 -163
  26. package/cypress/e2e/2-advanced-examples/querying.cy.js +0 -114
  27. package/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js +0 -201
  28. package/cypress/e2e/2-advanced-examples/storage.cy.js +0 -110
  29. package/cypress/e2e/2-advanced-examples/traversal.cy.js +0 -121
  30. package/cypress/e2e/2-advanced-examples/utilities.cy.js +0 -108
  31. package/cypress/e2e/2-advanced-examples/viewport.cy.js +0 -58
  32. package/cypress/e2e/2-advanced-examples/waiting.cy.js +0 -30
  33. package/cypress/e2e/2-advanced-examples/window.cy.js +0 -22
  34. package/cypress/fixtures/example.json +0 -5
  35. package/cypress/support/commands.js +0 -25
  36. package/cypress/support/e2e.js +0 -20
  37. package/cypress.config.js +0 -9
  38. package/index.js.example +0 -50
  39. package/samples/react/README.md +0 -70
  40. package/samples/react/build/asset-manifest.json +0 -16
  41. package/samples/react/build/favicon.ico +0 -0
  42. package/samples/react/build/index.html +0 -1
  43. package/samples/react/build/logo192.png +0 -0
  44. package/samples/react/build/logo512.png +0 -0
  45. package/samples/react/build/manifest.json +0 -25
  46. package/samples/react/build/robots.txt +0 -3
  47. package/samples/react/build/static/css/main.073c9b0a.css +0 -2
  48. package/samples/react/build/static/css/main.073c9b0a.css.map +0 -1
  49. package/samples/react/build/static/js/787.b83ed06f.chunk.js +0 -2
  50. package/samples/react/build/static/js/787.b83ed06f.chunk.js.map +0 -1
  51. package/samples/react/build/static/js/main.0a848807.js +0 -3
  52. package/samples/react/build/static/js/main.0a848807.js.LICENSE.txt +0 -39
  53. package/samples/react/build/static/js/main.0a848807.js.map +0 -1
  54. package/samples/react/build/static/media/sdk-icons.b491623214b2af4cccdb.png +0 -0
  55. package/samples/react/package-lock.json +0 -28973
  56. package/samples/react/package.json +0 -44
  57. package/samples/react/public/favicon.ico +0 -0
  58. package/samples/react/public/index.html +0 -43
  59. package/samples/react/public/logo192.png +0 -0
  60. package/samples/react/public/logo512.png +0 -0
  61. package/samples/react/public/manifest.json +0 -25
  62. package/samples/react/public/robots.txt +0 -3
  63. package/samples/react/src/App.css +0 -38
  64. package/samples/react/src/App.js +0 -22
  65. package/samples/react/src/App.test.js +0 -8
  66. package/samples/react/src/assets/img/sdk-icons.png +0 -0
  67. package/samples/react/src/components/Cart.js +0 -29
  68. package/samples/react/src/components/ProductCard.js +0 -27
  69. package/samples/react/src/context/CartContext.js +0 -116
  70. package/samples/react/src/index.css +0 -13
  71. package/samples/react/src/index.js +0 -17
  72. package/samples/react/src/logo.svg +0 -1
  73. package/samples/react/src/reportWebVitals.js +0 -13
  74. package/samples/react/src/screens/Checkout.js +0 -82
  75. package/samples/react/src/screens/Store.js +0 -21
  76. package/samples/react/src/setupTests.js +0 -5
  77. package/samples/react/src/storeProducts.js +0 -30
  78. package/src/classes/3dsHandler.js +0 -203
  79. package/src/classes/BaseInlineCheckout.js +0 -324
  80. package/src/classes/LiteInlineCheckout.js +0 -220
  81. package/src/classes/checkout.js +0 -125
  82. package/src/classes/globalLoader.js +0 -29
  83. package/src/classes/inlineCheckout.js +0 -515
  84. package/src/data/apmApi.js +0 -44
  85. package/src/data/businessApi.js +0 -19
  86. package/src/data/cardApi.js +0 -143
  87. package/src/data/checkoutApi.js +0 -92
  88. package/src/data/customerApi.js +0 -37
  89. package/src/data/index.js +0 -17
  90. package/src/data/openPayApi.js +0 -16
  91. package/src/data/skyflowApi.js +0 -18
  92. package/src/helpers/skyflow.js +0 -361
  93. package/src/helpers/styles.js +0 -61
  94. package/src/helpers/template-skeleton.js +0 -59
  95. package/src/helpers/template.js +0 -743
  96. package/src/helpers/utils.js +0 -163
  97. package/src/helpers/validations.js +0 -54
  98. package/src/index-dev.js +0 -307
  99. package/src/index.html +0 -172
  100. package/src/index.js +0 -15
  101. package/src/shared/catalog/paymentMethodsCatalog.js +0 -247
  102. package/src/shared/constants/messages.js +0 -10
  103. package/src/shared/constants/paymentMethodAPM.js +0 -63
  104. package/src/shared/constants/tonderUrl.js +0 -8
  105. package/webpack.config.js +0 -77
package/README.md CHANGED
@@ -7,8 +7,10 @@ Tonder SDK helps to integrate the services Tonder offers in your own website
7
7
  1. [Installation](#installation)
8
8
  2. [Usage](#usage)
9
9
  - [InlineCheckout](#inlinecheckout)
10
- - [LiteInlineCheckout](#Liteinlinecheckout)
11
- 3. [Configuration Options](#configuration-options)
10
+ - [LiteCheckout](#litecheckout)
11
+ 3. [Configuration Options](#configuration)
12
+ - [Inline Options](#inline-options)
13
+ - [Lite Options](#lite-options)
12
14
  4. [Styling InlineCheckout](#styling-inlinecheckout)
13
15
  5. [Payment Data Structure](#payment-data-structure)
14
16
  6. [Field Validation Functions](#field-validation-functions)
@@ -96,16 +98,16 @@ inlineCheckout.verify3dsTransaction().then((response) => {
96
98
  const response = await inlineCheckout.payment(checkoutData);
97
99
  ```
98
100
 
99
- ### LiteInlineCheckout
101
+ ### LiteCheckout
100
102
 
101
- LiteInlineCheckout allows you to build a custom checkout interface using Tonder's core functionality.
103
+ LiteCheckout allows you to build a custom checkout interface using Tonder's core functionality.
102
104
 
103
105
  ```javascript
104
- import { LiteInlineCheckout } from "tonder-web-sdk";
106
+ import { LiteCheckout } from "tonder-web-sdk";
105
107
  ```
106
108
 
107
109
  ```javascript
108
- const LiteInlineCheckout = new LiteInlineCheckout({
110
+ const liteCheckout = new LiteCheckout({
109
111
  apiKey: "your-api-key", // Your api key getted from Tonder Dashboard
110
112
  returnUrl: "http://your-website.com/checkout",
111
113
  });
@@ -115,57 +117,145 @@ const LiteInlineCheckout = new LiteInlineCheckout({
115
117
  inlineCheckout.configureCheckout({ customer: { email: "example@email.com" } });
116
118
 
117
119
  // Initialize the checkout
118
- await LiteInlineCheckout.injectCheckout();
120
+ await liteCheckout.injectCheckout();
119
121
  ```
120
122
 
121
123
  ```javascript
122
124
  // Retrieve customer's saved cards
123
- const cards = await LiteInlineCheckout.getCustomerCards();
125
+ const cards = await liteCheckout.getCustomerCards();
124
126
  ```
125
127
 
126
128
  ```javascript
127
129
  // Save a new card
128
- const newCard = await LiteInlineCheckout.saveCustomerCard(cardData);
130
+ const newCard = await liteCheckout.saveCustomerCard(cardData);
129
131
  ```
130
132
 
131
133
  ```javascript
132
134
  // Remove a saved card
133
- await LiteInlineCheckout.removeCustomerCard(cardId);
135
+ await liteCheckout.removeCustomerCard(cardId);
134
136
  ```
135
137
 
136
138
  ```javascript
137
139
  // Get available payment methods
138
- const paymentMethods = await LiteInlineCheckout.getCustomerPaymentMethods();
140
+ const paymentMethods = await liteCheckout.getCustomerPaymentMethods();
139
141
  ```
140
142
 
141
143
  ```javascript
142
144
  // Process a payment
143
- const paymentResponse = await LiteInlineCheckout.payment(paymentData);
145
+ const paymentResponse = await liteCheckout.payment(paymentData);
144
146
  ```
145
147
 
146
148
  ```javascript
147
149
  // Verify a 3DS transaction
148
- const verificationResult = await LiteInlineCheckout.verify3dsTransaction();
150
+ const verificationResult = await liteCheckout.verify3dsTransaction();
149
151
  ```
150
152
 
151
- ## Configuration Options
153
+ ## Configuration
154
+ ### Inline Options
155
+
156
+ | Property | Type | Required | Description | Default | Description |
157
+ |:-------------:|:--------------------:|----------|------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------:|
158
+ | mode | string | Yes | Environment mode for the SDK | stage | Environment mode. Options: 'stage', 'production', 'sandbox'. Default: 'stage' |
159
+ | apiKey | string | Yes | Your Tonder Public API key | | Your API key from the Tonder Dashboard |
160
+ | returnUrl | string | Yes | URL for 3DS redirect completion | | URL where the checkout form is mounted (used for 3DS) |
161
+ | styles | object | No | | | (InlineCheckout only) Custom styles for the checkout interface |
162
+ | customization | CustomizationOptions | No | UI customization options | `{displayMode: 'light',saveCards: {showSaveCardOption: false,showSaved: false,autoSave: false,},paymentButton: {show: false,text: "Pagar",showAmount: true,},cancelButton: {show: false,text: "Cancelar",},paymentMethods: {show: true,},cardForm: {show: true,},showMessages: true,}` | Object to customize the checkout behavior and UI. |
163
+ | callbacks | IInlineCallbacks | No | Payment process callback functions |
164
+ <details>
165
+ <summary>View Interface Definition</summary>
166
+
167
+ ```typescript
168
+ interface IInlineCheckoutBaseOptions {
169
+ mode?: "production" | "sandbox" | "stage" | "development";
170
+ apiKey: string;
171
+ returnUrl: string;
172
+ callBack?: (response: any) => void;
173
+ }
174
+ interface IInlineCheckoutOptions extends IInlineCheckoutBaseOptions {
175
+ styles?: Record<string, string>;
176
+ customization?: CustomizationOptions;
177
+ callbacks?: IInlineCallbacks;
178
+ }
179
+ ```
180
+ </details>
152
181
 
153
- Both InlineCheckout and LiteInlineCheckout accept the following configuration options:
182
+ ### Inline Callbacks Structure
154
183
 
155
- | Property | Type | Description |
156
- |:------------------------------------------:|:-------:|:-------------------------------------------------------------------------------------------------------------------------------------------:|
157
- | mode | string | Environment mode. Options: 'stage', 'production', 'sandbox'. Default: 'stage' |
158
- | apiKey | string | Your API key from the Tonder Dashboard |
159
- | returnUrl | string | URL where the checkout form is mounted (used for 3DS) |
160
- | renderPaymentButton | boolean | View the default Tonder payment button |
161
- | styles | object | (InlineCheckout only) Custom styles for the checkout interface |
162
- | customization | object | Object to customize the checkout behavior and UI. Default value `{saveCards: {showSaved: true, showSaveCardOption: true, autoSave: false}}` |
163
- | customization.saveCards.showSaved | boolean | Show saved cards in the checkout UI. Default value: `true` |
164
- | customization.saveCards.showSaveCardOption | object | Show the option to save the card for future payments. Default value: `true` |
165
- | customization.saveCards.autoSave | object | Automatically save the card without showing the option to the user. Default value: `false` |
184
+ | Callback | Required | Parameters | Description | Return |
185
+ |------------|----------|------------|--------------------------------------------|---------------|
186
+ | `onCancel` | No | none | Called when user clicked the cancel button | Promise<void> |
187
+ <details>
188
+ <summary>View Interface Definition</summary>
189
+
190
+ ```typescript
191
+ interface IInlineCallbacks extends IBaseCallback {
192
+ onCancel?: () => Promise<void>;
193
+ }
194
+ ```
195
+ </details>
196
+
197
+ ### Inline Customization Options
198
+
199
+ | Option | Type | Default | Description |
200
+ |------------------------------|---------|------------|-------------------------------------------------------------------------------------------|
201
+ | **saveCards** |
202
+ | saveCards.showSaveCardOption | boolean | true | Shows a checkbox allowing users to choose whether to save their card for future purchases |
203
+ | saveCards.showSaved | boolean | true | Displays a list of previously saved cards for the customer |
204
+ | saveCards.autoSave | boolean | false | Automatically saves the card without showing the save option to the user |
205
+ | **paymentButton** |
206
+ | paymentButton.show | boolean | true | Controls the visibility of the payment button |
207
+ | paymentButton.text | string | 'Pagar' | Custom text to display on the payment button |
208
+ | paymentButton.showAmount | boolean | true | Shows the payment amount on the button (e.g., "Pay $100") |
209
+ | **cancelButton** |
210
+ | cancelButton.show | boolean | true | Controls the visibility of the cancel button |
211
+ | cancelButton.text | string | 'Cancelar' | Custom text to display on the cancel button |
212
+ | **paymentMethods** |
213
+ | paymentMethods.show | boolean | true | Controls the visibility of alternative payment methods section |
214
+ | **cardForm** |
215
+ | cardForm.show | boolean | true | Controls the visibility of the card input form |
216
+ | **General** |
217
+ | showMessages | boolean | true | Controls the visibility of error and success messages |
218
+ | displayMode | string | light | Controls the display mode light or dark |
219
+
220
+ <details>
221
+ <summary>View Interface Definition</summary>
222
+
223
+ ```typescript
224
+ export type CustomizationOptions = {
225
+ displayMode?: "light" | "dark";
226
+ saveCards?: {
227
+ showSaveCardOption?: boolean;
228
+ showSaved?: boolean;
229
+ autoSave?: boolean;
230
+ };
231
+ paymentButton?: {
232
+ show?: boolean;
233
+ text?: string;
234
+ showAmount?: boolean;
235
+ };
236
+ cancelButton?: {
237
+ show?: boolean;
238
+ text?: string;
239
+ };
240
+ paymentMethods?: {
241
+ show?: boolean;
242
+ };
243
+ cardForm?: {
244
+ show?: boolean;
245
+ };
246
+ showMessages?: boolean;
247
+ };
248
+ ```
249
+ </details>
250
+
251
+ ## Lite Options
252
+
253
+ | Property | Type | Required | Description | Default | Description |
254
+ |:---------:|:------:|----------|---------------------------------|---------|:-----------------------------------------------------------------------------:|
255
+ | mode | string | Yes | Environment mode for the SDK | stage | Environment mode. Options: 'stage', 'production', 'sandbox'. Default: 'stage' |
256
+ | apiKey | string | Yes | Your Tonder Public API key | | Your API key from the Tonder Dashboard |
257
+ | returnUrl | string | Yes | URL for 3DS redirect completion | | URL where the checkout form is mounted (used for 3DS) |
166
258
 
167
- > **Important Note about SaveCard functionality**:
168
- > 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).
169
259
 
170
260
  ## Styling InlineCheckout
171
261
 
@@ -256,15 +346,15 @@ When calling the `payment` method, use the following data structure:
256
346
 
257
347
  - **metadata**: Object for including any additional information about the transaction. This can be used for internal references or tracking.
258
348
 
259
- - **card**: (for LiteInlineCheckout) Object containing card information. This is used differently depending on whether it's a new card or a saved card:
349
+ - **card**: (for LiteCheckout) Object containing card information. This is used differently depending on whether it's a new card or a saved card:
260
350
 
261
351
  - For a new card: Include `card_number`, `cvv`, `expiration_month`, `expiration_year`, and `cardholder_name`.
262
352
  - For a saved card: Include only the `skyflow_id` of the saved card.
263
353
  - This is only used when not paying with a payment_method.
264
354
 
265
- - **payment_method**: (for LiteInlineCheckout) String indicating the alternative payment method to be used (e.g., "Spei"). This is only used when not paying with a card.
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.
266
356
 
267
- Note: The exact fields required may vary depending on whether you're using InlineCheckout or LiteInlineCheckout, and the specific payment method being used.
357
+ Note: The exact fields required may vary depending on whether you're using InlineCheckout or LiteCheckout, and the specific payment method being used.
268
358
 
269
359
  ```javascript
270
360
  const paymentData = {
@@ -316,7 +406,7 @@ const paymentData = {
316
406
 
317
407
  ## Field Validation Functions
318
408
 
319
- For LiteInlineCheckout implementations, the SDK provides validation functions to ensure the integrity of card data before submitting:
409
+ For LiteCheckout implementations, the SDK provides validation functions to ensure the integrity of card data before submitting:
320
410
 
321
411
  - `validateCardNumber(cardNumber)`: Validates the card number using the Luhn algorithm.
322
412
  - `validateCardholderName(name)`: Checks if the cardholder name is valid.
@@ -361,7 +451,7 @@ if (
361
451
  - `payment(data)`: Process a payment
362
452
  - `verify3dsTransaction()`: Verify a 3DS transaction
363
453
 
364
- ### LiteInlineCheckout Methods
454
+ ### LiteCheckout Methods
365
455
 
366
456
  - `configureCheckout(data)`: Set initial checkout data
367
457
  - `injectCheckout()`: Initialize the checkout
@@ -453,7 +543,11 @@ const inlineCheckout = new InlineCheckout({
453
543
  apiKey,
454
544
  returnUrl,
455
545
  styles: customStyles,
456
- renderPaymentButton: true, // activate default Tonder Payment button
546
+ customization: {
547
+ paymentButton: {
548
+ show: true
549
+ }
550
+ }, // activate default Tonder Payment button
457
551
  callBack: (response) => {
458
552
  console.log('Payment response', response)
459
553
  }
@@ -499,16 +593,16 @@ import { LiteInlineCheckout } from "tonder-web-sdk";
499
593
  const apiKey = "your-api-key";
500
594
  const returnUrl = "http://your-website.com/checkout";
501
595
 
502
- const LiteInlineCheckout = new LiteInlineCheckout({
596
+ const liteCheckout = new LiteInlineCheckout({
503
597
  mode: "development",
504
598
  apiKey,
505
599
  returnUrl,
506
600
  });
507
601
 
508
- LiteInlineCheckout.configureCheckout({ customer: { email: "example@email.com" } });
509
- LiteInlineCheckout.injectCheckout();
602
+ liteCheckout.configureCheckout({ customer: { email: "example@email.com" } });
603
+ liteCheckout.injectCheckout();
510
604
 
511
- LiteInlineCheckout.verify3dsTransaction().then((response) => {
605
+ liteCheckout.verify3dsTransaction().then((response) => {
512
606
  console.log("Verify 3ds response", response);
513
607
  });
514
608
 
@@ -526,7 +620,7 @@ document
526
620
 
527
621
  try {
528
622
  const paymentData = { ...checkoutData, card: cardData };
529
- const response = await LiteInlineCheckout.payment(paymentData);
623
+ const response = await liteCheckout.payment(paymentData);
530
624
  console.log("Payment response:", response);
531
625
  alert("Payment successful");
532
626
  } catch (error) {
@@ -738,7 +832,7 @@ export class TonderService {
738
832
  // Add more functions, for example for lite sdk: get payment methods
739
833
 
740
834
  // getCustomerPaymentMethods(): Promise<IPaymentMethod[]> {
741
- // return this.LiteInlineCheckout.getCustomerPaymentMethods();
835
+ // return this.liteCheckout.getCustomerPaymentMethods();
742
836
  // }
743
837
  }
744
838
 
package/package.json CHANGED
@@ -1,19 +1,30 @@
1
1
  {
2
2
  "name": "tonder-web-sdk",
3
- "version": "1.16.1",
3
+ "version": "1.16.6-beta.DEV-1433.1",
4
4
  "description": "tonder sdk for integrations",
5
- "main": "src/index.js",
6
5
  "scripts": {
7
6
  "start": "webpack-dev-server",
8
- "build": "webpack --config webpack.config.js --mode production"
7
+ "build": "webpack --config webpack.config.js --mode production",
8
+ "prepare": "husky install",
9
+ "format": "prettier --write .",
10
+ "lint": "eslint 'src/**/*.js'",
11
+ "lint:fix": "eslint 'src/**/*.js' --fix"
9
12
  },
10
13
  "author": "",
14
+ "main": "v1/bundle.min.js",
11
15
  "types": "types/index.d.ts",
16
+ "files": [
17
+ "v1",
18
+ "types",
19
+ "LICENSE",
20
+ "README.md"
21
+ ],
12
22
  "license": "ISC",
13
23
  "dependencies": {
14
24
  "accordion-js": "^3.4.0",
15
25
  "crypto-js": "^4.1.1",
16
- "dotenv": "^16.3.1"
26
+ "dotenv": "^16.3.1",
27
+ "lodash.get": "^4.4.2"
17
28
  },
18
29
  "devDependencies": {
19
30
  "@babel/core": "^7.20.12",
@@ -22,12 +33,24 @@
22
33
  "babel-loader": "^9.1.2",
23
34
  "css-loader": "^6.7.3",
24
35
  "cypress": "^13.6.2",
36
+ "eslint": "^9.18.0",
37
+ "eslint-config-prettier": "^10.0.1",
38
+ "eslint-plugin-prettier": "^5.2.3",
25
39
  "html-webpack-plugin": "^5.5.3",
26
- "prettier": "^3.3.3",
40
+ "husky": "^8.0.3",
41
+ "lint-staged": "^15.4.1",
42
+ "prettier": "3.4.2",
27
43
  "style-loader": "^3.3.1",
28
44
  "terser-webpack-plugin": "^5.3.10",
29
45
  "webpack": "^5.75.0",
30
46
  "webpack-cli": "^5.0.1",
31
- "webpack-dev-server": "^4.11.1"
47
+ "webpack-dev-server": "^4.11.1",
48
+ "webpack-obfuscator": "^3.5.1"
49
+ },
50
+ "lint-staged": {
51
+ "**/*.{js,jsx,ts,tsx}": [
52
+ "npm run format",
53
+ "npm run lint:fix"
54
+ ]
32
55
  }
33
56
  }
package/types/card.d.ts CHANGED
@@ -1,34 +1,34 @@
1
1
  export interface ICard {
2
- fields: ICardSkyflowFields;
3
- icon?: string;
2
+ fields: ICardSkyflowFields;
3
+ icon?: string;
4
4
  }
5
5
 
6
6
  export interface ICardSkyflowFields {
7
- card_number: string;
8
- expiration_month: string;
9
- expiration_year: string;
10
- skyflow_id: string;
11
- card_scheme: string;
7
+ card_number: string;
8
+ expiration_month: string;
9
+ expiration_year: string;
10
+ skyflow_id: string;
11
+ card_scheme: string;
12
12
  }
13
13
 
14
14
  export interface ICustomerCardsResponse {
15
- user_id: number;
16
- cards: ICard[];
15
+ user_id: number;
16
+ cards: ICard[];
17
17
  }
18
18
 
19
19
  export interface ISaveCardResponse {
20
- skyflow_id: string;
21
- user_id: number;
20
+ skyflow_id: string;
21
+ user_id: number;
22
22
  }
23
23
 
24
24
  export interface ISaveCardSkyflowRequest {
25
- skyflow_id: string;
25
+ skyflow_id: string;
26
26
  }
27
27
 
28
28
  export interface ISaveCardRequest {
29
- card_number: string;
30
- cvv: string;
31
- expiration_month: string;
32
- expiration_year: string;
33
- cardholder_name: string;
29
+ card_number: string;
30
+ cvv: string;
31
+ expiration_month: string;
32
+ expiration_year: string;
33
+ cardholder_name: string;
34
34
  }
@@ -1,118 +1,116 @@
1
- import {ICustomer} from "./customer";
1
+ import { ICustomer } from "./customer";
2
2
 
3
3
  export interface IStartCheckoutRequestBase {
4
- name: any;
5
- last_name: string;
6
- email_client: any;
7
- phone_number: any;
8
- return_url?: string;
9
- id_product: string;
10
- quantity_product: number;
11
- id_ship: string;
12
- instance_id_ship: string;
13
- amount: any;
14
- title_ship: string;
15
- description: string;
16
- device_session_id: any;
17
- token_id: string;
18
- order_id: any;
19
- business_id: any;
20
- payment_id: any;
21
- source: string;
22
- browser_info?: any;
23
- metadata: any;
24
- currency: string;
4
+ name: any;
5
+ last_name: string;
6
+ email_client: any;
7
+ phone_number: any;
8
+ return_url?: string;
9
+ id_product: string;
10
+ quantity_product: number;
11
+ id_ship: string;
12
+ instance_id_ship: string;
13
+ amount: any;
14
+ title_ship: string;
15
+ description: string;
16
+ device_session_id: any;
17
+ token_id: string;
18
+ order_id: any;
19
+ business_id: any;
20
+ payment_id: any;
21
+ source: string;
22
+ browser_info?: any;
23
+ metadata: any;
24
+ currency: string;
25
25
  }
26
26
 
27
27
  export type IStartCheckoutRequestWithCard = IStartCheckoutRequestBase & {
28
- card: any;
29
- payment_method?: never;
28
+ card: any;
29
+ payment_method?: never;
30
30
  };
31
31
 
32
- export type IStartCheckoutRequestWithPaymentMethod =
33
- IStartCheckoutRequestBase & {
34
- card?: never;
35
- payment_method: string;
32
+ export type IStartCheckoutRequestWithPaymentMethod = IStartCheckoutRequestBase & {
33
+ card?: never;
34
+ payment_method: string;
36
35
  };
37
36
 
38
37
  export type IStartCheckoutRequest =
39
- | IStartCheckoutRequestWithCard
40
- | IStartCheckoutRequestWithPaymentMethod;
38
+ | IStartCheckoutRequestWithCard
39
+ | IStartCheckoutRequestWithPaymentMethod;
41
40
 
42
41
  export interface IStartCheckoutIdRequest {
43
- checkout_id: string;
42
+ checkout_id: string;
44
43
  }
45
44
 
46
45
  export interface IStartCheckoutErrorResponse {
47
- status: string;
48
- message: string;
49
- psp_response: [
50
- {
51
- status: number;
52
- response: Object;
53
- },
54
- ];
55
- checkout_id: string;
56
- is_route_finished: boolean;
46
+ status: string;
47
+ message: string;
48
+ psp_response: [
49
+ {
50
+ status: number;
51
+ response: Object;
52
+ },
53
+ ];
54
+ checkout_id: string;
55
+ is_route_finished: boolean;
57
56
  }
58
57
 
59
58
  export interface IStartCheckoutResponse {
60
- status: string;
61
- message: string;
62
- psp_response: Record<string, any>;
63
- checkout_id: string;
64
- is_route_finished: Boolean;
65
- transaction_status: string;
66
- transaction_id: number;
67
- payment_id: number;
68
- provider: string;
69
- next_action: {
70
- redirect_to_url: {
71
- url: string;
72
- return_url: string;
73
- verify_transaction_status_url: string;
74
- };
75
- iframe_resources?: {
76
- iframe: string;
77
- };
59
+ status: string;
60
+ message: string;
61
+ psp_response: Record<string, any>;
62
+ checkout_id: string;
63
+ is_route_finished: Boolean;
64
+ transaction_status: string;
65
+ transaction_id: number;
66
+ payment_id: number;
67
+ provider: string;
68
+ next_action: {
69
+ redirect_to_url: {
70
+ url: string;
71
+ return_url: string;
72
+ verify_transaction_status_url: string;
78
73
  };
79
- actions: IStartCheckoutActionResponse[];
74
+ iframe_resources?: {
75
+ iframe: string;
76
+ };
77
+ };
78
+ actions: IStartCheckoutActionResponse[];
80
79
  }
81
80
 
82
81
  export interface IStartCheckoutActionResponse {
83
- name: string;
84
- url: string;
85
- method: string;
82
+ name: string;
83
+ url: string;
84
+ method: string;
86
85
  }
87
86
 
88
-
89
87
  export interface IItem {
90
- description: string;
91
- quantity: number;
92
- price_unit: number;
93
- discount: number;
94
- taxes: number;
95
- product_reference: string | number;
96
- name: string;
97
- amount_total: number;
88
+ description: string;
89
+ quantity: number;
90
+ price_unit: number;
91
+ discount: number;
92
+ taxes: number;
93
+ product_reference: string | number;
94
+ name: string;
95
+ amount_total: number;
98
96
  }
99
97
 
100
98
  export interface IProcessPaymentRequest {
101
- customer: ICustomer;
102
- cart: {
103
- total: string | number;
104
- items: IItem[];
105
- };
106
- metadata?: Record<string, any>;
107
- currency?: string;
108
- payment_method?: string;
109
- card?: ICardFields | string;
99
+ customer: ICustomer;
100
+ cart: {
101
+ total: string | number;
102
+ items: IItem[];
103
+ };
104
+ metadata?: Record<string, any>;
105
+ currency?: string;
106
+ payment_method?: string;
107
+ card?: ICardFields | string;
110
108
  }
111
109
 
112
110
  export interface ICardFields {
113
- card_number: string;
114
- cvv: string;
115
- expiration_month: string;
116
- expiration_year: string;
117
- cardholder_name: string;
118
- }
111
+ card_number: string;
112
+ cvv: string;
113
+ expiration_month: string;
114
+ expiration_year: string;
115
+ cardholder_name: string;
116
+ }
package/types/common.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import { ICustomer } from "./customer";
2
- import {IProcessPaymentRequest} from "./checkout";
2
+ import { IProcessPaymentRequest } from "./checkout";
3
3
 
4
4
  export interface IInlineCheckoutBaseOptions {
5
5
  mode?: "production" | "sandbox" | "stage" | "development";
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
- export interface IConfigureCheckout extends IProcessPaymentRequest{
15
+ export interface IConfigureCheckout extends Partial<IProcessPaymentRequest> {
12
16
  customer: ICustomer;
13
17
  secureToken: string;
14
18
  }
@@ -26,3 +30,5 @@ export interface IPublicError {
26
30
  message: string;
27
31
  detail: Record<string, any> | string;
28
32
  }
33
+
34
+ export interface IBaseCallback {}
@@ -1,12 +1,12 @@
1
1
  export type ICustomer = {
2
- firstName: string;
3
- lastName: string;
4
- country?: string;
5
- street?: string;
6
- city?: string;
7
- state?: string;
8
- postCode?: string;
9
- email: string;
10
- phone?: string;
11
- address?: string;
2
+ firstName: string;
3
+ lastName: string;
4
+ country?: string;
5
+ street?: string;
6
+ city?: string;
7
+ state?: string;
8
+ postCode?: string;
9
+ email: string;
10
+ phone?: string;
11
+ address?: string;
12
12
  };