obtasks/archive/bridge_619/tests.dev.md

421 lines
11 KiB
Markdown
Raw Normal View History

2019-04-29 13:49:56 +00:00
# Acceptance Criteria #
The following acceptance criteria tests were performed on DEV.
### 1. User generates receivecode ###
Create a new worldpay merchant account using `/payment-instruments/worldpay-merchants`
Testing data:
```json
{
"key": "66bbbe00-bd6c-4b34-8269-d19a041045a8",
"ID": "5abcecc0de91bd75beb21a0e"
}
```
Using : `/receivecodes`
```json
{
"key": "66bbbe00-bd6c-4b34-8269-d19a041045a8",
"ID": "5abcecc0de91bd75beb21a0e"
}}
```
Response:
```json
{
"receivecode": "SCYDG"
}
```
Database Contains:
```json
{
"_id" : ObjectId("5abcecf5de91bd75beb21a11"),
"ReceiveCode" : "SCYDG",
"Creation" : ISODate("2018-03-29T13:41:09.080Z"),
"Expiry" : ISODate("2018-03-29T13:44:09.080Z"),
"PaymentInstrument" : {
"_id" : ObjectId("5abcecc0de91bd75beb21a0e"),
"AccountType" : "Worldpay Online Payments Account",
"ReceivingAccount" : 1,
"PaymentsAccount" : 0,
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::0a6915f1f98ee7d3b6aa06608c1d6d960e06002be6de2bf067f5337db301ceb52b534a23b233d2d464c8977026f2d9f034a807540076fb42d44f66425eaf390649f9786ca604dda45c93cb65cd6b839f8cbb6c41f43a6a6b566815ebe1d5d410",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
},
"UserID" : "79a26d981246978135edadf1",
"VendorID" : "Worldpay",
"VendorAccountName" : "Worldpay Online Payments",
"Description" : "Utah Iron Inc. account.",
"IconLocation" : "worldpay-account.png",
"APIVersion" : "7.6.4-44af11fdc504cff51f7e5fdaff97a7cf1a6b09a4",
"Integrity" : null,
"LastUpdate" : ISODate("2018-03-29T13:40:16.505Z"),
"LastVersion" : 1
},
"Status" : "Pending"
}
```
_Receivecode object contains the receivecode string_
```json
"ReceiveCode" : "SCYDG"
```
_Receivecode object contains re-encrypted payment instrument details_
```json
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::0a6915f1f98ee7d3b6aa06608c1d6d960e06002be6de2bf067f5337db301ceb52b534a23b233d2d464c8977026f2d9f034a807540076fb42d44f66425eaf390649f9786ca604dda45c93cb65cd6b839f8cbb6c41f43a6a6b566815ebe1d5d410",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
}
```
_Receivecode object contains an expiry timestamp_
```json
"Expiry" : ISODate("2018-03-29T13:44:09.080Z")
```
### 2. User specifies nonexistent instrument ID ###
Using : `/receivecodes`
```json
{
"key": "12345678-9012-3456-7890-123456789012",
"ID": "000000000000000000000000"
}
```
Response: `400 Error Bad Request`
```json
{
"code": 600,
"info": "The instrument could not be found, has no access or has expired."
}
```
### 3. User specifies instrument ID belonging to another user ###
Create a new instrument for user `YTM2ZGQ1NzUtOWFmNS01MjMyLTg5MjYtM2NkZjA5ZDU2ZGU2`
Create a new worldpay merchant account using `/payment-instruments/worldpay-merchants`
Testing data:
```json
{
"key": "2626d3f2-87a9-441a-9e4d-4c6e84ab50d6",
"ID": "5abceedbde91bd75beb21a1b"
}
```
Re-authorise with `YTM2ZGQ1NzUtOWFmNS01MjMyLTg5MjYtM2NkZjA5ZDU2ZGU1`
Using : `/receivecodes`
```json
{
"key": "2626d3f2-87a9-441a-9e4d-4c6e84ab50d6",
"ID": "5abceedbde91bd75beb21a1b"
}
```
Response:
`400 Error: Bad Request`
```json
{
"code": 600,
"info": "The instrument could not be found, has no access or has expired."
}
```
### 4. User provides incorrect encryption key ###
Using : `/receivecodes`
```json
{
"key": "badbadba-dbad-badb-adba-dbadbadbadba",
"ID": "5abcecc0de91bd75beb21a0e"
}
```
Response:
`401 Error: Unauthroized`
```json
{
"code": 602,
"info": "The instrument could not be decrypted."
}
```
### 5. Payment instrument cannot create receivecodes ###
Create a new worldpay merchant account using `/payment-instruments/worldpay-merchants`
Testing data:
```json
{
"key": "d995b840-6f0a-4362-b401-da3466e409b3",
"ID": "5abcf18bde91bd75beb21a5f"
}
```
Modify record to remove the ability to create receive codes.
```json
{
"_id" : ObjectId("5abcf18bde91bd75beb21a5f"),
"AccountType" : "Worldpay Online Payments Account",
"ReceivingAccount" : 0,
"PaymentsAccount" : 0,
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::a8c615cda59f2c75653bd4f26953ca0aae5bd2b095f5e211899b146c7824bb18990f4c6309694a33360b92bf79f03d374350dba679b36e8c1a65ace8c817bd097e7d2d5ccbf0cb9f5d17347e7e1e49ef062074a375de6dc74b6237bb827dce45",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
},
"UserID" : "79a26d981246978135edadf1",
"VendorID" : "Worldpay",
"VendorAccountName" : "Worldpay Online Payments",
"Description" : "Islington Copper Inc. account.",
"IconLocation" : "worldpay-account.png",
"APIVersion" : "7.6.4-44af11fdc504cff51f7e5fdaff97a7cf1a6b09a4",
"Integrity" : null,
"LastUpdate" : ISODate("2018-03-29T14:00:43.099Z"),
"LastVersion" : 1
}
```
Response:
`400 Error: Bad Request`
```json
{
"key": "de851ec5-6b36-453a-870c-14bb63e16ede",
"ID": "5aba46ecb28f2c8e1700c9c8"
}
```
### 6. Receivecode should be deleted when it expires ###
Using the code created in AC 1:
Using : `/receivecodes`
```json
{
"key": "66bbbe00-bd6c-4b34-8269-d19a041045a8",
"ID": "5abcecc0de91bd75beb21a0e"
}}
```
Response:
```json
{
"receivecode": "SCYDG"
}
```
Database Contains:
```json
{
"_id" : ObjectId("5abcecf5de91bd75beb21a11"),
"ReceiveCode" : "SCYDG",
"Creation" : ISODate("2018-03-29T13:41:09.080Z"),
"Expiry" : ISODate("2018-03-29T13:44:09.080Z"),
"PaymentInstrument" : {
"_id" : ObjectId("5abcecc0de91bd75beb21a0e"),
"AccountType" : "Worldpay Online Payments Account",
"ReceivingAccount" : 1,
"PaymentsAccount" : 0,
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::0a6915f1f98ee7d3b6aa06608c1d6d960e06002be6de2bf067f5337db301ceb52b534a23b233d2d464c8977026f2d9f034a807540076fb42d44f66425eaf390649f9786ca604dda45c93cb65cd6b839f8cbb6c41f43a6a6b566815ebe1d5d410",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
},
"UserID" : "79a26d981246978135edadf1",
"VendorID" : "Worldpay",
"VendorAccountName" : "Worldpay Online Payments",
"Description" : "Utah Iron Inc. account.",
"IconLocation" : "worldpay-account.png",
"APIVersion" : "7.6.4-44af11fdc504cff51f7e5fdaff97a7cf1a6b09a4",
"Integrity" : null,
"LastUpdate" : ISODate("2018-03-29T13:40:16.505Z"),
"LastVersion" : 1
},
"Status" : "Pending"
}
```
Database was checked again at 2018-03-29T13:45.
`db.getCollection('ReceiveCode').find({"_id" : ObjectId("5abcecf5de91bd75beb21a11")})`
`Fetched 0 record(s) in 21ms`
### 7. Request should be logged ###
Log for AC 1:
```json
{
"_id" : ObjectId("5abcecf5de91bd75beb21a12"),
"timestamp" : ISODate("2018-03-29T13:41:09.084Z"),
"level" : "info",
"message" : "Successfully created a receivecode",
"meta" : {
"logId" : "payments:receivecodes",
"ip" : "62.232.80.210",
"reqId" : "f0c1e13c-3a09-40c1-8e8a-007f52ebf846",
"userId" : "79a26d981246978135edadf1",
"file" : "/home/flexops/node_server/dev_api/controllers/receivecode_controller.js",
"_receivecode" : "SCYDG",
"_instrumentID" : "5abcecc0de91bd75beb21a0e"
},
"hostname" : "node01-cl01-cc"
}
```
Log for AC 2:
```json
{
"_id" : ObjectId("5abcee6ade91bd75beb21a19"),
"timestamp" : ISODate("2018-03-29T13:47:22.098Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:receivecodes",
"ip" : "62.232.80.210",
"reqId" : "10e1dcee-2330-456b-93e7-41b00f0c2a39",
"userId" : "79a26d981246978135edadf1",
"file" : "/home/flexops/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "000000000000000000000000",
"_internalError" : "Error: BRIDGE: INVALID INSTRUMENT",
"_httpCode" : 400,
"_info" : "The instrument could not be found, has no access or has expired.",
"_code" : 600
},
"hostname" : "node01-cl01-cc"
}
```
Log for AC 3:
```json
{
"_id" : ObjectId("5abcefd4de91bd75beb21a1e"),
"timestamp" : ISODate("2018-03-29T13:53:24.686Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:receivecodes",
"ip" : "62.232.80.210",
"reqId" : "9bf49711-2f43-44db-a990-d695a31f0733",
"userId" : "79a26d981246978135edadf1",
"file" : "/home/flexops/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "5abceedbde91bd75beb21a1b",
"_internalError" : "Error: BRIDGE: INVALID INSTRUMENT",
"_httpCode" : 400,
"_info" : "The instrument could not be found, has no access or has expired.",
"_code" : 600
},
"hostname" : "node01-cl01-cc"
}
```
Log for AC 4:
```json
{
"_id" : ObjectId("5abcf00ede91bd75beb21a25"),
"timestamp" : ISODate("2018-03-29T13:54:22.750Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:receivecodes",
"ip" : "62.232.80.210",
"reqId" : "f4f87109-1a40-440f-88ce-22d33121bd52",
"userId" : "79a26d981246978135edadf1",
"file" : "/home/flexops/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "5abcecc0de91bd75beb21a0e",
"_internalError" : "Error: BRIDGE: INSTRUMENT DECRYPTION FAILURE",
"_httpCode" : 401,
"_info" : "The instrument could not be decrypted.",
"_code" : 602
},
"hostname" : "node01-cl01-cc"
}
```
Log for AC 5:
```json
{
"_id" : ObjectId("5abcf4524e484a771f906de3"),
"timestamp" : ISODate("2018-03-29T14:12:34.702Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:receivecodes",
"ip" : "62.232.80.210",
"reqId" : "e72cca16-e9ee-4ab1-9b74-97a18d9991c2",
"userId" : "79a26d981246978135edadf1",
"file" : "/home/flexops/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "5abcf18bde91bd75beb21a5f",
"_internalError" : "Error: BRIDGE: INVALID INSTRUMENT",
"_httpCode" : 400,
"_info" : "The instrument could not be found, has no access or has expired.",
"_code" : 600
},
"hostname" : "node01-cl01-cc"
}
```
Log for AC 6:
```json
{
"_id" : ObjectId("5abcecf5de91bd75beb21a12"),
"timestamp" : ISODate("2018-03-29T13:41:09.084Z"),
"level" : "info",
"message" : "Successfully created a receivecode",
"meta" : {
"logId" : "payments:receivecodes",
"ip" : "62.232.80.210",
"reqId" : "f0c1e13c-3a09-40c1-8e8a-007f52ebf846",
"userId" : "79a26d981246978135edadf1",
"file" : "/home/flexops/node_server/dev_api/controllers/receivecode_controller.js",
"_receivecode" : "SCYDG",
"_instrumentID" : "5abcecc0de91bd75beb21a0e"
},
"hostname" : "node01-cl01-cc"
}
```