Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MODPATRON-165]-Added POST api for external patron. #140

Merged
merged 10 commits into from
Jun 6, 2024
11 changes: 10 additions & 1 deletion descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
"feefines.item.get"
]
},
{
"methods": ["POST"],
"pathPattern": "/patron/account",
"permissionsRequired": ["patron.account.item.post"],
"modulePermissions": [
"users.item.get"
]
},
{
"methods": ["POST"],
"pathPattern": "/patron/account/{accountId}/item/{itemId}/renew",
Expand Down Expand Up @@ -135,7 +143,8 @@
"patron.hold.item.post",
"patron.hold.instance.item.post",
"patron.hold.cancel.item.post",
"patron.hold.allowed-service-points.get"
"patron.hold.allowed-service-points.get",
"patron.account.item.post"
]
}
],
Expand Down
31 changes: 31 additions & 0 deletions ramls/examples/external_patron.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"generalInfo": {
"externalSystemId": "ext-123456",
"firstName": "John",
"preferredFirstName": "Johnny",
"middleName": "M",
"lastName": "Doe"
},
"address0": {
"addressLine0": "123 Main St",
"addressLine1": "Apt 4B",
"city": "Metropolis",
"province": "NY",
"zip": "12345",
"country": "USA"
},
"address1": {
"addressLine0": "456 Side St",
"addressLine1": "Suite 500",
"city": "Metropolis",
"province": "NY",
"zip": "12346",
"country": "USA"
},
"contactInfo": {
"phone": "555-1234",
"mobilePhone": "555-5678",
"email": "[email protected]"
},
"preferredEmailCommunication": ["Support", "Programs"]
}
135 changes: 135 additions & 0 deletions ramls/external_patron.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "User Information Schema",
"description": "Schema for user information including general info, addresses, contact info",
"type": "object",
"properties": {
"generalInfo": {
"type": "object",
"description": "General info of patron",
"properties": {
"externalSystemId": {
"type": "string",
"description": "A unique ID that corresponds to an external authority"
},
"firstName": {
"type": "string",
"description": "The user's given name"
},
"preferredFirstName": {
"type": "string",
"description": "The user's preferred name"
},
"middleName": {
"type": "string",
"description": "The user's middle name (if any)"
},
"lastName": {
"type": "string",
"description": "The user's surname"
}
},
"required": ["externalSystemId", "firstName", "lastName"],
"additionalProperties": false
},
"address0": {
"type": "object",
"description": "Primary address info of patron",
"properties": {
"addressLine0": {
"type": "string",
"description": "Address, Line 0"
},
"addressLine1": {
"type": "string",
"description": "Address, Line 1"
},
"city": {
"type": "string",
"description": "City name"
},
"province": {
"type": "string",
"description": "Province"
},
"zip": {
"type": "string",
"description": "Zip Code"
},
"country": {
"type": "string",
"description": "Country"
}
},
"required": ["addressLine0", "city", "province", "zip", "country"],
"additionalProperties": false
},
"address1": {
"type": "object",
"description": "Secondary address info of patron",
"properties": {
"addressLine0": {
"type": "string",
"description": "Address, Line 0"
},
"addressLine1": {
"type": "string",
"description": "Address, Line 1"
},
"city": {
"type": "string",
"description": "City name"
},
"province": {
"type": "string",
"description": "Province"
},
"zip": {
"type": "string",
"description": "Zip Code"
},
"country": {
"type": "string",
"description": "Country"
}
},
"required": ["addressLine0", "city", "province", "zip", "country"],
"additionalProperties": false
},
"contactInfo": {
"type": "object",
"description": "Contact info of patron",
"properties": {
"phone": {
"type": "string",
"description": "The user's primary phone number"
},
"mobilePhone": {
"type": "string",
"description": "The user's mobile phone number"
},
"email": {
"type": "string",
"description": "The user's email address",
"format": "email"
}
},
"required": ["email"],
"additionalProperties": false
},
"preferredEmailCommunication": {
"type": "array",
"description": "Email communication info of patron",
"items": {
"type": "string",
"enum": ["Support", "Programs", "Service"]
},
"minItems": 1,
"maxItems": 3,
"uniqueItems": true,
"description": "Preferred email communication types"
}
},
"required": ["generalInfo", "address0", "contactInfo", "preferredEmailCommunication"],
"additionalProperties": false
}
48 changes: 48 additions & 0 deletions ramls/patron.raml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ types:
charge: !include charge.json
money: !include money.json
item: !include item.json
external_patron: !include external_patron.json
allowedServicePoints: !include allowed-service-points-response.json
errors: !include raml-util/schemas/errors.schema
error: !include raml-util/schemas/error.schema
Expand All @@ -30,6 +31,53 @@ traits:
description: |
Services that allow patron empowerment from 3rd party discovery services
/account:
post:
description: |
Creates external patron request
is: [validate]
body:
application/json:
type: external_patron
example: !include examples/external_patron.json
responses:
201:
description: |
Returns data for a new hold request on the selected item
body:
application/json:
type: external_patron
example: !include examples/external_patron.json
400:
description: Bad request
body:
text/plain:
example: unable to process request
401:
description: Not authorized to perform requested action
body:
text/plain:
example: unable to create request
404:
description: Instance with a given ID not found
body:
text/plain:
example: item not found
403:
description: Access Denied
body:
text/plain:
example: Access Denied
409:
description: Conflict
body:
text/plain:
example: Optimistic Locking Conflict
500:
description: |
Internal server error, e.g. due to misconfiguration
body:
text/plain:
example: internal server error, contact administrator
/{id}:
displayName: Manage Accounts By Id
description: Service endpoints that manage accounts by an existing Id
Expand Down
Loading
Loading