diff --git a/src/core/base/ThingThatCanBeOffered.ts b/src/core/base/ThingThatCanBeOffered.ts index 21c2332c..56ccb111 100644 --- a/src/core/base/ThingThatCanBeOffered.ts +++ b/src/core/base/ThingThatCanBeOffered.ts @@ -20,10 +20,13 @@ import {SCISO8601Date} from '../types/Time'; import {SCInPlace} from './../types/Places'; /** - * A map from group name to price + * Default price without distinction */ export interface SCPriceGroup { - [s: string]: number | undefined; + /** + * Default price of the thing + */ + default: number; } /** @@ -82,15 +85,10 @@ export interface SCThingThatCanBeOfferedOffer */ availabilityStarts?: SCISO8601Date; - /** - * Default price of the thing - */ - price: number; - /** * List of prices that are distinct for specific groups */ - prices?: T; + prices: T; /** * Provider of an offer diff --git a/src/core/things/DateSeries.ts b/src/core/things/DateSeries.ts index 36b9df59..5eb15aee 100644 --- a/src/core/things/DateSeries.ts +++ b/src/core/things/DateSeries.ts @@ -32,7 +32,7 @@ export interface SCSportCoursePriceGroup extends SCAcademicPriceGroup { /** * Price for alumnis */ - alumni: number; + alumni?: number; } /** diff --git a/test/resources/DateSeries.3.json b/test/resources/DateSeries.3.json new file mode 100644 index 00000000..c4556164 --- /dev/null +++ b/test/resources/DateSeries.3.json @@ -0,0 +1,77 @@ +{ + "errorNames": [], + "instance": { + "type": "date series", + "uid": "540862f3-ea30-5b8f-8678-56b4dc217140", + "name": "Dance course for beginners", + "duration": "PT8H", + "inPlace": { + "geo": { + "point": { + "type": "Point", + "coordinates": [ + 13.3266207, + 52.5144409 + ] + } + }, + "type": "room", + "categories": [ + "student union" + ], + "uid": "540862f3-ea30-5b8f-8678-56b4dc217140", + "name": "EMH 225", + "floor": "2", + "origin": { + "indexed": "2018-09-11T12:30:00Z", + "name": "Dummy", + "type": "remote" + } + }, + "frequency": "once", + "dates": [ + "2016-04-12T11:00:00+00:00" + ], + "event": { + "type": "academic event", + "uid": "540862f3-ea30-5b8f-8678-56b4dc217140", + "name": "Dance course for beginners", + "categories": [ + "special" + ], + "origin": { + "indexed": "2018-09-11T12:30:00Z", + "name": "Dummy", + "type": "remote" + } + }, + "origin": { + "indexed": "2018-09-11T12:30:00Z", + "name": "Dummy", + "type": "remote" + }, + "offers": [ + { + "availability": "in stock", + "availabilityStarts": "2017-01-30T00:00:00.000Z", + "availabilityEnds": "2017-01-30T23:59:59.999Z", + "prices": { + "default": 6.5, + "student": 5, + "alumni": 5 + }, + "provider": { + "name": "Studentenwerk", + "origin": { + "indexed": "2018-09-11T12:30:00Z", + "name": "Dummy", + "type": "remote" + }, + "type": "organization", + "uid": "3b9b3df6-3a7a-58cc-922f-c7335c002634" + } + } + ] + }, + "schema": "SCDateSeries" +} diff --git a/test/resources/Dish.1.json b/test/resources/Dish.1.json index 9b1e4709..44d88bee 100644 --- a/test/resources/Dish.1.json +++ b/test/resources/Dish.1.json @@ -21,10 +21,11 @@ "availability": "in stock", "availabilityStarts": "2017-01-30T00:00:00.000Z", "availabilityEnds": "2017-01-30T23:59:59.999Z", - "price": 2.85, "prices": { + "default": 4.85, "student": 2.85, - "employee": 2.85 + "employee": 3.85, + "guest": 4.85 }, "provider": { "name": "Studentenwerk", diff --git a/test/resources/Dish.2.json b/test/resources/Dish.2.json index 8d697851..7d7f57c8 100644 --- a/test/resources/Dish.2.json +++ b/test/resources/Dish.2.json @@ -9,10 +9,10 @@ ], "offers": [ { - "price": 2.45, "prices": { + "default": 3.45, "student": 2.45, - "employee": 2.45 + "employee": 3.45 }, "provider": { "name": "Studentenwerk", diff --git a/test/resources/Dish.3.json b/test/resources/Dish.3.json index 992e570b..1001e127 100644 --- a/test/resources/Dish.3.json +++ b/test/resources/Dish.3.json @@ -41,10 +41,10 @@ } }, "prices": { + "default": 6.5, "student": 4.9, "employee": 6.5 }, - "price": 6.5, "provider": { "name": "Studentenwerk", "origin": {