bachs-sdk 0.1.0

Unofficial Rust SDK for the Bachs API — payments and billing for internet businesses.
Documentation
use crate::client::Bachs;
use crate::common::FlexObject;
use crate::error::BachsResult;
use reqwest::Method;
use serde::Deserialize;

/// A supported payment method / network (e.g. card, mobile money, bank
/// transfer) available to your account, along with which currencies and
/// countries it covers.
#[derive(Debug, Clone, Deserialize)]
pub struct PaymentRail {
    #[serde(default)]
    pub id: Option<String>,
    #[serde(default)]
    pub name: Option<String>,
    #[serde(default)]
    pub enabled: Option<bool>,
    #[serde(default)]
    pub countries: Vec<String>,
    #[serde(default)]
    pub currencies: Vec<String>,
    #[serde(flatten)]
    pub extra: FlexObject,
}

pub struct PaymentRails<'a> {
    pub(crate) client: &'a Bachs,
}

impl<'a> PaymentRails<'a> {
    pub async fn list(&self) -> BachsResult<Vec<PaymentRail>> {
        self.client
            .send::<(), _>(Method::GET, "/v1/payment-rails", None, None, None)
            .await
    }
}