Class: Peddler::APIs::VendorTransactionStatusV1

Inherits:
Peddler::API
  • Object
show all
Defined in:
lib/peddler/apis/vendor_transaction_status_v1.rb,
lib/peddler/apis/vendor_transaction_status_v1/error.rb,
lib/peddler/apis/vendor_transaction_status_v1/error_list.rb,
lib/peddler/apis/vendor_transaction_status_v1/transaction.rb,
lib/peddler/apis/vendor_transaction_status_v1/transaction_status.rb,
lib/peddler/apis/vendor_transaction_status_v1/get_transaction_response.rb

Overview

Selling Partner API for Retail Procurement Transaction Status

The Selling Partner API for Retail Procurement Transaction Status provides programmatic access to status information on specific asynchronous POST transactions for vendors.

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

The transaction status.

Structure.new do
  # @return [String] Current processing status of the transaction.
  attribute(:status, String)

  # @return [String] The unique identifier returned in the 'transactionId' field in response to the post request
  # of a specific transaction.
  attribute(:transaction_id, String, from: "transactionId")

  # @return [Array<Error>]
  attribute?(:errors, [Error])
end
TransactionStatus =

Represents the status of a transaction.

Structure.new do
  # @return [Transaction]
  attribute?(:transaction_status, Transaction, from: "transactionStatus")
end
GetTransactionResponse =

The response schema for the getTransaction operation.

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

  # @return [TransactionStatus] The response payload for the getTransaction operation.
  attribute?(:payload, TransactionStatus)
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_transaction(transaction_id, rate_limit: 10.0) ⇒ Peddler::Response

Returns the status of the transaction that you specify.

request of a specific transaction.

Parameters:

  • transaction_id (String)

    The GUID provided by Amazon in the 'transactionId' field in response to the post

  • rate_limit (Float) (defaults to: 10.0)

    Requests per second

Returns:



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

def get_transaction(transaction_id, rate_limit: 10.0)
  cannot_sandbox!

  path = "/vendor/transactions/v1/transactions/#{percent_encode(transaction_id)}"
  parser = -> { GetTransactionResponse }
  meter(rate_limit).get(path, parser:)
end