Class: Peddler::APIs::ExternalFulfillmentReturns20240911

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/external_fulfillment_returns_2024_09_11.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/error.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/return.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/error_list.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/otp_details.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/tracking_info.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/return_metadata.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/returns_response.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/replanning_details.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/invoice_information.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/marketplace_channel.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/return_shipping_info.rb,
lib/peddler/apis/external_fulfillment_returns_2024_09_11/marketplace_channel_details.rb

Overview

The Selling Partner API for Amazon External Fulfillment Return Item Processing

You can use the Amazon External Fulfillment Return Item Processing API to retrieve, track, and process return items through Amazon's External Fulfillment returns management system.

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

Information about the return item.

Structure.new do
  # @return [String] The ID of the location that fulfilled the order.
  attribute(:fulfillment_location_id, String, from: "fulfillmentLocationId")

  # @return [String] The return item's ID.
  attribute(:id, String)

  # @return [String] The date and time of the most recent update to the return.
  attribute(:last_updated_date_time, String, from: "lastUpdatedDateTime")

  # @return [MarketplaceChannelDetails] Channel-specific attributes for the return. These attributes are not
  # mandatory and each channel can provide them differently.
  attribute(:marketplace_channel_details, MarketplaceChannelDetails, from: "marketplaceChannelDetails")

  # @return [ReturnMetadata] Metadata about the return item.
  attribute(:return_metadata, ReturnMetadata, from: "returnMetadata")

  # @return [ReturnShippingInfo] Information about the shipping of the return packages.
  attribute(:return_shipping_info, ReturnShippingInfo, from: "returnShippingInfo")

  # @return [String] The type of return.
  attribute(:return_type, String, from: "returnType")

  # @return [String] The current status of the return.
  attribute(:status, String)

  # @return [String] The date and time when the return was created.
  attribute?(:creation_date_time, String, from: "creationDateTime")

  # @return [String] The seller's identifier for the SKU.
  attribute?(:merchant_sku, String, from: "merchantSku")

  # @return [Integer] The total number of units in the return.
  attribute?(:number_of_units, Integer, from: "numberOfUnits")

  # @return [OtpDetails] The one-time password (OTP) details of the return item.
  attribute?(:otp_details, OtpDetails, from: "otpDetails")

  # @return [String] The package delivery mode. This indicates whether the return was delivered to the seller with
  # or without a one-time password (OTP).
  attribute?(:package_delivery_mode, String, from: "packageDeliveryMode")

  # @return [ReplanningDetails] Details about the replanned returns.
  attribute?(:replanning_details, ReplanningDetails, from: "replanningDetails")

  # @return [String] The SmartConnect identifier for where the return item was dropped for delivery.
  attribute?(:return_location_id, String, from: "returnLocationId")

  # @return [String] The sub-type of return.
  attribute?(:return_sub_type, String, from: "returnSubType")
end
ErrorList =

An object containing a list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>] A list of error responses returned when a request is unsuccessful.
  attribute(:errors, [Error])
end
OtpDetails =

One-time password (OTP) details of the return item.

Structure.new do
  # @return [String] One-time password to validate the return delivered to the seller.
  attribute(:otp, String)

  # @return [Integer] The UNIX timestamp of when the verification code expires.
  attribute(:valid_till, Integer, from: "validTill")
end
TrackingInfo =

Information for tracking a return.

Structure.new do
  # @return [String] The name of the third party courier service used to ship the return package.
  attribute(:carrier_name, String, from: "carrierName")

  # @return [String] The tracking ID of the return package.
  attribute(:tracking_id, String, from: "trackingId")
end
ReturnMetadata =

Metadata about the return item.

Structure.new do
  # @return [String] The reason for the return.
  attribute(:return_reason, String, from: "returnReason")

  # @return [String] The SmartConnect ID of the fulfillment order for which the return was placed.
  attribute?(:fulfillment_order_id, String, from: "fulfillmentOrderId")

  # @return [InvoiceInformation]
  attribute?(:invoice_information, InvoiceInformation, from: "invoiceInformation")

  # @return [String] The RMA ID of the return.
  attribute?(:rma_id, String, from: "rmaId")
end
ReturnsResponse =

The response to the listReturns operation.

Structure.new do
  # @return [String] A token that you use to retrieve the next page of results. The response includes `nextToken`
  # when there are multiple pages of results. 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.
  attribute?(:next_token, String, from: "nextToken")

  # @return [Array<Return>] A list of returns.
  attribute?(:returns, [Return])
end
ReplanningDetails =

Provides details about the replanned returns.

Structure.new do
  # @return [Array<TrackingInfo>] A list of all the previous tracking information for the return.
  attribute?(:previous_tracking_info, [TrackingInfo], from: "previousTrackingInfo")
end
InvoiceInformation =

Invoice-related information for the return created for Amazon SmartConnect.

Structure.new do
  # @return [String] The unique ID of the invoice that corresponds to the return.
  attribute(:id, String)
end
MarketplaceChannel =

The marketplace and channel name.

Structure.new do
  # @return [String] The name of the channel within the marketplace.
  attribute?(:channel_name, String, from: "channelName")

  # @return [String] The name of the marketplace.
  attribute?(:marketplace_name, String, from: "marketplaceName")
