sphinx-tribes
sphinx-tribes copied to clipboard
Payment And Withdrawal Flow
Context
These are the flows to pay a bounty and withdraw from a Workspace.
Payment
Payment is handled with MakeBountyPayment
- If the payment is completed it sets the bounty to paid = true, adds the payment to the payment history with a status of
trueand payment_status ofCOMPLETED, then deducts the amount from the bounty budgets - If the payment is pending it sets bounty paid to
false, then setspayment_pending(payment_pending is a new column added to make pending payments not editable) to true, it also sets the payment_history status totrueand the payment_status will be set toPENDING, then deducts the amount from the bounty budgets - When the payment fails, it adds the payment to the payment history setting the payment_status as
FAILEDand status asfalsei.e it won't be shown on the payment_history anymore, and also won't deduct the budget balance
Retry Pending Payments
When a payment is pending, and a request is made from the web app to update a payment status UpdateBountyPaymentStatus
- It checks the V2 Bot for the status of the payment
- If the payment status is
COMPLETEDthe bounty paid property is set totrueand the payment_pending property is set to false. - If the payment status is not
COMPLETED, the bounty does not get updated.