Skip to content

Commit 9aa06fb

Browse files
authored
Fix Mural payout status syncing (#4853)
* Fix Mural payout status syncing * Make Mural payout code more resilient * prepare sqlx * fix test
1 parent cfd2977 commit 9aa06fb

File tree

22 files changed

+1162
-1142
lines changed

22 files changed

+1162
-1142
lines changed

Cargo.lock

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/.sqlx/query-76cf88116014e3151db2f85b0bd30dba70ae62f9f922ed711dbb85fcf4ec5f7c.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ lettre = { workspace = true }
7272
meilisearch-sdk = { workspace = true, features = ["reqwest"] }
7373
modrinth-maxmind = { workspace = true }
7474
modrinth-util = { workspace = true, features = ["decimal", "utoipa"] }
75-
muralpay = { workspace = true, features = ["mock", "utoipa"] }
75+
muralpay = { workspace = true, features = ["client", "mock", "utoipa"] }
7676
murmur2 = { workspace = true }
7777
paste = { workspace = true }
7878
path-util = { workspace = true }

apps/labrinth/src/background_task.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::search::indexing::index_projects;
1010
use crate::util::anrok;
1111
use crate::{database, search};
1212
use clap::ValueEnum;
13-
use muralpay::MuralPay;
1413
use sqlx::Postgres;
1514
use tracing::{error, info, warn};
1615

@@ -39,7 +38,7 @@ impl BackgroundTask {
3938
stripe_client: stripe::Client,
4039
anrok_client: anrok::Client,
4140
email_queue: EmailQueue,
42-
mural_client: MuralPay,
41+
mural_client: muralpay::Client,
4342
) {
4443
use BackgroundTask::*;
4544
match self {
@@ -207,7 +206,10 @@ pub async fn payouts(
207206
info!("Done running payouts");
208207
}
209208

210-
pub async fn sync_payout_statuses(pool: sqlx::Pool<Postgres>, mural: MuralPay) {
209+
pub async fn sync_payout_statuses(
210+
pool: sqlx::Pool<Postgres>,
211+
mural: muralpay::Client,
212+
) {
211213
// Mural sets a max limit of 100 for search payouts endpoint
212214
const LIMIT: u32 = 100;
213215

apps/labrinth/src/models/v3/payouts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ pub struct TremendousForexResponse {
150150
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
151151
pub struct MuralPayDetails {
152152
pub payout_details: MuralPayoutRequest,
153-
pub recipient_info: muralpay::PayoutRecipientInfo,
153+
pub recipient_info: muralpay::CreatePayoutRecipientInfo,
154154
}
155155

156156
impl PayoutMethodType {

apps/labrinth/src/queue/payouts/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use dashmap::DashMap;
2121
use eyre::{Result, eyre};
2222
use futures::TryStreamExt;
2323
use modrinth_util::decimal::Decimal2dp;
24-
use muralpay::MuralPay;
2524
use reqwest::Method;
2625
use rust_decimal::prelude::ToPrimitive;
2726
use rust_decimal::{Decimal, RoundingStrategy, dec};
@@ -48,7 +47,7 @@ pub struct PayoutsQueue {
4847
}
4948

5049
pub struct MuralPayConfig {
51-
pub client: MuralPay,
50+
pub client: muralpay::Client,
5251
pub source_account_id: muralpay::AccountId,
5352
}
5453

@@ -77,11 +76,11 @@ impl Default for PayoutsQueue {
7776
}
7877
}
7978

80-
pub fn create_muralpay_client() -> Result<MuralPay> {
79+
pub fn create_muralpay_client() -> Result<muralpay::Client> {
8180
let api_url = env_var("MURALPAY_API_URL")?;
8281
let api_key = env_var("MURALPAY_API_KEY")?;
8382
let transfer_api_key = env_var("MURALPAY_TRANSFER_API_KEY")?;
84-
Ok(MuralPay::new(api_url, api_key, Some(transfer_api_key)))
83+
Ok(muralpay::Client::new(api_url, api_key, transfer_api_key))
8584
}
8685

8786
pub fn create_muralpay() -> Result<MuralPayConfig> {

0 commit comments

Comments
 (0)