- Client-side application sends POST to /client, specifying their user ID, the ID of the charging pad they wish to use, and the amount power they would like to purchase in the URL.
- ClientServlet makes sure no such transaction is already in progress, and after verifying this, it creates a new Transaction with the parameters specified.
- Server sends an invoice over email to the user via PayPal, charging them in full for the power that they specified they would like to purchase.
- The server gives some time for the client to complete the invoice, checking every couple of minutes to see whether the transaction has been paid for.
- After successful payment, the transaction is added to a Cache of active transactions, so that it may be processed.
- Client-side application would then set the client to a polling cycle, so that it would send GET periodically to inquire about the status of the transaction (to see whether it has been completed yet).
- Meanwhile, charging pads that are not actively charging a drone are on a GET poll cycle, periodically pinging the server to check if there are any active transactions for that specific pad that are waiting to be serviced. If there is an active transaction, the pad begins to charge the drone.
- After charging, the pad sends POST to mark the transaction as completed, the client would be notified with the next iteration of their poll cycle, and the transaction has been completed.
Eric Kong (server team): https://www.linkedin.com/in/erickong98/
Ashwinee Panda (charging pad team): https://www.linkedin.com/in/ashwineepanda/
Aakash Parikh (charging pad team): https://www.linkedin.com/in/aakashparikh/