end
ReturnShippingInfo =

Information about the shipping of the return packages.

Structure.new do
  # @return [String] The date and time when the seller received the return.
  attribute?(:delivery_date_time, String, from: "deliveryDateTime")

  # @return [TrackingInfo]
  attribute?(:forward_tracking_info, TrackingInfo, from: "forwardTrackingInfo")

  # @return [String] The date and time when the return was picked up.
  attribute?(:pickup_date_time, String, from: "pickupDateTime")

  # @return [TrackingInfo]
  attribute?(:reverse_tracking_info, TrackingInfo, from: "reverseTrackingInfo")
end
MarketplaceChannelDetails =

Marketplace channel-specific attributes for the return. These attributes are not mandatory and each channel can provide them differently.

Structure.new do
  # @return [String] The Amazon SmartConnect SKU of the channel.
  attribute?(:channel_sku, String, from: "channelSku")

  # @return [String] The marketplace-specific customer order ID.
  attribute?(:customer_order_id, String, from: "customerOrderId")

  # @return [String] The Amazon SmartConnect ID of the exchange order.
  attribute?(:exchange_order_id, String, from: "exchangeOrderId")

  # @return [MarketplaceChannel]
  attribute?(:marketplace_channel, MarketplaceChannel, from: "marketplaceChannel")

  # @return [String] The ID of the merchant or seller to whom this return is created in the marketplace.
  attribute?(:merchant_id, String, from: "merchantId")

  # @return [String] The Amazon SmartConnect ID of the location to which this return is created.
  attribute?(:return_location_id, String, from: "returnLocationId")

  # @return [String] The marketplace-specific shipment ID.
  attribute?(:shipment_id, String, from: "shipmentId")
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_return(return_id) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve the return item with the specified ID.

Parameters:

  • return_id (String)

    The ID of the return item you want.

Returns:



69
70
71
72
73
# File 'lib/peddler/apis/external_fulfillment_returns_2024_09_11.rb', line 69

def get_return(return_id)
  path = "/externalFulfillment/2024-09-11/returns/#{percent_encode(return_id)}"
  parser = -> { Return }
  get(path, parser:)
end

#list_returns(return_location_id: nil, rma_id: nil, status: nil, reverse_tracking_id: nil, created_since: nil, created_until: nil, last_updated_since: nil, last_updated_until: nil, last_updated_after: nil, last_updated_before: nil, max_results: nil, next_token: nil) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve a list of return items. You can filter results by location, RMA ID, status, or time.

return items. the CREATED status. ISO 8601 date-time format. ISO 8601 date-time format. In ISO 8601 date-time format. If you supply this parameter, you must also supply returnLocationId and status. included in the response. In ISO 8601 date-time format. If you supply this parameter, you must also supply returnLocationId and status. Maximum: 100 nextToken when there are multiple pages of results. 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.

Parameters:

  • return_location_id (String) (defaults to: nil)

    The SmartConnect location ID of the location from which you want to retrieve

  • rma_id (String) (defaults to: nil)

    The RMA ID of the return items you want to list.

  • status (String) (defaults to: nil)

    The status of return items you want to list. You can retrieve all new return items with

  • reverse_tracking_id (String) (defaults to: nil)

    The reverse tracking ID of the return items you want to list.

  • created_since (String) (defaults to: nil)

    Return items created after the specified date are included in the response. In

  • created_until (String) (defaults to: nil)

    Return items created before the specified date are included in the response. In

  • last_updated_since (String) (defaults to: nil)

    Return items updated after the specified date are included in the response.

  • last_updated_until (String) (defaults to: nil)

    Return items whose most recent update is before the specified date are

  • last_updated_after (String) (defaults to: nil)

    DEPRECATED. Use the createdSince parameter.

  • last_updated_before (String) (defaults to: nil)

    DEPRECATED. Use the createdUntil parameter.

  • max_results (Integer) (defaults to: nil)

    The number of return items you want to include in the response. Default: 10

  • next_token (String) (defaults to: nil)

    A token that you use to retrieve the next page of results. The response includes

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/peddler/apis/external_fulfillment_returns_2024_09_11.rb', line 42

def list_returns(return_location_id: nil, rma_id: nil, status: nil, reverse_tracking_id: nil, created_since: nil,
  created_until: nil, last_updated_since: nil, last_updated_until: nil, last_updated_after: nil,
  last_updated_before: nil, max_results: nil, next_token: nil)
  path = "/externalFulfillment/2024-09-11/returns"
  params = {
    "returnLocationId" => return_location_id,
    "rmaId" => rma_id,
    "status" => status,
    "reverseTrackingId" => reverse_tracking_id,
    "createdSince" => created_since,
    "createdUntil" => created_until,
    "lastUpdatedSince" => last_updated_since,
    "lastUpdatedUntil" => last_updated_until,
    "lastUpdatedAfter" => last_updated_after,
    "lastUpdatedBefore" => last_updated_before,
    "maxResults" => max_results,
    "nextToken" => next_token,
  }.compact
  parser = -> { ReturnsResponse }
  get(path, params:, parser:)
end