Skip to content

Commit 6564d5e

Browse files
authored
feat: Fake places and simulation of a custom built system (#202)
1 parent 5a31fe5 commit 6564d5e

16 files changed

Lines changed: 147 additions & 149 deletions

File tree

Examples/BookingSystem.AspNetCore/Feeds/FacilitiesFeeds.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,7 @@ protected override async Task<List<RpdeItem<FacilityUse>>> GetRpdeItems(long? af
8888
},
8989
IsOpenBookingAllowed = true,
9090
},
91-
Location = new Place
92-
{
93-
Name = "Fake Pond",
94-
Address = new PostalAddress
95-
{
96-
StreetAddress = "1 Fake Park",
97-
AddressLocality = "Another town",
98-
AddressRegion = "Oxfordshire",
99-
PostalCode = "OX1 1AA",
100-
AddressCountry = "GB"
101-
},
102-
Geo = new GeoCoordinates
103-
{
104-
Latitude = result.Item1.LocationLat,
105-
Longitude = result.Item1.LocationLng
106-
}
107-
},
91+
Location = _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
10892
Url = new Uri("https://www.example.com/a-session-age"),
10993
FacilityType = new List<Concept> {
11094
new Concept

Examples/BookingSystem.AspNetCore/Feeds/SessionsFeeds.cs

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -171,40 +171,8 @@ protected override async Task<List<RpdeItem<SessionSeries>>> GetRpdeItems(long?
171171
AllowCustomerCancellationFullRefund = result.Item1.AllowCustomerCancellationFullRefund
172172
}
173173
},
174-
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : new Place
175-
{
176-
Name = "Fake Pond",
177-
Address = new PostalAddress
178-
{
179-
StreetAddress = "1 Fake Park",
180-
AddressLocality = "Another town",
181-
AddressRegion = "Oxfordshire",
182-
PostalCode = "OX1 1AA",
183-
AddressCountry = "GB"
184-
},
185-
Geo = new GeoCoordinates
186-
{
187-
Latitude = result.Item1.LocationLat,
188-
Longitude = result.Item1.LocationLng,
189-
}
190-
},
191-
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : new Place
192-
{
193-
Name = "Fake Pond",
194-
Address = new PostalAddress
195-
{
196-
StreetAddress = "1 Fake Park",
197-
AddressLocality = "Another town",
198-
AddressRegion = "Oxfordshire",
199-
PostalCode = "OX1 1AA",
200-
AddressCountry = "GB"
201-
},
202-
Geo = new GeoCoordinates
203-
{
204-
Latitude = result.Item1.LocationLat,
205-
Longitude = result.Item1.LocationLng,
206-
}
207-
},
174+
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
175+
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
208176
Url = new Uri("https://www.example.com/a-session-age"),
209177
Activity = new List<Concept>
210178
{

Examples/BookingSystem.AspNetCore/Settings/AppSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class FeatureSettings
1515
{
1616
public bool EnableTokenAuth { get; set; } = true;
1717
public bool SingleSeller { get; set; } = false;
18+
public bool CustomBuiltSystem { get; set; } = false;
1819
public bool PaymentReconciliationDetailValidation { get; set; } = true;
1920
public bool OnlyFreeOpportunities { get; set; } = false;
2021
public bool PrepaymentAlwaysRequired { get; set; } = false;

Examples/BookingSystem.AspNetCore/Settings/EngineConfig.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ public static StoreBookingEngine CreateStoreBookingEngine(AppSettings appSetting
176176
OrganisationPlainTextDescription = "The Reference Implementation provides an example of an full conformant implementation of the OpenActive specifications.",
177177
OrganisationLogoUrl = $"{appSettings.ApplicationHostBaseUrl}/images/placeholder-logo.png".ParseUrlOrNull(),
178178
OrganisationEmail = "hello@example.com",
179-
PlatformName = "OpenActive Reference Implementation",
180-
PlatformUrl = "https://tutorials.openactive.io/open-booking-sdk/".ParseUrlOrNull(),
181-
PlatformVersion = "1.0",
179+
PlatformName = appSettings.FeatureFlags.CustomBuiltSystem ? null : "OpenActive Reference Implementation",
180+
PlatformUrl = appSettings.FeatureFlags.CustomBuiltSystem ? null : "https://tutorials.openactive.io/open-booking-sdk/".ParseUrlOrNull(),
181+
PlatformVersion = appSettings.FeatureFlags.CustomBuiltSystem ? null : "1.0",
182182
BackgroundImageUrl = $"{appSettings.ApplicationHostBaseUrl}/images/placeholder-dataset-site-background.jpg".ParseUrlOrNull(),
183183
DateFirstPublished = new DateTimeOffset(new DateTime(2019, 01, 14)),
184184
OpenBookingAPIBaseUrl = $"{appSettings.ApplicationHostBaseUrl}/api/openbooking".ParseUrlOrNull(),

Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ protected override async Task TriggerTestAction(OpenBookingSimulateAction simula
274274
}
275275
return;
276276
case ChangeOfLogisticsLocationSimulateAction _:
277-
if (!await _fakeBookingSystem.Database.UpdateFacilityUseLocationLatLng(idComponents.SlotId.Value, 0.2m, 0.3m))
277+
if (!await _fakeBookingSystem.Database.UpdateFacilityUseLocationPlaceId(idComponents.SlotId.Value))
278278
{
279279
throw new OpenBookingException(new UnknownOpportunityError());
280280
}
@@ -339,15 +339,7 @@ protected override async Task GetOrderItems(List<OrderItemContext<FacilityOpport
339339
}),
340340
Name = facility.Name,
341341
Url = new Uri("https://example.com/events/" + slot.FacilityUseId),
342-
Location = new Place
343-
{
344-
Name = "Fake fitness studio",
345-
Geo = new GeoCoordinates
346-
{
347-
Latitude = facility.LocationLat,
348-
Longitude = facility.LocationLng,
349-
}
350-
},
342+
Location = _fakeBookingSystem.Database.GetPlaceById(facility.PlaceId),
351343
FacilityType = new List<Concept> {
352344
new Concept
353345
{

Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ protected override async Task TriggerTestAction(OpenBookingSimulateAction simula
295295
}
296296
return;
297297
case ChangeOfLogisticsLocationSimulateAction _:
298-
if (!await _fakeBookingSystem.Database.UpdateSessionSeriesLocationLatLng(idComponents.ScheduledSessionId.Value, 0.2m, 0.3m))
298+
if (!await _fakeBookingSystem.Database.UpdateSessionSeriesLocationPlaceId(idComponents.ScheduledSessionId.Value))
299299
{
300300
throw new OpenBookingException(new UnknownOpportunityError());
301301
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"FeatureFlags": {
33
"SingleSeller": true,
4+
"CustomBuiltSystem": true,
45
"EnableTokenAuth": false
56
}
67
}

Examples/BookingSystem.AspNetFramework/Feeds/FacilitiesFeeds.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,7 @@ protected override async Task<List<RpdeItem<FacilityUse>>> GetRpdeItems(long? af
8888
},
8989
IsOpenBookingAllowed = true,
9090
},
91-
Location = new Place
92-
{
93-
Name = "Fake Pond",
94-
Address = new PostalAddress
95-
{
96-
StreetAddress = "1 Fake Park",
97-
AddressLocality = "Another town",
98-
AddressRegion = "Oxfordshire",
99-
PostalCode = "OX1 1AA",
100-
AddressCountry = "GB"
101-
},
102-
Geo = new GeoCoordinates
103-
{
104-
Latitude = result.Item1.LocationLat,
105-
Longitude = result.Item1.LocationLng
106-
}
107-
},
91+
Location = _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
10892
Url = new Uri("https://www.example.com/a-session-age"),
10993
FacilityType = new List<Concept> {
11094
new Concept

Examples/BookingSystem.AspNetFramework/Feeds/SessionsFeeds.cs

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -171,40 +171,8 @@ protected override async Task<List<RpdeItem<SessionSeries>>> GetRpdeItems(long?
171171
AllowCustomerCancellationFullRefund = result.Item1.AllowCustomerCancellationFullRefund
172172
}
173173
},
174-
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : new Place
175-
{
176-
Name = "Fake Pond",
177-
Address = new PostalAddress
178-
{
179-
StreetAddress = "1 Fake Park",
180-
AddressLocality = "Another town",
181-
AddressRegion = "Oxfordshire",
182-
PostalCode = "OX1 1AA",
183-
AddressCountry = "GB"
184-
},
185-
Geo = new GeoCoordinates
186-
{
187-
Latitude = result.Item1.LocationLat,
188-
Longitude = result.Item1.LocationLng,
189-
}
190-
},
191-
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : new Place
192-
{
193-
Name = "Fake Pond",
194-
Address = new PostalAddress
195-
{
196-
StreetAddress = "1 Fake Park",
197-
AddressLocality = "Another town",
198-
AddressRegion = "Oxfordshire",
199-
PostalCode = "OX1 1AA",
200-
AddressCountry = "GB"
201-
},
202-
Geo = new GeoCoordinates
203-
{
204-
Latitude = result.Item1.LocationLat,
205-
Longitude = result.Item1.LocationLng,
206-
}
207-
},
174+
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
175+
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
208176
Url = new Uri("https://www.example.com/a-session-age"),
209177
Activity = new List<Concept>
210178
{

Examples/BookingSystem.AspNetFramework/Settings/AppSettings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class FeatureSettings
1515
{
1616
public bool EnableTokenAuth { get; set; } = true;
1717
public bool SingleSeller { get; set; } = false;
18+
public bool CustomBuiltSystem { get; set; } = false;
1819
public bool PaymentReconciliationDetailValidation { get; set; } = true;
1920
public bool OnlyFreeOpportunities { get; set; } = false;
2021
public bool PrepaymentAlwaysRequired { get; set; } = false;

0 commit comments

Comments
 (0)