skyflow-js 1.7.0 → 1.10.0

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 (36) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +342 -16
  3. package/dist/sdkNodeBuild/index.js +1 -1
  4. package/dist/sdkNodeBuild/index.js.LICENSE.txt +27 -0
  5. package/dist/sdkNodeBuild/index.js.LICENSE.txt.gz +0 -0
  6. package/dist/sdkNodeBuild/index.js.gz +0 -0
  7. package/package.json +7 -4
  8. package/types/Skyflow.d.ts +8 -7
  9. package/types/{container → core}/constants.d.ts +87 -14
  10. package/types/{container/external/PureJsController.d.ts → core/external/SkyflowContainer.d.ts} +4 -3
  11. package/types/{container/external → core/external/collect}/CollectContainer.d.ts +7 -6
  12. package/types/{container/external/element/index.d.ts → core/external/collect/CollectElement.d.ts} +9 -3
  13. package/types/core/external/common/Container.d.ts +3 -0
  14. package/types/{container/external/element → core/external/common}/IFrame.d.ts +0 -0
  15. package/types/core/external/common/SkyflowElement.d.ts +9 -0
  16. package/types/core/external/reveal/RevealContainer.d.ts +22 -0
  17. package/types/core/external/reveal/RevealElement.d.ts +22 -0
  18. package/types/{container → core}/internal/FrameElements.d.ts +0 -0
  19. package/types/core/internal/SkyflowFrame/SkyflowFrameController.d.ts +10 -0
  20. package/types/{container → core}/internal/iFrameForm/index.d.ts +4 -0
  21. package/types/{container → core}/internal/index.d.ts +2 -0
  22. package/types/{container → core}/internal/reveal/RevealFrame.d.ts +3 -0
  23. package/types/{container → core}/internal/reveal/RevealFrameController.d.ts +0 -0
  24. package/types/{core → core-utils}/collect.d.ts +2 -1
  25. package/types/{core → core-utils}/reveal.d.ts +5 -8
  26. package/types/libs/element-options.d.ts +2 -1
  27. package/types/libs/objectParse.d.ts +5 -1
  28. package/types/utils/busEvents/index.d.ts +1 -1
  29. package/types/utils/common/index.d.ts +6 -0
  30. package/types/utils/constants.d.ts +298 -22
  31. package/types/utils/helpers/index.d.ts +7 -0
  32. package/types/utils/logs.d.ts +104 -37
  33. package/types/utils/validators/index.d.ts +16 -6
  34. package/types/container/external/RevealContainer.d.ts +0 -18
  35. package/types/container/external/reveal/RevealElement.d.ts +0 -11
  36. package/types/container/internal/pureJs/PureJsFrameController.d.ts +0 -9
package/CHANGELOG.md CHANGED
@@ -1,6 +1,40 @@
1
1
  # Changelog
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
+
5
+
6
+ ## [1.10.0] - 2022-01-25
7
+
8
+ ### Added
9
+ - `formatRegex` option for `RevealElement`
10
+ ## [1.9.1] - 2022-01-11
11
+
12
+ ### Fixed
13
+ - Fixes in `invokeSoapConnection` method
14
+
15
+ ## [1.9.0] - 2022-01-11
16
+
17
+ ### Added
18
+ - `Soap protocol` support for connections
19
+
20
+ ## [1.8.0] - 2021-12-07
21
+
22
+ ### Added
23
+ - `setError(error: string)` method to set custom UI error to be displayed on the collect and reveal Elements
24
+ - `resetError()` method is used to clear the custom UI error message set through setError
25
+ - `format` parameter in `collectElementOptions` to support different type of date formats for `EXPIRATION_DATE` element
26
+ - `setValue(value: string)` and `clearValue()` method in DEV env, to set/clear the value of a collect element.
27
+ - `setToken(value: string)` method to set the token for a reveal element.
28
+ - `setAltText(value: string)` and `clearAltText()` method to set/clear the altText for a reveal
29
+ ### Changed
30
+
31
+ - Changed error messages in the logs and callback errors.
32
+ - `altText` support has been deprecated for collect element
33
+ - `vaultID` and `vaultURL` are now optional parameters in Configuration constructor
34
+
35
+ ### Fixed
36
+ - Updating UI error messages
37
+
4
38
  ## [1.7.0] - 2021-11-24
