From 52c7da483683605c2927b00522b359261e02ce16 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Fri, 19 Jan 2024 21:43:28 +0100 Subject: [PATCH] fix(paheko): use linked_subscriptions on transaction import --- src/paheko.rs | 7 +++---- src/sync_paheko.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/paheko.rs b/src/paheko.rs index cd10ccf..e5e2e26 100644 --- a/src/paheko.rs +++ b/src/paheko.rs @@ -97,7 +97,7 @@ struct SimpleTransaction { debit_account_code: String, reference: String, linked_users: Vec, - linked_services: Vec, + linked_subscriptions: Vec, accounting_year: Id } @@ -520,9 +520,8 @@ impl AuthentifiedClient { for linked_id in transaction.linked_users { form = form.text("linked_users[]", format!("{}", linked_id.0)); } - // only possible with paheko fork - for linked_id in transaction.linked_services { - form = form.text("linked_services[]", format!("{}", linked_id.0)); + for linked_id in transaction.linked_subscriptions { + form = form.text("linked_subscriptions[]", format!("{}", linked_id.0)); } let res = self.client diff --git a/src/sync_paheko.rs b/src/sync_paheko.rs index 93a944b..539be41 100644 --- a/src/sync_paheko.rs +++ b/src/sync_paheko.rs @@ -245,7 +245,7 @@ pub async fn sync_paheko( kind: paheko::TransactionKind::Revenue, linked_users: pk_users_summaries.iter().map(|x| x.id.clone()).collect(), // the linked_services, depend on a patch to paheko API code to work (see https://forge.lefuturiste.fr/mbess/paheko-fork/commit/a4fdd816112f51db23a2b02ac160b0513a5b09c5) - linked_services: pk_user_service_registrations.iter().map(|x| x.id.clone()).collect() + linked_subscriptions: pk_user_service_registrations.iter().map(|x| x.id.clone()).collect() }; let _ = paheko_client.register_transaction(transaction) .await.context("Expected to create new paheko transaction")?;