billecta 1.14.0

Generated Billecta API
Documentation
//! # Debt collection
//!
//! The following section describes the Debt collection area. It is a self-standing feature
//! but has tight integrations with invoices and reconciliation invoices if you have access to
//! those modules.
//!
use crate::{
    CommentAction, CommonActionEvents, Created, CreditAction, Date, DebtCollectionAction,
    DebtCollectionActionSubs, DebtCollectionEntry, DebtCollectionFromInvoiceEntry,
    DebtCollectionFromReconciliationInvoiceEntry, EmptyResponse, Request, RequestBuilder,
    UpdateAddressAction, Uuid,
};

pub fn get_a_debt_collection_action(id: &str) -> Request<DebtCollectionAction> {
    RequestBuilder::new(http::Method::GET, "/v1/debtcollection/action/")
        .path_param(id)
        .build()
}
///Decoupled debt collection actions are actions that are not a result of
///an invoice created in Billecta and instead created in an external
///system. You must in a decoupled debt collection action send the
///invoice PDF and amounts in the POST call. This feature requires that
///the creditor has been reviewed and approved by Billecta customer
///service before active.
pub fn create_a_decoupled_new_debt_collection_action(
    body: &DebtCollectionEntry,
) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/debtcollection/action")
        .body(body)
        .build()
}
///Create a new debt collection action from an invoice that was created
///in Billecta. Payments on the invoice will affect the debt collection
///and vice versa and make both always in sync with remaining amounts.
pub fn create_new_debt_collection_action_from_an_invoice(
    body: &DebtCollectionFromInvoiceEntry,
) -> Request<Created> {
    RequestBuilder::new(http::Method::POST, "/v1/debtcollection/actionfrominvoice")
        .body(body)
        .build()
}
///Create a new debt collection action from an invoice that was created
///in Billecta. Payments on the invoice will affect the debt collection
///and vice versa and make both always in sync with remaining amounts.
///This endpoint uses the values in the default configuration
pub fn create_new_debt_collection_action_from_an_invoice_using_default_settings(
    id: &str,
) -> Request<Created> {
    RequestBuilder::new(http::Method::POST, "/v1/debtcollection/actionfrominvoice/")
        .path_param(id)
        .build()
}
///Create a new debt collection action from a reconciliation invoice.
///Payments on the reconciliation invoice will affect the debt collection
///and vice versa and make both always in sync with remaining amounts
pub fn create_new_debt_collection_action_from_a_reconciliation_invoice(
    body: &DebtCollectionFromReconciliationInvoiceEntry,
) -> Request<Created> {
    RequestBuilder::new(
        http::Method::POST,
        "/v1/debtcollection/actionfromreconciliationinvoice",
    )
    .body(body)
    .build()
}
///Overrides the debtor card address and sets a temporary address for
///this debt collection action only
pub fn update_address_on_an_action(body: &UpdateAddressAction) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/address")
        .body(body)
        .build()
}
///Delete the overridden debtor address and uses the address from the
///debtor card
pub fn delete_address_override_for_action(
    id: &str,
    body: &UpdateAddressAction,
) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::DELETE, "/v1/debtcollection/address/")
        .path_param(id)
        .body(body)
        .build()
}
///Cancels a debt collection action and disconnects any Billecta invoice
pub fn cancel_a_debt_collection_action(id: &str) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/cancel/")
        .path_param(id)
        .build()
}
///Get all debt collection actions that was closed/fully paid on the
///specified date interval
pub fn get_all_closed_debt_collection_actions(
    id: &str,
    from: Date,
    to: Date,
    offset: Option<i32>,
    limit: Option<i32>,
    sortingfield: Option<&str>,
    asc: Option<bool>,
) -> Request<DebtCollectionActionSubs> {
    RequestBuilder::new(http::Method::GET, "/v1/debtcollection/closed/")
        .path_param(id)
        .query_param("from", from)
        .query_param("to", to)
        .query_param_opt("offset", offset)
        .query_param_opt("limit", limit)
        .query_param_opt("sortingfield", sortingfield)
        .query_param_opt("asc", asc)
        .build()
}
pub fn comment_a_debt_collection_action(body: &CommentAction) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::POST, "/v1/debtcollection/comment")
        .body(body)
        .build()
}
///Credit/Lower the current amount on the specified debt collection
///action. If amount is a actual payment the InvoiceInterest property
///indicates if interest up to payment date should be added to next claim
///if any. If debt collection action is fully paid, then flag is ignored.
pub fn credit_lower_the_debt_on_a_debt_collection_action(body: &CreditAction) -> Request<Created> {
    RequestBuilder::new(http::Method::POST, "/v1/debtcollection/credit")
        .body(body)
        .build()
}
///Dispute a debt collection action. Billecta is prohibited from
///regulations to move claim forward.
pub fn dispute_debt_collection_action(id: &str) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/dispute/")
        .path_param(id)
        .build()
}
///Please note that events older than 6 months after debt collection
///action was closed is archived and will not be returned with this call.
pub fn get_all_events_for_all_debt_collections(
    id: Uuid,
    from: Date,
    to: Date,
) -> Request<CommonActionEvents> {
    RequestBuilder::new(http::Method::GET, "/v1/debtcollection/events/")
        .path_param(id)
        .query_param("from", from)
        .query_param("to", to)
        .build()
}
///Get all debt collection actions that has not been cancelled or fully
///paid (ie closed). Closed actions are extracted using Closed endpoint
pub fn get_all_open_debt_collection_actions(
    id: Uuid,
    offset: Option<i32>,
    limit: Option<i32>,
    sortingfield: Option<&str>,
    asc: Option<bool>,
) -> Request<DebtCollectionActionSubs> {
    RequestBuilder::new(http::Method::GET, "/v1/debtcollection/open/")
        .path_param(id)
        .query_param_opt("offset", offset)
        .query_param_opt("limit", limit)
        .query_param_opt("sortingfield", sortingfield)
        .query_param_opt("asc", asc)
        .build()
}
///Postpones the next automatic event on the debt collection action. Use
///to give debtor a little more time.
pub fn postpone_next_event(id: &str, days: &str) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/postpone/")
        .path_param(id)
        .query_param("days", days)
        .build()
}
///Postpones the next automatic event on the debt collection action. Use
///to give debtor a little more time.
pub fn postpone_next_event_date(id: &str, date: Date) -> Request<EmptyResponse> {
    RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/postpone/")
        .path_param(id)
        .query_param("date", date)
        .build()
}