gratipay / gratipay.com

Here lieth a pioneer in open source sustainability. RIP
https://gratipay.news/the-end-cbfba8f50981
MIT License
1.12k stars 308 forks source link

Add notification for missing credit card #4644

Closed mattbk closed 6 years ago

mattbk commented 7 years ago

On FD, someone wasn't paying in every 10 weeks on a $1/week donation. Turns out they didn't have a credit card set up.

These are all the banner notifications, yes? https://github.com/gratipay/gratipay.com/blob/4b5b0b3e287424a3e5b4179d49eddac44064f7e4/gratipay/utils/notifications.py

(Most of these I can dig up, just writing the questions down to come back to.)

todo

mattbk commented 7 years ago

We require a credit card to set up a gift initially, right?

mattbk commented 7 years ago

No! There's just a gentle reminder. We should make this a hard rule, because otherwise what's the point?

image

I'd also go so far (once this is fixed) as to email everyone who is giving but doesn't have a card set up to tell them that they aren't actually giving and need to set a card up.

mattbk commented 7 years ago

@whit537 can you query how many ~users are giving but don't have a credit card set up?

mattbk commented 7 years ago

I think it would be something like

    SELECT username
         , balance
         , (SELECT SUM(amount) FROM payment_instructions WHERE participant_id = p.id) AS giving
         , (SELECT COUNT(*) FROM payment_instructions WHERE participant_id = p.id AND amount > 0) AS ngiving_to
      FROM participants p
     WHERE (                                  -- They do not have a credit card set up
             SELECT COUNT(*)
               FROM exchange_routes r
              WHERE r.participant = p.id
              AND r.network = 'balanced-cc'
           ) = 0
       AND giving > 0
       AND NOT is_closed
  ORDER BY claimed_time

Modified from https://github.com/gratipay/gratipay.com/blob/992bf1bf03d256931f97a31dad8de6e254e43a29/www/dashboard/index.spt#L10.

chadwhitacre commented 7 years ago
(188 rows)
mattbk commented 7 years ago

Was my query right?

chadwhitacre commented 7 years ago

I didn't dig that deep, I just ran it. 🐭

mattbk commented 7 years ago

Are you feeling okay? Is now the time for me to submit PRs without tests? ;-)

chadwhitacre commented 7 years ago

I mean, I skimmed it for UPDATE DELETE and INSERT. :P