Skip to content

Commit

Permalink
Updated schema for totals endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
flashingpumpkin committed Jun 28, 2017
1 parent 03b8e2c commit 88040c9
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 132 deletions.
3 changes: 1 addition & 2 deletions app/uk/gov/hmrc/epayeapi/models/TotalsResponse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ import uk.gov.hmrc.domain.EmpRef
import uk.gov.hmrc.epayeapi.models.domain.AggregatedTotals

case class TotalsResponse(
empRef: EmpRef,
credit: BigDecimal,
debit: BigDecimal,
_links: TotalsLinks
)

object TotalsResponse {
def apply(empRef: EmpRef, totals: AggregatedTotals): TotalsResponse =
TotalsResponse(empRef, totals.credit, totals.debit, TotalsLinks())
TotalsResponse(totals.credit, totals.debit, TotalsLinks())
}

case class TotalsLinks(
Expand Down
26 changes: 26 additions & 0 deletions resources/public/api/conf/1.0/application.raml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,29 @@ types:
"code" : "INSUFFICIENT_ENROLMENTS",
"message" : "You are not currently enrolled for ePAYE"
}
/epaye/:EmpRef/total:
get:
is: [ headers.acceptHeader ]
displayName: Total balance
description: This resource returns the outstanding credits and debits on your account.
(annotations.scope): "read:epaye"
securedBy: [ sec.oauth_2_0: { scopes: [ "read:epaye" ] } ]
responses:
200:
body:
application/json:
type: !include schemas/Totals.get.schema.json
example: !include examples/Totals.get.json
401:
body:
application/json:
type: !include schemas/ErrorCodes.schema.json
examples:
notOpenStatus:
description: You don't have currently an ePAYE enrolment on this account.
value: |
{
"code" : "INSUFFICIENT_ENROLMENTS",
"message" : "You are not currently enrolled for ePAYE"
}
40 changes: 0 additions & 40 deletions resources/public/api/conf/1.0/examples/Totals.get.array.json

This file was deleted.

10 changes: 10 additions & 0 deletions resources/public/api/conf/1.0/examples/Totals.get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"empRef" : "840/GZ00064",
"credit" : 100,
"debit" : 0,
"_links" : {
"empRefs" : {
"href" : "/"
}
}
}
90 changes: 0 additions & 90 deletions resources/public/api/conf/1.0/schemas/Totals.get.schema.array.json

This file was deleted.

30 changes: 30 additions & 0 deletions resources/public/api/conf/1.0/schemas/Totals.get.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"type": "object",
"description": "An object containing the outstanding debits and outstanding credits",
"properties": {
"_links": {
"type": "object",
"description": "An object of links to explore further data",
"properties": {
"empRefs": {
"type": "object",
"description": "An object holding the link back to the entry endpoint",
"properties": {
"href": {
"type": "string",
"description": "Link to the entry endpoint"
}
}
}
}
},
"credit": {
"type": "integer",
"description": "The currently outstanding credits on your account."
},
"debit": {
"type": "integer",
"description": "The currently outstanding debits on your account."
}
}
}

0 comments on commit 88040c9

Please sign in to comment.