This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
implement a flag for paying out Gratipay 1.0 balances #3535
Merged
+120
−57
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ba5b5d5
Stub a test for paying out Gratipay 1.0 balances
chadwhitacre c97316b
Harmonize payday and masspay payout selects
chadwhitacre a7ad836
Pay out for pending-release participants
chadwhitacre e081f28
Update new status field when balance goes to 0
chadwhitacre fc3e438
Fix enum value in masspay
rohitpaulk d58af0b
Clean and DRY the SQL behind payout and masspay
chadwhitacre 7506e5b
Reformat SQL for clarity
chadwhitacre f49da8c
I can't stop preening!!!
chadwhitacre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
BEGIN; | ||
|
||
CREATE TYPE status_of_1_0_balance AS ENUM | ||
('unresolved', 'pending-payout', 'resolved'); | ||
|
||
ALTER TABLE participants | ||
ADD COLUMN status_of_1_0_balance status_of_1_0_balance | ||
NOT NULL | ||
DEFAULT 'unresolved'; | ||
|
||
CREATE FUNCTION set_status_of_1_0_balance_to_resolved() RETURNS trigger AS $$ | ||
BEGIN | ||
UPDATE participants | ||
SET status_of_1_0_balance='resolved' | ||
WHERE id = NEW.id; | ||
RETURN NULL; | ||
END; | ||
$$ LANGUAGE plpgsql; | ||
|
||
CREATE TRIGGER update_status_of_1_0_balance | ||
AFTER UPDATE OF balance ON participants | ||
FOR EACH ROW | ||
WHEN (OLD.balance > 0 AND NEW.balance = 0) | ||
EXECUTE PROCEDURE set_status_of_1_0_balance_to_resolved(); | ||
|
||
END; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user had 4 old bank accounts and 1 active one, wouldn't this result in multiple calls to
ach_credit
with the same participant? Maybe changing this tocurrent_exchange_routes
would solve the problem?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the same bug afflict MassPay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it does - that's a serious bug, we could end up paying people double their balance :/ Here (ach payouts in payday), the worst case scenario is a few extra API calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hasn't happened till now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think replacing
exchange_routes
withcurrent_exchange_routes
in both places should solve the problem.