Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fake places and simulation of a custom built system #202

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions Examples/BookingSystem.AspNetCore/Feeds/FacilitiesFeeds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,7 @@ protected override async Task<List<RpdeItem<FacilityUse>>> GetRpdeItems(long? af
},
IsOpenBookingAllowed = true,
},
Location = new Place
{
Name = "Fake Pond",
Address = new PostalAddress
{
StreetAddress = "1 Fake Park",
AddressLocality = "Another town",
AddressRegion = "Oxfordshire",
PostalCode = "OX1 1AA",
AddressCountry = "GB"
},
Geo = new GeoCoordinates
{
Latitude = result.Item1.LocationLat,
Longitude = result.Item1.LocationLng
}
},
Location = _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
Url = new Uri("https://www.example.com/a-session-age"),
FacilityType = new List<Concept> {
new Concept
Expand Down
36 changes: 2 additions & 34 deletions Examples/BookingSystem.AspNetCore/Feeds/SessionsFeeds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,40 +171,8 @@ protected override async Task<List<RpdeItem<SessionSeries>>> GetRpdeItems(long?
AllowCustomerCancellationFullRefund = result.Item1.AllowCustomerCancellationFullRefund
}
},
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : new Place
{
Name = "Fake Pond",
Address = new PostalAddress
{
StreetAddress = "1 Fake Park",
AddressLocality = "Another town",
AddressRegion = "Oxfordshire",
PostalCode = "OX1 1AA",
AddressCountry = "GB"
},
Geo = new GeoCoordinates
{
Latitude = result.Item1.LocationLat,
Longitude = result.Item1.LocationLng,
}
},
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : new Place
{
Name = "Fake Pond",
Address = new PostalAddress
{
StreetAddress = "1 Fake Park",
AddressLocality = "Another town",
AddressRegion = "Oxfordshire",
PostalCode = "OX1 1AA",
AddressCountry = "GB"
},
Geo = new GeoCoordinates
{
Latitude = result.Item1.LocationLat,
Longitude = result.Item1.LocationLng,
}
},
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
Url = new Uri("https://www.example.com/a-session-age"),
Activity = new List<Concept>
{
Expand Down
1 change: 1 addition & 0 deletions Examples/BookingSystem.AspNetCore/Settings/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class FeatureSettings
{
public bool EnableTokenAuth { get; set; } = true;
public bool SingleSeller { get; set; } = false;
public bool CustomBuiltSystem { get; set; } = false;
public bool PaymentReconciliationDetailValidation { get; set; } = true;
public bool OnlyFreeOpportunities { get; set; } = false;
public bool PrepaymentAlwaysRequired { get; set; } = false;
Expand Down
6 changes: 3 additions & 3 deletions Examples/BookingSystem.AspNetCore/Settings/EngineConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ public static StoreBookingEngine CreateStoreBookingEngine(AppSettings appSetting
OrganisationPlainTextDescription = "The Reference Implementation provides an example of an full conformant implementation of the OpenActive specifications.",
OrganisationLogoUrl = $"{appSettings.ApplicationHostBaseUrl}/images/placeholder-logo.png".ParseUrlOrNull(),
OrganisationEmail = "[email protected]",
PlatformName = "OpenActive Reference Implementation",
PlatformUrl = "https://tutorials.openactive.io/open-booking-sdk/".ParseUrlOrNull(),
PlatformVersion = "1.0",
PlatformName = appSettings.FeatureFlags.CustomBuiltSystem ? null : "OpenActive Reference Implementation",
PlatformUrl = appSettings.FeatureFlags.CustomBuiltSystem ? null : "https://tutorials.openactive.io/open-booking-sdk/".ParseUrlOrNull(),
PlatformVersion = appSettings.FeatureFlags.CustomBuiltSystem ? null : "1.0",
BackgroundImageUrl = $"{appSettings.ApplicationHostBaseUrl}/images/placeholder-dataset-site-background.jpg".ParseUrlOrNull(),
DateFirstPublished = new DateTimeOffset(new DateTime(2019, 01, 14)),
OpenBookingAPIBaseUrl = $"{appSettings.ApplicationHostBaseUrl}/api/openbooking".ParseUrlOrNull(),
Expand Down
12 changes: 2 additions & 10 deletions Examples/BookingSystem.AspNetCore/Stores/FacilityStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ protected override async Task TriggerTestAction(OpenBookingSimulateAction simula
}
return;
case ChangeOfLogisticsLocationSimulateAction _:
if (!await _fakeBookingSystem.Database.UpdateFacilityUseLocationLatLng(idComponents.SlotId.Value, 0.2m, 0.3m))
if (!await _fakeBookingSystem.Database.UpdateFacilityUseLocationPlaceId(idComponents.SlotId.Value))
{
throw new OpenBookingException(new UnknownOpportunityError());
}
Expand Down Expand Up @@ -339,15 +339,7 @@ protected override async Task GetOrderItems(List<OrderItemContext<FacilityOpport
}),
Name = facility.Name,
Url = new Uri("https://example.com/events/" + slot.FacilityUseId),
Location = new Place
{
Name = "Fake fitness studio",
Geo = new GeoCoordinates
{
Latitude = facility.LocationLat,
Longitude = facility.LocationLng,
}
},
Location = _fakeBookingSystem.Database.GetPlaceById(facility.PlaceId),
FacilityType = new List<Concept> {
new Concept
{
Expand Down
2 changes: 1 addition & 1 deletion Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ protected override async Task TriggerTestAction(OpenBookingSimulateAction simula
}
return;
case ChangeOfLogisticsLocationSimulateAction _:
if (!await _fakeBookingSystem.Database.UpdateSessionSeriesLocationLatLng(idComponents.ScheduledSessionId.Value, 0.2m, 0.3m))
if (!await _fakeBookingSystem.Database.UpdateSessionSeriesLocationPlaceId(idComponents.ScheduledSessionId.Value))
{
throw new OpenBookingException(new UnknownOpportunityError());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"FeatureFlags": {
"SingleSeller": true,
"CustomBuiltSystem": true,
"EnableTokenAuth": false
}
}
18 changes: 1 addition & 17 deletions Examples/BookingSystem.AspNetFramework/Feeds/FacilitiesFeeds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,7 @@ protected override async Task<List<RpdeItem<FacilityUse>>> GetRpdeItems(long? af
},
IsOpenBookingAllowed = true,
},
Location = new Place
{
Name = "Fake Pond",
Address = new PostalAddress
{
StreetAddress = "1 Fake Park",
AddressLocality = "Another town",
AddressRegion = "Oxfordshire",
PostalCode = "OX1 1AA",
AddressCountry = "GB"
},
Geo = new GeoCoordinates
{
Latitude = result.Item1.LocationLat,
Longitude = result.Item1.LocationLng
}
},
Location = _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
Url = new Uri("https://www.example.com/a-session-age"),
FacilityType = new List<Concept> {
new Concept
Expand Down
36 changes: 2 additions & 34 deletions Examples/BookingSystem.AspNetFramework/Feeds/SessionsFeeds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,40 +171,8 @@ protected override async Task<List<RpdeItem<SessionSeries>>> GetRpdeItems(long?
AllowCustomerCancellationFullRefund = result.Item1.AllowCustomerCancellationFullRefund
}
},
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : new Place
{
Name = "Fake Pond",
Address = new PostalAddress
{
StreetAddress = "1 Fake Park",
AddressLocality = "Another town",
AddressRegion = "Oxfordshire",
PostalCode = "OX1 1AA",
AddressCountry = "GB"
},
Geo = new GeoCoordinates
{
Latitude = result.Item1.LocationLat,
Longitude = result.Item1.LocationLng,
}
},
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : new Place
{
Name = "Fake Pond",
Address = new PostalAddress
{
StreetAddress = "1 Fake Park",
AddressLocality = "Another town",
AddressRegion = "Oxfordshire",
PostalCode = "OX1 1AA",
AddressCountry = "GB"
},
Geo = new GeoCoordinates
{
Latitude = result.Item1.LocationLat,
Longitude = result.Item1.LocationLng,
}
},
Location = result.Item1.AttendanceMode == AttendanceMode.Online ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
AffiliatedLocation = result.Item1.AttendanceMode == AttendanceMode.Offline ? null : _fakeBookingSystem.Database.GetPlaceById(result.Item1.PlaceId),
Url = new Uri("https://www.example.com/a-session-age"),
Activity = new List<Concept>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class FeatureSettings
{
public bool EnableTokenAuth { get; set; } = true;
public bool SingleSeller { get; set; } = false;
public bool CustomBuiltSystem { get; set; } = false;
public bool PaymentReconciliationDetailValidation { get; set; } = true;
public bool OnlyFreeOpportunities { get; set; } = false;
public bool PrepaymentAlwaysRequired { get; set; } = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ public static StoreBookingEngine CreateStoreBookingEngine(AppSettings appSetting
OrganisationPlainTextDescription = "The Reference Implementation provides an example of an full conformant implementation of the OpenActive specifications.",
OrganisationLogoUrl = $"{appSettings.ApplicationHostBaseUrl}/images/placeholder-logo.png".ParseUrlOrNull(),
OrganisationEmail = "[email protected]",
PlatformName = "OpenActive Reference Implementation",
PlatformUrl = "https://tutorials.openactive.io/open-booking-sdk/".ParseUrlOrNull(),
PlatformVersion = "1.0",
PlatformName = appSettings.FeatureFlags.CustomBuiltSystem ? null : "OpenActive Reference Implementation",
PlatformUrl = appSettings.FeatureFlags.CustomBuiltSystem ? null : "https://tutorials.openactive.io/open-booking-sdk/".ParseUrlOrNull(),
PlatformVersion = appSettings.FeatureFlags.CustomBuiltSystem ? null : "1.0",
BackgroundImageUrl = $"{appSettings.ApplicationHostBaseUrl}/images/placeholder-dataset-site-background.jpg".ParseUrlOrNull(),
DateFirstPublished = new DateTimeOffset(new DateTime(2019, 01, 14)),
OpenBookingAPIBaseUrl = $"{appSettings.ApplicationHostBaseUrl}/api/openbooking".ParseUrlOrNull(),
Expand Down
12 changes: 2 additions & 10 deletions Examples/BookingSystem.AspNetFramework/Stores/FacilityStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ protected override async Task TriggerTestAction(OpenBookingSimulateAction simula
}
return;
case ChangeOfLogisticsLocationSimulateAction _:
if (!await _fakeBookingSystem.Database.UpdateFacilityUseLocationLatLng(idComponents.SlotId.Value, 0.2m, 0.3m))
if (!await _fakeBookingSystem.Database.UpdateFacilityUseLocationPlaceId(idComponents.SlotId.Value))
{
throw new OpenBookingException(new UnknownOpportunityError());
}
Expand Down Expand Up @@ -339,15 +339,7 @@ protected override async Task GetOrderItems(List<OrderItemContext<FacilityOpport
}),
Name = facility.Name,
Url = new Uri("https://example.com/events/" + slot.FacilityUseId),
Location = new Place
{
Name = "Fake fitness studio",
Geo = new GeoCoordinates
{
Latitude = facility.LocationLat,
Longitude = facility.LocationLng,
}
},
Location = _fakeBookingSystem.Database.GetPlaceById(facility.PlaceId),
FacilityType = new List<Concept> {
new Concept
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ protected override async Task TriggerTestAction(OpenBookingSimulateAction simula
}
return;
case ChangeOfLogisticsLocationSimulateAction _:
if (!await _fakeBookingSystem.Database.UpdateSessionSeriesLocationLatLng(idComponents.ScheduledSessionId.Value, 0.2m, 0.3m))
if (!await _fakeBookingSystem.Database.UpdateSessionSeriesLocationPlaceId(idComponents.ScheduledSessionId.Value))
{
throw new OpenBookingException(new UnknownOpportunityError());
}
Expand Down
Loading
Loading