sphinx-tribes icon indicating copy to clipboard operation
sphinx-tribes copied to clipboard

Payment And Withdrawal Flow

Open elraphty opened this issue 1 year ago • 0 comments

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 true and payment_status of COMPLETED, then deducts the amount from the bounty budgets
  • If the payment is pending it sets bounty paid to false, then sets payment_pending (payment_pending is a new column added to make pending payments not editable) to true, it also sets the payment_history status to true and the payment_status will be set to PENDING, 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 FAILED and status as false i.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 COMPLETED the bounty paid property is set to true and the payment_pending property is set to false.
  • If the payment status is not COMPLETED, the bounty does not get updated.

elraphty avatar Oct 22 '24 16:10 elraphty