use crate::{
ActionPublicIds, CardRefundPayment, CommentAction, CommonActionEvents, Created,
CreditCardPayment, CreditCardPaymentIntent, CreditCardPayments, Date, DeliveryMethodType,
EmptyResponse, InterestType, InvoiceAction, InvoiceActionEntry, InvoiceActionSubs,
RegisterPayment, ReminderInvoiceAction, ReminderInvoiceActionSubs, Request, RequestBuilder,
SendReminderInvoice, SwishRefundPayment, UpdateAddressAction, Uuid,
VerificationInvoiceActionEntry,
};
pub fn get_an_invoice(id: &str) -> Request<InvoiceAction> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/action/")
.path_param(id)
.build()
}
pub fn update_an_invoice(id: &str, body: &InvoiceActionEntry) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/action/")
.path_param(id)
.body(body)
.build()
}
pub fn create_an_invoice(body: &InvoiceActionEntry) -> Request<Created> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/action")
.body(body)
.build()
}
pub fn delete_an_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/action/")
.path_param(id)
.build()
}
pub fn get_an_invoice_by_invoice_number(id: Uuid, invoicenumber: &str) -> Request<InvoiceAction> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/actionbyinvoicenumber/")
.path_param(id)
.query_param("invoicenumber", invoicenumber)
.build()
}
pub fn update_address_on_an_invoice(body: &UpdateAddressAction) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/address")
.body(body)
.build()
}
pub fn delete_address_override_for_an_invoice(
id: &str,
body: &UpdateAddressAction,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/address/")
.path_param(id)
.body(body)
.build()
}
pub fn attest_an_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/attest/")
.path_param(id)
.build()
}
pub fn create_autogiro_withdrawal(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/autogiro/")
.path_param(id)
.build()
}
pub fn cancel_autogiro_withdrawal(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/autogiro/")
.path_param(id)
.build()
}
pub fn cancel_invoice_dispute(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/canceldispute/")
.path_param(id)
.build()
}
pub fn cancel_reminder_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/cancelreminder/")
.path_param(id)
.build()
}
pub fn get_all_closed_invoices(
id: Uuid,
from: Date,
to: Date,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<InvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/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 get_all_closed_invoices_by_debtor_public_id(
id: Uuid,
from: Date,
to: Date,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<InvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/closedbydebtor/")
.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 get_all_closed_invoices_by_invoice_period(
id: Uuid,
from: Date,
to: Date,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<InvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/closedbyperiod/")
.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_an_invoice(body: &CommentAction) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/comment")
.body(body)
.build()
}
pub fn credit_an_invoice_with_existing_credit_invoice(
id: &str,
creditinvoiceactionpublicid: &str,
paymentmeancode: Option<&str>,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/creditaction/")
.path_param(id)
.query_param("creditinvoiceactionpublicid", creditinvoiceactionpublicid)
.query_param_opt("paymentmeancode", paymentmeancode)
.build()
}
pub fn create_credit_card_payment_intent(
body: &CreditCardPaymentIntent,
) -> Request<CreditCardPayment> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/creditcardpayment")
.body(body)
.build()
}
pub fn cancel_credit_card_payment(id: Uuid) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/creditcardpayment/")
.path_param(id)
.build()
}
pub fn get_all_credit_card_payment_intents(id: &str) -> Request<CreditCardPayments> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/creditcardpayments/")
.path_param(id)
.build()
}
pub fn create_card_withdrawal(id: &str, paymentdate: Option<Date>) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/creditcardwithdrawal/")
.path_param(id)
.query_param_opt("paymentdate", paymentdate)
.build()
}
pub fn dispute_an_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/dispute/")
.path_param(id)
.build()
}
pub fn get_all_events_for_all_invoices(
id: Uuid,
from: &str,
to: &str,
) -> Request<CommonActionEvents> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/events/")
.path_param(id)
.query_param("from", from)
.query_param("to", to)
.build()
}
pub fn finance_the_invoice(
id: &str,
debtorcontractpublicid: Uuid,
salescontractpublicid: Option<Uuid>,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/financeinvoice/")
.path_param(id)
.query_param("debtorcontractpublicid", debtorcontractpublicid)
.query_param_opt("salescontractpublicid", salescontractpublicid)
.build()
}
pub fn create_interest_invoice(
id: &str,
from: Date,
to: Date,
interesttype: &InterestType,
interest: f64,
) -> Request<Created> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/interestinvoice/")
.path_param(id)
.query_param("from", from)
.query_param("to", to)
.query_param("interesttype", *interesttype)
.query_param("interest", interest)
.build()
}
pub fn load_archived_events(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/loadarchivedevents/")
.path_param(id)
.build()
}
pub fn get_all_open_invoices(
id: Uuid,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<InvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/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 get_all_open_invoices_by_debtor_public_id(
id: Uuid,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<InvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/openbydebtor/")
.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 get_all_open_invoices_by_invoice_period(
id: Uuid,
from: Date,
to: Date,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<InvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/openbyperiod/")
.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 get_all_open_reminder_invoices(
id: Uuid,
offset: Option<i32>,
limit: Option<i32>,
sortingfield: Option<&str>,
asc: Option<bool>,
) -> Request<ReminderInvoiceActionSubs> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/openreminders/")
.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 pause_an_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/pause/")
.path_param(id)
.build()
}
pub fn postpone_next_event(id: &str, days: i32) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/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/invoice/postpone/")
.path_param(id)
.query_param("date", date)
.build()
}
pub fn preview_an_invoice(id: &str) -> Request<Vec<u8>> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/preview/")
.path_param(id)
.build()
}
pub fn preview_an_invoice_post(body: &InvoiceActionEntry) -> Request<Vec<u8>> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/preview")
.body(body)
.build()
}
pub fn refund_credit_card_payment(body: &CardRefundPayment) -> Request<Created> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/refundcreditcardpayment")
.body(body)
.build()
}
pub fn refund_swish_payment(body: &SwishRefundPayment) -> Request<Created> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/refundswishpayment")
.body(body)
.build()
}
pub fn register_payment_on_an_invoice(body: &RegisterPayment) -> Request<Created> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/registerpayment")
.body(body)
.build()
}
pub fn get_reminder_invoice(id: &str) -> Request<ReminderInvoiceAction> {
RequestBuilder::new(http::Method::GET, "/v1/invoice/reminder/")
.path_param(id)
.build()
}
pub fn resume_a_paused_invoice(id: &str) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/resume/")
.path_param(id)
.build()
}
pub fn mark_invoices_are_processed_for_rot(body: &ActionPublicIds) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/rotprocessed")
.body(body)
.build()
}
pub fn unmark_invoices_are_processed_for_rot(body: &ActionPublicIds) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/rotprocessed")
.body(body)
.build()
}
pub fn mark_invoices_are_processed_for_rut(body: &ActionPublicIds) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/rutprocessed")
.body(body)
.build()
}
pub fn unmark_invoices_are_processed_for_rut(body: &ActionPublicIds) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/rutprocessed")
.body(body)
.build()
}
pub fn sell_the_invoice(id: &str, salescontractpublicid: Option<Uuid>) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/sellinvoice/")
.path_param(id)
.query_param_opt("salescontractpublicid", salescontractpublicid)
.build()
}
pub fn cancel_the_invoice_sales(id: &str, comment: Option<&str>) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::DELETE, "/v1/invoice/sellinvoice/")
.path_param(id)
.query_param_opt("comment", comment)
.build()
}
pub fn send_the_invoice(id: &str, method: &DeliveryMethodType) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/sendinvoice/")
.path_param(id)
.query_param("method", *method)
.build()
}
pub fn send_the_reminder_invoice(id: &str, method: &DeliveryMethodType) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/sendreminderinvoice/")
.path_param(id)
.query_param("method", *method)
.build()
}
pub fn send_the_reminder_invoice_with_pregenerated_pdf(
body: &SendReminderInvoice,
) -> Request<EmptyResponse> {
RequestBuilder::new(http::Method::PUT, "/v1/invoice/sendreminderinvoice")
.body(body)
.build()
}
pub fn create_a_verification_invoice(body: &VerificationInvoiceActionEntry) -> Request<Created> {
RequestBuilder::new(http::Method::POST, "/v1/invoice/verificationinvoice")
.body(body)
.build()
}