...
Technical Solution
intl-delivery-service
Task 1 - return nextOpenDate
in findEligible
function
In the file src/modules/restaurant/restaurant.service.ts have a function called
findEligible
and in these functions have another functionderiveEligibility
and in this function return errors of restaurant and return the next time that the restaurant open again, but now don’t use this, so we need to add this information.
Before:
...
After:
...
Just add nextOpenDate
in lines 174 and 175.
And the returned this function need to change too, because need pass the parameter
nextOpenDate
and adjusted of logic to return the data in case ofeligible
equals the false, in this validation we can validate if not have none eligible, so we use ineligible.
Before:
...
After:
...
Task 2 - Validate if restaurant is closed and fire a throw exception
In the file src/modules/quote/quote.service.ts in
retrieveFirstQuote
function, we can get these informations in thegetEligibleDeliveryRestaurantData
function, because now return the errors and the nextOpenDate.
After this changes, we can validate if a restaurant has closed and create a new throw for closed restaurant QuoteRestaurantClosedError
with this we can to go for catch of retrieveFirstQuote
function.
Just an example to fire throw:
...
Task 3 - Change of return in catch for return correct status
In the file src/modules/quote/quote.service.ts in
retrieveFirstQuote
function we can adjust the return in catch and in this catch we can get the error of restaurant closed and manipulate this error, and change for return the status correct and the nextOpenDate.
...
The return after this changes:
...
POC intl-delivery
We made a POC for this in this link: https://github.com/rbilabs/intl-delivery-service/pull/470
...
In the file of this component we need to change some things for work, for example we need to tranform in a React component and pass the atribute for next open date.
...
The POC of this solution:
https://github.com/rbilabs/intl-whitelabel-app/pull/2422