liberapay / liberapay.com

Source code of the recurrent donations platform Liberapay
https://liberapay.com/
1.66k stars 213 forks source link

Teams 2.0 #1222

Open Changaco opened 6 years ago

Changaco commented 6 years ago

Donations to teams are currently inoperative, this issue is to discuss and record the progress on making teams operational again.

Changaco commented 6 years ago

Relevant thread: https://chaos.social/@rixx/100576894480186297

kindlyfire commented 6 years ago

Reading the Stripe docs, I think it should be possible to have some kind of "holding account" that each team would need to have, like this:

Stripe image

Here is the page it comes from. Though the example they give is one-to-many, not many-to-many.

mattbk commented 6 years ago

In the meantime, can teams be excluded from payday? I'm notified every week that I receive money, but don't actually.

mattbk commented 6 years ago

@kindlyfire I looked into that a little bit over at https://github.com/liberapay/liberapay.com/issues/1186#issuecomment-407901041. I think it would be worth looking into.

Which flavor of Stripe are you using? It looks like Stripe Connect Express is designed to "onboard recipients quickly and at scale" and Stripe Connect Custom would give you control over the whole pipeline. Example app is much easier to onboard than the form set up on Liberapay right now: https://stripe.com/docs/connect/express-accounts#express-demo Fees are different, though: https://stripe.com/us/connect/pricing ETA: Never mind, Express is US-only:

Users based in the United States: Express accounts are available only to individuals, businesses, and nonprofits located in the United States. Contact us if you are interested in support for users outside the U.S.

Changaco commented 6 years ago

@kindlyfire That only works within the same "region", so for example a team based in the EU wouldn't be able to transfer money to a member in the US. Anyway teams can't have their own Stripe/PayPal/etc account because they're not legal entities.

@mattbk Stripe's account types aren't relevant to the team issue.

mattbk commented 6 years ago

Dude, work with us here. Everyone is completely in the dark about how you are planning to proceed.

mal0ki commented 6 years ago

@mattbk I think they are in the dark themselves. Give them some time to think about solutions.

Sometimes work needs some extra time for ideas to process properly.

Thus far I've seen everyone on liberapay being very transparent, and sharing their thoughts and processes with us.

MartinDelille commented 6 years ago

@mal0ki You're right. The thing is that Liberapay team income are also falling down since the Mangopay crisis:

screenshot 2018-09-07 14 17 05
Changaco commented 6 years ago

