openactive / OpenActive.Server.NET

.NET server library, including an OpenActive Reference Implementation
MIT License
0 stars 7 forks source link

prepayment implementation notes #54

Open nickevansuk opened 3 years ago

nickevansuk commented 3 years ago

1. For the first table of https://openactive.io/open-booking-api/EditorsDraft/#booking-without-payment

https://github.com/openactive/OpenActive.Server.NET/blob/5c117d1abd779696a3a2f6f5547715a92c32c31e/OpenActive.Server.NET/OpenBookingHelper/OrderCalculations/OrderCalculations.cs#L70-L70

AugmentOrderWithTotals should include logic to set order.TotalPaymentDue.Prepayment based on e.g. order.OrderedItem.Any(x => x.AcceptedOffer.Prepayment == RequiredStatusType.Required) (according to the first table in the spec)

2. For the second table of https://openactive.io/open-booking-api/EditorsDraft/#booking-without-payment

https://github.com/openactive/OpenActive.Server.NET/blob/29cff7750305c3a45a50f9d32fe70e5f8c419aaf/OpenActive.Server.NET/StoreBookingEngine/StoreBookingEngine.cs#L613-L613

Logic in CheckOrderIntegrity needs to be updated to inspect the responseOrder.TotalPaymentDue?.Prepayment and then include logic within it to implement the errors UnnecessaryPaymentDetailsError and MissingPaymentDetailsError based on the second table in the spec and https://openactive.io/open-booking-api/EditorsDraft/#payment-error-conditions

3. Fake booking system stores Prepayment next to Price (to be outputted within the Offer)

FakeBookingSystem random data must include Prepayment, just randomly for now.

4. Stores and feeds need to pull through Prepayment from the FakeBookingSystem

The following should include Prepayment = pulled from the fake database

https://github.com/openactive/OpenActive.Server.NET/blob/b87ccae7eb00efe9fe74da125dad84750263128a/Examples/BookingSystem.AspNetCore/Stores/SessionStore.cs#L186-L193

https://github.com/openactive/OpenActive.Server.NET/blob/d3b839fdcafba5c0dbf9e3b2032b190e3d722873/Examples/BookingSystem.AspNetCore/Feeds/SessionsFeeds.cs#L122-L141

5. Test interface

Stores need to implement TestOpportunityBookablePrepaymentOptional and TestOpportunityBookablePrepaymentUnavailable

lukedawilson commented 3 years ago

ToDo: @lukedawilson test the following:

lukedawilson commented 3 years ago

ToDo: @nickevansuk create the following:

nickevansuk commented 3 years ago

Note for TestOpportunityBookableFreePrepaymentOptional and TestOpportunityBookableFreePrepaymentRequired we should: