diff --git a/maas-schemas/package.json b/maas-schemas/package.json index a1f892ee3..08fc7591f 100644 --- a/maas-schemas/package.json +++ b/maas-schemas/package.json @@ -1,6 +1,6 @@ { "name": "maas-schemas", - "version": "21.1.0", + "version": "22.0.0", "description": "Schemas for MaaS infrastructure", "main": "index.js", "engine": { diff --git a/maas-schemas/schemas/core/itineraryV2.json b/maas-schemas/schemas/core/itineraryV2.json index f629cc79e..b41ed013f 100644 --- a/maas-schemas/schemas/core/itineraryV2.json +++ b/maas-schemas/schemas/core/itineraryV2.json @@ -35,6 +35,12 @@ "$ref": "https://schemas.maas.global/core/components/fare.json" } }, + "estimatedTotalFares": { + "type": "array", + "items": { + "$ref": "https://schemas.maas.global/core/components/fare.json" + } + }, "legs": { "type": "array", "minItems": 0, @@ -261,6 +267,15 @@ "type": "charge" } ], + "estimatedTotalFares": [ + { + "amount": 4744, + "currency": "WMP", + "productionAmount": 4744, + "originalAmount": 4744, + "type": "charge" + } + ], "endTime": 1619780520000, "signature": "51236c26c20eb2ab0e6378d0751004bb0c0614a18e1fdb44108bd9f05f7e8c92", "co2": 16, @@ -512,6 +527,14 @@ ] }, "ref": 0 + }, + { + "type": "BOOKING_AVAILABLE", + "ref": 1, + "customerId": "a2825ef0-5bc5-11eb-8fe1-2f1c39696bf6", + "agencyId": "Kova", + "productId": "Kova-scooter", + "estimatedFares": [] } ] }, @@ -529,6 +552,15 @@ "type": "charge" } ], + "estimatedTotalFares": [ + { + "amount": 2586, + "currency": "WMP", + "productionAmount": 2586, + "originalAmount": 2586, + "type": "charge" + } + ], "co2": 18, "type": "outward", "endTime": 1622037420000, @@ -2146,6 +2178,15 @@ "type": "charge" } ], + "estimatedTotalFares": [ + { + "amount": 220, + "currency": "EUR", + "productionAmount": 220, + "originalAmount": 220, + "type": "charge" + } + ], "version": "2", "co2": 173, "signature": "9b1c61da77039fc82531b78432881a5d2a476691e358308b11dc9ad49517c74c", diff --git a/maas-schemas/schemas/core/product-optionV2.json b/maas-schemas/schemas/core/product-optionV2.json index 34dc2bc69..3e74876ee 100644 --- a/maas-schemas/schemas/core/product-optionV2.json +++ b/maas-schemas/schemas/core/product-optionV2.json @@ -154,7 +154,14 @@ "productOptionAvailable": { "description": "A booking is required but it should be deferred", "type": "object", - "required": ["ref", "customerId", "type", "agencyId", "productId"], + "required": [ + "ref", + "customerId", + "type", + "agencyId", + "productId", + "estimatedFares" + ], "properties": { "ref": { "type": "integer", @@ -171,6 +178,12 @@ }, "productId": { "$ref": "https://schemas.maas.global/core/product.json#/definitions/id" + }, + "estimatedFares": { + "type": "array", + "items": { + "$ref": "https://schemas.maas.global/core/components/fare.json" + } } } }, diff --git a/maas-schemas/src/io-ts/_types/core/itineraryV2.ts b/maas-schemas/src/io-ts/_types/core/itineraryV2.ts index e32db6a03..04895414d 100644 --- a/maas-schemas/src/io-ts/_types/core/itineraryV2.ts +++ b/maas-schemas/src/io-ts/_types/core/itineraryV2.ts @@ -61,6 +61,7 @@ export type ItineraryV2Base = t.Branded< endTime?: Units_c404_.Time; co2?: number; fares?: Array; + estimatedTotalFares?: Array; legs?: Array; productOptions?: Array; type?: 'outward' | 'return'; @@ -86,6 +87,7 @@ export type ItineraryV2BaseC = t.BrandC< endTime: typeof Units_c404_.Time; co2: t.NumberC; fares: t.ArrayC; + estimatedTotalFares: t.ArrayC; legs: t.ArrayC; productOptions: t.ArrayC; type: t.UnionC<[t.LiteralC<'outward'>, t.LiteralC<'return'>]>; @@ -115,6 +117,7 @@ export const ItineraryV2Base: ItineraryV2BaseC = t.brand( endTime: Units_c404_.Time, co2: t.number, fares: t.array(Fare_a3ab_.Fare), + estimatedTotalFares: t.array(Fare_a3ab_.Fare), legs: t.array(LegV2_0fbd_.LegV2), productOptions: t.array(ProductOptionV2_8170_.ProductOptionV2), type: t.union([t.literal('outward'), t.literal('return')]), @@ -140,6 +143,7 @@ export const ItineraryV2Base: ItineraryV2BaseC = t.brand( endTime?: Units_c404_.Time; co2?: number; fares?: Array; + estimatedTotalFares?: Array; legs?: Array; productOptions?: Array; type?: 'outward' | 'return'; @@ -415,6 +419,15 @@ export const examplesItineraryV2: NonEmptyArray = [ type: 'charge', }, ], + estimatedTotalFares: [ + { + amount: 4744, + currency: 'WMP', + productionAmount: 4744, + originalAmount: 4744, + type: 'charge', + }, + ], endTime: 1619780520000, signature: '51236c26c20eb2ab0e6378d0751004bb0c0614a18e1fdb44108bd9f05f7e8c92', co2: 16, @@ -562,6 +575,14 @@ export const examplesItineraryV2: NonEmptyArray = [ }, ref: 0, }, + { + type: 'BOOKING_AVAILABLE', + ref: 1, + customerId: 'a2825ef0-5bc5-11eb-8fe1-2f1c39696bf6', + agencyId: 'Kova', + productId: 'Kova-scooter', + estimatedFares: [], + }, ], }, { @@ -578,6 +599,15 @@ export const examplesItineraryV2: NonEmptyArray = [ type: 'charge', }, ], + estimatedTotalFares: [ + { + amount: 2586, + currency: 'WMP', + productionAmount: 2586, + originalAmount: 2586, + type: 'charge', + }, + ], co2: 18, type: 'outward', endTime: 1622037420000, @@ -2065,6 +2095,15 @@ export const examplesItineraryV2: NonEmptyArray = [ type: 'charge', }, ], + estimatedTotalFares: [ + { + amount: 220, + currency: 'EUR', + productionAmount: 220, + originalAmount: 220, + type: 'charge', + }, + ], version: '2', co2: 173, signature: '9b1c61da77039fc82531b78432881a5d2a476691e358308b11dc9ad49517c74c', diff --git a/maas-schemas/src/io-ts/_types/core/product-optionV2.ts b/maas-schemas/src/io-ts/_types/core/product-optionV2.ts index 9404db087..b05c0da06 100644 --- a/maas-schemas/src/io-ts/_types/core/product-optionV2.ts +++ b/maas-schemas/src/io-ts/_types/core/product-optionV2.ts @@ -555,12 +555,14 @@ export type ProductOptionAvailable = t.Branded< type?: 'BOOKING_AVAILABLE'; agencyId?: Leg_1308_.AgencyId; productId?: Product_d23e_.Id; + estimatedFares?: Array; } & Record) & { ref: Defined; customerId: Defined; type: Defined; agencyId: Defined; productId: Defined; + estimatedFares: Defined; }, ProductOptionAvailableBrand >; @@ -575,6 +577,7 @@ export type ProductOptionAvailableC = t.BrandC< type: t.LiteralC<'BOOKING_AVAILABLE'>; agencyId: typeof Leg_1308_.AgencyId; productId: typeof Product_d23e_.Id; + estimatedFares: t.ArrayC; }>, t.RecordC, ] @@ -585,6 +588,7 @@ export type ProductOptionAvailableC = t.BrandC< type: typeof Defined; agencyId: typeof Defined; productId: typeof Defined; + estimatedFares: typeof Defined; }>, ] >, @@ -599,6 +603,7 @@ export const ProductOptionAvailable: ProductOptionAvailableC = t.brand( type: t.literal('BOOKING_AVAILABLE'), agencyId: Leg_1308_.AgencyId, productId: Product_d23e_.Id, + estimatedFares: t.array(Fare_a3ab_.Fare), }), t.record(t.string, t.unknown), ]), @@ -608,6 +613,7 @@ export const ProductOptionAvailable: ProductOptionAvailableC = t.brand( type: Defined, agencyId: Defined, productId: Defined, + estimatedFares: Defined, }), ]), ( @@ -619,12 +625,14 @@ export const ProductOptionAvailable: ProductOptionAvailableC = t.brand( type?: 'BOOKING_AVAILABLE'; agencyId?: Leg_1308_.AgencyId; productId?: Product_d23e_.Id; + estimatedFares?: Array; } & Record) & { ref: Defined; customerId: Defined; type: Defined; agencyId: Defined; productId: Defined; + estimatedFares: Defined; }, ProductOptionAvailableBrand > => true,