Class: Peddler::APIs::Invoices20240619

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/invoices_2024_06_19.rb,
lib/peddler/apis/invoices_2024_06_19/error.rb,
lib/peddler/apis/invoices_2024_06_19/export.rb,
lib/peddler/apis/invoices_2024_06_19/invoice.rb,
lib/peddler/apis/invoices_2024_06_19/error_list.rb,
lib/peddler/apis/invoices_2024_06_19/invoice_error.rb,
lib/peddler/apis/invoices_2024_06_19/attribute_option.rb,
lib/peddler/apis/invoices_2024_06_19/invoice_document.rb,
lib/peddler/apis/invoices_2024_06_19/invoices_document.rb,
lib/peddler/apis/invoices_2024_06_19/invoices_attributes.rb,
lib/peddler/apis/invoices_2024_06_19/get_invoice_response.rb,
lib/peddler/apis/invoices_2024_06_19/get_invoices_response.rb,
lib/peddler/apis/invoices_2024_06_19/transaction_identifier.rb,
lib/peddler/apis/invoices_2024_06_19/carrier_details_context.rb,
lib/peddler/apis/invoices_2024_06_19/export_invoices_request.rb,
lib/peddler/apis/invoices_2024_06_19/export_invoices_response.rb,
lib/peddler/apis/invoices_2024_06_19/government_invoice_request.rb,
lib/peddler/apis/invoices_2024_06_19/get_invoices_export_response.rb,
lib/peddler/apis/invoices_2024_06_19/get_invoices_exports_response.rb,
lib/peddler/apis/invoices_2024_06_19/get_invoices_document_response.rb,
lib/peddler/apis/invoices_2024_06_19/govt_invoice_document_response.rb,
lib/peddler/apis/invoices_2024_06_19/get_invoices_attributes_response.rb,
lib/peddler/apis/invoices_2024_06_19/government_invoice_status_response.rb,
sig/peddler/apis/invoices_2024_06_19.rbs

Overview

The Selling Partner API for Invoices.

Use the Selling Partner API for Invoices to retrieve and manage invoice-related operations, which can help selling partners manage their bookkeeping processes.

Defined Under Namespace

Classes: AttributeOption, CarrierDetailsContext, Error, ErrorList, Export, ExportInvoicesRequest, ExportInvoicesResponse, GetInvoiceResponse, GetInvoicesAttributesResponse, GetInvoicesDocumentResponse, GetInvoicesExportResponse, GetInvoicesExportsResponse, GetInvoicesResponse, GovernmentInvoiceRequest, GovernmentInvoiceStatusResponse, GovtInvoiceDocumentResponse, Invoice, InvoiceDocument, InvoiceError, InvoicesAttributes, InvoicesDocument, TransactionIdentifier

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #http, #initialize, #must_sandbox!, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#create_government_invoice(body, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Submits an asynchronous government invoice creation request.

Parameters:

  • body (Hash)

    Information required to create the government invoice.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 0.0167)

Returns:



105
106
107
108
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 105

def create_government_invoice(body, rate_limit: 0.0167)
  path = "/tax/invoices/2024-06-19/governmentInvoiceRequests"
  post(path, body:, rate_limit:)
end

#create_invoices_export(body, rate_limit: 0.167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Creates an invoice export request.

Parameters:

  • body (Hash)

    Information required to create the export request.

  • rate_limit (Float) (defaults to: 0.167)

    Requests per second

  • (Hash[untyped, untyped])
  • rate_limit: (Float) (defaults to: 0.167)

Returns:



48
49
50
51
52
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 48

def create_invoices_export(body, rate_limit: 0.167)
  path = "/tax/invoices/2024-06-19/exports"
  parser = -> { ExportInvoicesResponse }
  post(path, body:, rate_limit:, parser:)
end

#get_government_invoice_document(marketplace_id, transaction_type, shipment_id, invoice_type, inbound_plan_id: nil, file_format: nil, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns an invoiceDocument object containing an invoiceDocumentUrl .

