taler-rust

GNU Taler code in Rust. Largely core banking integrations.
Log | Files | Refs | Submodules | README | LICENSE

commit 0c297ca460bccbae40934d2c3a6dd2bcfe39a324
parent 4071009a46ea4d0b9f1ed418fe27d4037b3a1254
Author: Antoine A <>
Date:   Thu, 30 Jul 2026 15:34:42 +0200

wise: log failure to parse account info

Diffstat:
Madapters/taler-wise/db/wise-procedures.sql | 2+-
Madapters/taler-wise/src/wise_api/client.rs | 10+++++++---
Madapters/taler-wise/src/worker.rs | 28+++++++++++++++++++---------
Madapters/taler-wise/wise.conf | 2+-
4 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/adapters/taler-wise/db/wise-procedures.sql b/adapters/taler-wise/db/wise-procedures.sql @@ -126,7 +126,7 @@ IF out_pending THEN -- Delay talerable registration until mapping again INSERT INTO pending_recurrent_in (tx_in_id, authorization_pub) VALUES (out_tx_row_id, local_authorization_pub); -ELSIF in_type IS NOT NULL THEN +ELSIF in_type IS NOT NULL AND in_debit_payto IS NOT NULL THEN UPDATE prepared_in SET tx_in_id = out_tx_row_id WHERE ( diff --git a/adapters/taler-wise/src/wise_api/client.rs b/adapters/taler-wise/src/wise_api/client.rs @@ -23,6 +23,7 @@ use hyper::{ }; use jiff::Timestamp; use serde::de::DeserializeOwned; +use taler_common::types::amount::Currency; use thiserror::Error; use url::Url; @@ -111,6 +112,9 @@ impl<'a> Client<'a> { &self, profile_id: u64, balance_id: u32, + currency: &Currency, + start: Timestamp, + end: Timestamp, ) -> ApiResult<BalanceStatement> { Self::send( self, @@ -118,9 +122,9 @@ impl<'a> Client<'a> { Method::GET, format!("/v1/profiles/{profile_id}/balance-statements/{balance_id}/statement.json"), ) - .query("currency", "EUR") - .query("intervalStart", "2026-07-16T00:00:00.000Z") - .query("intervalEnd", Timestamp::now().to_string()), + .query("currency", currency) + .query("intervalStart", start) + .query("intervalEnd", end), ) .await } diff --git a/adapters/taler-wise/src/worker.rs b/adapters/taler-wise/src/worker.rs @@ -22,7 +22,7 @@ use regex::Regex; use sqlx::PgPool; use taler_api::subject::parse_incoming_unstructured; use taler_common::{ExpoBackoffDecorr, config::Config, types::payto::BankID}; -use tracing::{error, info, trace}; +use tracing::{error, info, trace, warn}; use crate::{ config::WorkerCfg, @@ -79,7 +79,7 @@ pub async fn run_worker( // Sync for balance in &cfg.balances { let stmt = client - .balance_statement(cfg.profile_id, balance.id) + .balance_statement(cfg.profile_id, balance.id, &balance.currency, "2026-07-16T00:00:00.000Z".parse().unwrap(), Timestamp::now() ) .await .unwrap(); let now = Timestamp::now(); @@ -93,7 +93,8 @@ pub async fn run_worker( parse_incoming_unstructured(&tx.details.payment_reference); // Parse sender account let payto = parse_account(&tx.details.sender_account); - let tx = TxIn { + // + let t = TxIn { balance_id: balance.id, wise_ref: Some(tx.reference_number), amount: tx.amount.into(), @@ -103,12 +104,15 @@ pub async fn run_worker( value_at: tx.date, }; let failure = - match register_tx_in(pool, &tx, &subject.ok(), &now).await? { + match register_tx_in(pool, &t, &subject.ok(), &now).await? { AddIncomingResult::Success { new, .. } => { if new { - info!(target: "worker", "in {tx}"); + info!(target: "worker", "in {t}"); + if t.debtor.is_none() { + warn!(target: "worker", "Couldn't parse creditor account from '{}'", tx.details.sender_account) + } } else { - trace!(target: "worker", "in {tx} already seen"); + trace!(target: "worker", "in {t} already seen"); } continue; } @@ -117,12 +121,15 @@ pub async fn run_worker( AddIncomingResult::MappingReuse => "mapping reuse", }; - match register_tx_in(pool, &tx, &None, &now).await? { + match register_tx_in(pool, &t, &None, &now).await? { AddIncomingResult::Success { new, .. } => { if new { - info!(target: "worker", "in {tx}: {failure}"); + info!(target: "worker", "in {t}: {failure}"); + if t.debtor.is_none() { + warn!(target: "worker", "Couldn't parse creditor account from '{}'", tx.details.sender_account) + } } else { - trace!(target: "worker", "in {tx} already seen: {failure}"); + trace!(target: "worker", "in {t} already seen: {failure}"); } continue; } @@ -136,6 +143,9 @@ pub async fn run_worker( } // then wait + if transient { + break Ok(()); + } jitter.reset(); tokio::time::sleep(cfg.frequency).await; info!(target: "worker", "running at frequency"); diff --git a/adapters/taler-wise/wise.conf b/adapters/taler-wise/wise.conf @@ -7,7 +7,7 @@ NAME = PROFILE_ID = # How often should worker run when no notification is received -FREQUENCY = 30m +FREQUENCY = 10m # Account token TOKEN =