bridge-1001

This commit is contained in:
martin 2018-05-04 11:22:47 +01:00
parent 34801ac2ce
commit 406028d336
7 changed files with 11344 additions and 1 deletions

View File

@ -0,0 +1,41 @@
{
"data": [
{
"atpID": "5ae0593212b84e5d871e941e",
"rtpID": "5ae0593212b84e5d871e941b",
"payerID": "dc870f553840a414962875b3",
"amount": {
"value": 101,
"currency": "GBP"
},
"lastUpdate": "2018-04-25T10:32:19.049Z",
"status": "Paid",
"payerDetails": {
"payer": {
"email": "servertest1@comcarde.com",
"firstName": "Server",
"lastName": "Test"
},
"card": {
"cardPAN": "4*** **** **** *111",
"nameOnAccount": "Server Test"
}
},
"payeeID": "79a26d981246978135edadf1",
"payeeInstrument": {
"ID": "5ae0593112b84e5d871e9418",
"accountType": "Worldpay Online Payments Account",
"description": "List ATPs for RTP test"
},
"transactionDetails": {
"orderDescription": "create RTP for the user 79a26d981246978135edadf1 for List receivable Test"
},
"resultDetails": {
"processorResponse": {
"transactionID": "ea595e1d-869a-4d98-83b2-080d21a87087"
}
},
"lastVersion": 4
}
]
}

View File

@ -0,0 +1,53 @@
So I've been looking into this and I updated get-all-atps-for-rtp.spec.js with a new response test.
I pushed the following 'bad' data through as the response:
```
{
data: [
{
atpID: '5aeadbff0139b01a9ac983ea',
rtpID: '5aeadbff0139b01a9ac983e7',
payerID: '79a26d981246978135edadf1',
amount: {
value: 101,
currency: 'GBP'
},
lastUpdate: '2018-05-03T09:53:03.746Z',
status: 'Failed',
payerDetails: {
payer: {
email: 'servertest1@comcarde.com',
firstName: 'Server',
lastName: 'Test'
},
card: {
cardPAN: '4*** **** **** *111',
nameOnAccount: 'Server Test'
}
},
payeeID: 'dc870f553840a414962875b3',
payeeInstrument: {
accountType: 'Worldpay Online Payments Account'
},
transactionDetails: {
orderDescription: 'create RTP for the user 79a26d981246978135edadf1 for List Test'
},
resultDetails: {
errorDetails: {
statusCode: 400,
code: 538,
info: 'Error processing payment',
processorResponse: {
customCode: 'BAD_REQUEST',
message: 'Expiry date [1/2000] is in past'
}
}
},
lastVersion: 4
}
]
}
```
Swagger was happy to accept this and didn't give me an error.

View File

@ -7,7 +7,6 @@ If there was a WorldPay error when an ATP was being created, the ResultDetails w
* Swagger definition for ErrorDetails was updated to prevent anything other than the specified details being included.
* get-all-atps-for-rtp.spec.js was updated to test that swagger prevents ResultDetails from appearing in ErrorDetails
* controllers/atps/payables/create.js updated to move ProcessorResponse out of ErrorDetails and is now a child of ResultDetails
* tests refreshed using the new test framework
# Test Plan
@ -15,3 +14,22 @@ If there was a WorldPay error when an ATP was being created, the ResultDetails w
* Run E2E: get All ATPs
Test Results
```
E2E: get All ATPs PASSED
ObjectID tests PASSED
✓ Test with a valid objectID PASSED
✓ Test objectID with an invalid pattern PASSED
✓ Test objectID is too short PASSED
✓ Test objectID is too long PASSED
Invalid path PASSED
✓ Test responds with 404 PASSED
✓ Test responds with error PASSED
Unauthorised access PASSED
✓ Test responds with error PASSED
Tests the response PASSED
Response validation for 200 Get response PASSED
✓ Test rejects a response with processorResponse in errorDetails PASSED
✓ Test rejects an empty response PASSED
9 Of 9 Passing
```

View File

@ -0,0 +1,37 @@
{
"data": [
{
"atpID": "5ae0599512b84e5d871e9498",
"rtpID": "5ae0599412b84e5d871e9493",
"payerID": "dc870f553840a414962875b3",
"amount": {
"value": 101,
"currency": "GBP"
},
"lastUpdate": "2018-04-25T10:33:57.083Z",
"status": "Failed",
"payerDetails": {
"payer": {
"email": "servertest1@comcarde.com",
"firstName": "Server",
"lastName": "Test"
},
"card": {
"cardPAN": "4*** **** **** *111",
"nameOnAccount": "Server Test"
}
},
"payeeInstrument": {
"accountType": "Unspecified"
},
"resultDetails": {
"errorDetails": {
"statusCode": 400,
"code": 625,
"info": "The RTP ID doesn't exist, is in the wrong state for the operation, the amount value is incorrect or you don't have permission to access it."
}
},
"lastVersion": 3
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
"not": { "allOff": [ { "$ref" : "#/definitions/processor-response" } ] },
,
"processorResponse" : "#/definitions/processor-response"
{
"type": "object",
"properties": {
"x": { "type": "integer" }
},
"required": [ "x" ],
"not": { "required": [ "z" ] }
}

View File

@ -0,0 +1,33 @@
the processorResponse object is located in the ErrorDetails or in ResultDetails if there is no error.
should it just be in ResultsDetails if it exists?
example responses
"resultDetails": {
"errorDetails": {
"statusCode": 400,
"code": 538,
"info": "Error processing payment",
"processorResponse": {
"customCode": "BAD_REQUEST",
"message": "Expiry date [1/2000] is in past"
}
}
}
"resultDetails": {
"processorResponse": {
"transactionID": "ca7dbb41-6c2c-4d00-a52a-126a4374248b"
}
}
actually i think this is just a bug as the swagger model has processorResponse under resultsDetails.
resultDetails {
errorDetails ErrorDetails{...}
processorResponse processor-response{...}
}