Class: Peddler::APIs::DeliveryByAmazon20220701

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/delivery_by_amazon_2022_07_01.rb,
lib/peddler/apis/delivery_by_amazon_2022_07_01/error.rb,
lib/peddler/apis/delivery_by_amazon_2022_07_01/error_list.rb,
lib/peddler/apis/delivery_by_amazon_2022_07_01/invoice_status.rb,
lib/peddler/apis/delivery_by_amazon_2022_07_01/submit_invoice_request.rb,
lib/peddler/apis/delivery_by_amazon_2022_07_01/submit_invoice_response.rb,
lib/peddler/apis/delivery_by_amazon_2022_07_01/get_invoice_status_response.rb,
sig/peddler/apis/delivery_by_amazon_2022_07_01.rbs

Overview

Selling Partner API for Delivery Shipment Invoicing

The Selling Partner API for Delivery Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil Amazon store for a selling partner’s orders.

Defined Under Namespace

Classes: Error, ErrorList, GetInvoiceStatusResponse, InvoiceStatus, SubmitInvoiceRequest, SubmitInvoiceResponse

Constant Summary

Constants inherited from Peddler::API

Peddler::API::TRANSIENT_STATUSES

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #base_url, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #host_header, #http, #initialize, #must_sandbox!, #parse_base_url, #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

#get_invoice_status(marketplace_id, invoice_type, program_type, order_id: nil, shipment_id: nil, invoice_id: nil, rate_limit: 1.133) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the invoice status for the order or shipment you specify. You must specify either an orderId, shipmentId, or invoiceId as a query parameter. If multiple parameters are supplied, orderId takes precedence over shipmentId, which takes precedence over invoiceId.

Parameters:

  • order_id (String) (defaults to: nil) —

    The order identifier.

  • shipment_id (String) (defaults to: nil) —

    The shipment identifier.

  • invoice_id (String) (defaults to: nil) —

    The invoice access key (NF-e access key for Brazilian invoices). Use this to retrieve the status of a specific invoice.

  • marketplace_id (String) —

    The Amazon store identifier.

  • invoice_type (String) —

    The invoice's type. Known values: Outbound.

  • program_type (String) —

    The Amazon program that seller is currently enrolled. Known values: EasyShip, FbaOnSite, SelfShip.

  • rate_limit (Float) (defaults to: 1.133) —

    Requests per second

  • (String)
  • (String)
  • (String)
  • order_id: (String, nil) (defaults to: nil)
  • shipment_id: (String, nil) (defaults to: nil)
  • invoice_id: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 1.133)

Returns:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/peddler/apis/delivery_by_amazon_2022_07_01.rb', line 48

def get_invoice_status(marketplace_id, invoice_type, program_type, order_id: nil, shipment_id: nil,
  invoice_id: nil, rate_limit: 1.133)
  path = "/delivery/2022-07-01/invoice/status"
  params = {
    "orderId" => order_id,
    "shipmentId" => shipment_id,
    "invoiceId" => invoice_id,
    "marketplaceId" => marketplace_id,
    "invoiceType" => invoice_type,
    "programType" => program_type,
  }.compact
  parser = -> { GetInvoiceStatusResponse }
  get(path, params:, rate_limit:, parser:)
end

#submit_invoice(body, order_id: nil, shipment_id: nil, rate_limit: 1.133) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Submits a shipment invoice for a given order or shipment. You must specify either an orderId or shipmentId as query parameter. If both parameters are supplied, orderId takes precedence over shipmentId.

Parameters:

  • order_id (String) (defaults to: nil) —

    The identifier for the order.

  • shipment_id (String) (defaults to: nil) —

    The identifier for the shipment.

  • body (Hash) —

    The request body that specifies invoice, program and marketplaceId values.

  • rate_limit (Float) (defaults to: 1.133) —

    Requests per second

  • (Hash[untyped, untyped])
  • order_id: (String, nil) (defaults to: nil)
  • shipment_id: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 1.133)

Returns:



23
24
25
26
27
28
29
30
31
# File 'lib/peddler/apis/delivery_by_amazon_2022_07_01.rb', line 23

def submit_invoice(body, order_id: nil, shipment_id: nil, rate_limit: 1.133)
  path = "/delivery/2022-07-01/invoice"
  params = {
    "orderId" => order_id,
    "shipmentId" => shipment_id,
  }.compact
  parser = -> { SubmitInvoiceResponse }
  post(path, body:, params:, rate_limit:, parser:)
end