Use auto payments with paypal (#472)

* Use auto payments with paypal

* Remove sandbox key
This commit is contained in:
Geometrically
2022-11-07 15:38:25 -07:00
committed by GitHub
parent 35891c74cd
commit 2c1bcaafc1
18 changed files with 1424 additions and 825 deletions

View File

@@ -1,7 +1,7 @@
use super::ids::*;
use crate::database::models::User;
use crate::models::teams::Permissions;
use crate::models::users::Badges;
use crate::models::users::{Badges, RecipientType, RecipientWallet};
use rust_decimal::Decimal;
pub struct TeamBuilder {
@@ -158,7 +158,9 @@ impl TeamMember {
SELECT tm.id id, tm.role member_role, tm.permissions permissions, tm.accepted accepted, tm.payouts_split payouts_split,
u.id user_id, u.github_id github_id, u.name user_name, u.email email,
u.avatar_url avatar_url, u.username username, u.bio bio,
u.created created, u.role user_role, u.badges badges, u.paypal_email paypal_email
u.created created, u.role user_role, u.badges badges, u.balance balance,
u.payout_wallet payout_wallet, u.payout_wallet_type payout_wallet_type,
u.payout_address payout_address
FROM team_members tm
INNER JOIN users u ON u.id = tm.user_id
WHERE tm.team_id = $1
@@ -186,7 +188,10 @@ impl TeamMember {
created: m.created,
role: m.user_role,
badges: Badges::from_bits(m.badges as u64).unwrap_or_default(),
paypal_email: m.paypal_email
balance: m.balance,
payout_wallet: m.payout_wallet.map(|x| RecipientWallet::from_string(&*x)),
payout_wallet_type: m.payout_wallet_type.map(|x| RecipientType::from_string(&*x)),
payout_address: m.payout_address
},
payouts_split: m.payouts_split
})))
@@ -221,7 +226,9 @@ impl TeamMember {
SELECT tm.id id, tm.team_id team_id, tm.role member_role, tm.permissions permissions, tm.accepted accepted, tm.payouts_split payouts_split,
u.id user_id, u.github_id github_id, u.name user_name, u.email email,
u.avatar_url avatar_url, u.username username, u.bio bio,
u.created created, u.role user_role, u.badges badges, u.paypal_email paypal_email
u.created created, u.role user_role, u.badges badges, u.balance balance,
u.payout_wallet payout_wallet, u.payout_wallet_type payout_wallet_type,
u.payout_address payout_address
FROM team_members tm
INNER JOIN users u ON u.id = tm.user_id
WHERE tm.team_id = ANY($1)
@@ -250,7 +257,10 @@ impl TeamMember {
created: m.created,
role: m.user_role,
badges: Badges::from_bits(m.badges as u64).unwrap_or_default(),
paypal_email: m.paypal_email
balance: m.balance,
payout_wallet: m.payout_wallet.map(|x| RecipientWallet::from_string(&*x)),
payout_wallet_type: m.payout_wallet_type.map(|x| RecipientType::from_string(&*x)),
payout_address: m.payout_address
},
payouts_split: m.payouts_split
})))