Class: Peddler::APIs::ShipmentInvoicingV0

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/shipment_invoicing_v0.rb,
lib/peddler/apis/shipment_invoicing_v0/error.rb,
lib/peddler/apis/shipment_invoicing_v0/address.rb,
lib/peddler/apis/shipment_invoicing_v0/error_list.rb,
lib/peddler/apis/shipment_invoicing_v0/shipment_item.rb,
lib/peddler/apis/shipment_invoicing_v0/buyer_tax_info.rb,
lib/peddler/apis/shipment_invoicing_v0/shipment_items.rb,
lib/peddler/apis/shipment_invoicing_v0/shipment_detail.rb,
lib/peddler/apis/shipment_invoicing_v0/tax_classification.rb,
lib/peddler/apis/shipment_invoicing_v0/payment_information.rb,
lib/peddler/apis/shipment_invoicing_v0/serial_numbers_list.rb,
lib/peddler/apis/shipment_invoicing_v0/marketplace_tax_info.rb,
lib/peddler/apis/shipment_invoicing_v0/submit_invoice_request.rb,
lib/peddler/apis/shipment_invoicing_v0/submit_invoice_response.rb,
lib/peddler/apis/shipment_invoicing_v0/tax_classification_list.rb,
lib/peddler/apis/shipment_invoicing_v0/payment_information_list.rb,
lib/peddler/apis/shipment_invoicing_v0/get_invoice_status_response.rb,
lib/peddler/apis/shipment_invoicing_v0/shipment_invoice_status_info.rb,
lib/peddler/apis/shipment_invoicing_v0/get_shipment_details_response.rb,
lib/peddler/apis/shipment_invoicing_v0/payment_method_detail_item_list.rb,
lib/peddler/apis/shipment_invoicing_v0/shipment_invoice_status_response.rb

Overview

Selling Partner API for Shipment Invoicing

The Selling Partner API for Shipment Invoicing helps you programmatically retrieve shipment invoice information in the Brazil marketplace for a selling partner’s Fulfillment by Amazon (FBA) orders.

Defined Under Namespace

Classes: ErrorList, PaymentInformationList, PaymentMethodDetailItemList, SerialNumbersList, ShipmentItems, TaxClassificationList

Constant Summary collapse

Error =

An error response returned when the request is unsuccessful.

Structure.new do
  # @return [String] An error code that identifies the type of error that occurred.
  attribute(:code, String)

  # @return [String] A message that describes the error condition.
  attribute(:message, String)

  # @return [String] Additional details that can help the caller understand or fix the issue.
  attribute?(:details, String)
end
Address =

The shipping address details of the shipment.

Structure.new do
  # @return [String] The street address.
  attribute?(:address_line1, String, from: "AddressLine1")

  # @return [String] Additional street address information, if required.
  attribute?(:address_line2, String, from: "AddressLine2")

  # @return [String] Additional street address information, if required.
  attribute?(:address_line3, String, from: "AddressLine3")

  # @return [String]
  attribute?(:address_type, String, from: "AddressType")

  # @return [String] The city.
  attribute?(:city, String, from: "City")

  # @return [String] The country code.
  attribute?(:country_code, String, from: "CountryCode")

  # @return [String] The county.
  attribute?(:county, String, from: "County")

  # @return [String] The district.
  attribute?(:district, String, from: "District")

  # @return [String] The name.
  attribute?(:name, String, from: "Name")

  # @return [String] The phone number.
  attribute?(:phone, String, from: "Phone")

  # @return [String] The postal code.
  attribute?(:postal_code, String, from: "PostalCode")

  # @return [String] The state or region.
  attribute?(:state_or_region, String, from: "StateOrRegion")
end
ShipmentItem =

The shipment item information required by a seller to issue a shipment invoice.

