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

implement a flag for paying out Gratipay 1.0 balances #3535

Merged
merged 8 commits into from
Jun 11, 2015
Merged

Conversation

chadwhitacre
Copy link
Contributor

For use on #3481.

There are going to be two ways to resolve a Gratipay 1.0 balance, either
we release it, or we refund it. We release it the first payday after
someone becomes a team owner, or (now) when we set `pending-payout`. At
this point I don't think we'll need a `pending-refund` value. I've
changed `{un,}released` to `{un,}resolved` to cover both cases, release
and refund. I implemented the status update in Postgres to cover both
payday and masspay.
@chadwhitacre
Copy link
Contributor Author

Ready for review, @rohitpaulk, et al. We need this for tomorrow's payday.

AND network = 'balanced-ba'
) > 0
FROM exchange_routes r
JOIN participants p ON p.id = r.participant
Copy link
Contributor

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 to current_exchange_routes would solve the problem?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could end up paying people double their balance

SELECT COUNT(*)
  FROM participants p
 WHERE (
 SELECT COUNT(*)
   FROM exchange_routes r
  WHERE network='paypal'
    AND r.participant = p.id
) > 1; -- returns 0

Hasn't happened till now.

Copy link
Contributor

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 with current_exchange_routes in both places should solve the problem.

@chadwhitacre
Copy link
Contributor Author

Blech, forgot the UI for this. :)

@chadwhitacre chadwhitacre mentioned this pull request Jun 11, 2015
@chadwhitacre
Copy link
Contributor Author

Okay @rohitpaulk, how does it look now?

@rohitpaulk
Copy link
Contributor

Looks good now.

@chadwhitacre
Copy link
Contributor Author

Okay! I'll let you merge when Travis is green. Diving in on #3538 ...

rohitpaulk added a commit that referenced this pull request Jun 11, 2015
implement a flag for paying out Gratipay 1.0 balances
@rohitpaulk rohitpaulk merged commit 043889f into master Jun 11, 2015
@rohitpaulk rohitpaulk deleted the 1.0-balances branch June 11, 2015 16:38
@chadwhitacre
Copy link
Contributor Author

Gah, still forgot the UI for this. :)

@chadwhitacre
Copy link
Contributor Author

New PR for that: #3542.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants