Class: Peddler::APIs::VendorDirectFulfillmentOrdersV1

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/error.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/order.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/address.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/error_list.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/order_item.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/order_list.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/pagination.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/tax_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/gift_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/item_quantity.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/order_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/tax_line_item.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/shipment_dates.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/transaction_id.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/shipment_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/get_order_response.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/get_orders_response.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/party_identification.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/acknowledgement_status.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/tax_registration_details.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/order_acknowledgement_item.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/order_item_acknowledgement.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/scheduled_delivery_shipment.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/submit_acknowledgement_request.rb,
lib/peddler/apis/vendor_direct_fulfillment_orders_v1/submit_acknowledgement_response.rb

Overview

Selling Partner API for Direct Fulfillment Orders

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

Defined Under Namespace

Classes: ErrorList, TaxLineItem

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
Order =

Represents a purchase order.

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

  # @return [OrderDetails] Purchase order details.
  attribute?(:order_details, OrderDetails, from: "orderDetails")
end
Address =

Address of the party.

Structure.new do
  # @return [String] First line of the address. For Amazon label only vendors, this field will have the value
  # `xxxxx` within the object `shipToParty`.
  attribute(:address_line1, String, from: "addressLine1")

  # @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. For Amazon label only
  # vendors, this field will have the value `xxxxx` within the object `shipToParty`.
  attribute(:name, String)

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

  # @return [String] Additional address information, if required. For Amazon label only vendors, this field will
  # have the value `xxxxx` within the object `shipToParty`.
  attribute?(:address_line2, String, from: "addressLine2")

  # @return [String] Additional address information, if required. For Amazon label only vendors, this field will
  # have the value `xxxxx` within the object `shipToParty`.
  attribute?(:address_line3, String, from: "addressLine3")

  # @return [String] The attention name of the person at that address. For Amazon label only vendors, this field
  # will have the value `xxxxx` within the object `shipToParty`.
  attribute?(:attention, String)

  # @return [String] The city where the person, business or institution is located. For Amazon label only vendors,
  # this field will have the value `xxxxx` within the object `shipToParty`.
  attribute?(:city, String)

  # @return [String] The county where person, business or institution is located. For Amazon label only vendors,
  # this field will have the value `xxxxx` within the object `shipToParty`.
  attribute?(:county, String)

  # @return [String] The district where person, business or institution is located. For Amazon label only vendors,
  # this field will have the value `xxxxx` within the object `shipToParty`.
  attribute?(:district, String)

  # @return [String] The phone number of the person, business or institution located at that address. For Amazon
  # label only vendors, this field will have the value `xxxxx` within the object `shipToParty`.
  attribute?(:phone, 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")
end
OrderItem =

An item within an order

Structure.new do
  # @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_price, Money, from: "netPrice")

  # @return [ItemQuantity] Item quantity ordered.
  attribute(:ordered_quantity, ItemQuantity, from: "orderedQuantity")

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

  # @return [GiftDetails] Gift message and wrapId details.
  attribute?(:gift_details, GiftDetails, from: "giftDetails")

  # @return [ScheduledDeliveryShipment] Details for the scheduled delivery shipment.
  attribute?(:scheduled_delivery_shipment, ScheduledDeliveryShipment, from: "scheduledDeliveryShipment")

  # @return [Hash] Total tax details for the line item.
  attribute?(:tax_details, TaxDetails, from: "taxDetails")

  # @return [String] Title for the item.
  attribute?(:title, String)

  # @return [Money] The price to Amazon each (cost).
  attribute?(:total_price, Money, from: "totalPrice")

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

A list of purchase orders returned as response.

Structure.new do
  # @return [Array<Order>] Represents a purchase order within the OrderList.
  attribute?(:orders, [Order])

  # @return [Pagination] The pagination elements required to retrieve the remaining data.
  attribute?(:pagination, Pagination)
end
Pagination =

The pagination elements required to retrieve the remaining data.

Structure.new do
  # @return [String] A generated string used to pass information to your next request. If NextToken is returned,
  # pass the value of NextToken to the next request. If NextToken is not returned, there are no more order items
  # to return.
  attribute?(:next_token, String, from: "nextToken")
end
TaxDetails =

The tax details for the order. Note: Amazon calculates tax on the list price (Amazon retail price).

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

  # @return [String]
  attribute?(:tax_rate, String, from: "taxRate")

  # @return [Money]
  attribute?(:taxable_amount, Money, from: "taxableAmount")

  # @return [String] Tax type.
  attribute?(:type, String)
end
GiftDetails =

Gift details for the item.

Structure.new do
  # @return [String] Gift message to be printed in shipment.
  attribute?(:gift_message, String, from: "giftMessage")

  # @return [String] Gift wrap identifier for the gift wrapping, if any.
  attribute?(:gift_wrap_id, String, from: "giftWrapId")
end
ItemQuantity =

Details of quantity ordered.

Structure.new do
  # @return [Integer] Acknowledged quantity. This value should not be zero.
  attribute?(:amount, Integer)

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

Details of an order.

Structure.new do
  # @return [PartyIdentification] Name/Address and tax details of the bill to party.
  attribute(:bill_to_party, PartyIdentification, from: "billToParty")

  # @return [String] The customer order number.
  attribute(:customer_order_number, String, from: "customerOrderNumber")

  # @return [Array<OrderItem>] A list of items in this purchase order.
  attribute(:items, [OrderItem])

  # @return [Time] The date the order was placed. This field is expected to be in ISO-8601 date/time format, for
  # example:2018-07-16T23:00:00Z/ 2018-07-16T23:00:00-05:00 /2018-07-16T23:00:00-08:00. If no time zone is
  # specified, UTC should be assumed.
  attribute(:order_date, Time, from: "orderDate")

  # @return [PartyIdentification] PartyID of vendor code.
  attribute(:selling_party, PartyIdentification, from: "sellingParty")

  # @return [PartyIdentification] PartyID of vendor's warehouse.
  attribute(:ship_from_party, PartyIdentification, from: "shipFromParty")

  # @return [Address] Name/Address and tax details of the ship to party.
  attribute(:ship_to_party, Address, from: "shipToParty")

  # @return [ShipmentDetails]
  attribute(:shipment_details, ShipmentDetails, from: "shipmentDetails")

  # @return [String] Current status of the order.
  attribute?(:order_status, String, from: "orderStatus")

  # @return [Hash] The total Tax object within shipment that relates to the order.
  attribute?(:tax_total, Hash, from: "taxTotal")
end
ShipmentDates =

Shipment dates.

Structure.new do
  # @return [Time] Time by which the vendor is required to ship the order.
  attribute(:required_ship_date, Time, from: "requiredShipDate")

  # @return [Time] Delivery date promised to the Amazon customer.
  attribute?(:promised_delivery_date, Time, from: "promisedDeliveryDate")
end
TransactionId =

Response containing the transaction ID.

Structure.new do
  # @return [String] GUID assigned by Amazon 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
ShipmentDetails =

Shipment details required for the shipment.

Structure.new do
  # @return [:boolean] When true, this is a priority shipment.
  attribute(:priority_shipment, :boolean, from: "isPriorityShipment")

  # @return [:boolean] When true, a packing slip is required to be sent to the customer.
  attribute(:pslip_required, :boolean, from: "isPslipRequired")

  # @return [String] Message to customer for order status.
  attribute(:message_to_customer, String, from: "messageToCustomer")

  # @return [String] Ship method to be used for shipping the order. Amazon defines ship method codes indicating
  # the shipping carrier and shipment service level. To see the full list of ship methods in use, including both
  # the code and the friendly name, search the 'Help' section on Vendor Central for 'ship methods'.
  attribute(:ship_method, String, from: "shipMethod")

  # @return [ShipmentDates]
  attribute(:shipment_dates, ShipmentDates, from: "shipmentDates")

  # @return [:boolean] When true, the order contain a gift. Include the gift message and gift wrap information.
  attribute?(:gift, :boolean, from: "isGift")

  # @return [:boolean] When true, this order is part of a scheduled delivery program.
  attribute?(:scheduled_delivery_shipment, :boolean, from: "isScheduledDeliveryShipment")
end
GetOrderResponse =

The response schema for the getOrder operation.

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

  # @return [Order] The payload for the getOrder operation.
  attribute?(:payload, Order)
end
GetOrdersResponse =

The response schema for the getOrders operation.

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

  # @return [OrderList] A list of purchase orders.
  attribute?(:payload, OrderList)
end
PartyIdentification =

Name, address and tax details of a party.

Structure.new do
  # @return [String] Assigned identification for the party. For example, warehouse code or vendor code. Please
  # refer to specific party for more details.
  attribute(:party_id, String, from: "partyId")

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

  # @return [TaxRegistrationDetails] Tax registration details of the entity.
  attribute?(:tax_info, TaxRegistrationDetails, from: "taxInfo")
end
AcknowledgementStatus =

Status of acknowledgement.

Structure.new do
  # @return [String] Acknowledgement code is a unique two digit value which indicates the status of the
  # acknowledgement. For a list of acknowledgement codes that Amazon supports, see the Vendor Direct Fulfillment
  # APIs Use Case Guide.
  attribute?(:code, String)

  # @return [String] Reason for the acknowledgement code.
  attribute?(:description, String)
end
TaxRegistrationDetails =

Tax registration details of the entity.

Structure.new do
  # @return [String] Tax registration number for the party. For example, VAT 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_messages, String, from: "taxRegistrationMessages")

  # @return [String] Tax registration type for the entity.
  attribute?(:tax_registration_type, String, from: "taxRegistrationType")
end
OrderAcknowledgementItem =

Details of an individual order being acknowledged.

Structure.new do
  # @return [Time] The date and time when the order is acknowledged, in ISO-8601 date/time format. For example:
  # 2018-07-16T23:00:00Z / 2018-07-16T23:00:00-05:00 / 2018-07-16T23:00:00-08:00.
  attribute(:acknowledgement_date, Time, from: "acknowledgementDate")

  # @return [AcknowledgementStatus] Status of acknowledgement.
  attribute(:acknowledgement_status, AcknowledgementStatus, from: "acknowledgementStatus")

  # @return [Array<OrderItemAcknowledgement>] Item details including acknowledged quantity.
  attribute(:item_acknowledgements, [OrderItemAcknowledgement], from: "itemAcknowledgements")

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

  # @return [PartyIdentification] PartyID as vendor code.
  attribute(:selling_party, PartyIdentification, from: "sellingParty")

  # @return [PartyIdentification] PartyID as the vendor's warehouseId.
  attribute(:ship_from_party, PartyIdentification, from: "shipFromParty")

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

Details of an individual item within the order being acknowledged.

Structure.new do
  # @return [ItemQuantity] Details of quantity acknowledged with the above acknowledgement code.
  attribute(:acknowledged_quantity, ItemQuantity, from: "acknowledgedQuantity")

  # @return [String] Line item sequence number for the item.
  attribute(:item_sequence_number, String, from: "itemSequenceNumber")

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

  # @return [String] The vendor selected product identification of the item. Should be the same as was provided in
  # the purchase order.
  attribute?(:vendor_product_identifier, String, from: "vendorProductIdentifier")
end
ScheduledDeliveryShipment =

Dates for the scheduled delivery shipments.

Structure.new do
  # @return [Time] Earliest nominated delivery date for the scheduled delivery.
  attribute?(:earliest_nominated_delivery_date, Time, from: "earliestNominatedDeliveryDate")

  # @return [Time] Latest nominated delivery date for the scheduled delivery.
  attribute?(:latest_nominated_delivery_date, Time, from: "latestNominatedDeliveryDate")

  # @return [String] Scheduled delivery service type.
  attribute?(:scheduled_delivery_service_type, String, from: "scheduledDeliveryServiceType")
end
SubmitAcknowledgementRequest =

The request schema for the submitAcknowledgement operation.

Structure.new do
  # @return [Array<OrderAcknowledgementItem>] A list of one or more purchase orders.
  attribute?(:order_acknowledgements, [OrderAcknowledgementItem], from: "orderAcknowledgements")
end
SubmitAcknowledgementResponse =

The response schema for the submitAcknowledgement operation.

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

  # @return [TransactionId] The payload for the submitAcknowledgement operation.
  attribute?(:payload, TransactionId)
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_order(purchase_order_number, rate_limit: 10.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns purchase order information for the purchaseOrderNumber that you specify.

Notes: alpha-numeric code.

Parameters:

  • purchase_order_number (String)

    The order identifier for the purchase order that you want. Formatting

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:



61
62
63
64
65
# File 'lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb', line 61

def get_order(purchase_order_number, rate_limit: 10.0)
  path = "/vendor/directFulfillment/orders/v1/purchaseOrders/#{percent_encode(purchase_order_number)}"
  parser = -> { GetOrderResponse }
  meter(rate_limit).get(path, parser:)
end

#get_orders(created_after, created_before, ship_from_party_id: nil, status: nil, limit: nil, sort_order: nil, next_token: nil, include_details: "true", rate_limit: 10.0) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns a list of purchase orders created during the time frame that you specify. You define the time frame using the createdAfter and createdBefore parameters. You must use both parameters. You can choose to get only the purchase order numbers by setting the includeDetails parameter to false. In that case, the operation returns a list of purchase order numbers. You can then call the getOrder operation to return the details of a specific order.

specified, the result will contain orders for all warehouses. result will contain orders that match any status. the result. Must be in ISO-8601 date/time format. in the result. Must be in ISO-8601 date/time format. The token value is returned in the previous API call. order numbers are returned.

Parameters:

  • ship_from_party_id (String) (defaults to: nil)

    The vendor warehouse identifier for the fulfillment warehouse. If not

  • status (String) (defaults to: nil)

    Returns only the purchase orders that match the specified status. If not specified, the

  • limit (Integer) (defaults to: nil)

    The limit to the number of purchase orders returned.

  • created_after (String)

    Purchase orders that became available after this date and time will be included in

  • created_before (String)

    Purchase orders that became available before this date and time will be included

  • sort_order (String) (defaults to: nil)

    Sort the list in ascending or descending order by order creation date.

  • next_token (String) (defaults to: nil)

    Used for pagination when there are more orders than the specified result size limit.

  • include_details (String) (defaults to: "true")

    When true, returns the complete purchase order details. Otherwise, only purchase

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb', line 37

def get_orders(created_after, created_before, ship_from_party_id: nil, status: nil, limit: nil, sort_order: nil,
  next_token: nil, include_details: "true", rate_limit: 10.0)
  path = "/vendor/directFulfillment/orders/v1/purchaseOrders"
  params = {
    "shipFromPartyId" => ship_from_party_id,
    "status" => status,
    "limit" => limit,
    "createdAfter" => created_after,
    "createdBefore" => created_before,
    "sortOrder" => sort_order,
    "nextToken" => next_token,
    "includeDetails" => include_details,
  }.compact
  parser = -> { GetOrdersResponse }
  meter(rate_limit).get(path, params:, parser:)
end

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

Note:

This operation can make a static sandbox call.

Submits acknowledgements for one or more purchase orders.

Parameters:

  • body (Hash)

    The request body containing the acknowledgement to an order.

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:



73
74
75
76
77
# File 'lib/peddler/apis/vendor_direct_fulfillment_orders_v1.rb', line 73

def submit_acknowledgement(body, rate_limit: 10.0)
  path = "/vendor/directFulfillment/orders/v1/acknowledgements"
  parser = -> { SubmitAcknowledgementResponse }
  meter(rate_limit).post(path, body:, parser:)
end