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()
}
pub fn create_a_decoupled_new_debt_collection_action(
body: &DebtCollectionEntry,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::POST, "/v1/debtcollection/action")
.body(body)
.build()
}
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()
}
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()
}
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()
}
pub fn update_address_on_an_action(body: &UpdateAddressAction) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/address")
.body(body)
.build()
}
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()
}
pub fn cancel_a_debt_collection_action(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/cancel/")
.path_param(id)
.build()
}
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()
}
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()
}
pub fn dispute_debt_collection_action(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/debtcollection/dispute/")
.path_param(id)
.build()
}
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()
}
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()
}
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()
}
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()
}