#491 Implementing an MVP Parcel Locker for Order Pickup
A parcel locker is an automated station for receiving and handing out parcels.
Orders are created in the marketplace, and parcel-locker pickup must be added as an option. An MVP is being launched for a small group of users and several parcel lockers in Moscow. When placing an order, the user may choose pickup from a parcel locker.
Implement the code for the MVP solution:
- A courier brings an order and tries to place it into a cell while specifying the order number. The parcel locker selects a cell itself and returns it. The calling code opens that cell;
- After the order is placed into a cell, the user receives an SMS with a pickup code. The order waits indefinitely;
- If any error occurs, the courier takes the order back and tries again the next day, which is acceptable for the MVP;
- The user may collect the order using the pickup code from the SMS. After the code is entered, the parcel locker must display the text "your order XXX is in cell YYY", and the cell opens automatically.
Constraints:
- All cells have the same size, but their number depends on the specific parcel locker;
- One order is one box, and it fits into a cell;
- The cells of every parcel locker are numbered;
- Every parcel locker stores its own state.
Use the UserNotificationApi client to send a message to the user:
class PostalBox {
private final UserNotificationApi notificationApi;
// implement methods for storing and handing out an order
}
This is a synchronous client that calls postalbox.notify.market.yandex.net. The interface implementation does not need to be described:
interface UserNotificationApi {
// describe the method or methods used to send the pickup-code message
// the response contains the pickup code that was sent to the user
}
Question review
Sign in to start the dialogue
The mentor keeps the context of the current question and your previous messages.
Sign in
Available with Premium
This is just one of the solutions available with Premium. And more:
- 250+ advanced lectures
- 1300+ practice exercises
- 500+ solutions to problems from real interviews
- Personalized Java Hub certificates
- Expanded access to the AI mentor