use serde::{Deserialize, Serialize};
use crate::error::Result;
use super::build_client;
use super::models::PaginatedResponse;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MerchantAggregate {
pub merchant: Option<String>,
pub parent: Option<String>,
pub date: Option<String>,
pub transaction_count: Option<f64>,
pub avg_transaction_value: Option<f64>,
pub total_spend: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct MerchantHierarchy {
pub merchant: Option<String>,
pub parent: Option<String>,
pub ticker: Option<String>,
pub category: Option<String>,
}
pub async fn merchant_aggregates(
params: &[(&str, &str)],
) -> Result<PaginatedResponse<MerchantAggregate>> {
let client = build_client()?;
client
.get("/v1/alternative/merchant-aggregates", params)
.await
}
pub async fn merchant_hierarchy(
params: &[(&str, &str)],
) -> Result<PaginatedResponse<MerchantHierarchy>> {
let client = build_client()?;
client
.get("/v1/alternative/merchant-hierarchy", params)
.await
}