billecta 1.14.0

Generated Billecta API
Documentation
//! # Debtors
//!
//! Debtors in the system are equal to a creditor customer. Debtors can be both an individual
//! or an organization. Use the same property OrgNo regardless if it is person/social security
//! number or an organizational number.
//!
use crate::{
    AddMultipleDebtorsToCategoryRequest, Created, CreditCardAdd, CreditCardAddIntent, Debtor,
    DebtorAutogiroApprovals, DebtorBalances, DebtorEvents, Debtors, EmptyResponse, Request,
    RequestBuilder, Uuid,
};

///Get the 'Add credit card' intent to view status
pub fn get_add_credit_card_intent(id: Uuid) -> Request<CreditCardAdd> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/addcreditcard/")
        .path_param(id)
        .build()
}
///Creates an intent to add a credit card on debtor. Endpoints following
///all PCI requirements. No card number is handled directly by your site.
///Create the request and load the AddWindowUrl in an iframe. Once the
///addition is complete the iframe will be redirected to the SuccessUrl/
///FailedUrl (on you site)
pub fn create_an_intent_to_add_credit_card_on_debtor(
    body: &CreditCardAddIntent,
) -> Request<CreditCardAdd> {
    RequestBuilder::new(http::Method::POST, "/v1/debtors/addcreditcard")
        .body(body)
        .build()
}
pub fn delete_a_saved_credit_card_on_debtor(id: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/debtors/addcreditcard/")
        .path_param(id)
        .build()
}
///Adds multiple debtors to a specified category
pub fn add_debtors_to_category(
    body: &AddMultipleDebtorsToCategoryRequest,
) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/debtors/adddebtorstocategory")
        .body(body)
        .build()
}
///Adds a debtor to specified category
pub fn add_debtor_to_category(
    id: Uuid,
    debtorpublicid: Uuid,
    categorypublicid: Uuid,
) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/debtors/adddebtortocategory/")
        .path_param(id)
        .query_param("debtorpublicid", debtorpublicid)
        .query_param("categorypublicid", categorypublicid)
        .build()
}
///Removes all personal information about the customer and inactivates it
pub fn anonymize_debtor_gdpr(id: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtors/anonymize/")
        .path_param(id)
        .build()
}
///Get all existing debtor autogiro approval XML's
pub fn autogiro_approval_xml(id: Uuid) -> Request<DebtorAutogiroApprovals> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/autogiroapprovalxmls/")
        .path_param(id)
        .build()
}
///Get all debtor balances on specified debtor
pub fn debtor_balances(id: Uuid) -> Request<DebtorBalances> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/balances/")
        .path_param(id)
        .build()
}
///Get a single debtor by its DebtorPublicId.
pub fn get_a_debtor(id: Uuid) -> Request<Debtor> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtor/")
        .path_param(id)
        .build()
}
///Note that DebtorPublicId must be set when updating a debtor. It is
///used to identify which debtor to update. CreditorPublicId specifies
///under which creditor it shall be created since creditors don't share
///data
pub fn update_a_debtor(body: &Debtor) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtors/debtor")
        .body(body)
        .build()
}
///Creates a debtor. Note that DebtorPublicId are generated by Billecta
///API and can't be set through the API and should be omitted when
///creating. CreditorPublicId specifies under which creditor it shall be
///created since creditors don't share data
pub fn create_a_debtor(body: &Debtor) -> Request<Created> {
    RequestBuilder::new(http::Method::POST, "/v1/debtors/debtor")
        .body(body)
        .build()
}
///A debtor can't be deleted if it used in an invoice (of any kind)
pub fn delete_a_debtor(id: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/debtors/debtor/")
        .path_param(id)
        .build()
}
///Get a single debtor by its debtor number. Debtor number is unique per
///creditor
pub fn get_debtor_by_debtor_number(id: Uuid, debtorno: &str) -> Request<Debtor> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtorbydebtorno/")
        .path_param(id)
        .query_param("debtorno", debtorno)
        .build()
}
///Gets all debtor events for the specified debtor.
pub fn get_debtor_events(id: Uuid) -> Request<DebtorEvents> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtorevents/")
        .path_param(id)
        .build()
}
///Get all debtors for a creditor
pub fn get_all_debtors(
    id: Uuid,
    offset: Option<i32>,
    limit: Option<i32>,
    sortingfield: Option<&str>,
    asc: Option<bool>,
) -> Request<Debtors> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtors/")
        .path_param(id)
        .query_param_opt("offset", offset)
        .query_param_opt("limit", limit)
        .query_param_opt("sortingfield", sortingfield)
        .query_param_opt("asc", asc)
        .build()
}
///Get all debtors for a creditor
#[allow(clippy::too_many_arguments)]
pub fn get_all_debtors_extra(
    id: Uuid,
    filter: &str,
    offset: Option<i32>,
    limit: Option<i32>,
    sortingfield: Option<&str>,
    asc: Option<bool>,
    excludeinactive: Option<bool>,
    categorypublicid: Option<Uuid>,
    deliverymethod: Option<&str>,
) -> Request<Debtors> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtors/")
        .path_param(id)
        .query_param("filter", filter)
        .query_param_opt("offset", offset)
        .query_param_opt("limit", limit)
        .query_param_opt("sortingfield", sortingfield)
        .query_param_opt("asc", asc)
        .query_param_opt("excludeinactive", excludeinactive)
        .query_param_opt("categorypublicid", categorypublicid)
        .query_param_opt("deliverymethod", deliverymethod)
        .build()
}
///Imports multiple debtors. If debtor has DebtorPublicId set it will
///update corresponding debtor. If DebtorPublicId is not set the debtor
///will be created
pub fn create_update_multiple_debtors(body: &Debtors) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/debtors/debtors")
        .body(body)
        .build()
}
///Get all debtors by its external id. External id is text field where
///you can set to any value. It could be your internal id of the customer
pub fn get_debtors_by_debtor_external_id(
    id: Uuid,
    externalid: &str,
    offset: Option<i32>,
    limit: Option<i32>,
    sortingfield: Option<&str>,
    asc: Option<bool>,
) -> Request<Debtors> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtorsbyexternalid/")
        .path_param(id)
        .query_param("externalid", externalid)
        .query_param_opt("offset", offset)
        .query_param_opt("limit", limit)
        .query_param_opt("sortingfield", sortingfield)
        .query_param_opt("asc", asc)
        .build()
}
///Get all debtors by person or organizational number. Country code of
///the format of the organisational number must be specified.
pub fn get_debtors_by_person_organisation_number(
    id: Uuid,
    orgno: &str,
    countrycode: &str,
    offset: Option<i32>,
    limit: Option<i32>,
    sortingfield: Option<&str>,
    asc: Option<bool>,
) -> Request<Debtors> {
    RequestBuilder::new(http::Method::GET, "/v1/debtors/debtorsbyorgno/")
        .path_param(id)
        .query_param("orgno", orgno)
        .query_param("countrycode", countrycode)
        .query_param_opt("offset", offset)
        .query_param_opt("limit", limit)
        .query_param_opt("sortingfield", sortingfield)
        .query_param_opt("asc", asc)
        .build()
}
///Deletes the specified debtor category
pub fn delete_debtor_category(id: Uuid, categorypublicid: Uuid) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/debtors/deletedebtorcategory/")
        .path_param(id)
        .query_param("categorypublicid", categorypublicid)
        .build()
}
///Deletes the relation between a debtor and a category
pub fn drop_debtor_from_category(
    id: Uuid,
    debtorpublicid: Uuid,
    categorypublicid: Uuid,
) -> Request<EmptyResponse> {
    RequestBuilder::new(
        http::Method::DELETE,
        "/v1/debtors/deletedebtorfromcategory/",
    )
    .path_param(id)
    .query_param("debtorpublicid", debtorpublicid)
    .query_param("categorypublicid", categorypublicid)
    .build()
}