Parameters:

  • marketplace_id (String)

    The invoices returned will match the marketplace that you specify.

  • transaction_type (String)

    Marketplace specific classification of the transaction type that originated the invoice. Check 'transactionType' options using 'getInvoicesAttributes' operation.

  • shipment_id (String)

    The unique shipment identifier to get an invoice for.

  • invoice_type (String)

    Marketplace specific classification of the invoice type. Check 'invoiceType' options using 'getInvoicesAttributes' operation.

  • inbound_plan_id (String) (defaults to: nil)

    The unique InboundPlan identifier in which the shipment is contained and for which the invoice will be created.

  • file_format (String) (defaults to: nil)

    Requested file format. Default is XML

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

  • (String)
  • (String)
  • (String)
  • (String)
  • inbound_plan_id: (String, nil) (defaults to: nil)
  • file_format: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.0167)

Returns:



151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 151

def get_government_invoice_document(marketplace_id, transaction_type, shipment_id, invoice_type,
  inbound_plan_id: nil, file_format: nil, rate_limit: 0.0167)
  path = "/tax/invoices/2024-06-19/governmentInvoiceRequests/#{percent_encode(shipment_id)}"
  params = {
    "marketplaceId" => marketplace_id,
    "transactionType" => transaction_type,
    "invoiceType" => invoice_type,
    "inboundPlanId" => inbound_plan_id,
    "fileFormat" => file_format,
  }.compact
  parser = -> { GovtInvoiceDocumentResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_government_invoice_status(marketplace_id, transaction_type, shipment_id, invoice_type, inbound_plan_id: nil, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the status of an invoice generation request.

Parameters:

  • marketplace_id (String)

    The invoices status will match the marketplace that you specify.

  • transaction_type (String)

    Marketplace specific classification of the transaction type that originated the invoice. Check 'transactionType' options using 'getInvoicesAttributes' operation.

  • shipment_id (String)

    The unique shipment identifier to get an invoice for.

  • invoice_type (String)

    Marketplace specific classification of the invoice type. Check 'invoiceType' options using 'getInvoicesAttributes' operation.

  • inbound_plan_id (String) (defaults to: nil)

    The unique InboundPlan identifier in which the shipment is contained and for which the invoice will be created.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

  • (String)
  • (String)
  • (String)
  • (String)
  • inbound_plan_id: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.0167)

Returns:



123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 123

def get_government_invoice_status(marketplace_id, transaction_type, shipment_id, invoice_type,
  inbound_plan_id: nil, rate_limit: 0.0167)
  path = "/tax/invoices/2024-06-19/governmentInvoiceRequests"
  params = {
    "marketplaceId" => marketplace_id,
    "transactionType" => transaction_type,
    "shipmentId" => shipment_id,
    "invoiceType" => invoice_type,
    "inboundPlanId" => inbound_plan_id,
  }.compact
  parser = -> { GovernmentInvoiceStatusResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_invoice(marketplace_id, invoice_id, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns invoice data for the specified invoice. This operation returns only a subset of the invoices data; refer to the response definition to get all the possible attributes. To get the full invoice, use the createInvoicesExport operation to start an export request.

Parameters:

  • marketplace_id (String)

    The marketplace from which you want the invoice.

  • invoice_id (String)

    The invoice identifier.

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

  • (String)
  • (String)
  • rate_limit: (Float) (defaults to: 2.0)

Returns:



232
233
234
235
236
237
238
239
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 232

def get_invoice(marketplace_id, invoice_id, rate_limit: 2.0)
  path = "/tax/invoices/2024-06-19/invoices/#{percent_encode(invoice_id)}"
  params = {
    "marketplaceId" => marketplace_id,
  }.compact
  parser = -> { GetInvoiceResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_invoices(marketplace_id, transaction_identifier_name: nil, page_size: nil, date_end: nil, transaction_type: nil, transaction_identifier_id: nil, date_start: nil, series: nil, next_token: nil, sort_order: nil, invoice_type: nil, statuses: nil, external_invoice_id: nil, sort_by: nil, rate_limit: 0.1) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns invoice details for the invoices that match the filters that you specify.

Parameters:

  • transaction_identifier_name (String) (defaults to: nil)

    The name of the transaction identifier filter. If you provide a value for this field, you must also provide a value for the transactionIdentifierId field.Use the getInvoicesAttributes operation to check transactionIdentifierName options.

  • page_size (Integer) (defaults to: nil)

    The maximum number of invoices you want to return in a single call. Minimum: 1 Maximum: 200

  • date_end (String) (defaults to: nil)

    The latest invoice creation date for invoices that you want to include in the response. Dates are in ISO 8601 date-time format. The default is the current date-time.

  • marketplace_id (String)

    The response includes only the invoices that match the specified marketplace.

  • transaction_type (String) (defaults to: nil)

    The marketplace-specific classification of the transaction type for which the invoice was created. Use the getInvoicesAttributes operation to check transactionType options.

  • transaction_identifier_id (String) (defaults to: nil)

    The ID of the transaction identifier filter. If you provide a value for this field, you must also provide a value for the transactionIdentifierName field.

  • date_start (String) (defaults to: nil)

    The earliest invoice creation date for invoices that you want to include in the response. Dates are in ISO 8601 date-time format. The default is 24 hours prior to the time of the request.

  • series (String) (defaults to: nil)

    Return invoices with the specified series number.

  • next_token (String) (defaults to: nil)

    The response includes nextToken when the number of results exceeds the specified pageSize value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until nextToken is null. Note that this operation can return empty pages.

  • sort_order (String) (defaults to: nil)

    Sort the invoices in the response in ascending or descending order.

  • invoice_type (String) (defaults to: nil)

    The marketplace-specific classification of the invoice type. Use the getInvoicesAttributes operation to check invoiceType options.

  • statuses (Array<String>) (defaults to: nil)

    A list of statuses that you can use to filter invoices. Use the getInvoicesAttributes operation to check invoice status options. Min count: 1

  • external_invoice_id (String) (defaults to: nil)

    Return invoices that match this external ID. This is typically the Government Invoice ID.

  • sort_by (String) (defaults to: nil)

    The attribute by which you want to sort the invoices in the response.

  • rate_limit (Float) (defaults to: 0.1)

    Requests per second

  • (String)
  • transaction_identifier_name: (String, nil) (defaults to: nil)
  • page_size: (Integer, nil) (defaults to: nil)
  • date_end: (String, nil) (defaults to: nil)
  • transaction_type: (String, nil) (defaults to: nil)
  • transaction_identifier_id: (String, nil) (defaults to: nil)
  • date_start: (String, nil) (defaults to: nil)
  • series: (String, nil) (defaults to: nil)
  • next_token: (String, nil) (defaults to: nil)
  • sort_order: (String, nil) (defaults to: nil)
  • invoice_type: (String, nil) (defaults to: nil)
  • statuses: (Array[String], nil) (defaults to: nil)
  • external_invoice_id: (String, nil) (defaults to: nil)
  • sort_by: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.1)

Returns:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 199

def get_invoices(marketplace_id, transaction_identifier_name: nil, page_size: nil, date_end: nil,
  transaction_type: nil, transaction_identifier_id: nil, date_start: nil, series: nil, next_token: nil,
  sort_order: nil, invoice_type: nil, statuses: nil, external_invoice_id: nil, sort_by: nil, rate_limit: 0.1)
  path = "/tax/invoices/2024-06-19/invoices"
  params = {
    "transactionIdentifierName" => transaction_identifier_name,
    "pageSize" => page_size,
    "dateEnd" => date_end,
    "marketplaceId" => marketplace_id,
    "transactionType" => transaction_type,
    "transactionIdentifierId" => transaction_identifier_id,
    "dateStart" => date_start,
    "series" => series,
    "nextToken" => next_token,
    "sortOrder" => sort_order,
    "invoiceType" => invoice_type,
    "statuses" => stringify_array(statuses),
    "externalInvoiceId" => external_invoice_id,
    "sortBy" => sort_by,
  }.compact
  parser = -> { GetInvoicesResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_invoices_attributes(marketplace_id, rate_limit: 1.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns marketplace-dependent schemas and their respective set of possible values.

Parameters:

  • marketplace_id (String)

    The marketplace identifier.

  • rate_limit (Float) (defaults to: 1.0)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 1.0)

Returns:



20
21
22
23
24
25
26
27
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 20

def get_invoices_attributes(marketplace_id, rate_limit: 1.0)
  path = "/tax/invoices/2024-06-19/attributes"
  params = {
    "marketplaceId" => marketplace_id,
  }.compact
  parser = -> { GetInvoicesAttributesResponse }
  get(path, params:, rate_limit:, parser:)
end

#get_invoices_document(invoices_document_id, rate_limit: 0.0167) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the invoice document's ID and URL. Use the URL to download the ZIP file, which contains the invoices from the corresponding createInvoicesExport request.

Parameters:

  • invoices_document_id (String)

    The export document identifier.

  • rate_limit (Float) (defaults to: 0.0167)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 0.0167)

Returns:



36
37
38
39
40
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 36

def get_invoices_document(invoices_document_id, rate_limit: 0.0167)
  path = "/tax/invoices/2024-06-19/documents/#{percent_encode(invoices_document_id)}"
  parser = -> { GetInvoicesDocumentResponse }
  get(path, rate_limit:, parser:)
end

#get_invoices_export(export_id, rate_limit: 2.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns invoice export details (including the exportDocumentId, if available) for the export that you specify.

Parameters:

  • export_id (String)

    The unique identifier for the export.

  • rate_limit (Float) (defaults to: 2.0)

    Requests per second

  • (String)
  • rate_limit: (Float) (defaults to: 2.0)

Returns:



93
94
95
96
97
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 93

def get_invoices_export(export_id, rate_limit: 2.0)
  path = "/tax/invoices/2024-06-19/exports/#{percent_encode(export_id)}"
  parser = -> { GetInvoicesExportResponse }
  get(path, rate_limit:, parser:)
end

#get_invoices_exports(marketplace_id, date_start: nil, next_token: nil, page_size: nil, date_end: nil, status: nil, rate_limit: 0.1) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns invoice exports details for exports that match the filters that you specify.

Parameters:

  • marketplace_id (String)

    The returned exports match the specified marketplace.

  • date_start (String) (defaults to: nil)

    The earliest export creation date and time for exports that you want to include in the response. Values are in ISO 8601 date-time format. The default is 30 days ago.

  • next_token (String) (defaults to: nil)

    The response includes nextToken when the number of results exceeds the specified pageSize value. To get the next page of results, call the operation with this token and include the same arguments as the call that produced the token. To get a complete list, call this operation until nextToken is null. Note that this operation can return empty pages.

  • page_size (Integer) (defaults to: nil)

    The maximum number of invoices to return in a single call. Minimum: 1 Maximum: 100

  • date_end (String) (defaults to: nil)

    The latest export creation date and time for exports that you want to include in the response. Values are in ISO 8601 date-time format. The default value is the time of the request.

  • status (String) (defaults to: nil)

    Return exports matching the status specified.

  • rate_limit (Float) (defaults to: 0.1)

    Requests per second

  • (String)
  • date_start: (String, nil) (defaults to: nil)
  • next_token: (String, nil) (defaults to: nil)
  • page_size: (Integer, nil) (defaults to: nil)
  • date_end: (String, nil) (defaults to: nil)
  • status: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.1)

Returns:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/peddler/apis/invoices_2024_06_19.rb', line 72

def get_invoices_exports(marketplace_id, date_start: nil, next_token: nil, page_size: nil, date_end: nil,
  status: nil, rate_limit: 0.1)
  path = "/tax/invoices/2024-06-19/exports"
  params = {
    "marketplaceId" => marketplace_id,
    "dateStart" => date_start,
    "nextToken" => next_token,
    "pageSize" => page_size,
    "dateEnd" => date_end,
    "status" => status,
  }.compact
  parser = -> { GetInvoicesExportsResponse }
  get(path, params:, rate_limit:, parser:)
end