1
0

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 crate::database;
use crate::database::models;
use crate::database::models::project_item::QueryProject;
use crate::models::users::{Role, User, UserId};
use crate::models::users::{Role, User, UserId, UserPayoutData};
use crate::routes::ApiError;
use actix_web::http::header::HeaderMap;
use actix_web::web;
@@ -73,7 +73,12 @@ where
created: result.created,
role: Role::from_string(&result.role),
badges: result.badges,
paypal_email: result.paypal_email,
payout_data: Some(UserPayoutData {
balance: result.balance,
payout_wallet: result.payout_wallet,
payout_wallet_type: result.payout_wallet_type,
payout_address: result.payout_address,
}),
}),
None => Err(AuthenticationError::InvalidCredentials),
}

View File

@@ -2,7 +2,6 @@ pub mod auth;
pub mod env;
pub mod ext;
pub mod guards;
pub mod payout_calc;
pub mod routes;
pub mod validate;
pub mod webhook;

View File

@@ -1,22 +0,0 @@
use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime, NaiveTime, Utc};
pub fn get_claimable_time(
current: DateTime<Utc>,
future: bool,
) -> DateTime<Utc> {
let adder = if current.month() == 1 && !future {
(-1, 12)
} else if current.month() == 12 && future {
(1, 1)
} else {
(0, current.month())
};
DateTime::from_utc(
NaiveDateTime::new(
NaiveDate::from_ymd(current.year() + adder.0, adder.1, 16),
NaiveTime::default(),
),
Utc,
)
}