11 KiB
Acceptance Criteria
1. User generates receivecode
Create a new worldpay merchant account using /payment-instruments/worldpay-merchants
Testing data:
{
"key": "4f84d8e7-b800-444d-b2ad-2633d5561bc0",
"ID": "5aba3afdb28f2c8e1700c9b6"
}
Using : /receivecodes
{
"key": "4f84d8e7-b800-444d-b2ad-2633d5561bc0",
"ID": "5aba3afdb28f2c8e1700c9b6"
}
Response:
{
"receivecode": "WGB5U"
}
Database Contains:
{
"_id" : ObjectId("5aba3b2db28f2c8e1700c9b9"),
"ReceiveCode" : "WGB5U",
"Creation" : ISODate("2018-03-27T12:38:05.776Z"),
"Expiry" : ISODate("2018-03-27T12:41:05.776Z"),
"PaymentInstrument" : {
"_id" : ObjectId("5aba3afdb28f2c8e1700c9b6"),
"AccountType" : "Worldpay Online Payments Account",
"ReceivingAccount" : 1,
"PaymentsAccount" : 0,
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::3820fe3fa496b06d66f8c3c1e11fa7f590be6b3caf8ce31e9460b0eafade924d3da17699552fdfea26e48c8b904e52da146f4478a622b5aed3241182e27aa73eb91c94412e0c619506f57358f989b79369a4dd51c7ab8dea3a5ae961e758c22e",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
},
"UserID" : "79a26d981246978135edadf1",
"VendorID" : "Worldpay",
"VendorAccountName" : "Worldpay Online Payments",
"Description" : "Erskine Argon Inc. account.",
"IconLocation" : "worldpay-account.png",
"APIVersion" : "7.6.4-dev",
"Integrity" : null,
"LastUpdate" : ISODate("2018-03-27T12:37:17.423Z"),
"LastVersion" : 1
},
"Status" : "Pending"
}
Receivecode object contains the receivecode string
"ReceiveCode" : "WGB5U"
Receivecode object contains re-encrypted payment instrument details
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::3820fe3fa496b06d66f8c3c1e11fa7f590be6b3caf8ce31e9460b0eafade924d3da17699552fdfea26e48c8b904e52da146f4478a622b5aed3241182e27aa73eb91c94412e0c619506f57358f989b79369a4dd51c7ab8dea3a5ae961e758c22e",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
}
Receivecode object contains an expiry timestamp
"Expiry" : ISODate("2018-03-27T12:41:05.776Z")
2. User specifies nonexistent instrument ID
Using : /receivecodes
{
"key": "12345678-9012-3456-7890-123456789012",
"ID": "000000000000000000000000"
}
Response:
{
"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:
{
"key": "f3c94230-2e2d-4b7a-8f27-7c05ca51ab1a",
"ID": "5aba42b5b28f2c8e1700c9c0"
}
Re-authorise with YTM2ZGQ1NzUtOWFmNS01MjMyLTg5MjYtM2NkZjA5ZDU2ZGU1
Using : /receivecodes
{
"key": "f3c94230-2e2d-4b7a-8f27-7c05ca51ab1a",
"ID": "5aba42b5b28f2c8e1700c9c0"
}
Response:
400 Error: Bad Request
{
"code": 600,
"info": "The instrument could not be found, has no access or has expired."
}
4. User provides incorrect encryption key
Using : /receivecodes
{
"key": "badbadba-dbad-badb-adba-badbadbadbad",
"ID": "5aba3afdb28f2c8e1700c9b6"
}
Response:
401 Error: Unauthroized
{
"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:
{
"key": "de851ec5-6b36-453a-870c-14bb63e16ede",
"ID": "5aba46ecb28f2c8e1700c9c8"
}
Modify record to remove the ability to create receive codes.
{
"_id" : ObjectId("5aba46ecb28f2c8e1700c9c8"),
"AccountType" : "Worldpay Online Payments Account",
"ReceivingAccount" : 0,
"PaymentsAccount" : 0,
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::e6c0dea6b0dff24f0c3502830aaafbf04d3530e36b18180186bde15b2e0984b2c4ef841a6f05e4f3d8ba4fd73d50b2296e881ed1a60eadddff1d955a4d07ac61798ad8d04b307b9b4b8df8a23ba6aacdc4ed8068f5fcaaeb985d1642b16e8339",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
},
"UserID" : "79a26d981246978135edadf1",
"VendorID" : "Worldpay",
"VendorAccountName" : "Worldpay Online Payments",
"Description" : "Falkirk Tin Inc. account.",
"IconLocation" : "worldpay-account.png",
"APIVersion" : "7.6.4-dev",
"Integrity" : null,
"LastUpdate" : ISODate("2018-03-27T13:28:12.544Z"),
"LastVersion" : 1
}
Response:
400 Error: Bad Request
{
"key": "de851ec5-6b36-453a-870c-14bb63e16ede",
"ID": "5aba46ecb28f2c8e1700c9c8"
}
6. Receivecode should be deleted when it expires
Using : /receivecodes
{
"key": "4f84d8e7-b800-444d-b2ad-2633d5561bc0",
"ID": "5aba3afdb28f2c8e1700c9b6"
}
Response: 201
{
"receivecode": "9S4CJ"
}
Database record:
{
"_id" : ObjectId("5aba5a31febf9e953ffadcab"),
"ReceiveCode" : "9S4CJ",
"Creation" : ISODate("2018-03-27T14:50:25.997Z"),
"Expiry" : ISODate("2018-03-27T14:53:25.997Z"),
"PaymentInstrument" : {
"_id" : ObjectId("5aba3afdb28f2c8e1700c9b6"),
"AccountType" : "Worldpay Online Payments Account",
"ReceivingAccount" : 1,
"PaymentsAccount" : 0,
"WorldpayOnlinePaymentsInfo" : {
"ServiceKeyEncrypted" : "3::75bcbcb07040bc95c2409800f67384e1e186e87fceb90c4a6291189635d2a11bb52ce93d0e83a9bd82d3e130c9f25f60f64529f9b4ae9e6feac6c9d4ca2e131d5efc4793fdaf97d8b89909b05a8bd39c940899b71e816a0242149e360ad551a0",
"ServiceKey" : "T_S_********-****-****-****-********4bfb"
},
"UserID" : "79a26d981246978135edadf1",
"VendorID" : "Worldpay",
"VendorAccountName" : "Worldpay Online Payments",
"Description" : "Erskine Argon Inc. account.",
"IconLocation" : "worldpay-account.png",
"APIVersion" : "7.6.4-dev",
"Integrity" : null,
"LastUpdate" : ISODate("2018-03-27T12:37:17.423Z"),
"LastVersion" : 1
},
"Status" : "Pending"
}
Database was checked again at 2018-03-27 14:54.
db.getCollection('ReceiveCode').find({"_id" : ObjectId("5aba5a31febf9e953ffadcab")})
Fetched 0 record(s) in 1ms
7. Request should be logged
Log for AC 1:
{
"_id" : ObjectId("5aba3b2db28f2c8e1700c9ba"),
"timestamp" : ISODate("2018-03-27T12:38:05.791Z"),
"level" : "info",
"message" : "Successfully created a receivecode",
"meta" : {
"logId" : "payments:paycodes",
"ip" : "127.0.0.1",
"reqId" : "56c96602-9d3d-49ad-8495-3a7527e85be5",
"userId" : "79a26d981246978135edadf1",
"file" : "/Users/martin/dev/bridge-node-server/node_server/dev_api/controllers/receivecode_controller.js",
"_receivecode" : "WGB5U",
"_instrumentID" : "5aba3afdb28f2c8e1700c9b6"
},
"hostname" : "Admins-MacBook-Pro.local"
}
Log for AC 2:
{
"_id" : ObjectId("5aba3f05b28f2c8e1700c9bd"),
"timestamp" : ISODate("2018-03-27T12:54:29.830Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:paycodes",
"ip" : "127.0.0.1",
"reqId" : "6eaea836-c247-41e1-940a-a84dc192d5ce",
"userId" : "79a26d981246978135edadf1",
"file" : "/Users/martin/dev/bridge-node-server/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" : "Admins-MacBook-Pro.local"
}
Log for AC 3:
{
"_id" : ObjectId("5aba42fab28f2c8e1700c9c3"),
"timestamp" : ISODate("2018-03-27T13:11:22.983Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:paycodes",
"ip" : "127.0.0.1",
"reqId" : "ad27c4a1-6324-459d-b457-380ed0d3140d",
"userId" : "79a26d981246978135edadf1",
"file" : "/Users/martin/dev/bridge-node-server/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "5aba42b5b28f2c8e1700c9c0",
"_internalError" : "Error: BRIDGE: INVALID INSTRUMENT",
"_httpCode" : 400,
"_info" : "The instrument could not be found, has no access or has expired.",
"_code" : 600
},
"hostname" : "Admins-MacBook-Pro.local"
}
Log for AC 4:
{
"_id" : ObjectId("5aba4634b28f2c8e1700c9c6"),
"timestamp" : ISODate("2018-03-27T13:25:08.701Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:paycodes",
"ip" : "127.0.0.1",
"reqId" : "14dcc4b2-80dc-41da-a680-f648099205e6",
"userId" : "79a26d981246978135edadf1",
"file" : "/Users/martin/dev/bridge-node-server/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "5aba3afdb28f2c8e1700c9b6",
"_internalError" : "Error: BRIDGE: INSTRUMENT DECRYPTION FAILURE",
"_httpCode" : 401,
"_info" : "The instrument could not be decrypted.",
"_code" : 602
},
"hostname" : "Admins-MacBook-Pro.local"
}
Log for AC 5:
{
"_id" : ObjectId("5aba55a4febf9e953ffadca8"),
"timestamp" : ISODate("2018-03-27T14:31:00.918Z"),
"level" : "error",
"message" : "Failed to create a receivecode",
"meta" : {
"logId" : "payments:paycodes",
"ip" : "127.0.0.1",
"reqId" : "d01bf003-10d4-4cfa-8f31-c4bdb447445d",
"userId" : "79a26d981246978135edadf1",
"file" : "/Users/martin/dev/bridge-node-server/node_server/dev_api/controllers/receivecode_controller.js",
"_instrumentID" : "5aba46ecb28f2c8e1700c9c8",
"_internalError" : "Error: BRIDGE: INVALID INSTRUMENT",
"_httpCode" : 400,
"_info" : "The instrument could not be found, has no access or has expired.",
"_code" : 600
},
"hostname" : "Admins-MacBook-Pro.local"
}
Log for AC 6:
{
"_id" : ObjectId("5aba5a32febf9e953ffadcac"),
"timestamp" : ISODate("2018-03-27T14:50:26.008Z"),
"level" : "info",
"message" : "Successfully created a receivecode",
"meta" : {
"logId" : "payments:paycodes",
"ip" : "127.0.0.1",
"reqId" : "ea671287-89cf-4be0-9229-0144e743dd96",
"userId" : "79a26d981246978135edadf1",
"file" : "/Users/martin/dev/bridge-node-server/node_server/dev_api/controllers/receivecode_controller.js",
"_receivecode" : "9S4CJ",
"_instrumentID" : "5aba3afdb28f2c8e1700c9b6"
},
"hostname" : "Admins-MacBook-Pro.local"
}