feat(config): add ha org slug, ha form name, pk activity name config
This commit is contained in:
parent
40c41fd930
commit
91f74a8a34
2 changed files with 27 additions and 12 deletions
21
src/main.rs
21
src/main.rs
|
|
@ -18,10 +18,16 @@ struct Config {
|
|||
helloasso_proxy: Option<String>,
|
||||
helloasso_email: String,
|
||||
helloasso_password: String,
|
||||
|
||||
helloasso_organization_slug: String,
|
||||
helloasso_form_name: String,
|
||||
|
||||
paheko_proxy: Option<String>,
|
||||
paheko_base_url: String,
|
||||
paheko_client_id: String,
|
||||
paheko_client_secret: String,
|
||||
|
||||
paheko_target_activity_name: String,
|
||||
paheko_accounting_year_id: u64,
|
||||
}
|
||||
|
||||
|
|
@ -221,16 +227,11 @@ async fn launch_adapter() -> Result<()> {
|
|||
email: config.helloasso_email,
|
||||
password: config.helloasso_password
|
||||
};
|
||||
let auth_client: helloasso::AuthentifiedClient = get_auth_client_from_cache(&mut user_cache, &mut ha_client, login_payload).await?;
|
||||
let auth_client: helloasso::AuthentifiedClient =
|
||||
get_auth_client_from_cache(&mut user_cache, &mut ha_client, login_payload).await?;
|
||||
|
||||
// FIXME: make it configurable
|
||||
let ha_org_slug = "l-etoile-de-bethleem-association-des-amis-de-la-chapelle-de-bethleem-d-aubevoye";
|
||||
// FIXME: make it configurable
|
||||
let pk_target_campaign_name = "Cotisation 2023-2024";
|
||||
let ha_form_name = "2023-2024";
|
||||
|
||||
let org: helloasso::Organization = auth_client.organization(ha_org_slug);
|
||||
let answers = org.get_form_answers(ha_form_name).await?;
|
||||
let org = auth_client.organization(&config.helloasso_organization_slug);
|
||||
let answers = org.get_form_answers(&config.helloasso_form_name).await?;
|
||||
|
||||
// dbg!(&answers);
|
||||
println!("Got {} answers to the membership form. Processing...", &answers.len());
|
||||
|
|
@ -327,7 +328,7 @@ async fn launch_adapter() -> Result<()> {
|
|||
|
||||
let mut pk_membership = paheko::Membership {
|
||||
id: generate_id(),
|
||||
campaign_name: pk_target_campaign_name.to_string(),
|
||||
campaign_name: config.paheko_target_activity_name.clone(),
|
||||
// FIXME: handle errors
|
||||
mode_name: serde_json::to_value(answer.mode.clone())
|
||||
.unwrap().as_str().unwrap().to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue