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

Bookings v2 #245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8,992 changes: 7,966 additions & 1,026 deletions prebuilt/core/booking.json

Large diffs are not rendered by default.

185 changes: 162 additions & 23 deletions prebuilt/core/components/fare.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,172 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A fare/price as billed to the user in WMPs or in tokens",
"type": "object",
"properties": {
"amount": {
"anyOf": [
{
"description": "A fare/price as billed to the user",
"oneOf": [
{
"type": "object",
"properties": {
"amount": {
"description": "amount of the fare in the given currency",
"type": "integer",
"multipleOf": 0.01,
"minimum": 0
},
{
"type": "null"
"currency": {
"description": "currency of the fare amount",
"type": "string",
"enum": [
"EUR",
"GBP"
]
},
"wmp": {
"description": "The fare amount in the WMP internal currency",
"type": "integer",
"multipleOf": 1,
"minimum": 0
},
"region": {
"description": "The fare in the home currency associated with the region of the user's subscription",
"type": "Object",
"properties": {
"amount": {
"description": "amount of the fare in the given currency",
"type": "integer",
"multipleOf": 0.01,
"minimum": 0
},
"currency": {
"description": "currency of the fare amount",
"type": "string",
"enum": [
"EUR",
"GBP"
]
}
},
"required": [
"amount",
"currency"
],
"additionalProperties": false
}
]
},
"required": [
"amount",
"currency",
"wmps",
"region"
],
"additionalProperties": false
},
"currency": {
"type": "string",
"enum": [
"WMP",
"TOKEN"
]
},
"tokenId": {
"type": "string"
{
"type": "object",
"properties": {
"amount": {
"description": "number of tokens",
"type": "integer",
"multipleOf": 1,
"minimum": 0
},
"currency": {
"description": "TOKEN internal currency",
"value": "TOKEN"
},
"tokenId": {
"description": "Token id field used if the currency is TOKEN",
"type": "string"
}
},
"required": [
"amount",
"currency",
"tokenId"
],
"additionalProperties": false
}
},
"required": [
"amount",
"currency"
],
"additionalProperties": false
"definitions": {
"currencyFare": {
"type": "object",
"properties": {
"amount": {
"description": "amount of the fare in the given currency",
"type": "integer",
"multipleOf": 0.01,
"minimum": 0
},
"currency": {
"description": "currency of the fare amount",
"type": "string",
"enum": [
"EUR",
"GBP"
]
},
"wmp": {
"description": "The fare amount in the WMP internal currency",
"type": "integer",
"multipleOf": 1,
"minimum": 0
},
"region": {
"description": "The fare in the home currency associated with the region of the user's subscription",
"type": "Object",
"properties": {
"amount": {
"description": "amount of the fare in the given currency",
"type": "integer",
"multipleOf": 0.01,
"minimum": 0
},
"currency": {
"description": "currency of the fare amount",
"type": "string",
"enum": [
"EUR",
"GBP"
]
}
},
"required": [
"amount",
"currency"
],
"additionalProperties": false
}
},
"required": [
"amount",
"currency",
"wmps",
"region"
],
"additionalProperties": false
},
"tokenFare": {
"type": "object",
"properties": {
"amount": {
"description": "number of tokens",
"type": "integer",
"multipleOf": 1,
"minimum": 0
},
"currency": {
"description": "TOKEN internal currency",
"value": "TOKEN"
},
"tokenId": {
"description": "Token id field used if the currency is TOKEN",
"type": "string"
}
},
"required": [
"amount",
"currency",
"tokenId"
],
"additionalProperties": false
}
}
}
10 changes: 9 additions & 1 deletion prebuilt/core/components/units.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
"type": "string",
"pattern": "^[aepsu]{2}\\-[0-9A-Z_a-z]{4}\\-[0-9]:[0-9a-f]{8}(\\-[0-9a-f]{4}){3}\\-[0-9a-f]{12}$"
},
"currency": {
"internalCurrency": {
"description": "Internal monetary unit in ISO 4127 format, see https://en.wikipedia.org/wiki/ISO_4217#cite_note-1",
"type": "string",
"enum": [
"WMP",
"TOKEN"
]
},
"actualCurrency": {
"description": "Accepted monetary unit in ISO 4127 format, see https://en.wikipedia.org/wiki/ISO_4217#cite_note-1",
"type": "string",
"enum": [
Expand Down
107 changes: 107 additions & 0 deletions prebuilt/core/invoice.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://api.maas.global/maas-backend/invoices/invoice",
"description": "MaaS Invoice schema",
"definitions": {
"InvoiceId": {
"type": "string",
"minLength": 2
},
"Invoice": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 2
},
"customerId": {
"type": "string",
"pattern": "^[aepsu]{2}\\-[0-9A-Z_a-z]{4}\\-[0-9]:[0-9a-f]{8}(\\-[0-9a-f]{4}){3}\\-[0-9a-f]{12}$"
},
"bookingId": {
"description": "bookingId of the requested booking",
"type": "string",
"pattern": "^[0-9A-Fa-f]{8}(\\-[0-9A-Fa-f]{4}){3}\\-[0-9A-Fa-f]{12}$"
},
"lineItems": {
"type": "array",
"items": {
"description": "Invoice line item",
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 2
},
"gatewayId": {
"type": "string",
"minLength": 4
},
"invoiceId": {
"type": "string",
"minLength": 2
},
"type": {
"type": "string",
"enum": [
"authorization",
"capture",
"charge",
"refund"
]
},
"paymentSourceId": {
"type": "string",
"minLength": 4
},
"date": {
"description": "POSIX time in milliseconds, https://en.wikipedia.org/wiki/Unix_time",
"type": "integer",
"maximum": 9007199254740991,
"minimum": 1451606400
},
"description": {
"type": "string",
"minLength": 1
},
"amount": {
"type": "number",
"minimum": 0,
"multipleOf": 0.01
},
"currency": {
"description": "Accepted monetary unit in ISO 4127 format, see https://en.wikipedia.org/wiki/ISO_4217#cite_note-1",
"type": "string",
"enum": [
"EUR",
"GBP"
]
},
"referenceInvoiceLineItemId": {
"type": "string",
"minLength": 2
}
},
"required": [
"id",
"gatewayId",
"description",
"amount",
"currency",
"type"
],
"additionalProperties": false
},
"minLength": 1
}
},
"required": [
"id",
"customerId",
"bookingId",
"lineItems"
],
"additionalProperties": false
}
}
}
Loading