-
Notifications
You must be signed in to change notification settings - Fork 38
run Gratipay 238 #951
Comments
One 1.0 payout approved. |
No other accounts to review. |
Backup started ... |
Backup finished and verified. |
Script ran for 51 seconds (0:00:51.667995). |
MassPay submitted. |
Eff. Okay: I forgot to post MassPay back last week, which means that we never decreased people's balances last week, which means that we overpaid people this week. |
First: I'm sorry. 😞 |
Second ... what do we do? Hmm ... 🤔 |
If we can pull back from PayPal we should consider that first. |
https://developer.paypal.com/docs/classic/mass-pay/integration-guide/MassPayFAQ/#id09BDB200WHT All ours are claimed except one for 88¢. 😕 Next option! ... |
Decision taken in slack w/ @clone1018 @mattbk is to post back both masspays, which will send some balances negative, and then email affected users. |
Alright, so I don't think we need to mail anybody unless their balance is going negative. Can we predict who that will be? |
I think it will be those who had a payout in both weeks (last and this). If we paid them out last, then it doesn't matter that we forgot to record it because we didn't pay them out this week. Likewise, if we didn't pay them out last week, then there was nothing to post back, so this week's payout would have been the same anyway. |
Run in the logdir:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import csv
def extract_emails(date):
fp = open('{}.report.paypal.csv'.format(date))
for i in range(20):
next(fp)
as_list = [rec[1] for rec in csv.reader(fp)]
as_set = set(as_list)
assert len(as_list) == len(as_set)
return as_set
last_week = extract_emails('2016-12-15')
this_week = extract_emails('2016-12-22')
import pdb; pdb.set_trace() |
It makes sense that everyone from last week would be affected, since they're precisely the ones whose balances we didn't update last week. |
|
Alright, so what's our expectation? All 72 of those from last week will now have a negative balance, ya? In the amount of their payout last week? |
Spot-check: @mattbk. |
$2 payout last week, $4.34 this week. |
When we post back today's, that should take you down to $0 balance, and then when we post last week's that would take you down to -$2. 👍 |
|
Okay! How are we emailing them? /me checks Freshdesk for bcc ... |
Fees? |
/me gets distracted by #137 ... |
Hmm ... |
Fees are included, you should've gotten 1.96 of the 2.00, and 4.25 of the 4.34. Ya? |
So let's understand a little more about the set of users we're dealing with here—how the previously-negative relate to the currently negative, and why the currently negative are slightly fewer than we expected—and then get this mail out! |
Two of four previously negative balance participants have email addresses. Neither is affected here. |
I've manually created a sql file to load the emails of affected participants into a table. CREATE TABLE affected (email text not null);
INSERT INTO affected VALUES
('foo'),
[...] |
I've created this table in the production database. |
I'm working on a query to collate the two (affected and negative). |
SELECT * FROM (
SELECT id
, username
, balance
, (SELECT address
FROM current_exchange_routes
WHERE participant=participants.id
AND network='paypal'
) AS paypal
FROM participants
WHERE balance < 0
) _ full join affected ON email=paypal
ORDER BY affected is null
, paypal is null
, balance ASC; |
Ah! The nine declines didn't send the associated balances in Gratipay negative. |
That takes us from 72 down to 63. 👍 |
Okay, here are scripts that are giving me the set of participants whose balance we sent negative today, with their paypal address. #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import csv
def extract_emails(date):
fp = open('{}.report.paypal.csv'.format(date))
for i in range(20):
next(fp)
as_list = [rec[1] for rec in csv.reader(fp) if rec[5] != 'Denied']
as_set = set(as_list)
assert len(as_list) == len(as_set)
return as_set
last_week = extract_emails('2016-12-15')
this_week = extract_emails('2016-12-22')
affected = this_week & last_week
print("""\
DROP TABLE IF EXISTS affected;
CREATE TABLE affected (email text not null);
INSERT INTO affected VALUES
""")
n = len(affected)
for i, address in enumerate(sorted(affected), start=1):
print("('{}'){}".format(address, ',' if i < n else ';')) SELECT *
FROM ( SELECT id
, username
, balance
, (SELECT address
FROM current_exchange_routes
WHERE participant=participants.id
AND network='paypal'
) AS paypal
FROM participants
WHERE balance < 0
) _ join affected ON email=paypal
ORDER BY affected is null
, paypal is null
, balance ASC
, paypal
; |
Dumped addresses to a file with: CREATE TEMP TABLE combined AS (
SELECT *
FROM ( SELECT id
, username
, balance
, (SELECT address
FROM current_exchange_routes
WHERE participant=participants.id
AND network='paypal'
) AS paypal
FROM participants
WHERE balance < 0
) _ join affected ON email=paypal
ORDER BY affected is null
, paypal is null
, balance ASC
, paypal
);
\copy (SELECT paypal FROM combined) TO affected.txt WITH CSV; |
Question: if someone has a negative balance and a credit card on file, will we charge them next week to make up the difference? If so, how might we avoid that? |
Ten folks are in this boat. |
Seven of the ten have |
If they take enough next week, they won't be charged, right? |
I find a couple tests related to negative balances during payday: The second doesn't cover our situation, and I'm pretty sure the first doesn't either. Seems that the right next step would be to write some tests demonstrating current behavior for the cases we've got before us, and then decide what to do once we know what'll happen. |
Variant for seeing who has a credit card and who gives: SELECT balance, username, braintree, ngiving_to, giving, paypal
FROM ( SELECT id
, username
, balance
, ngiving_to
, giving
, (SELECT address
FROM current_exchange_routes
WHERE participant=participants.id
AND network='paypal'
) AS paypal
, (SELECT error
FROM current_exchange_routes
WHERE participant=participants.id
AND network='braintree-cc'
) AS braintree
FROM participants
WHERE balance < 0
) _ join affected ON email=paypal
ORDER BY affected is null
, paypal is null
, braintree is null
, braintree
, ngiving_to desc
, balance asc
, paypal
; |
Alright, done for now. I am going to try to work on this and get it done (tests written, emails sent) tomorrow morning. |
We really don't want to get support requests from people who, like @mattbk, noticed that their payout was larger than normal. We want to get ahead of that ... though I expect we'll have at least one or two by the time we get an email out. :-/ |
Alright! So we do charge people with a negative balance if they have a working card. I've made some tests that demonstrate this, and started a PR to change this behavior: gratipay/gratipay.com#4255. My plan is to send an email today stating that we will recoup the loss from their future taking only (not by charging their card) and that therefore no action is necessary on their part. We'll then need to land gratipay/gratipay.com#4255 before next Thursday in order to make that not a lie. :-) |
Sent: "We made a mistake. :-("
|
Alright, closing. I've put gratipay/gratipay.com#4255 and gratipay/gratipay.com#4256 on my radar for next week. |
!m @whit537 |
← Payday 237
Docs
http://inside.gratipay.com/howto/run-payday
Checklist
Rotation
The text was updated successfully, but these errors were encountered: