Skip to content

Commit

Permalink
Move invoice schemas into core
Browse files Browse the repository at this point in the history
  • Loading branch information
konker committed Apr 10, 2018
1 parent 48586ad commit 7730651
Show file tree
Hide file tree
Showing 8 changed files with 4,049 additions and 4 deletions.
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
}
}
}
78 changes: 78 additions & 0 deletions prebuilt/core/invoiceLineItem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://api.maas.global/maas-backend/invoices/invoice",
"description": "MaaS InvoiceLineItem schema",
"definitions": {
"InvoiceLineItemId": {
"type": "string",
"minLength": 2
},
"InvoiceLineItem": {
"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
}
}
}
1,924 changes: 1,924 additions & 0 deletions prebuilt/maas-backend/bookings/bookings-estimate/request.json

Large diffs are not rendered by default.

1,897 changes: 1,897 additions & 0 deletions prebuilt/maas-backend/bookings/bookings-estimate/response.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"$ref": "#/definitions/InvoiceId"
},
"customerId": {
"$ref": "../../core/components/units.json#/definitions/identityId"
"$ref": "./components/units.json#/definitions/identityId"
},
"bookingId": {
"description": "bookingId of the requested booking",
"$ref": "../../core/components/units.json#/definitions/uuid"
"$ref": "./components/units.json#/definitions/uuid"
},
"lineItems": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"minLength": 4
},
"date": {
"$ref": "../../core/components/units.json#/definitions/time"
"$ref": "./components/units.json#/definitions/time"
},
"description": {
"type": "string",
Expand All @@ -42,7 +42,7 @@
"multipleOf": 0.01
},
"currency": {
"$ref": "../../core/components/units.json#/definitions/currency"
"$ref": "./components/units.json#/definitions/currency"
},
"referenceInvoiceLineItemId": {
"$ref": "#/definitions/InvoiceLineItemId"
Expand Down
22 changes: 22 additions & 0 deletions schemas/maas-backend/bookings/bookings-estimate/request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://api.maas.global/maas-backend/bookings/bookings-create/request",
"description": "Request schema for bookings-create",
"type": "object",
"properties": {
"identityId": {
"$ref": "../../../core/components/units.json#/definitions/identityId"
},
"payload": {
"allOf": [
{ "$ref": "../../../core/booking.json" },
{ "required": [ "leg", "terms", "product" ] }
]
},
"headers": {
"$ref": "../../../core/components/api-common.json#/definitions/headers"
}
},
"required": [ "identityId", "payload" ],
"additionalProperties": false
}
17 changes: 17 additions & 0 deletions schemas/maas-backend/bookings/bookings-estimate/response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://api.maas.global/maas-backend/bookings/bookings-create/response",
"description": "Response schema for bookings-create",
"type": "object",
"properties": {
"booking": {
"$ref": "../../../core/booking.json"
},
"debug": {
"type": "object",
"additionalProperties": true
}
},
"required": ["booking"],
"additionalProperties": false
}

0 comments on commit 7730651

Please sign in to comment.