Skip to content

Instantly share code, notes, and snippets.

@fitzoh
Created January 14, 2017 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitzoh/f51e5a3658e9a6d340a5ac4260bbf6eb to your computer and use it in GitHub Desktop.
Save fitzoh/f51e5a3658e9a6d340a5ac4260bbf6eb to your computer and use it in GitHub Desktop.
{
"provider": {
"name": "Provider"
},
"consumer": {
"name": "Consumer"
},
"interactions": [
{
"description": "A fraudulent fraud check request",
"request": {
"method": "PUT",
"path": "/fraudcheck",
"headers": {
"Content-Type": "application/vnd.fraud.v1+json"
},
"body": {
"clientId": "1234567890",
"loanAmount": 99999
},
"matchingRules": {
"$.body.clientId": {
"regex": "[0-9]{10}"
},
"$.body.loanAmount": {
"match": "type"
}
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json;charset=UTF-8"
},
"body": {
"fraudCheckStatus": "FRAUD",
"rejectionReason": "Amount too high"
},
"matchingRules": {
"$.body.fraudCheckStatus": {
"regex": "FRAUD"
}
}
}
},
{
"description": "A non-fraudulent fraud check request",
"request": {
"method": "PUT",
"path": "/fraudcheck",
"headers": {
"Content-Type": "application/vnd.fraud.v1+json"
},
"body": {
"clientId": "1234567890",
"loanAmount": 123.123
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json;charset=UTF-8"
},
"body": {
"fraudCheckStatus": "OK",
"rejectionReason": null
}
}
},
{
"description": "A request to get the drunks count",
"request": {
"method": "GET",
"path": "/drunks"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json;charset=UTF-8"
},
"body": {
"count": 100
}
}
},
{
"description": "A request to get the fraud count",
"request": {
"method": "GET",
"path": "/frauds"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/vnd.fraud.v1+json;charset=UTF-8"
},
"body": {
"count": 200
}
}
}
],
"metadata": {
"pact-specification": {
"version": "2.0.0"
},
"pact-jvm": {
"version": "2.4.18"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment