taler-rust

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

commit f0f1480b60a9ae07f7b0f21a4c82106d7610e1ce
parent 20d95dafe4abacee0dc9f1ec1400958de632ef88
Author: Antoine A <>
Date:   Thu, 18 Jun 2026 13:24:12 +0200

common: all adapters must support kyc at least for testing

Diffstat:
Madapters/taler-cyclos/src/api.rs | 3---
Madapters/taler-cyclos/src/db.rs | 11+++++++----
Madapters/taler-magnet-bank/src/api.rs | 3---
Mcommon/taler-api/src/error.rs | 7++-----
Mcommon/taler-api/src/test.rs | 3---
Mcommon/taler-test-utils/src/routine.rs | 33++++++---------------------------
6 files changed, 15 insertions(+), 45 deletions(-)

diff --git a/adapters/taler-cyclos/src/api.rs b/adapters/taler-cyclos/src/api.rs @@ -515,7 +515,6 @@ mod test { &server.prefix("/taler-prepared-transfer"), &EXCHANGE, &EXCHANGE, - true, ) .await; } @@ -528,7 +527,6 @@ mod test { &server.prefix("/taler-prepared-transfer"), &EXCHANGE, &EXCHANGE, - true, tasks!({ in_talerable(db).await }), tasks!( { out_malformed(db).await }, @@ -547,7 +545,6 @@ mod test { &server.prefix("/taler-wire-gateway"), &server.prefix("/taler-revenue"), &EXCHANGE, - true, tasks!({ in_malformed(db).await }, { in_talerable(db).await },), tasks!({ out_malformed(db).await }, { out_talerable(db).await }, { out_bounce(db).await diff --git a/adapters/taler-cyclos/src/db.rs b/adapters/taler-cyclos/src/db.rs @@ -1071,17 +1071,20 @@ mod test { // Regular transaction routine(&None, &None).await; + let first = EddsaPublicKey::rand(); + let second = EddsaPublicKey::rand(); + // Reserve transaction routine( - &Some(IncomingSubject::Reserve(EddsaPublicKey::rand())), - &Some(IncomingSubject::Reserve(EddsaPublicKey::rand())), + &Some(IncomingSubject::Reserve(first.clone())), + &Some(IncomingSubject::Reserve(second)), ) .await; // Kyc transaction routine( - &Some(IncomingSubject::Kyc(EddsaPublicKey::rand())), - &Some(IncomingSubject::Kyc(EddsaPublicKey::rand())), + &Some(IncomingSubject::Kyc(first.clone())), + &Some(IncomingSubject::Kyc(first)), ) .await; diff --git a/adapters/taler-magnet-bank/src/api.rs b/adapters/taler-magnet-bank/src/api.rs @@ -479,7 +479,6 @@ mod test { &server.prefix("/taler-prepared-transfer"), &EXCHANGE, &EXCHANGE, - true, ) .await; } @@ -492,7 +491,6 @@ mod test { &server.prefix("/taler-prepared-transfer"), &EXCHANGE, &EXCHANGE, - true, tasks!({ in_talerable(db).await }), tasks!( { out_malformed(db).await }, @@ -511,7 +509,6 @@ mod test { &server.prefix("/taler-wire-gateway"), &server.prefix("/taler-revenue"), &EXCHANGE, - true, tasks!({ in_malformed(db).await }, { in_talerable(db).await },), tasks!({ out_malformed(db).await }, { out_talerable(db).await }, { out_bounce(db).await diff --git a/common/taler-api/src/error.rs b/common/taler-api/src/error.rs @@ -109,16 +109,13 @@ impl From<sqlx::Error> for ApiError { | sqlx::Error::PoolTimedOut => { (ErrorCode::GENERIC_DB_FETCH_FAILED, StatusCode::BAD_GATEWAY) } - _ => ( - ErrorCode::BANK_UNMANAGED_EXCEPTION, - StatusCode::INTERNAL_SERVER_ERROR, - ), + _ => (ErrorCode::GENERIC_DB_FETCH_FAILED, StatusCode::BAD_GATEWAY), }; Self { code, hint: None, status: Some(status), - log: Some(format!("db: {value}").into_boxed_str()), + log: Some(format!("{value}").into_boxed_str()), path: None, headers: None, } diff --git a/common/taler-api/src/test.rs b/common/taler-api/src/test.rs @@ -240,7 +240,6 @@ async fn admin_add_incoming() { &server.prefix("/taler-prepared-transfer"), &EXCHANGE, &EXCHANGE, - true, ) .await; } @@ -253,7 +252,6 @@ async fn in_history() { &server.prefix("/taler-prepared-transfer"), &EXCHANGE, &EXCHANGE, - true, tasks!(), tasks!(), ) @@ -267,7 +265,6 @@ async fn revenue() { &server.prefix("/taler-wire-gateway"), &server.prefix("/taler-revenue"), &EXCHANGE, - true, tasks!(), tasks!(), ) diff --git a/common/taler-test-utils/src/routine.rs b/common/taler-test-utils/src/routine.rs @@ -776,7 +776,6 @@ pub async fn revenue_routine( wire_gateway: &Router, revenue_api: &Router, debit_acount: &PaytoURI, - kyc: bool, register: Tasks<impl AsyncFnMut(usize)>, ignore: Tasks<impl AsyncFnMut(usize)>, ) { @@ -795,7 +794,7 @@ pub async fn revenue_routine( .await .assert_ok_json::<TransferResponse>(); }, - if kyc => { + { wire_gateway .post("/admin/add-kycauth") .json(json!({ @@ -828,7 +827,6 @@ pub async fn in_history_routine( prepared_transfer: &Router, debit_account: &PaytoURI, credit_account: &PaytoURI, - kyc: bool, register: Tasks<impl AsyncFnMut(usize)>, ignored: Tasks<impl AsyncFnMut(usize)>, ) { @@ -905,7 +903,7 @@ pub async fn in_history_routine( .await .assert_ok_json::<RegistrationResponse>(); }, - if kyc => { + { wire_gateway .post("/admin/add-kycauth") .json(json!({ @@ -916,7 +914,7 @@ pub async fn in_history_routine( .await .assert_ok_json::<TransferResponse>(); }, - if kyc => { + { key = Ed25519KeyPair::generate().unwrap(); let auth_pub = EddsaPublicKey::try_from(key.public_key().as_ref()).unwrap(); let account_pub = EddsaPublicKey::rand(); @@ -954,7 +952,7 @@ pub async fn in_history_routine( .await .assert_ok_json::<TransferResponse>(); }, - if kyc => { + { let auth_pub = EddsaPublicKey::try_from(key.public_key().as_ref()).unwrap(); let account_pub = EddsaPublicKey::rand(); prepared_transfer @@ -984,33 +982,14 @@ pub async fn admin_add_incoming_routine( prepared_transfer: &Router, debit_acount: &PaytoURI, credit_account: &PaytoURI, - kyc: bool, ) { let currency = &get_currency(wire_gateway).await; - add_incoming_routine( - wire_gateway, - prepared_transfer, - currency, - IncomingType::reserve, - debit_acount, - credit_account, - ) - .await; - add_incoming_routine( - wire_gateway, - prepared_transfer, - currency, - IncomingType::map, - debit_acount, - credit_account, - ) - .await; - if kyc { + for kind in IncomingType::entries { add_incoming_routine( wire_gateway, prepared_transfer, currency, - IncomingType::kyc, + *kind, debit_acount, credit_account, )