5
39
  ### Added
6
40
  - `validations` option in `CollectElementInput` that takes an array of validation rules
package/README.md CHANGED
@@ -9,6 +9,7 @@ Skyflow’s Javascript SDK can be used to securely collect, tokenize, and reveal
9
9
  - [**Securely collecting data client-side**](#Securely-collecting-data-client-side)
10
10
  - [**Securely revealing data client-side**](#Securely-revealing-data-client-side)
11
11
  - [**Securely invoking Connections client-side**](#Securely-invoking-Connections-client-side)
12
+ - [**Securely invoking Connections client-side using SOAP**](#Securely-invoking-Connections-client-side-using-soap)
12
13
 
13
14
  ---
14
15
 
@@ -127,6 +128,8 @@ For `env` parameter, there are 2 accepted values in Skyflow.Env
127
128
  - [**Using Skyflow Elements to collect data**](#using-skyflow-elements-to-collect-data)
128
129
  - [**Using validations on Collect Elements**](#validations)
129
130
  - [**Event Listener on Collect Elements**](#event-listener-on-collect-elements)
131
+ - [**UI Error for Collect Eements**](#ui-error-for-collect-elements)
132
+ - [**Set and Clear value for Collect Elements (DEV ENV ONLY)**](#set-and-clear-value-for-collect-elements-dev-env-only)
130
133
  ## Inserting data into the vault
131
134
 
132
135
  To insert data into the vault from the browser, use the `insert(records, options?)` method of the Skyflow client. The `records` parameter takes a JSON object of the records to be inserted in the below format. The `options` parameter takes a dictionary of optional parameters for the insertion. See below:
@@ -209,11 +212,13 @@ const collectElement = {
209
212
  errorTextStyles:{}, //optional styles that will be applied to the errorText of the collect element
210
213
  label: "string", //optional label for the form element
211
214
  placeholder: "string", //optional placeholder for the form element
212
- altText: "string" //optional string that acts as an initial value for the collect element
215
+ altText: "string" //(DEPRECATED) string that acts as an initial value for the collect element
213
216
  validations:[] // optional array of validation rules
214
217
  }
215
218
  ```
216
- The `table` and `column` fields indicate which table and column in the vault the Element corresponds to. **Note**:
219
+ The `table` and `column` fields indicate which table and column in the vault the Element corresponds to.
220
+
221
+ **Note**:
217
222
  - Use dot delimited strings to specify columns nested inside JSON fields (e.g. `address.street.line1`)
218
223
  - `table` and `column` are optional only if the element is being used in invokeConnection()
219
224
 
@@ -284,7 +289,31 @@ Finally, the `type` field takes a Skyflow ElementType. Each type applies the app
284
289
 
285
290
  The `INPUT_FIELD` type is a custom UI element without any built-in validations. See the section on [validations](#validations) for more information on validations.
286
291
 
287
- Once the Element object has been defined, add it to the container using the `create(element, options)` method as shown below. The `element` param takes a Skyflow Element object as defined above and the `options` parameter takes a dictionary of optional parameters as described below:
292
+ Along with CollectElement we can define other options which takes a dictionary of optional parameters as described below:
293
+
294
+ ```javascript
295
+ const options = {
296
+ required: false, //optional, indicates whether the field is marked as required. Defaults to 'false'
297
+ enableCardIcon: true // optional, indicates whether card icon should be enabled (only applicable for CARD_NUMBER ElementType)
298
+ format: String //optinal, format for the element (only applicable currently for EXPIRATION_DATE ElementType)
299
+ }
300
+ ```
301
+
302
+ `required` parameter indicates whether the field is marked as required or not. If not provided, it defaults to false
303
+
304
+ `enableCardIcon` paramenter indicates whether the icon is visible for the CARD_NUMBER element, defaults to true
305
+
306
+ `format` parameter takes string value and indicates the format pattern applicable to the element type. It is currently applicable to EXPIRATION_DATE element type only, the values that are accepted are
307
+
308
+ - `MM/YY`
309
+ - `MM/YYYY`
310
+ - `YY/MM`
311
+ - `YYYY/MM`
312
+
313
+ `NOTE` : If not specified or invalid value is passed to the format for EXPIRATION_DATE element, then it defaults to MM/YY format.
314
+
315
+
316
+ Once the Element object and options has been defined, add it to the container using the `create(element, options)` method as shown below. The `element` param takes a Skyflow Element object and options as defined above:
288
317
 
289
318
  ```javascript
290
319
  const collectElement = {
@@ -296,13 +325,14 @@ const collectElement = {
296
325
  errorTextStyles:{}, //optional styles that will be applied to the errorText of the collect element
297
326
  label: "string", //optional label for the form element
298
327
  placeholder: "string", //optional placeholder for the form element
299
- altText: "string" //optional string that acts as an initial value for the collect element
328
+ altText: "string" //(DEPRECATED) string that acts as an initial value for the collect element
300
329
  validations:[] // optional array of validation rules
301
330
  }
302
331
 
303
332
  const options = {
304
- required: false, //indicates whether the field is marked as required. Defaults to 'false'
305
- enableCardIcon: true // indicates whether card icon should be enabled (only for CARD_NUMBER type Element)
333
+ required: false, //optional, indicates whether the field is marked as required. Defaults to 'false'
334
+ enableCardIcon: true // optional, indicates whether card icon should be enabled (only applicable for CARD_NUMBER ElementType)
335
+ format: String //optinal, format for the element (only applicable currently for EXPIRATION_DATE ElementType)
306
336
  }
307
337
 
308
338
  const element = container.create(collectElement, options)
@@ -441,7 +471,7 @@ Every Collect Element except of type `INPUT_FIELD` has a set of default validati
441
471
  - `CARD_NUMBER`: Card number validation with checkSum algorithm(Luhn algorithm), available card lengths for defined card types
442
472
  - `CARD_HOLDER_NAME`: Name should be 2 or more symbols, valid characters should match pattern - `^([a-zA-Z\\ \\,\\.\\-\\']{2,})$`
443
473
  - `CVV`: Card CVV can have 3-4 digits
444
- - `EXPIRATION_DATE`: Any date starting from current month. By default valid expiration date should be in short year format - `MM/YYYY`
474
+ - `EXPIRATION_DATE`: Any date starting from current month. By default valid expiration date should be in short year format - `MM/YY`
445
475
  - `PIN`: Can have 4-12 digits
446
476
 
447
477
  #### 2. Custom Validations:
@@ -591,7 +621,7 @@ values of SkyflowElements will be returned in elementstate object only when `env
591
621
 
592
622
  ##### Sample code snippet for using listeners
593
623
  ```javascript
594
- //create skyflow client with loglevel:"DEBUG"
624
+ //create skyflow client
595
625
  const skyflowClient = Skyflow.init({
596
626
  vaultID: <VAULT_ID>,
597
627
  vaultURL: <VAULT_URL>,
@@ -641,12 +671,70 @@ cardNumber.on(Skyflow.EventName.CHANGE,(state) => {
641
671
  }
642
672
  ```
643
673
 
674
+ ### UI Error for Collect Elements
675
+
676
+ Helps to display custom error messages on the Skyflow Elements through the methods `setError` and `resetError` on the elements.
677
+
678
+ `setError(error: string)` method is used to set the error text for the element, when this method is trigerred, all the current errors present on the element will be overridden with the custom error message passed. This error will be displayed on the element until `resetError()` is trigerred on the same element.
679
+
680
+ `resetError()` method is used to clear the custom error message that is set using `setError`.
681
+
682
+ ##### Sample code snippet for setError and resetError
683
+
684
+ ```javascript
685
+
686
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
687
+
688
+ const cardNumber = container.create({
689
+ table: "pii_fields",
690
+ column: "primary_card.card_number",
691
+ type: Skyflow.ElementType.CARD_NUMBER,
692
+ });
693
+
694
+ //Set custom error
695
+ cardNumber.setError("custom error");
696
+
697
+ //reset custom error
698
+ cardNumber.resetError();
699
+
700
+ ```
701
+
702
+ ### Set and Clear value for Collect Elements (DEV ENV ONLY)
703
+
704
+ `setValue(value: string)` method is used to set the value of the element. This method will override any previous value present in the element.
705
+
706
+ `clearValue()` method is used to reset the value of the element.
707
+
708
+ `Note:` This methods are only available in DEV env for testing/developmental purposes and MUST NOT be used in PROD env.
709
+
710
+ ##### Sample code snippet for setValue and clearValue
711
+
712
+ ```javascript
713
+ const container = skyflowClient.container(Skyflow.ContainerType.COLLECT)
714
+
715
+ const cardNumber = container.create({
716
+ table: "pii_fields",
717
+ column: "primary_card.card_number",
718
+ type: Skyflow.ElementType.CARD_NUMBER,
719
+ });
720
+
721
+ // Set a value programatically
722
+ cardNumber.setValue("4111111111111111");
723
+
724
+ // Clear the value
725
+ cardNumber.clearValue();
726
+
727
+ ```
728
+
644
729
  ---
645
730
 
646
731
 
647
732
  # Securely revealing data client-side
648
733
  - [**Retrieving data from the vault**](#retrieving-data-from-the-vault)
649
734
  - [**Using Skyflow Elements to reveal data**](#using-skyflow-elements-to-reveal-data)
735
+ - [**UI Error for Reveal Elements**](#ui-error-for-reveal-elements)
736
+ - [**Set token for Reveal Elements**](#set-token-for-reveal-elements)
737
+ - [**Set and clear altText for Reveal Elements**](#set-and-clear-alttext-for-reveal-elements)
650
738
 
651
739
  ## Retrieving data from the vault
652
740
 
@@ -780,12 +868,18 @@ const revealElement = {
780
868
  inputStyles: {}, //optional styles to be applied to the element
781
869
  labelStyles: {}, //optional, styles to be applied to the label of the reveal element
782
870
  errorTextStyles: {}, //optional styles that will be applied to the errorText of the reveal element
783
- label: "string", //label for the form element
871
+ label: "string", //optional, label for the form element
784
872
  altText: "string" //optional, string that is shown before reveal, will show token if altText is not provided
785
873
  }
874
+
875
+ const revealElementOptions = {
876
+ formatRegex: RegExp //optional, regex to specify the format on the value that has been revealed
877
+ }
786
878
  ```
787
879
  `Note`:
788
880
  - `token` is optional only if it is being used in invokeConnection()
881
+ - If revealElement has a formatRegex option and on invoking container.reveal() method, it will first reveal the token and then apply the formatRegex match, and then render it in UI
882
+ - If there are multiple matches found with the given formatRegex option, then always the first match is applied to the revealed value
789
883
 
790
884
  The `inputStyles`, `labelStyles` and `errorTextStyles` parameters accepts a styles object as described in the [previous section](#step-2-create-a-collect-element) for collecting data but only a single variant is available i.e. base.
791
885
 
@@ -823,7 +917,7 @@ errorTextStyles: {
823
917
  Once you've defined a Skyflow Element, you can use the `create(element)` method of the container to create the Element as shown below:
824
918
 
825
919
  ```javascript
826
- const element = container.create(revealElement)
920
+ const element = container.create(revealElement, revealElementOptions)
827
921
  ```
828
922
 
829
923
  ### Step 3: Mount Elements to the DOM
@@ -922,6 +1016,65 @@ The response below shows that some tokens assigned to the reveal elements get re
922
1016
  }
923
1017
  ```
924
1018
 
1019
+ ### UI Error for Reveal Elements
1020
+ Helps to display custom error messages on the Skyflow Elements through the methods `setError` and `resetError` on the elements.
1021
+
1022
+ `setError(error: string)` method is used to set the error text for the element, when this method is trigerred, all the current errors present on the element will be overridden with the custom error message passed. This error will be displayed on the element until `resetError()` is trigerred on the same element.
1023
+
1024
+ `resetError()` method is used to clear the custom error message that is set using `setError`.
1025
+
1026
+ ##### Sample code snippet for setError and resetError
1027
+
1028
+ ```javascript
1029
+
1030
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1031
+
1032
+ const cardNumber = container.create({
1033
+ token: "89024714-6a26-4256-b9d4-55ad69aa4047",
1034
+ });
1035
+
1036
+ //Set custom error
1037
+ cardNumber.setError("custom error");
1038
+
1039
+ //reset custom error
1040
+ cardNumber.resetError();
1041
+
1042
+ ```
1043
+ ### Set token for Reveal Elements
1044
+
1045
+ The `setToken(value: string)` method can be used to set the token of the Reveal Element. If no altText is set, the set token will be displayed on the UI as well. If altText is set, then there will be no change in the UI but the token of the element will be internally updated.
1046
+
1047
+ ##### Sample code snippet for setToken
1048
+ ```javascript
1049
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1050
+
1051
+ const cardNumber = container.create({
1052
+ altText:"Card Number",
1053
+ });
1054
+
1055
+ // set token
1056
+ cardNumber.setToken("89024714-6a26-4256-b9d4-55ad69aa4047");
1057
+
1058
+ ```
1059
+ ### Set and Clear altText for Reveal Elements
1060
+ The `setAltText(value: string)` method can be used to set the altText of the Reveal Element. This will cause the altText to be displayed in the UI regardless of whether the token or value is currently being displayed.
1061
+
1062
+ `clearAltText()` method can be used to clear the altText, this will cause the element to display the token or actual value of the element. If the element has no token, the element will be empty.
1063
+ ##### Sample code snippet for setAltText and clearAltText
1064
+
1065
+ ```javascript
1066
+ const container = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1067
+
1068
+ const cardNumber = container.create({
1069
+ token:"89024714-6a26-4256-b9d4-55ad69aa4047",
1070
+ });
1071
+
1072
+ // set altText
1073
+ cardNumber.setAltText("Card Number");
1074
+
1075
+ //clear altText
1076
+ cardNumber.clearAltText();
1077
+ ```
925
1078
  # Securely invoking Connections client-side
926
1079
  Using Skyflow Connections, end-user applications can integrate checkout/card issuance flow without any of their apps/systems touching the PCI compliant fields like cvv, card number. To invoke Connections, use the `invokeConnection(connectionConfig)` method of the Skyflow client.
927
1080
 
@@ -951,7 +1104,7 @@ const response = skyflowClient.invokeConnection(connectionConfig);
951
1104
  The values in the above parameters can contain collect elements, reveal elements or actual values. When elements are provided inplace of values, they get replaced with the value entered in the collect elements or value present in the reveal elements
952
1105
 
953
1106
  **responseBody**:
954
- It is a JSON object that specifies where to render the response in the UI. The values in the responseBody can contain collect elements or reveal elements.
1107
+ It is a JSON object that specifies where to render the response in the UI. The values in the responseBody can contain collect elements or reveal elements. The actual values corresponding to these elements will be stripped out from the actual response, which is then forwarded from the SDK to the client application.
955
1108
 
956
1109
  Sample use-cases on using invokeConnection():
957
1110
 
@@ -962,8 +1115,6 @@ Merchant acceptance - customers should be able to complete payment checkout with
962
1115
  ```javascript
963
1116
  // step 1
964
1117
  const skyflowClient = skyflow.init({
965
- vaultID: <vault_Id>,
966
- vaultURL: <vault_url>,
967
1118
  getBearerToken: <helperFunc>
968
1119
  });
969
1120
 
@@ -1013,8 +1164,6 @@ In the above example, CVV is being collected from the user input at the time of
1013
1164
  ```javascript
1014
1165
  // step 1
1015
1166
  const skyflowClient = skyflow.init({
1016
- vaultID: <vault_Id>,
1017
- vaultURL: <vault_url>,
1018
1167
  getBearerToken: <helperFunc>
1019
1168
  });
1020
1169
 
@@ -1064,4 +1213,181 @@ Sample Response:
1064
1213
 
1065
1214
  `Note`:
1066
1215
  - `token` is optional for creating reveal element, if it is used for invokeConnection
1067
- - responseBody contains collect or reveal elements to render the response from the Connection on UI
1216
+ - responseBody contains collect or reveal elements to render the response from the Connection on UI
1217
+
1218
+ # Securely invoking Connections client-side using SOAP
1219
+
1220
+ To invoke Connections using SOAP, use the `invokeSoapConnection(connectionConfig)` method of the Skyflow client as shown below:
1221
+
1222
+ ```javascript
1223
+ const connectionConfig = {
1224
+ connectionURL: string, // connection url received when creating a Skyflow Connection
1225
+ httpHeaders: any, // optional
1226
+ requestXML: string,
1227
+ responseXML: string, // optional
1228
+ }
1229
+
1230
+ const response = skyflowClient.invokeSoapConnection(connectionConfig);
1231
+ ```
1232
+
1233
+ **httpHeaders** is the JSON object containing key-value pairs that are sent as request headers.
1234
+
1235
+ `Note:` "X-Skyflow-Authorization" key is added in headers by SDK internally. If user specifies it again, it overrides.
1236
+
1237
+ **requestXML** accepts the entire XML request as a string.
1238
+
1239
+ The values in the **requestXML** can contain collect element IDs or reveal element IDs or actual values. When the IDs are provided in place of values, they get replaced with the value entered in the collect elements or value present in the reveal elements.
1240
+
1241
+ **responseXML** accepts the entire XML request as a string. It specifies where to render the response in the UI. The values in the responseXML can contain collect element IDs or reveal element IDs. The actual values corresponding to these IDs will be stripped out from the actual response, which is then forwarded from the SDK to the client application.
1242
+
1243
+ `Note:` If the user needs to use Skyflow Elements in place of values in the requestXML or responseXML, they will pass in an additional tag **Skyflow** containing the ID of the particular element.
1244
+
1245
+ Please ensure that the paths configured in the responseXML are present in the actual response. In case of a misconfigured path, the response from the server will be discarded and an error will be thrown.
1246
+
1247
+ ```javascript
1248
+
1249
+ // step 1
1250
+ const skyflowClient = skyflow.init({
1251
+ vaultID: '<vault_ID>', // optional, required only when a revealElement has formatRegex option set
1252
+ vaultURL: '<vault_URL>', // optional, required only when a revealElement has formatRegex option set
1253
+ getBearerToken: '<helperFunc>'
1254
+ });
1255
+
1256
+ // step 2
1257
+ const revealContainer = skyflowClient.container(Skyflow.ContainerType.REVEAL)
1258
+ const collectContainer = skyflowClient.container(Skyflow.ContainerType.COLLECT)
1259
+
1260
+
1261
+ // step 3
1262
+ const cardNumberElement = collectContainer.create({
1263
+ type: skyflow.ElementType.CARD_NUMBER
1264
+ })
1265
+ cardNumberElement.mount("#cardNumber")
1266
+
1267
+ const expiryMonthElement = revealContainer.create({
1268
+ token: "<expiry_month_token>"
1269
+ })
1270
+ expiryMonthElement.mount("#expirationMonth")
1271
+
1272
+ const expiryYearElement = revealContainer.create({
1273
+ token: "<expiry_year_token>"
1274
+ }, {
1275
+ formatRegex: /^..$/ // only last 2 characters are sent for invoking connection
1276
+ })
1277
+ expiryYearElement.mount("#expirationYear")
1278
+
1279
+
1280
+ const cvvElement = revealContainer.create({
1281
+ altText: "###",
1282
+ })
1283
+ cvvElement.mount("#cvv")
1284
+
1285
+ //step 4
1286
+ const cardNumberID = cardNumberElement.getID() // to get element ID
1287
+ const expiryMonthID = expiryDateElement.getID()
1288
+ const expiryYearID = expiryYearElement.getID()
1289
+ const cvvElementID = cvvElement.getID()
1290
+
1291
+ // step 5
1292
+ const requestXML = `<soapenv:Envelope>
1293
+ <soapenv:Header>
1294
+ <ClientID>1234</ClientID>
1295
+ </soapenv:Header>
1296
+ <soapenv:Body>
1297
+ <GenerateCVV>
1298
+ <CardNumber>
1299
+ <Skyflow>${cardNumberID}</Skyflow>
1300
+ </CardNumber>
1301
+ <ExpiryMonth>
1302
+ <Skyflow>${expiryMonthID}</Skyflow>
1303
+ </ExpiryMonth>
1304
+ <ExpiryYear>
1305
+ <Skyflow>${expiryYearID}</Skyflow>
1306
+ </ExpiryYear>
1307
+ </GenerateCVV>
1308
+ </soapenv:Body>
1309
+ </soapenv:Envelope>`
1310
+
1311
+
1312
+ const responseXML = `<soapenv:Envelope>
1313
+ <soapenv:Header>
1314
+ <HeaderList>
1315
+ <HeaderItem>
1316
+ <Name>NodeId</Name>
1317
+ <Value>
1318
+ <Skyflow>${revealNodeId}</Skyflow>
1319
+ </Value>
1320
+ </HeaderItem>
1321
+ <HeaderItem>
1322
+ <Name>ProgramId</Name>
1323
+ <Value>
1324
+ <Skyflow>${revealProgramId}</Skyflow>
1325
+ </Value>
1326
+ </HeaderItem>
1327
+ </HeaderList>
1328
+ <ClientID>1234</ClientID>
1329
+ </soapenv:Header>
1330
+ <soapenv:Body>
1331
+ <GenerateCVV>
1332
+ <CVV>
1333
+ <Skyflow>${cvvElementID}</Skyflow>
1334
+ </CVV>
1335
+ </GenerateCVV>
1336
+ </soapenv:Body>
1337
+ </soapenv:Envelope>`
1338
+
1339
+ const headers = {
1340
+ soapAction: '<soap_action>', // any http headers can be added here
1341
+ }
1342
+
1343
+ const connectionConfig = {
1344
+ connectionURL: '<connection_url>',
1345
+ httpHeaders: headers,
1346
+ requestXML: requestXML,
1347
+ responseXML: responseXML,
1348
+ }
1349
+
1350
+ const response = skyflowClient.invokeSoapConnection(connectionConfig);
1351
+
1352
+ ```
1353
+
1354
+ Sample Response on success:
1355
+
1356
+ ```xml
1357
+ <soapenv:Envelope>
1358
+ <soapenv:Header>
1359
+ <HeaderList>
1360
+ <HeaderItem>
1361
+ <Name>NodeId</Name>
1362
+ </HeaderItem>
1363
+ <HeaderItem>
1364
+ <Name>ProgramId</Name>
1365
+ </HeaderItem>
1366
+ </HeaderList>
1367
+ </soapenv:Header>
1368
+ <soapenv:Body>
1369
+ <GenerateCVV>
1370
+ <ReceivedTimestamp>2019-05-29 21:49:56.625</ReceivedTimestamp>
1371
+ </GenerateCVV>
1372
+ </soapenv:Body>
1373
+ </soapenv:Envelope>
1374
+ ```
1375
+
1376
+ Sample Response on failure:
1377
+
1378
+ ```javascript
1379
+ {
1380
+ code: '<error_code>',
1381
+ description: '<error_description>',
1382
+ xml: '<xml_received_from_server>'
1383
+ }
1384
+ ```
1385
+
1386
+ `Note`:
1387
+ - In responseXML we provide the tags that needs to be rendered in UI and stripped out from the actual response.
1388
+ 1. For uniquely identifiable tag, we can give the elementID within a skyflow tag directly corresponding to the actual value.
1389
+ Please refer to the CVV tag in the above example. Here, we wish to strip the actual value present within the CVV tag.
1390
+ 2. For arrays, since we have multiple tags with the same name, we will need to provide identifiers to uniquely identify the required tag.
1391
+ Please refer to HeaderItem tag. Here, we have provided NodeId within the Name tag which acts as an identifier and we wish to strip the actual value present in the Value tag.
1392
+ - In requestXML, if revealElement has a formatRegex option, it will first reveal the token and then apply the formatRegex match, and then sent it to invokeConnections/invokeSoapConnections
1393
+ - In responseXML, if revealElement has a formatRegex option, then value is revealed in the UI according to the match found with respect to the given formatRegex