Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Pay out for pending-release participants
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jun 11, 2015
1 parent c97316b commit a7ad836
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
5 changes: 3 additions & 2 deletions bin/masspay.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ def compute_input_csv():
---- Only include team owners
---- TODO: Include members on payroll once process_payroll is implemented
AND ( SELECT count(*)
AND (( SELECT count(*)
FROM teams t
WHERE t.owner = p.username
AND t.is_approved IS TRUE
AND t.is_closed IS NOT TRUE
) > 0
) > 0
OR p.status_of_1_0_balance='pending-release')
ORDER BY p.balance DESC
Expand Down
6 changes: 4 additions & 2 deletions gratipay/billing/payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,14 @@ def payout(self):
---- Only include team owners
---- TODO: Include members on payroll once process_payroll is implemented
AND ( SELECT count(*)
AND (( SELECT count(*)
FROM teams t
WHERE t.owner = p.username
AND t.is_approved IS TRUE
AND t.is_closed IS NOT TRUE
) > 0
) > 0
OR p.status_of_1_0_balance='pending-release')
""")
def credit(participant):
if participant.is_suspicious is None:
Expand Down
11 changes: 11 additions & 0 deletions sql/branch.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
BEGIN;

CREATE TYPE status_of_1_0_balance AS ENUM
('unreleased', 'pending-release', 'released', 'refunded');

ALTER TABLE participants
ADD COLUMN status_of_1_0_balance status_of_1_0_balance
NOT NULL
DEFAULT 'unreleased';

END;
4 changes: 2 additions & 2 deletions tests/py/test_billing_payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ def test_payout_ach_error_gets_recorded(self, ach_credit):
@mock.patch('gratipay.billing.payday.ach_credit')
def test_payout_pays_out_Gratipay_1_0_balance(self, ach):
alice = self.make_participant('alice', claimed_time='now', is_suspicious=False,
balanced_customer_href='foo',
last_ach_result='')
balanced_customer_href='foo', last_ach_result='',
balance=20, status_of_1_0_balance='pending-release')
Payday.start().payout()

assert ach.call_count == 1
Expand Down

0 comments on commit a7ad836

Please sign in to comment.