Skip to content

Commit

Permalink
Merge pull request #774 from konker/itinerary-estimated-total-fares
Browse files Browse the repository at this point in the history
UNI-601 Itinerary estimated total fares
  • Loading branch information
konker authored Jan 22, 2024
2 parents 476f2d7 + fe84e44 commit c7fd858
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 2 deletions.
2 changes: 1 addition & 1 deletion maas-schemas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maas-schemas",
"version": "21.1.0",
"version": "22.0.0",
"description": "Schemas for MaaS infrastructure",
"main": "index.js",
"engine": {
Expand Down
41 changes: 41 additions & 0 deletions maas-schemas/schemas/core/itineraryV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -261,6 +267,15 @@
"type": "charge"
}
],
"estimatedTotalFares": [
{
"amount": 4744,
"currency": "WMP",
"productionAmount": 4744,
"originalAmount": 4744,
"type": "charge"
}
],
"endTime": 1619780520000,
"signature": "51236c26c20eb2ab0e6378d0751004bb0c0614a18e1fdb44108bd9f05f7e8c92",
"co2": 16,
Expand Down Expand Up @@ -512,6 +527,14 @@
]
},
"ref": 0
},
{
"type": "BOOKING_AVAILABLE",
"ref": 1,
"customerId": "a2825ef0-5bc5-11eb-8fe1-2f1c39696bf6",
"agencyId": "Kova",
"productId": "Kova-scooter",
"estimatedFares": []
}
]
},
Expand All @@ -529,6 +552,15 @@
"type": "charge"
}
],
"estimatedTotalFares": [
{
"amount": 2586,
"currency": "WMP",
"productionAmount": 2586,
"originalAmount": 2586,
"type": "charge"
}
],
"co2": 18,
"type": "outward",
"endTime": 1622037420000,
Expand Down Expand Up @@ -2146,6 +2178,15 @@
"type": "charge"
}
],
"estimatedTotalFares": [
{
"amount": 220,
"currency": "EUR",
"productionAmount": 220,
"originalAmount": 220,
"type": "charge"
}
],
"version": "2",
"co2": 173,
"signature": "9b1c61da77039fc82531b78432881a5d2a476691e358308b11dc9ad49517c74c",
Expand Down
15 changes: 14 additions & 1 deletion maas-schemas/schemas/core/product-optionV2.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
}
}
},
Expand Down
39 changes: 39 additions & 0 deletions maas-schemas/src/io-ts/_types/core/itineraryV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export type ItineraryV2Base = t.Branded<
endTime?: Units_c404_.Time;
co2?: number;
fares?: Array<Fare_a3ab_.Fare>;
estimatedTotalFares?: Array<Fare_a3ab_.Fare>;
legs?: Array<LegV2_0fbd_.LegV2>;
productOptions?: Array<ProductOptionV2_8170_.ProductOptionV2>;
type?: 'outward' | 'return';
Expand All @@ -86,6 +87,7 @@ export type ItineraryV2BaseC = t.BrandC<
endTime: typeof Units_c404_.Time;
co2: t.NumberC;
fares: t.ArrayC<typeof Fare_a3ab_.Fare>;
estimatedTotalFares: t.ArrayC<typeof Fare_a3ab_.Fare>;
legs: t.ArrayC<typeof LegV2_0fbd_.LegV2>;
productOptions: t.ArrayC<typeof ProductOptionV2_8170_.ProductOptionV2>;
type: t.UnionC<[t.LiteralC<'outward'>, t.LiteralC<'return'>]>;
Expand Down Expand Up @@ -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')]),
Expand All @@ -140,6 +143,7 @@ export const ItineraryV2Base: ItineraryV2BaseC = t.brand(
endTime?: Units_c404_.Time;
co2?: number;
fares?: Array<Fare_a3ab_.Fare>;
estimatedTotalFares?: Array<Fare_a3ab_.Fare>;
legs?: Array<LegV2_0fbd_.LegV2>;
productOptions?: Array<ProductOptionV2_8170_.ProductOptionV2>;
type?: 'outward' | 'return';
Expand Down Expand Up @@ -415,6 +419,15 @@ export const examplesItineraryV2: NonEmptyArray<ItineraryV2> = [
type: 'charge',
},
],
estimatedTotalFares: [
{
amount: 4744,
currency: 'WMP',
productionAmount: 4744,
originalAmount: 4744,
type: 'charge',
},
],
endTime: 1619780520000,
signature: '51236c26c20eb2ab0e6378d0751004bb0c0614a18e1fdb44108bd9f05f7e8c92',
co2: 16,
Expand Down Expand Up @@ -562,6 +575,14 @@ export const examplesItineraryV2: NonEmptyArray<ItineraryV2> = [
},
ref: 0,
},
{
type: 'BOOKING_AVAILABLE',
ref: 1,
customerId: 'a2825ef0-5bc5-11eb-8fe1-2f1c39696bf6',
agencyId: 'Kova',
productId: 'Kova-scooter',
estimatedFares: [],
},
],
},
{
Expand All @@ -578,6 +599,15 @@ export const examplesItineraryV2: NonEmptyArray<ItineraryV2> = [
type: 'charge',
},
],
estimatedTotalFares: [
{
amount: 2586,
currency: 'WMP',
productionAmount: 2586,
originalAmount: 2586,
type: 'charge',
},
],
co2: 18,
type: 'outward',
endTime: 1622037420000,
Expand Down Expand Up @@ -2065,6 +2095,15 @@ export const examplesItineraryV2: NonEmptyArray<ItineraryV2> = [
type: 'charge',
},
],
estimatedTotalFares: [
{
amount: 220,
currency: 'EUR',
productionAmount: 220,
originalAmount: 220,
type: 'charge',
},
],
version: '2',
co2: 173,
signature: '9b1c61da77039fc82531b78432881a5d2a476691e358308b11dc9ad49517c74c',
Expand Down
8 changes: 8 additions & 0 deletions maas-schemas/src/io-ts/_types/core/product-optionV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,14 @@ export type ProductOptionAvailable = t.Branded<
type?: 'BOOKING_AVAILABLE';
agencyId?: Leg_1308_.AgencyId;
productId?: Product_d23e_.Id;
estimatedFares?: Array<Fare_a3ab_.Fare>;
} & Record<string, unknown>) & {
ref: Defined;
customerId: Defined;
type: Defined;
agencyId: Defined;
productId: Defined;
estimatedFares: Defined;
},
ProductOptionAvailableBrand
>;
Expand All @@ -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<typeof Fare_a3ab_.Fare>;
}>,
t.RecordC<t.StringC, t.UnknownC>,
]
Expand All @@ -585,6 +588,7 @@ export type ProductOptionAvailableC = t.BrandC<
type: typeof Defined;
agencyId: typeof Defined;
productId: typeof Defined;
estimatedFares: typeof Defined;
}>,
]
>,
Expand All @@ -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),
]),
Expand All @@ -608,6 +613,7 @@ export const ProductOptionAvailable: ProductOptionAvailableC = t.brand(
type: Defined,
agencyId: Defined,
productId: Defined,
estimatedFares: Defined,
}),
]),
(
Expand All @@ -619,12 +625,14 @@ export const ProductOptionAvailable: ProductOptionAvailableC = t.brand(
type?: 'BOOKING_AVAILABLE';
agencyId?: Leg_1308_.AgencyId;
productId?: Product_d23e_.Id;
estimatedFares?: Array<Fare_a3ab_.Fare>;
} & Record<string, unknown>) & {
ref: Defined;
customerId: Defined;
type: Defined;
agencyId: Defined;
productId: Defined;
estimatedFares: Defined;
},
ProductOptionAvailableBrand
> => true,
Expand Down

0 comments on commit c7fd858

Please sign in to comment.