Struct InvoicesApi

Source
pub struct InvoicesApi { /* private fields */ }
Expand description

Create and manage invoices.

Implementations§

Source§

impl InvoicesApi

Source

pub fn new(config: Configuration, client: HttpClient) -> Self

Source

pub async fn list_invoices( &self, params: &ListInvoicesParameters, ) -> Result<ListInvoicesResponse, ApiError>

Returns a list of invoices for a given location.

The response is paginated. If truncated, the response includes a cursor that you use in a subsequent request to retrieve the next set of invoices.

Source

pub async fn create_invoice( &self, body: &CreateInvoiceRequest, ) -> Result<CreateInvoiceResponse, ApiError>

Creates a draft [Invoice] for an order created using the Orders API.

A draft invoice remains in your account and no action is taken. You must publish the invoice before Square can process it (send it to the customer’s email address or charge the customer’s card on file).

Source

pub async fn search_invoices( &self, body: &SearchInvoicesRequest, ) -> Result<SearchInvoicesResponse, ApiError>

Searches for invoices from a location specified in the filter.

You can optionally specify customers in the filter for whom to retrieve invoices. In the current implementation, you can only specify one location and optionally one customer.

The response is paginated. If truncated, the response includes a cursor that you use in a subsequent request to retrieve the next set of invoices.

Source

pub async fn delete_invoice( &self, invoice_id: &str, params: &DeleteInvoiceParameters, ) -> Result<DeleteInvoiceResponse, ApiError>

Deletes the specified invoice.

When an invoice is deleted, the associated order status changes to CANCELED. You can only delete a draft invoice (you cannot delete a published invoice, including one that is scheduled for processing).

Source

pub async fn get_invoice( &self, invoice_id: &str, ) -> Result<GetInvoiceResponse, ApiError>

Retrieves an invoice by invoice ID.

Source

pub async fn update_invoice( &self, invoice_id: &str, body: &UpdateInvoiceRequest, ) -> Result<UpdateInvoiceResponse, ApiError>

Updates an invoice by modifying fields, clearing fields, or both.

For most updates, you can use a sparse [Invoice] object to add fields or change values and use the fields_to_clear field to specify fields to clear. However, some restrictions apply. For example, you cannot change the order_id or location_id field and you must provide the complete custom_fields list to update a custom field. Published invoices have additional restrictions.

Source

pub async fn cancel_invoice( &self, invoice_id: &str, body: &CancelInvoiceRequest, ) -> Result<CancelInvoiceResponse, ApiError>

Cancels an invoice.

The seller cannot collect payments for the canceled invoice.

You cannot cancel an invoice in the DRAFT state or in a terminal state: PAID, REFUNDED, CANCELED, or FAILED.

Source

pub async fn publish_invoice( &self, invoice_id: &str, body: &PublishInvoiceRequest, ) -> Result<PublishInvoiceResponse, ApiError>

Publishes the specified draft invoice.

After an invoice is published, Square follows up based on the invoice configuration. For example, Square sends the invoice to the customer’s email address, charges the customer’s card on file, or does nothing. Square also makes the invoice available on a Square-hosted invoice page.

The invoice status also changes from DRAFT to a status based on the invoice configuration. For example, the status changes to UNPAID if Square emails the invoice or PARTIALLY_PAID if Square charge a card on file for a portion of the invoice amount.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,