Structure.new do
  # @return [String] The Amazon Standard Identification Number (ASIN) of the item.
  attribute?(:asin, String, from: "ASIN")

  # @return [Money] The gift wrap price of the item.
  attribute?(:gift_wrap_price, Money, from: "GiftWrapPrice")

  # @return [Money] The selling price of the item multiplied by the quantity ordered. Note that ItemPrice excludes
  # ShippingPrice and GiftWrapPrice.
  attribute?(:item_price, Money, from: "ItemPrice")

  # @return [String] The Amazon-defined identifier for the order item.
  attribute?(:order_item_id, String, from: "OrderItemId")

  # @return [Money] The total of all promotional discounts in the offer.
  attribute?(:promotion_discount, Money, from: "PromotionDiscount")

  # @return [Float] The number of items ordered.
  attribute?(:quantity_ordered, Float, from: "QuantityOrdered")

  # @return [String] The seller SKU of the item.
  attribute?(:seller_sku, String, from: "SellerSKU")

  # @return [Array<String>] The list of serial numbers.
  attribute?(:serial_numbers, [String], from: "SerialNumbers")

  # @return [Money] The discount on the shipping price.
  attribute?(:shipping_discount, Money, from: "ShippingDiscount")

  # @return [Money] The shipping price of the item.
  attribute?(:shipping_price, Money, from: "ShippingPrice")

  # @return [String] The name of the item.
  attribute?(:title, String, from: "Title")
end
BuyerTaxInfo =

Tax information about the buyer.

Structure.new do
  # @return [String] The legal name of the company.
  attribute?(:company_legal_name, String, from: "CompanyLegalName")

  # @return [Array<TaxClassification>]
  attribute?(:tax_classifications, [TaxClassification], from: "TaxClassifications")

  # @return [String] The country or region imposing the tax.
  attribute?(:taxing_region, String, from: "TaxingRegion")
end
ShipmentDetail =

The information required by a selling partner to issue a shipment invoice.

Structure.new do
  # @return [String] The Amazon-defined identifier for the order.
  attribute?(:amazon_order_id, String, from: "AmazonOrderId")

  # @return [String] The Amazon-defined identifier for the shipment.
  attribute?(:amazon_shipment_id, String, from: "AmazonShipmentId")

  # @return [String] The county of the buyer.
  attribute?(:buyer_county, String, from: "BuyerCounty")

  # @return [String] The name of the buyer.
  attribute?(:buyer_name, String, from: "BuyerName")

  # @return [BuyerTaxInfo]
  attribute?(:buyer_tax_info, BuyerTaxInfo, from: "BuyerTaxInfo")

  # @return [String] The identifier for the marketplace where the order was placed.
  attribute?(:marketplace_id, String, from: "MarketplaceId")

  # @return [MarketplaceTaxInfo]
  attribute?(:marketplace_tax_info, MarketplaceTaxInfo, from: "MarketplaceTaxInfo")

  # @return [Array<String>]
  attribute?(:payment_method_details, [String], from: "PaymentMethodDetails")

  # @return [Array<PaymentInformation>]
  attribute?(:payments, [PaymentInformation], from: "Payments")

  # @return [Time] The date and time when the order was created.
  attribute?(:purchase_date, Time, from: "PurchaseDate")

  # @return [String] The seller’s friendly name registered in the marketplace.
  attribute?(:seller_display_name, String, from: "SellerDisplayName")

  # @return [String] The seller identifier.
  attribute?(:seller_id, String, from: "SellerId")

  # @return [Array<ShipmentItem>]
  attribute?(:shipment_items, [ShipmentItem], from: "ShipmentItems")

  # @return [Address]
  attribute?(:shipping_address, Address, from: "ShippingAddress")

  # @return [String] The Amazon-defined identifier for the warehouse.
  attribute?(:warehouse_id, String, from: "WarehouseId")
end
TaxClassification =

The tax classification for the entity.

Structure.new do
  # @return [String] The type of tax.
  attribute?(:name, String, from: "Name")

  # @return [String] The entity's tax identifier.
  attribute?(:value, String, from: "Value")
end
PaymentInformation =

Payment transaction information

Structure.new do
  # @return [String] Government ID of acquirer
  attribute?(:acquirer_id, String, from: "AcquirerId")

  # @return [String] Authorization code for this payment
  attribute?(:authorization_code, String, from: "AuthorizationCode")

  # @return [String] Credit card brand (if payment method is CreditCard)
  attribute?(:card_brand, String, from: "CardBrand")

  # @return [String] Payment method name
  attribute?(:payment_method, String, from: "PaymentMethod")

  # @return [Money] Amount paid in this payment
  attribute?(:payment_value, Money, from: "PaymentValue")
end
MarketplaceTaxInfo =

Tax information about the marketplace.

Structure.new do
  # @return [String] The legal name of the company.
  attribute?(:company_legal_name, String, from: "CompanyLegalName")

  # @return [Array<TaxClassification>]
  attribute?(:tax_classifications, [TaxClassification], from: "TaxClassifications")

  # @return [String] The country or region imposing the tax.
  attribute?(:taxing_region, String, from: "TaxingRegion")
