Browse Source

Bug 20944: OpenAPI spec for /patrons/{patron_id}/account/credits

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
18.11.x
Tomás Cohen Arazi 4 years ago
committed by Nick Clemens
parent
commit
566badf12a
  1. 3
      api/v1/swagger/definitions.json
  2. 39
      api/v1/swagger/definitions/patron_account_credit.json
  3. 3
      api/v1/swagger/paths.json
  4. 69
      api/v1/swagger/paths/patrons_account.json

3
api/v1/swagger/definitions.json

@ -17,6 +17,9 @@
"patron": {
"$ref": "definitions/patron.json"
},
"patron_account_credit": {
"$ref": "definitions/patron_account_credit.json"
},
"patron_balance": {
"$ref": "definitions/patron_balance.json"
},

39
api/v1/swagger/definitions/patron_account_credit.json

@ -0,0 +1,39 @@
{
"type": "object",
"properties": {
"credit_type": {
"type": "string",
"description": "Type of credit ('credit', 'forgiven', 'lost_item_return', 'payment', 'writeoff' )"
},
"amount": {
"type": "number",
"minimum": 0,
"description": "Credit amount"
},
"account_lines_ids": {
"type": "array",
"items": {
"type": "integer"
},
"description": "List of account line ids the credit goes against (optional)"
},
"payment_type": {
"type": "string",
"description": "Payment type (only applies when credit_type=payment)"
},
"date": {
"type": "string",
"format": "date",
"description": "Date the credit was recorded (optional)"
},
"description": {
"type": "string",
"description": "Description"
},
"note": {
"type": "string",
"description": "Internal note"
}
},
"required": [ "amount" ]
}

3
api/v1/swagger/paths.json

@ -29,6 +29,9 @@
"/patrons/{patron_id}/account": {
"$ref": "paths/patrons_account.json#/~1patrons~1{patron_id}~1account"
},
"/patrons/{patron_id}/account/credits": {
"$ref": "paths/patrons_account.json#/~1patrons~1{patron_id}~1account~1credits"
},
"/illrequests": {
"$ref": "paths/illrequests.json#/~1illrequests"
}

69
api/v1/swagger/paths/patrons_account.json

@ -61,5 +61,74 @@
}
}
}
},
"/patrons/{patron_id}/account/credits": {
"post": {
"x-mojo-to": "Patrons::Account#add_credit",
"operationId": "addPatronCredit",
"tags": [
"patron"
],
"parameters": [
{
"$ref": "../parameters.json#/patron_id_pp"
},
{
"name": "body",
"in": "body",
"description": "A JSON object containing credit information",
"required": true,
"schema": {
"$ref": "../definitions.json#/patron_account_credit"
}
}
],
"produces": [
"application/json"
],
"responses": {
"200": {
"description": "Credit added",
"schema": {
"type": "object"
}
},
"401": {
"description": "Authentication required",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"403": {
"description": "Access forbidden",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"404": {
"description": "Patron not found",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "../definitions.json#/error"
}
},
"503": {
"description": "Under maintenance",
"schema": {
"$ref": "../definitions.json#/error"
}
}
},
"x-koha-authorization": {
"permissions": {
"updatecharges": "remaining_permissions"
}
}
}
}
}

Loading…
Cancel
Save