Class: Peddler::APIs::VendorDirectFulfillmentPaymentsV1

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/vendor_direct_fulfillment_payments_v1.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/error.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/address.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/error_list.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/tax_detail.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/invoice_item.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/item_quantity.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/charge_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/invoice_detail.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/additional_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/party_identification.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/transaction_reference.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/submit_invoice_request.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/submit_invoice_response.rb,
lib/peddler/apis/vendor_direct_fulfillment_payments_v1/tax_registration_detail.rb

Overview

Selling Partner API for Direct Fulfillment Payments

The Selling Partner API for Direct Fulfillment Payments provides programmatic access to a direct fulfillment vendor's invoice data.

Defined Under Namespace

Classes: ErrorList

Constant Summary collapse

Error =

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 =

Address of the party.

Structure.new do
  # @return [String] First line of the address.
  attribute(:address_line1, String, from: "addressLine1")

  # @return [String] The city where the person, business or institution is located.
  attribute(:city, String)

  # @return [String] The two digit country code in ISO 3166-1 alpha-2 format.
  attribute(:country_code, String, from: "countryCode")

  # @return [String] The name of the person, business or institution at that address.
  attribute(:name, String)

  # @return [String] The postal code of that address. It conatins a series of letters or digits or both, sometimes
  # including spaces or punctuation.
  attribute(:postal_code, String, from: "postalCode")

  # @return [String] The state or region where person, business or institution is located.
  attribute(:state_or_region, String, from: "stateOrRegion")

  # @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] The county where person, business or institution is located.
  attribute?(:county, String)

  # @return [String] The district where person, business or institution is located.
  attribute?(:district, String)

  # @return [String] The phone number of the person, business or institution located at that address.
  attribute?(:phone, String)
end
TaxDetail =

Details of tax amount applied.

Structure.new do
  # @return [Money] Total tax amount applied on invoice total or an item total.
  attribute(:tax_amount, Money, from: "taxAmount")

  # @return [String] Type of the tax applied.
  attribute(:tax_type, String, from: "taxType")

  # @return [String] Tax percentage applied. Percentage must be expressed in decimal.
  attribute?(:tax_rate, String, from: "taxRate")

  # @return [Money] This field will contain the invoice amount that is taxable at the rate specified in the tax
  # rate field.
  attribute?(:taxable_amount, Money, from: "taxableAmount")
end
InvoiceItem =

Provides the details of the items in this invoice.

Structure.new do
  # @return [ItemQuantity] Item quantity invoiced.
  attribute(:invoiced_quantity, ItemQuantity, from: "invoicedQuantity")

  # @return [String] Numbering of the item on the purchase order. The first item will be 1, the second 2, and so
  # on.
  attribute(:item_sequence_number, String, from: "itemSequenceNumber")

  # @return [Money] Net price (before tax) to vendor with currency details.
  attribute(:net_cost, Money, from: "netCost")

  # @return [String] The purchase order number for this order. Formatting Notes: 8-character alpha-numeric code.
  attribute(:purchase_order_number, String, from: "purchaseOrderNumber")

  # @return [String] Buyer's standard identification number (ASIN) of an item.
  attribute?(:buyer_product_identifier, String, from: "buyerProductIdentifier")

  # @return [Array<ChargeDetails>] Individual charge details per line item.
  attribute?(:charge_details, [ChargeDetails], from: "chargeDetails")

  # @return [String] Harmonized System of Nomenclature (HSN) tax code. The HSN number cannot contain alphabets.
  attribute?(:hsn_code, String, from: "hsnCode")

  # @return [Array<TaxDetail>] Individual tax details per line item.
  attribute?(:tax_details, [TaxDetail], from: "taxDetails")

  # @return [String] The vendor's order number for this order.
  attribute?(:vendor_order_number, String, from: "vendorOrderNumber")

  # @return [String] The vendor selected product identification of the item.
  attribute?(:vendor_product_identifier, String, from: "vendorProductIdentifier")
end
ItemQuantity =

Details of item quantity.

Structure.new do
  # @return [Integer] Quantity of units available for a specific item.
  attribute(:amount, Integer)

  # @return [String] Unit of measure for the available quantity.
  attribute(:unit_of_measure, String, from: "unitOfMeasure")
end
ChargeDetails =

Monetary and tax details of the charge.

Structure.new do
  # @return [Money]
  attribute(:charge_amount, Money, from: "chargeAmount")

  # @return [String] Type of charge applied.
  attribute(:type, String)

  # @return [Array<TaxDetail>] Individual tax details per line item.
  attribute?(:tax_details, [TaxDetail], from: "taxDetails")
end
InvoiceDetail =

