Link customer ID to Anrok transaction (#4509)

* Mark transactions with unresolvable addresses as unresolved

* Add customer_name + customer_id to anrok transactions

* Increase rate of Anrok syn

* Remove timer from update_tax_transactions

* chore: query cache, clippy, fmt
This commit is contained in:
François-Xavier Talbot
2025-10-06 17:06:57 +01:00
committed by GitHub
parent dbc64afe48
commit 9589e23118
6 changed files with 97 additions and 51 deletions

View File

@@ -89,7 +89,7 @@ impl TryFrom<ChargeQueryResult> for DBCharge {
}
macro_rules! select_charges_with_predicate {
($predicate:tt, $param:ident) => {
($predicate:tt $(, $( $param0:expr $(, $param:expr)* $(,)? )?)?) => {
sqlx::query_as!(
ChargeQueryResult,
r#"
@@ -107,7 +107,7 @@ macro_rules! select_charges_with_predicate {
FROM charges
"#
+ $predicate,
$param
$( $( $param0, $( $param ),* )? )?
)
};
}
@@ -344,6 +344,7 @@ impl DBCharge {
/// Charges are locked.
pub async fn get_missing_tax_identifier_lock(
exec: impl sqlx::Executor<'_, Database = sqlx::Postgres>,
offset: i64,
limit: i64,
) -> Result<Vec<DBCharge>, DatabaseError> {
let res = select_charges_with_predicate!(
@@ -354,8 +355,10 @@ impl DBCharge {
AND payment_platform_id IS NOT NULL
ORDER BY due ASC
FOR NO KEY UPDATE SKIP LOCKED
LIMIT $1
OFFSET $1
LIMIT $2
",
offset,
limit
)
.fetch_all(exec)