skyflow-js 1.8.0 → 1.9.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.
- package/CHANGELOG.md +6 -0
- package/README.md +161 -2
- package/dist/sdkNodeBuild/index.js +1 -1
- package/dist/sdkNodeBuild/index.js.LICENSE.txt +27 -0
- package/dist/sdkNodeBuild/index.js.LICENSE.txt.gz +0 -0
- package/dist/sdkNodeBuild/index.js.gz +0 -0
- package/package.json +5 -2
- package/types/Skyflow.d.ts +6 -5
- package/types/{container → core}/constants.d.ts +11 -1
- package/types/{container/external/PureJsController.d.ts → core/external/SkyflowContainer.d.ts} +4 -3
- package/types/{container/external → core/external/collect}/CollectContainer.d.ts +7 -6
- package/types/{container/external/element/index.d.ts → core/external/collect/CollectElement.d.ts} +5 -3
- package/types/core/external/common/Container.d.ts +3 -0
- package/types/{container/external/element → core/external/common}/IFrame.d.ts +0 -0
- package/types/core/external/common/SkyflowElement.d.ts +9 -0
- package/types/{container/external → core/external/reveal}/RevealContainer.d.ts +5 -4
- package/types/{container → core}/external/reveal/RevealElement.d.ts +5 -3
- package/types/{container → core}/internal/FrameElements.d.ts +0 -0
- package/types/core/internal/SkyflowFrame/SkyflowFrameController.d.ts +10 -0
- package/types/{container → core}/internal/iFrameForm/index.d.ts +0 -0
- package/types/{container → core}/internal/index.d.ts +0 -0
- package/types/{container → core}/internal/reveal/RevealFrame.d.ts +0 -0
- package/types/{container → core}/internal/reveal/RevealFrameController.d.ts +0 -0
- package/types/{core → core-utils}/collect.d.ts +0 -0
- package/types/{core → core-utils}/reveal.d.ts +0 -0
- package/types/libs/element-options.d.ts +1 -1
- package/types/libs/objectParse.d.ts +3 -0
- package/types/utils/common/index.d.ts +6 -0
- package/types/utils/constants.d.ts +76 -0
- package/types/utils/helpers/index.d.ts +4 -0
- package/types/utils/logs.d.ts +23 -0
- package/types/utils/validators/index.d.ts +6 -4
- package/types/container/internal/pureJs/PureJsFrameController.d.ts +0 -9
package/CHANGELOG.md
CHANGED
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
|
|
|
@@ -1097,7 +1098,7 @@ const response = skyflowClient.invokeConnection(connectionConfig);
|
|
|
1097
1098
|
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
|
|
1098
1099
|
|
|
1099
1100
|
**responseBody**:
|
|
1100
|
-
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.
|
|
1101
|
+
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.
|
|
1101
1102
|
|
|
1102
1103
|
Sample use-cases on using invokeConnection():
|
|
1103
1104
|
|
|
@@ -1206,4 +1207,162 @@ Sample Response:
|
|
|
1206
1207
|
|
|
1207
1208
|
`Note`:
|
|
1208
1209
|
- `token` is optional for creating reveal element, if it is used for invokeConnection
|
|
1209
|
-
- responseBody contains collect or reveal elements to render the response from the Connection on UI
|
|
1210
|
+
- responseBody contains collect or reveal elements to render the response from the Connection on UI
|
|
1211
|
+
|
|
1212
|
+
# Securely invoking Connections client-side using SOAP
|
|
1213
|
+
|
|
1214
|
+
To invoke Connections using SOAP, use the `invokeSoapConnection(connectionConfig)` method of the Skyflow client as shown below:
|
|
1215
|
+
|
|
1216
|
+
```javascript
|
|
1217
|
+
const connectionConfig = {
|
|
1218
|
+
connectionURL: string, // connection url received when creating a Skyflow Connection
|
|
1219
|
+
httpHeaders: any, // optional
|
|
1220
|
+
requestXML: string,
|
|
1221
|
+
responseXML: string, // optional
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
const response = skyflowClient.invokeSoapConnection(connectionConfig);
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
**httpHeaders** is the JSON object containing key-value pairs that are sent as request headers.
|
|
1228
|
+
|
|
1229
|
+
**requestXML** accepts the entire XML request as a string.
|
|
1230
|
+
|
|
1231
|
+
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.
|
|
1232
|
+
|
|
1233
|
+
**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.
|
|
1234
|
+
|
|
1235
|
+
`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.
|
|
1236
|
+
|
|
1237
|
+
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.
|
|
1238
|
+
|
|
1239
|
+
```javascript
|
|
1240
|
+
|
|
1241
|
+
// step 1
|
|
1242
|
+
const skyflowClient = skyflow.init({
|
|
1243
|
+
getBearerToken: '<helperFunc>'
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
// step 2
|
|
1247
|
+
const revealContainer = skyflowClient.container(Skyflow.ContainerType.REVEAL)
|
|
1248
|
+
const collectContainer = skyflowClient.container(Skyflow.ContainerType.COLLECT)
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
// step 3
|
|
1252
|
+
const cardNumberElement = collectContainer.create({
|
|
1253
|
+
type: skyflow.ElementType.CARD_NUMBER
|
|
1254
|
+
})
|
|
1255
|
+
cardNumberElement.mount("#cardNumber")
|
|
1256
|
+
|
|
1257
|
+
const expiryDateElement = collectContainer.create({
|
|
1258
|
+
type: skyflow.ElementType.EXPIRATION_DATE
|
|
1259
|
+
})
|
|
1260
|
+
expiryDateElement.mount("#expirationDate")
|
|
1261
|
+
|
|
1262
|
+
const cvvElement = revealContainer.create({
|
|
1263
|
+
altText: "###",
|
|
1264
|
+
})
|
|
1265
|
+
cvvElement.mount("#cvv")
|
|
1266
|
+
|
|
1267
|
+
//step 4
|
|
1268
|
+
const cardNumberID = cardNumberElement.getID() // to get element ID
|
|
1269
|
+
const expiryDateID = expiryDateElement.getID()
|
|
1270
|
+
const cvvElementID = cvvElement.getID()
|
|
1271
|
+
|
|
1272
|
+
// step 5
|
|
1273
|
+
const requestXML = `<soapenv:Envelope>
|
|
1274
|
+
<soapenv:Header>
|
|
1275
|
+
<ClientID>1234</ClientID>
|
|
1276
|
+
</soapenv:Header>
|
|
1277
|
+
<soapenv:Body>
|
|
1278
|
+
<GenerateCVV>
|
|
1279
|
+
<CardNumber>
|
|
1280
|
+
<Skyflow>${cardNumberID}</Skyflow>
|
|
1281
|
+
</CardNumber>
|
|
1282
|
+
<ExpiryDate>
|
|
1283
|
+
<Skyflow>${expiryDateID}</Skyflow>
|
|
1284
|
+
</ExpiryDate>
|
|
1285
|
+
</GenerateCVV>
|
|
1286
|
+
</soapenv:Body>
|
|
1287
|
+
</soapenv:Envelope>`
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
const responseXML = `<soapenv:Envelope>
|
|
1291
|
+
<soapenv:Header>
|
|
1292
|
+
<HeaderList>
|
|
1293
|
+
<HeaderItem>
|
|
1294
|
+
<Name>NodeId</Name>
|
|
1295
|
+
<Value>
|
|
1296
|
+
<Skyflow>${revealNodeId}</Skyflow>
|
|
1297
|
+
</Value>
|
|
1298
|
+
</HeaderItem>
|
|
1299
|
+
<HeaderItem>
|
|
1300
|
+
<Name>ProgramId</Name>
|
|
1301
|
+
<Value>
|
|
1302
|
+
<Skyflow>${revealProgramId}</Skyflow>
|
|
1303
|
+
</Value>
|
|
1304
|
+
</HeaderItem>
|
|
1305
|
+
</HeaderList>
|
|
1306
|
+
<ClientID>1234</ClientID>
|
|
1307
|
+
</soapenv:Header>
|
|
1308
|
+
<soapenv:Body>
|
|
1309
|
+
<GenerateCVV>
|
|
1310
|
+
<CVV>
|
|
1311
|
+
<Skyflow>${cvvElementID}</Skyflow>
|
|
1312
|
+
</CVV>
|
|
1313
|
+
</GenerateCVV>
|
|
1314
|
+
</soapenv:Body>
|
|
1315
|
+
</soapenv:Envelope>`
|
|
1316
|
+
|
|
1317
|
+
const headers = {
|
|
1318
|
+
soapAction: '<soap_action>', // any http headers can be added here
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
const connectionConfig = {
|
|
1322
|
+
connectionURL: '<connection_url>',
|
|
1323
|
+
httpHeaders: headers,
|
|
1324
|
+
requestXML: requestXML,
|
|
1325
|
+
responseXML: responseXML,
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
const response = skyflowClient.invokeSoapConnection(connectionConfig);
|
|
1329
|
+
|
|
1330
|
+
```
|
|
1331
|
+
|
|
1332
|
+
Sample Response on success:
|
|
1333
|
+
|
|
1334
|
+
```xml
|
|
1335
|
+
<soapenv:Envelope>
|
|
1336
|
+
<soapenv:Header>
|
|
1337
|
+
<HeaderList>
|
|
1338
|
+
<HeaderItem>
|
|
1339
|
+
<Name>NodeId</Name>
|
|
1340
|
+
</HeaderItem>
|
|
1341
|
+
<HeaderItem>
|
|
1342
|
+
<Name>ProgramId</Name>
|
|
1343
|
+
</HeaderItem>
|
|
1344
|
+
</HeaderList>
|
|
1345
|
+
</soapenv:Header>
|
|
1346
|
+
<soapenv:Body>
|
|
1347
|
+
<GenerateCVV>
|
|
1348
|
+
<ReceivedTimestamp>2019-05-29 21:49:56.625</ReceivedTimestamp>
|
|
1349
|
+
</GenerateCVV>
|
|
1350
|
+
</soapenv:Body>
|
|
1351
|
+
</soapenv:Envelope>
|
|
1352
|
+
```
|
|
1353
|
+
|
|
1354
|
+
Sample Response on failure:
|
|
1355
|
+
|
|
1356
|
+
```javascript
|
|
1357
|
+
{
|
|
1358
|
+
code: '<error_code>',
|
|
1359
|
+
description: '<error_description>',
|
|
1360
|
+
xml: '<xml_received_from_server>'
|
|
1361
|
+
}
|
|
1362
|
+
```
|
|
1363
|
+
|
|
1364
|
+
`Note`: In responseXML we provide the tags that needs to be rendered in UI and stripped out from the actual response.
|
|
1365
|
+
1. For uniquely identifiable tag, we can give the elementID within a skyflow tag directly corresponding to the actual value.
|
|
1366
|
+
Please refer to the CVV tag in the above example. Here, we wish to strip the actual value present within the CVV tag.
|
|
1367
|
+
2. For arrays, since we have multiple tags with the same name, we will need to provide identifiers to uniquely identify the required tag.
|
|
1368
|
+
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.
|