Table of Contents | ||
---|---|---|
|
Document Status |
| ||||||
---|---|---|---|---|---|---|---|
Document Owner(s) | |||||||
Reviewers |
Business Problem
The RBIberia relates that recent analyses have highlighted a significant risk of fraud in home delivery orders that are paid for using physical payment methods (Cash, terminal at home, voucher physical).
To safeguard our operations and protect both our business and customers from fraudulent activities, it is essential to implement additional rules that restrict the use of physical payments under certain scenarios. In these scenarios, there are some rules that can be controlled by the user can control, so we need to create a way for the user to change these rules to one or many restaurants.
These rules are:
First buy order on Home Delivery - : In first buy of the user order, the value to the user can pay with physical payments will have a limitation, e.g. $30.00
Buy on Home Delivery - : In the second or more buy of user order, the value to the user can pay with physical payments will have a limitation, e.g. $50.00;
Prevent Repeat Failures - : In cases where the last order involved a physical payment method and was marked as a delivery failure, the next order from the same user will be restricted to only online payment methods.
Delivery failure motivesreasons:
Wrong address
Customer was not there
Fake order
Problems with payment
In case some of these rules are active, the WL-app must hide the physical payments to the user.
UX Proposal - Payment Method Section
Decision
We will create a new screen on DOP and the user can choose and manipulate the "rules" “rules” to one or many restaurants. This information will be save saved on Sanity and the WL-app will get these values when choose the restaurant is chosen, so the WL-app can verify if allow it allows or not doesn’t the payment by physical method.
Summary the decision:
Store this information in restaurant on Sanity
...
Main local to store information about restaurant;
Added in
restaurant
the new typephysicalPaymentMethodsLimitations
schemas/menu/documents/restaurant.tsx
schemas/menu/objects/physical-payment-limitations.tsx
The information in Sanity is only
readyread-only
, to change this information is only by DOP.. Only DOP can change it.
...
The interface to receive this information is IDeliverOrderAmountLimit
This interface exists in many repositories:
intl-fulfillment-service
intl-whitelabel-graphql
intl-store-service
intl-packages
intl-whitelabel-app
intl-delivery-service
Manipulate this information on DOP (FZ-
...
Portal)
...
To enhance the functionality of managing rules and purchase limits for home deliveries, a new page
...
Create rules of access in this page, reference here;
...
The users can choose which rules they want to use;
...
The users can adjust the limit values to purchases in home delivery;
...
The users can make this to your restaurants;
...
The franchisees can change this information as well;
WL-app control the exhibition of physical payments;
...
will be created containing all the relevant information. This page allows users to perform several important actions.
Firstly, it will be possible to establish specific access rules for this page, ensuring that only authorized users can view and modify the information. The access rules will be detailed in this reference.
Users will have the ability to decide which rules they want to apply to their transactions. Additionally, they will be able to adjust the limit values for purchases in home deliveries, providing greater flexibility and control over financial operations.
This functionality is not limited to end users. Franchisees will also be able to access and modify this information, ensuring that all organizational levels can effectively manage their own settings.
To assist users in using this new page and its functionalities, a detailed guide will be made available through in this link.
Finally, all information configured by users will be saved in Sanity, using the Sanity Client Library to connect DOP with Sanity. This will ensure that the data is stored securely and is accessible for future consultations and modifications.
The mutation that controls updates in Sanity is located at
workspaces/graphql/src/schema/mutations/updateRestaurantCashLimitation.ts
.The pages are controlled in
workspaces/frontend/src/pages/payment-methods/index.ts
.
WL-app controls the exhibition of physical payments
On Home Delivery, the WL-App gets the information about the restaurant, and in this data, there are the values about cash limitation:
Zenuml sequence macro lite | ||||||
---|---|---|---|---|---|---|
| ||||||
...
With cash limitation data, the WL-App can validate if some rule is active and if
needit needs to hide physical payments
;This, following the order:
First order on Home Delivery: Verify if it is the user's first purchase in “home delivery” mode. To do this, perform a query using
useGetUserOrdersQuery
, which will return a counter indicating the number of orders in this service mode. If the counter is zero, validate if the purchase amount exceeds the maximum allowed value.Prevent Repeat Failures: In the next rule, you should check if the user's last “home delivery” order was canceled. If it was canceled for any of the reasons mentioned above and the payment was made physically, this will constitute a violation of this rule, resulting in a change to the available payment methods.
Buy on Home Delivery: In this rule, we must first check if it is not the first “home delivery” order. To do this, we use the same query from the first rule (
first delivery
), but here we validate if the counter is greater than zero. Then, we check if the purchase amount exceeds the defined limit.
More details about these rules, this control is by each user;
Create a new field- In
At the moment of payment, the WL-app
can get theretrieves information
of the last delivery order of user (getUserOrders
), and there are the restaurant information with the limitation rules, so we need to create a logic with this information and in case some limitation is true the physical payment is hiddenabout the user's most recent delivery order using the
getUserOrders
function. This includes restaurant details and any applicable limitation rules. Based on this information, we need to implement logic that hides the physical payment option if any limitation is met.For example, if it is the
first purchase of user ofuser's first home delivery
typepurchase,
we know this becausewhich we can determine if the
return 0 ordergetUserOrders
queryreturns zero orders of this type, and the selected restaurant
selectedhas a
limitationrule that the first purchase
need have a limit ofmust not exceed $30.00
, we know this because(as specified by the restaurant
return this's information
offrom Sanity
, and we have the order value in this screen because there are the order with the total value at this moment. So with all this information), then the WL-app can check the current order value on this screen. If the order total cents exceeds the limit, the WL-app will hide the physical payment options.
With all these details, the WL-app
is able to hide or not the physical payments
- In
Consequences
can effectively decide whether to display or hide the physical payment option.
Zenuml sequence macro lite | ||||||
---|---|---|---|---|---|---|
| ||||||
The system will validate all active rules. If any rule is violated, the payment methods will be limited to online payments only, such as credit card, PayPal, etc.
It is controlled through a hook called useCashLimitation
in the following: filesrc/pages/cart/payment/order-payment/use-cash-limitation.ts.
This hook is invoked in the Paycomet Payment screen located at:: src/pages/cart/payment/order-payment/paycomet-hosted-page-payment/paycomet-hosted-page-payment.tsx
All Payments | Only Online Payments |
---|---|
Consequences
Create new fields in Restaurant Document on Sanity to receive this informationstore Cash Limitation rules data;
Create a new screen on DOP (FZ-Portal) to so that user can manipulate this information and to send to Cash Limitation rules and store them on Sanity;
Use the Sanity Client Lib to get and save information on Sanity, this lib library is already available on DOP.
Create a new logic on WL-App in the payment page to control the exhibition of according to the information and limitation that get of limitations that are got from Restaurant;