end
SubmitInvoiceRequest =

The request schema for the submitInvoice operation.

Structure.new do
  # @return [String] MD5 sum for validating the invoice data. For more information about calculating this value,
  # see [Working with Content-MD5
  # Checksums](https://docs.developer.amazonservices.com/en_US/dev_guide/DG_MD5.html).
  attribute(:content_md5_value, String, from: "ContentMD5Value")

  # @return [String]
  attribute(:invoice_content, String, from: "InvoiceContent")

  # @return [String] An Amazon marketplace identifier.
  attribute?(:marketplace_id, String, from: "MarketplaceId")
end
SubmitInvoiceResponse =

The response schema for the submitInvoice operation.

Structure.new do
  # @return [Array<Error>]
  attribute?(:errors, [Error])
end
GetInvoiceStatusResponse =

The response schema for the getInvoiceStatus operation.

Structure.new do
  # @return [Array<Error>]
  attribute?(:errors, [Error])

  # @return [ShipmentInvoiceStatusResponse] The payload for the getInvoiceStatus operation.
  attribute?(:payload, ShipmentInvoiceStatusResponse)
end
ShipmentInvoiceStatusInfo =

The shipment invoice status information.

Structure.new do
  # @return [String] The Amazon-defined shipment identifier.
  attribute?(:amazon_shipment_id, String, from: "AmazonShipmentId")

  # @return [String]
  attribute?(:invoice_status, String, from: "InvoiceStatus")
end
GetShipmentDetailsResponse =

The response schema for the getShipmentDetails operation.

Structure.new do
  # @return [Array<Error>]
  attribute?(:errors, [Error])

  # @return [ShipmentDetail] The payload for the getShipmentDetails operation
  attribute?(:payload, ShipmentDetail)
end
ShipmentInvoiceStatusResponse =

The shipment invoice status response.

Structure.new do
  # @return [ShipmentInvoiceStatusInfo]
  attribute?(:shipments, ShipmentInvoiceStatusInfo, from: "Shipments")
end

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#endpoint_uri, #http, #initialize, #meter, #retriable, #sandbox, #sandbox?, #use, #via

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#get_invoice_status(shipment_id, rate_limit: 1.133) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the invoice status for the shipment you specify.

Parameters:

  • shipment_id (String)

    The shipment identifier for the shipment.

  • rate_limit (Float) (defaults to: 1.133)

    Requests per second

Returns:



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

def get_invoice_status(shipment_id, rate_limit: 1.133)
  path = "/fba/outbound/brazil/v0/shipments/#{percent_encode(shipment_id)}/invoice/status"
  parser = -> { GetInvoiceStatusResponse }
  meter(rate_limit).get(path, parser:)
end

#get_shipment_details(shipment_id, rate_limit: 1.133) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns the shipment details required to issue an invoice for the specified shipment.

notification. For information about subscribing to notifications, see the href="https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide">https://developer-docs.amazon.com/sp-api/docs/notifications-api-v1-use-case-guide Notifications API Use Case Guide.

Parameters:

  • shipment_id (String)

    The identifier for the shipment. Get this value from the FBAOutboundShipmentStatus

  • rate_limit (Float) (defaults to: 1.133)

    Requests per second

Returns:



23
24
25
26
27
# File 'lib/peddler/apis/shipment_invoicing_v0.rb', line 23

def get_shipment_details(shipment_id, rate_limit: 1.133)
  path = "/fba/outbound/brazil/v0/shipments/#{percent_encode(shipment_id)}"
  parser = -> { GetShipmentDetailsResponse }
  meter(rate_limit).get(path, parser:)
end

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

Note:

This operation can make a static sandbox call.

Submits a shipment invoice document for a given shipment.

Parameters:

  • shipment_id (String)

    The identifier for the shipment.

  • body (Hash)
  • rate_limit (Float) (defaults to: 1.133)

    Requests per second

Returns:



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

def submit_invoice(shipment_id, body, rate_limit: 1.133)
  path = "/fba/outbound/brazil/v0/shipments/#{percent_encode(shipment_id)}/invoice"
  parser = -> { SubmitInvoiceResponse }
  meter(rate_limit).post(path, body:, parser:)
end