Moneybirx.SalesInvoice (Moneybirx v0.1.8) View Source
Moneybird Sales Invoices
Attributes
Sales Invoices are quite large data structures so we omitted full documentation examples. Here is a full Sales Invoice in JSON format.
{
"id": "264861204459030166",
"administration_id": 123,
"contact_id": "264861203795281549",
"contact": {
"id": "264861203795281549",
"administration_id": 123,
"company_name": "Foobar Holding B.V.",
"firstname": "",
"lastname": "",
"address1": "Hoofdstraat 12",
"address2": "",
"zipcode": "1234AB",
"city": "Amsterdam",
"country": "NL",
"phone": "",
"delivery_method": "Email",
"customer_id": "1",
"tax_number": "",
"chamber_of_commerce": "",
"bank_account": "",
"attention": "",
"email": "info@example.com",
"email_ubl": true,
"send_invoices_to_attention": "",
"send_invoices_to_email": "info@example.com",
"send_estimates_to_attention": "",
"send_estimates_to_email": "info@example.com",
"sepa_active": false,
"sepa_iban": "",
"sepa_iban_account_name": "",
"sepa_bic": "",
"sepa_mandate_id": "",
"sepa_mandate_date": null,
"sepa_sequence_type": "RCUR",
"credit_card_number": "",
"credit_card_reference": "",
"credit_card_type": null,
"tax_number_validated_at": null,
"tax_number_valid": null,
"invoice_workflow_id": null,
"estimate_workflow_id": null,
"si_identifier": "",
"si_identifier_type": null,
"created_at": "2019-08-26T09:22:29.161Z",
"updated_at": "2019-08-26T09:22:29.161Z",
"version": 1566811349,
"sales_invoices_url": "http://moneybird.dev/123/sales_invoices/62dd27d4a4eda96a66e6c8293227d3a4f1d5a310435733460adc43b8bc3f0590/all",
"notes": [],
"custom_fields": []
},
"invoice_id": null,
"recurring_sales_invoice_id": null,
"workflow_id": "264861010714690884",
"document_style_id": "264861011128878414",
"identity_id": "264861010400118083",
"draft_id": 2,
"state": "draft",
"invoice_date": null,
"due_date": "2019-09-09",
"payment_conditions": "We verzoeken u vriendelijk het bovenstaande bedrag van {document.total_price} voor {document.due_date} te voldoen op onze bankrekening onder vermelding van de omschrijving {document.payment_reference}. Voor vragen kunt u contact opnemen per e-mail.",
"payment_reference": null,
"reference": "30052",
"language": "nl",
"currency": "EUR",
"discount": "0.0",
"original_sales_invoice_id": null,
"paused": false,
"paid_at": null,
"sent_at": null,
"created_at": "2019-08-26T09:22:29.792Z",
"updated_at": "2019-08-26T09:22:29.808Z",
"public_view_code": "303058",
"version": 1566811349,
"details": [
{
"id": "264861204466370199",
"administration_id": 123,
"tax_rate_id": "264861010337203517",
"ledger_account_id": "264861010182014250",
"product_id": null,
"amount": null,
"amount_decimal": 1,
"description": "Rocking Chair",
"price": "129.95",
"period": null,
"row_order": 0,
"total_price_excl_tax_with_discount": "129.95",
"total_price_excl_tax_with_discount_base": "129.95",
"tax_report_reference": ["NL/1a"],
"created_at": "2019-08-26T09:22:29.800Z",
"updated_at": "2019-08-26T09:22:29.800Z"
}
],
"payments": [],
"total_paid": "0.0",
"total_unpaid": "157.24",
"total_unpaid_base": "157.24",
"prices_are_incl_tax": false,
"total_price_excl_tax": "129.95",
"total_price_excl_tax_base": "129.95",
"total_price_incl_tax": "157.24",
"total_price_incl_tax_base": "157.24",
"total_discount": "0.0",
"url": "http://moneybird.dev/123/sales_invoices/af93fa653c5ec1c8b6ac3d7d939000a2cc2d7b380f117943f4a26a0b8e4d3178/62dd27d4a4eda96a66e6c8293227d3a4f1d5a310435733460adc43b8bc3f0590",
"custom_fields": [],
"notes": [],
"attachments": [],
"events": [
{
"administration_id": 123,
"user_id": 15668111646740,
"action": "sales_invoice_created",
"link_entity_id": null,
"link_entity_type": null,
"data": {},
"created_at": "2019-08-26T09:22:29.812Z",
"updated_at": "2019-08-26T09:22:29.812Z"
}
],
"tax_totals": [
{
"tax_rate_id": "264861010337203517",
"taxable_amount": "129.95",
"taxable_amount_base": "129.95",
"tax_amount": "27.29",
"tax_amount_base": "27.29"
}
]
}
See Moneybird's API Documentation for more info.
Link to this section Summary
Functions
Lists all Sales Invoices in the Administration.
Parameters
page
,Integer
– The page number.per_page
,Integer
– Amount of sales_invoices per page (max 100).filter
,String
– Search terms. See below for a list of fields being filtered.
Examples
Moneybirx.SalesInvoice.all()
Filter Query
Moneybird allows filtering on the following attributes and formats
Create a SalesInvoice.
Issues a DELETE request to the given url.
Issues a DELETE request to the given url, raising an exception in case of failure.
Find a SalesInvoice by it's id
.
Find a SalesInvoice by it's invoice_id
.
Issues a GET request to the given url.
Issues a GET request to the given url, raising an exception in case of failure.
Issues a HEAD request to the given url.
Issues a HEAD request to the given url, raising an exception in case of failure.
Issues an OPTIONS request to the given url.
Issues a OPTIONS request to the given url, raising an exception in case of failure.
Issues a PATCH request to the given url.
Issues a PATCH request to the given url, raising an exception in case of failure.
Issues a POST request to the given url.
Issues a POST request to the given url, raising an exception in case of failure.
Callback implementation for HTTPoison.Base.process_headers/1
.
Callback implementation for HTTPoison.Base.process_request_body/1
.
Callback implementation for HTTPoison.Base.process_request_headers/1
.
Callback implementation for HTTPoison.Base.process_request_options/1
.
Callback implementation for HTTPoison.Base.process_request_params/1
.
Callback implementation for HTTPoison.Base.process_request_url/1
.
Callback implementation for HTTPoison.Base.process_response/1
.
Callback implementation for HTTPoison.Base.process_response_body/1
.
Callback implementation for HTTPoison.Base.process_response_chunk/1
.
Callback implementation for HTTPoison.Base.process_response_headers/1
.
Callback implementation for HTTPoison.Base.process_response_status_code/1
.
Callback implementation for HTTPoison.Base.process_status_code/1
.
Callback implementation for HTTPoison.Base.process_url/1
.
Issues a PUT request to the given url.
Issues a PUT request to the given url, raising an exception in case of failure.
Issues an HTTP request using a Request
struct.
Issues an HTTP request with the given method to the given url.
Issues an HTTP request with the given method to the given url, raising an exception in case of failure.
Send and Invoice
This endpoint provides two options: sending the invoice and scheduling sending in the future. When sending now, you can provide a send method, email address and message. If you don’t provide any arguments, the defaults from the contact and workflow will be used.
Starts HTTPoison and its dependencies.
Requests the next message to be streamed for a given HTTPoison.AsyncResponse
.
Link to this section Types
Specs
body() :: HTTPoison.Base.body()
Specs
headers() :: HTTPoison.Base.headers()
Specs
method() :: HTTPoison.Base.method()
Specs
options() :: HTTPoison.Base.options()
Specs
params() :: HTTPoison.Base.params()
Specs
request() :: HTTPoison.Base.request()
Specs
url() :: HTTPoison.Base.url()
Link to this section Functions
Lists all Sales Invoices in the Administration.
Parameters
page
,Integer
– The page number.per_page
,Integer
– Amount of sales_invoices per page (max 100).filter
,String
– Search terms. See below for a list of fields being filtered.
Examples
Moneybirx.SalesInvoice.all()
Filter Query
Moneybird allows filtering on the following attributes and formats:
state
String
– all all, draft, open, scheduled, pending_payment, late, reminded, paid or uncollectibleperiod
String
– this_year This can either be the description of a period (this_month, prev_month, next_month, this_quarter, prev_quarter, next_quarter, this_year, prev_year, next_year) or a custom period (201301..201302, 20130101..20130131)contact_id
Integer
– Select invoices belonging to a certain contactrecurring_sales_invoice_id
Integer
– Select invoices created by a certain recurring invoiceworkflow_id
Integer
– Select invoices that use a certain workflowMoneybirx.SalesInvoice.all(%{filter: "period:this_month"})
Create a SalesInvoice.
Examples
Moneybirx.SalesInvoice.create(%{"valid" => "params"})
Specs
delete(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a DELETE request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
delete!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a DELETE request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Find a SalesInvoice by it's id
.
Examples
Moneybirx.SalesInvoice.find("264861201281844836")
Find a SalesInvoice by it's invoice_id
.
Examples
Moneybirx.SalesInvoice.find_by_invoice_id("2020-0001")
Specs
get(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a GET request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
get!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a GET request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
head(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a HEAD request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
head!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a HEAD request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
options(binary(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues an OPTIONS request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
options!(binary(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a OPTIONS request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
patch(binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a PATCH request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
patch!(binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a PATCH request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
post(binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a POST request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
post!(binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a POST request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
Callback implementation for HTTPoison.Base.process_headers/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_body/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_headers/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_options/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_params/1
.
Specs
Callback implementation for HTTPoison.Base.process_request_url/1
.
Specs
process_response(HTTPoison.Base.response()) :: any()
Callback implementation for HTTPoison.Base.process_response/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_body/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_chunk/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_headers/1
.
Specs
Callback implementation for HTTPoison.Base.process_response_status_code/1
.
Specs
Callback implementation for HTTPoison.Base.process_status_code/1
.
Specs
Callback implementation for HTTPoison.Base.process_url/1
.
Specs
put(binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues a PUT request to the given url.
Returns {:ok, response}
if the request is successful, {:error, reason}
otherwise.
See request/5
for more detailed information.
Specs
put!(binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues a PUT request to the given url, raising an exception in case of failure.
If the request does not fail, the response is returned.
See request!/5
for more detailed information.
Specs
request(HTTPoison.Request.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues an HTTP request using a Request
struct.
This function returns {:ok, response}
or {:ok, async_response}
if the
request is successful, {:error, reason}
otherwise.
Examples
request = %HTTPoison.Request{
method: :post,
url: "https://my.website.com",
body: "{\"foo\": 3}",
headers: [{"Accept", "application/json"}]
}
request(request)
Specs
request(method(), binary(), any(), headers(), Keyword.t()) :: {:ok, HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Issues an HTTP request with the given method to the given url.
This function is usually used indirectly by get/3
, post/4
, put/4
, etc
Args:
method
- HTTP method as an atom (:get
,:head
,:post
,:put
,:delete
, etc.)url
- target url as a binary string or char listbody
- request body. See more belowheaders
- HTTP headers as an orddict (e.g.,[{"Accept", "application/json"}]
)options
- Keyword list of options
Body: see type HTTPoison.Request
Options: see type HTTPoison.Request
This function returns {:ok, response}
or {:ok, async_response}
if the
request is successful, {:error, reason}
otherwise.
Examples
request(:post, "https://my.website.com", "{\"foo\": 3}", [{"Accept", "application/json"}])
Specs
request!(method(), binary(), any(), headers(), Keyword.t()) :: HTTPoison.Response.t() | HTTPoison.AsyncResponse.t()
Issues an HTTP request with the given method to the given url, raising an exception in case of failure.
request!/5
works exactly like request/5
but it returns just the
response in case of a successful request, raising an exception in case the
request fails.
Send and Invoice
This endpoint provides two options: sending the invoice and scheduling sending in the future. When sending now, you can provide a send method, email address and message. If you don’t provide any arguments, the defaults from the contact and workflow will be used.
When scheduling sending, set the boolean sending_scheduled to true and provide an invoice_date.
PARAMETERS
Starts HTTPoison and its dependencies.
Specs
stream_next(HTTPoison.AsyncResponse.t()) :: {:ok, HTTPoison.AsyncResponse.t()} | {:error, HTTPoison.Error.t()}
Requests the next message to be streamed for a given HTTPoison.AsyncResponse
.
See request!/5
for more detailed information.