openactive / open-booking-api

Repository for the Open Booking API specification
Other
2 stars 3 forks source link

Resolve prepayment ambiguity #171

Open nickevansuk opened 3 years ago

nickevansuk commented 3 years ago

(from @lukehesluke )

Is it possible for an Order to have multiple (non-free) OrderItems where some OrderItems have prepayment=Required and some have prepayment=Unavailable ?

It seems that it shouldn't be possible. e.g. if OrderItems have prices:

Then what is the totalPaymentDue of the order? It can't be:

Because this would prompt the broker to take £13 payment for the whole order, which is £6 too many.

And it can't be:

Because this would prompt the broker to inform the customer that all payment has been made. The customer would then find that they are expected to pay a further £6 when they arrive

An optional surplusPriceToPayAtTheVenue field (in PriceSpecification) seems like it would suffice. The broker could then use this to inform the customer that more payment will be required at the venue.

nickevansuk commented 3 years ago

Potentially another solution could be to not allow non-zero prepayment "Unavailable" items to be included in an Order where a prepayment is required.

So therefore if Payment is taken, the totalPaymentDue must equal the total of all the OrderItems. If Payment is not taken, then totalPaymentDue is the amount that must be paid at the venue.

This handles the most likely case of the Seller's prepayment policy being uniform across their opportunities, without adding additional complexity to the specification at this stage.

lukehesluke commented 3 years ago

That seems a good solution for now @nickevansuk . It's essentially a limitation being acknowledged and handled with acceptable trade-offs. It can be re-assessed at a later time if deemed necessary.

It will be important to document this in the spec so that Brokers know that they need to handle situations in which a customer wants to book items with different prepayment values - they could internally manage two OrderQuotes - one for prepaid and one for non-prepaid. Or they could just disallow customers from selecting multiple items with different prepayment requirements

nickevansuk commented 3 years ago

Ok great, in which case trying to book two items, oneTestOpportunityBookableNonFreePrepaymentRequired and one TestOpportunityBookableNonFreePrepaymentUnavailable should result in OpportunityIsInConflictError on each of the conflicting items.

We should add a test for this to a new prepayment-required-unavailable test suite feature and update the spec