playfinder / openactive

A place to submit issues with the Bookteq Openactive feeds
0 stars 0 forks source link

UnnecessaryPaymentDetailsError not implemented #3

Open nickevansuk opened 9 months ago

nickevansuk commented 9 months ago

If payment is supplied for a free opportunity, UnnecessaryPaymentDetailsError must be returned.

An example UnnecessaryPaymentDetailsError is as follows (this is the entire response):

{
  "@context": "https://openactive.io/",
  "@type": "UnnecessaryPaymentDetailsError",
  "name": "The 'payment' property of the 'Order' is provided when it is expected to be absent.",
  "description": "Orders without prepayment must have zero price."
}

Test result below: free-opportunities_opportunity-free-unnecessary-payment-error_OpenBookingSimpleFlow_IndividualFacilityUseSlot.md

nathansalter commented 7 months ago

Surely we can just compare the payment property against what we expect? Is there anything inherently wrong with a payment of zero? An example of this could be if you've pre-authenticated the original offer amount, but the user has a 100% discount. It's useful metadata for the booking system to have some information regarding that payment.

lukehesluke commented 6 days ago

I think this part of the example might be slightly misleading:

"description": "Orders without prepayment must have zero price."

The price is handled spearately in the totalPaymentDue field.

The payment field, in an Order, represents an actual payment made by the customer, which is why it has data like Stripe payment details in it.

So if this field is included in a B request, it means that a payment is actually in the process of being extracted from the user (e.g. via Stripe). Therefore, it's useful for the Booking System to reject these requests to demonstrate to the client that this payment is being made erroneously and so should be cancelled rather than completed.