Donations to teams are now operational again, but only in a simplistic way: every new payment is sent to a single team member (because we currently can't split a payment into transfers to multiple recipients). For single-member teams this isn't a problem, but for "real" teams this can lead to some members getting more money than others, at least temporarily (until new payments balance things out).

mattbk commented 6 years ago

To be clear, this post is to help understand what behavior the average user might see. I trust that things are going on behind the scenes, but others may not. Uncertainty is bad when money is involved.

I think the way teams work could be communicated better to the user. In my case, the only team I was receiving donations for was Liberapay, but although my notifications (at https://liberapay.com/about/me/notifications) say I am receiving money each week, I am obviously not:

image

Some questions another user like myself may ask:

Going from what is posted above, maybe this shows my "average" received over time (how long?) and I will eventually get the money that is promised via PayPal or Stripe donation individually?


The way I imagine this happening is:

Team A consists of these takes: Alice 1.00 Bob 0.50 Charlie 0.25

They have some donors, and each week the donations are split up 1:1 to get everyone as close as possible to the takes as they are set (that sounds like some fun math).

Three donors: Dan 1.50 Evan 0.20 Fran 0.75

So does it work like this? Alice gets 1.50 from Dan (150% of take) Bob gets 0.75 from Fran (150% of take) Charlie gets 0.20 from Evan (80% of take)

Then the next week rolls around. I assume Charlie gets more this week because he got less last week. Over what time period are the takes being averaged?

I can crawl through https://github.com/liberapay/liberapay.com/pull/1245/files and try to figure this out, but any clarity would help.


If there is a ledger keeping track of everyone's asynchronous team takes, it seems like this should be exposed to the user directly in some way, rather than obfuscating it behind the number that is being shown in the notifications.

Changaco commented 6 years ago

@mattbk No, there's no "average". The income amount in the weekly notification is the sum of the active donations for that week, basically the same number displayed publicly on profile pages (except for users who hide their income). It's an exact number, not an average, and under normal circumstances it's a rather stable number.

mattbk commented 6 years ago

If my account is alone in seeing a value in the notification that is reflected nowhere else, I will open a new ticket. But the 1.41, 1.38, 1.31 reflected in the screenshot above doesn't show up in my wallet or ledger.

Changaco commented 6 years ago

The ledger page only shows real payments, it's not designed to tell you how much you get per week.

The 1.41, 1.38, 1.31 appear in your public income history (this data, displayed on your profile page if you click on the "View income history" button):

[
    {
        "date": "2018-09-19",
        "npatrons": 3,
        "receipts": {
            "amount": "1.31",
            "currency": "USD"
        }
    },
    {
        "date": "2018-09-12",
        "npatrons": 4,
        "receipts": {
            "amount": "1.38",
            "currency": "USD"
        }
    },
    {
        "date": "2018-09-05",
        "npatrons": 4,
        "receipts": {
            "amount": "1.41",
            "currency": "USD"
        }
    },
    {
        "date": "2018-08-29",
        "npatrons": 4,
        "receipts": {
            "amount": "1.46",
            "currency": "USD"
        }
    },
...
jelv commented 6 years ago

I get the same messages from the Liberapay team"Your Liberapay income is approximately €0.88 this week / Donations for your role in the Liberapay team: €0.47 and $0.47 from 3 donors." but there is none in my account "You have €0.12 in your account."

trebmuh commented 6 years ago

@jelv the money is now going straight from a donor to a receiver account. No money is hold anymore in the "wallet" which was the old system (mangopay).

jelv commented 6 years ago

@trebmuh I know. But the problem is that message. I have only have PayPal connected and I don't receive anything on it. Why do I get that message?

mattbk commented 6 years ago

@trebmuh, is this the same question that is answered at https://github.com/liberapay/liberapay.com/issues/1265? Just linking the tickets together.

trebmuh commented 6 years ago

@mattbk I'm not sure

trebmuh commented 6 years ago

I spotted something on https://liberapay.com/Liberapay/income/ and I'm not sure what to think of that. On the last few weeks (maybe 3 or 4, I'm not sure), I'm seeing that 3 members of the liberapay team (jelv, Vej, and myself) which are asking for a something in the "Nominal Take" column (Next Payday) are given 0 in the "Actual Take" column (Next Payday).

Note that there is still some leftover.

I thought that it might have been because I had only a paypal account, so I created/connected a Stripe one a few days ago, but it still displays the same.

I'm wondering if it can be the same for other teams as well.

@Changaco : any idea/clarification on what's going on here?

lp-team-bogue

Changaco commented 5 years ago

@trebmuh I don't have a good explanation yet, but clearly there still are some bugs to fix.

As you can see in the raw data below, almost all the members who have a negative paid_in_advance (due to the bug that was fixed by #1245) also have an actual_take lower than it should be. That could be a clue.

select p.username, t.member, t.amount, (t.actual_amount).amounts, t.paid_in_advance
  from current_takes t join participants p on p.id = t.member where t.team = 3
 order by p.username;
    username    | member |    amount    |         actual_amount          | paid_in_advance 
----------------+--------+--------------+--------------------------------+-----------------
 aandis         |    662 | (0.00,EUR)   | {}                             | (0.00,EUR)
 aggsol         |   4975 | (0.00,EUR)   | {}                             | (9.80,EUR)
 Bisqwit        |  23125 | (2.00,EUR)   | {"EUR": "0.71", "USD": "0.24"} | (64.91,EUR)
 Calinou        |    449 | (0.00,EUR)   | {}                             | (0.00,EUR)
 CaptainMuon    |   1573 | (0.00,EUR)   | {}                             | (0.00,EUR)
 Changaco       |      1 | (200.00,EUR) | {"EUR": 87.67, "USD": 3.95}    | (3372.35,EUR)
 daniele        |   4724 | (0.30,EUR)   | {"EUR": 0.14}                  | (5.22,EUR)
 dasj19         |  34551 | (1.00,EUR)   | {"EUR": 0.46}                  | (10.34,EUR)
 EdOverflow     |   3805 | (15.00,EUR)  | {"USD": "7.79"}                | (121.43,EUR)
 eldelacajita   |  11013 | (0.00,EUR)   | {}                             | (1.05,EUR)
 Evild67        |   1123 | (10.00,EUR)  | {"EUR": 4.56}                  | (125.08,EUR)
 finkiki        |     65 | (0.10,EUR)   | {"EUR": 0.05}                  | (4.41,EUR)
 hugoroger      |   5211 | (0.50,EUR)   | {"EUR": 0.23}                  | (6.24,EUR)
 Jelv           |   5735 | (2.00,EUR)   | {}                             | (-4.27,EUR)
 jorgesumle     |   5840 | (1.00,EUR)   | {"EUR": "0.39", "USD": "0.08"} | (100.52,EUR)
 karel_origin   | 152001 | (10,EUR)     | {"EUR": 4.56}                  | (85.12,EUR)
 Katharsisdrill |   5796 | (0.15,EUR)   | {"USD": 0.08}                  | (4.29,EUR)
 KindlyFire     |   1043 | (10.00,EUR)  | {"EUR": 4.56}                  | (210.22,EUR)
 LiberapayOrg   |     12 | (50.00,EUR)  | {"EUR": 22.79}                 | (118.99,EUR)
 m4sk1n         |  10335 | (0.14,EUR)   | {"EUR": 0.07}                  | (3.16,EUR)
 martindelille  |     17 | (4.00,EUR)   | {"EUR": "0.17"}                | (-5.19,EUR)
 mattbk         |    497 | (0.05,USD)   | {"USD": 0.03}                  | (29.75,USD)
 mnh48          |  33108 | (2.00,USD)   | {"USD": 0.92}                  | (52.93,USD)
 morvanc        |     10 | (0.00,EUR)   | {}                             | (0.00,EUR)
 mrousseaux     |    129 | (0.00,EUR)   | {}                             | (0.00,EUR)
 nijel          |    119 | (1,EUR)      | {"EUR": 0.46}                  | (8.57,EUR)
 pgno           |    733 | (0.00,EUR)   | {}                             | (0.00,EUR)
 pskosinski     |  11723 | (0.00,EUR)   | {}                             | (0.00,EUR)
 remmy          |  12729 | (0.01,EUR)   | {"USD": "0.01"}                | (2.52,EUR)
 revi           |    703 | (5.00,EUR)   | {"EUR": "2.04", "USD": "0.27"} | (80.86,EUR)
 Skyblade       |  11007 | (3.00,EUR)   | {"EUR": 1.37}                  | (17.31,EUR)
 taufiqsumadi   |   3478 | (2.00,EUR)   | {"EUR": 0.92}                  | (7.56,EUR)
 trebmuh        |   4696 | (5.00,EUR)   | {}                             | (-11.14,EUR)
 Vej            |  52841 | (0.02,EUR)   | {}                             | (-0.14,EUR)
 Zatalyz        |      2 | (0.01,EUR)   | {"EUR": "0.01"}                | (-0.10,EUR)
 Zveryok        |  28807 | (0.00,EUR)   | {}                             | (0.00,EUR)
(36 rows)
Changaco commented 5 years ago

I've found the bugs in the code that determines which team member a new payment should go to.

MartinDelille commented 5 years ago

@Changaco Concerning my take: I've set it up to 4€ per week so why is the actual_amount so low (0.17€) comparing to other team members?

Changaco commented 5 years ago

Any member with a negative paid_in_advance should have an actual_amount of zero until new payments fix that deficit. The 17 cents are a mistake computed by a part of the code that behaves as if we were still processing transfers between wallets.

Changaco commented 5 years ago

The bug fixes have been deployed.

MartinDelille commented 5 years ago

Strange: my actual amount is now 0€

trebmuh commented 5 years ago

@Changaco if I understand it correctly, because I have 11,14€ "paid in advance", I'll see some changes on https://liberapay.com/Liberapay/income/ in 3 paydays, right?

trebmuh commented 5 years ago

@Changaco keeping you in the loop, starting this night at around 1am, I've started to receive paypal notifications (3 different ones) that people donated to me for my role in the Liberapay team.

Changaco commented 5 years ago

That's good news @trebmuh, thanks.

if I understand it correctly, because I have 11,14€ "paid in advance", I'll see some changes on https://liberapay.com/Liberapay/income/ in 3 paydays, right?

No. A negative paid_in_advance means that Liberapay has told you in the past that you received money, when in fact you hadn't. As mentioned previously this was due to the bug fixed by #1245, it's a temporary situation that only affects a small number of users, mostly Liberapay team members if I remember correctly. As soon as you've received more than €11.14 in new payments you'll see your actual_take increase.

mattbk commented 5 years ago

Why do some of the amounts in your table have quotation marks around them? E.g., "7.79" in

EdOverflow     |   3805 | (15.00,EUR)  | {"USD": "7.79"}                | (121.43,EUR)
trebmuh commented 5 years ago

@Changaco thanks for this clear explanation :+1:

Changaco commented 5 years ago

@mattbk Technical "limitation", I didn't find a simple way to typecast to strings in pgSQL. The quoted values are from the Python code.

trebmuh commented 5 years ago

FWIW, myself's case seems to be back in shape with something in the "Actual Take".