Represents the details of an invoice, including invoice number, date, parties involved, payment terms, totals, taxes, charges, and line items.

Structure.new do
  # @return [Time] Invoice date.
  attribute(:invoice_date, Time, from: "invoiceDate")

  # @return [String] The unique invoice number.
  attribute(:invoice_number, String, from: "invoiceNumber")

  # @return [Money] Total amount details of the invoice.
  attribute(:invoice_total, Money, from: "invoiceTotal")

  # @return [Array<InvoiceItem>] Provides the details of the items in this invoice.
  attribute(:items, [InvoiceItem])

  # @return [PartyIdentification] Name, address and tax details of the party receiving the payment of this
  # invoice.
  attribute(:remit_to_party, PartyIdentification, from: "remitToParty")

  # @return [PartyIdentification] Warehouse code of the vendor as in the order.
  attribute(:ship_from_party, PartyIdentification, from: "shipFromParty")

  # @return [Array<AdditionalDetails>] Additional details provided by the selling party, for tax-related or other
  # purposes.
  attribute?(:additional_details, [AdditionalDetails], from: "additionalDetails")

  # @return [PartyIdentification] Name, address and tax details of the party to whom this invoice is issued.
  attribute?(:bill_to_party, PartyIdentification, from: "billToParty")

  # @return [Array<ChargeDetails>] Total charge amount details for all line items.
  attribute?(:charge_details, [ChargeDetails], from: "chargeDetails")

  # @return [String] The payment terms for the invoice.
  attribute?(:payment_terms_code, String, from: "paymentTermsCode")

  # @return [String] An additional unique reference number used for regulatory or other purposes.
  attribute?(:reference_number, String, from: "referenceNumber")

  # @return [String] Ship-to country code.
  attribute?(:ship_to_country_code, String, from: "shipToCountryCode")

  # @return [Array<TaxDetail>] Individual tax details per line item.
  attribute?(:tax_totals, [TaxDetail], from: "taxTotals")
end
AdditionalDetails =

A field where the selling party can provide additional information for tax-related or any other purposes.

Structure.new do
  # @return [String] The detail of the additional information provided by the selling party.
  attribute(:detail, String)

  # @return [String] The type of the additional information provided by the selling party.
  attribute(:type, String)

  # @return [String] The language code of the additional information detail.
  attribute?(:language_code, String, from: "languageCode")
end
PartyIdentification =

Name, address and tax details of a party.

Structure.new do
  # @return [String] Assigned Identification for the party.
  attribute(:party_id, String, from: "partyId")

  # @return [Address] Identification of the party by address.
  attribute?(:address, Address)

  # @return [Array<TaxRegistrationDetail>] Tax registration details of the entity.
  attribute?(:tax_registration_details, [TaxRegistrationDetail], from: "taxRegistrationDetails")
end
TransactionReference =

Response containing the transaction ID.

Structure.new do
  # @return [String] GUID to identify this transaction. This value can be used with the Transaction Status API to
  # return the status of this transaction.
  attribute?(:transaction_id, String, from: "transactionId")
end
SubmitInvoiceRequest =

The request schema for the submitInvoice operation.

Structure.new do
  # @return [Array<InvoiceDetail>] An array of invoice details to be submitted.
  attribute?(:invoices, [InvoiceDetail])
end
SubmitInvoiceResponse =

The response schema for the submitInvoice operation.

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

  # @return [TransactionReference] The response payload for the submitInvoice operation.
  attribute?(:payload, TransactionReference)
end
TaxRegistrationDetail =

Tax registration details of the entity.

Structure.new do
  # @return [String] Tax registration number for the entity. For example, VAT ID, Consumption Tax ID.
  attribute(:tax_registration_number, String, from: "taxRegistrationNumber")

  # @return [Address] Address associated with the tax registration number.
  attribute?(:tax_registration_address, Address, from: "taxRegistrationAddress")

  # @return [String] Tax registration message that can be used for additional tax related details.
  attribute?(:tax_registration_message, String, from: "taxRegistrationMessage")

  # @return [String] Tax registration type for the entity.
  attribute?(:tax_registration_type, String, from: "taxRegistrationType")
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

#submit_invoice(body, rate_limit: 10.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Submits one or more invoices for a vendor's direct fulfillment orders.

Parameters:

  • body (Hash)

    The request body containing one or more invoices for vendor orders.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:



20
21
22
23
24
# File 'lib/peddler/apis/vendor_direct_fulfillment_payments_v1.rb', line 20

def submit_invoice(body, rate_limit: 10.0)
  path = "/vendor/directFulfillment/payments/v1/invoices"
  parser = -> { SubmitInvoiceResponse }
  meter(rate_limit).post(path, body:, parser:)
end