Rule 1 - First Order Physical Payment Limit
For a user's first order, if the total value is equal to or exceeds €20, only online payment methods will be permitted. The threshold value of €20 is configurable and can be adjusted as needed.
Feature toggle and configuration:
Create a new setting in the OpsPortal (DOP) that will allow each restaurant to set the limit.
Identification of First Orders:
We can determine whether an order is a user's first by utilizing the getUserOrders gateway query. This query retrieves all orders associated with the currently logged-in user and includes a count of these orders. Here is the process:
Trigger the
getUserOrders
when the payment method screen loads.The response includes all past orders of the user and a count of these orders.
Sample response of a user without any previous orders:
{ "data": { "userOrders": { "count": 0, "resumeAfter": null, "orders": [], "__typename": "OrderListResponse" } }
If the count is 0, indicating no previous orders, physical payment options should not be displayed.
This new rules ensures that users attempting their first purchase with a total of €20 or more are only presented with online payment options.