Class: Peddler::APIs::Finances20240619

Inherits:
Peddler::API show all
Defined in:
lib/peddler/apis/finances_2024_06_19.rb,
lib/peddler/apis/finances_2024_06_19/item.rb,
lib/peddler/apis/finances_2024_06_19/error.rb,
lib/peddler/apis/finances_2024_06_19/items.rb,
lib/peddler/apis/finances_2024_06_19/context.rb,
lib/peddler/apis/finances_2024_06_19/contexts.rb,
lib/peddler/apis/finances_2024_06_19/breakdown.rb,
lib/peddler/apis/finances_2024_06_19/breakdowns.rb,
lib/peddler/apis/finances_2024_06_19/error_list.rb,
lib/peddler/apis/finances_2024_06_19/transaction.rb,
lib/peddler/apis/finances_2024_06_19/transactions.rb,
lib/peddler/apis/finances_2024_06_19/product_context.rb,
lib/peddler/apis/finances_2024_06_19/business_context.rb,
lib/peddler/apis/finances_2024_06_19/deferred_context.rb,
lib/peddler/apis/finances_2024_06_19/payments_context.rb,
lib/peddler/apis/finances_2024_06_19/amazon_pay_context.rb,
lib/peddler/apis/finances_2024_06_19/related_identifier.rb,
lib/peddler/apis/finances_2024_06_19/time_range_context.rb,
lib/peddler/apis/finances_2024_06_19/marketplace_details.rb,
lib/peddler/apis/finances_2024_06_19/related_identifiers.rb,
lib/peddler/apis/finances_2024_06_19/transactions_payload.rb,
lib/peddler/apis/finances_2024_06_19/item_related_identifier.rb,
lib/peddler/apis/finances_2024_06_19/item_related_identifiers.rb,
lib/peddler/apis/finances_2024_06_19/selling_partner_metadata.rb,
lib/peddler/apis/finances_2024_06_19/list_transactions_response.rb

Overview

The Selling Partner API for Finances

The Selling Partner API for Finances provides financial information relevant to a seller's business. You can obtain financial events for a given order or date range without having to wait until a statement period closes.

Defined Under Namespace

Classes: Breakdowns, Contexts, ItemRelatedIdentifiers, Items, RelatedIdentifiers, Transactions

Constant Summary collapse

Item =

Additional information about the items in a transaction.

Structure.new do
  # @return [Array<Breakdown>] A list of breakdowns that detail how the total amount is calculated for the
  #   transaction.
  attribute?(:breakdowns, [Breakdown])

  # @return [Array<Context>] Additional Information about the item.
  attribute?(:contexts, [Context])

  # @return [String] A description of the items in a transaction.
  attribute?(:description, String)

  # @return [Array<ItemRelatedIdentifier>] Related business identifiers of the item.
  attribute?(:related_identifiers, [ItemRelatedIdentifier], from: "relatedIdentifiers")

  # @return [Money] The total monetary amount of the item.
  attribute?(:total_amount, Money, from: "totalAmount")
end
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
Context =

Additional Information about the item.

Structure.new do
  # @return [String]
  attribute(:context_type, String, from: "contextType")

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

  # @return [String] Channel details of related transaction.
  attribute?(:channel, String)

  # @return [String] The deferral policy applied to the transaction.
  #
  # **Examples:** `B2B` (invoiced orders), `DD7` (delivery date policy)
  attribute?(:deferral_reason, String, from: "deferralReason")

  # @return [String] The end time of the transaction.
  attribute?(:end_time, String, from: "endTime")

  # @return [String] The fulfillment network of the item.
  attribute?(:fulfillment_network, String, from: "fulfillmentNetwork")

  # @return [String] The release date of the transaction.
  attribute?(:maturity_date, String, from: "maturityDate")

  # @return [String] The transaction's order type.
  attribute?(:order_type, String, from: "orderType")

  # @return [String] The date of the payment.
  attribute?(:payment_date, String, from: "paymentDate")

  # @return [String] The method of payment.
  attribute?(:payment_method, String, from: "paymentMethod")

  # @return [String] The reference number of the payment.
  attribute?(:payment_reference, String, from: "paymentReference")

  # @return [String] The type of payment.
  attribute?(:payment_type, String, from: "paymentType")

  # @return [Integer] The quantity of the item shipped.
  attribute?(:quantity_shipped, Integer, from: "quantityShipped")

  # @return [String] The Stock Keeping Unit (SKU) of the item.
  attribute?(:sku, String)

  # @return [String] The start time of the transaction.
  attribute?(:start_time, String, from: "startTime")

  # @return [String] The store name associated with the transaction.
  attribute?(:store_name, String, from: "storeName")
end
Breakdown =

Details about the movement of money in the financial transaction. Breakdowns are further categorized into breakdown types, breakdown amounts, and further breakdowns.

Structure.new do
  # @return [Money] The monetary amount of the charge.
  attribute?(:breakdown_amount, Money, from: "breakdownAmount")

  # @return [String] The type of charge.
  attribute?(:breakdown_type, String, from: "breakdownType")

  # @return [Array<self>] A list of breakdowns that detail how the total amount is calculated for the transaction.
  attribute?(:breakdowns, [:self])
end
ErrorList =

A list of error responses returned when a request is unsuccessful.

Structure.new do
  # @return [Array<Error>] The error responses that are returned when the request is unsuccessful.
  attribute(:errors, [Error])
end
Transaction =

All the information related to a transaction.

Structure.new do
  # @return [Array<Breakdown>] A list of breakdowns that detail how the total amount is calculated for the
  #   transaction.
  attribute?(:breakdowns, [Breakdown])

  # @return [Array<Context>] Additional Information about the transaction.
  attribute?(:contexts, [Context])

  # @return [String] Describes the reasons for the transaction.
  #
  # **Example:** 'Order Payment', 'Refund Order'
  attribute?(:description, String)

  # @return [Array<Item>] Additional information about the items in the transaction.
  attribute?(:items, [Item])

  # @return [MarketplaceDetails] Information about the marketplace where the transaction occurred.
  attribute?(:marketplace_details, MarketplaceDetails, from: "marketplaceDetails")

  # @return [String] The date and time when the transaction was posted.
  attribute?(:posted_date, String, from: "postedDate")

  # @return [Array<RelatedIdentifier>] Identifiers related to the transaction, such as order and shipment IDs.
  attribute?(:related_identifiers, [RelatedIdentifier], from: "relatedIdentifiers")

  # @return [SellingPartnerMetadata] Metadata that describes the seller.
  attribute?(:selling_partner_metadata, SellingPartnerMetadata, from: "sellingPartnerMetadata")

  # @return [Money] The total amount of money in the transaction.
  attribute?(:total_amount, Money, from: "totalAmount")

  # @return [String] The unique identifier of the transaction.
  attribute?(:transaction_id, String, from: "transactionId")

  # @return [String] The status of the transaction.
  #
  # **Possible values:**
  #
  # * `DEFERRED`: the transaction is currently deferred.
  # * `RELEASED`: the transaction is currently released.
  # * `DEFERRED_RELEASED`: the transaction was deferred in the past, but is now released. The status of a deferred
  #   transaction is updated to `DEFERRED_RELEASED` when the transaction is released.
  attribute?(:transaction_status, String, from: "transactionStatus")

  # @return [String] The type of transaction.
  #
  # **Possible value:** `Shipment`
  attribute?(:transaction_type, String, from: "transactionType")
end
ProductContext =

Additional information related to the product.

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

  # @return [String] The fulfillment network of the item.
  attribute?(:fulfillment_network, String, from: "fulfillmentNetwork")

  # @return [Integer] The quantity of the item shipped.
  attribute?(:quantity_shipped, Integer, from: "quantityShipped")

  # @return [String] The Stock Keeping Unit (SKU) of the item.
  attribute?(:sku, String)
end
BusinessContext =

Information about the line of business associated with a transaction.

Structure.new do
  # @return [String] The store name associated with the transaction.
  attribute?(:store_name, String, from: "storeName")
end
DeferredContext =

Additional information related to deferred transactions.

Structure.new do
  # @return [String] The deferral policy applied to the transaction.
  #
  # **Examples:** `B2B` (invoiced orders), `DD7` (delivery date policy)
  attribute?(:deferral_reason, String, from: "deferralReason")

  # @return [String] The release date of the transaction.
  attribute?(:maturity_date, String, from: "maturityDate")
end
PaymentsContext =

Additional information related to payments-related transactions.

Structure.new do
  # @return [String] The date of the payment.
  attribute?(:payment_date, String, from: "paymentDate")

  # @return [String] The method of payment.
  attribute?(:payment_method, String, from: "paymentMethod")

  # @return [String] The reference number of the payment.
  attribute?(:payment_reference, String, from: "paymentReference")

  # @return [String] The type of payment.
  attribute?(:payment_type, String, from: "paymentType")
end
AmazonPayContext =

Additional information related to Amazon Pay.

Structure.new do
  # @return [String] Channel details of related transaction.
  attribute?(:channel, String)

  # @return [String] The transaction's order type.
  attribute?(:order_type, String, from: "orderType")

  # @return [String] The name of the store that is related to the transaction.
  attribute?(:store_name, String, from: "storeName")
end
RelatedIdentifier =

Related business identifier of the transaction.

Structure.new do
  # @return [String] An enumerated set of related business identifier names.
  attribute?(:related_identifier_name, String, from: "relatedIdentifierName")

  # @return [String] Corresponding value of `RelatedIdentifierName`.
  attribute?(:related_identifier_value, String, from: "relatedIdentifierValue")
end
TimeRangeContext =

Additional information that is related to the time range of the transaction.

Structure.new do
  # @return [String] The end time of the transaction.
  attribute?(:end_time, String, from: "endTime")

  # @return [String] The start time of the transaction.
  attribute?(:start_time, String, from: "startTime")
end
MarketplaceDetails =

Information about the marketplace where the transaction occurred.

Structure.new do
  # @return [String] The identifier of the marketplace where the transaction occurred. The marketplace ID is the
  #   globally unique identifier of a marketplace. To find the ID for your marketplace, refer to [Marketplace
  #   IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
  attribute?(:marketplace_id, String, from: "marketplaceId")

  # @return [String] The name of the marketplace where the transaction occurred. For example:
  #   `Amazon.com`,`Amazon.in`
  attribute?(:marketplace_name, String, from: "marketplaceName")
end
TransactionsPayload =

The payload for the listTransactions operation.

Structure.new do
  # @return [String] The response includes `nextToken` when the number of results exceeds the specified `pageSize`
  #   value. 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<Transaction>]
  attribute?(:transactions, [Transaction])
end
ItemRelatedIdentifier =

Related business identifiers of the item.

Structure.new do
  # @return [String] Enumerated set of related item identifier names for the item.
  attribute?(:item_related_identifier_name, String, from: "itemRelatedIdentifierName")

  # @return [String] Corresponding value to `ItemRelatedIdentifierName`.
  attribute?(:item_related_identifier_value, String, from: "itemRelatedIdentifierValue")
end
SellingPartnerMetadata =

Metadata that describes the seller.

Structure.new do
  # @return [String] The type of account in the transaction.
  attribute?(:account_type, String, from: "accountType")

  # @return [String] The identifier of the marketplace where the transaction occurred. The marketplace ID is the
  #   globally unique identifier of a marketplace. To find the ID for your marketplace, refer to [Marketplace
  #   IDs](https://developer-docs.amazon.com/sp-api/docs/marketplace-ids).
  attribute?(:marketplace_id, String, from: "marketplaceId")

  # @return [String] A unique seller identifier.
  attribute?(:selling_partner_id, String, from: "sellingPartnerId")
end
ListTransactionsResponse =

The response schema for the listTransactions operation.

Structure.new do
  # @return [TransactionsPayload] The payload for the `listTransactions` operation.
  attribute?(:payload, TransactionsPayload)
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

#list_transactions(posted_after: nil, posted_before: nil, marketplace_id: nil, transaction_status: nil, related_identifier_name: nil, related_identifier_value: nil, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Returns transactions for the given parameters. Financial events might not include orders from the last 48 hours.

Parameters:

  • posted_after (String) (defaults to: nil)

    The response includes financial events posted on or after this date. This date must be in ISO 8601 date-time format. The date-time must be more than two minutes before the time of the request. This field is required if you do not specify a related identifier.

  • posted_before (String) (defaults to: nil)

    The response includes financial events posted before (but not on) this date. This date must be in ISO 8601 date-time format. The date-time must be later than PostedAfter and more than two minutes before the request was submitted. If PostedAfter and PostedBefore are more than 180 days apart, the response is empty. Default: Two minutes before the time of the request.

  • marketplace_id (String) (defaults to: nil)

    The identifier of the marketplace from which you want to retrieve transactions. The marketplace ID is the globally unique identifier of a marketplace. To find the ID for your marketplace, refer to Marketplace IDs.

  • transaction_status (String) (defaults to: nil)

    The status of the transaction. Possible values: * DEFERRED: the transaction is currently deferred. * RELEASED: the transaction is currently released. * DEFERRED_RELEASED: the transaction was deferred in the past, but is now released. The status of a deferred transaction is updated to DEFERRED_RELEASED when the transaction is released.

  • related_identifier_name (String) (defaults to: nil)

    The name of the relatedIdentifier. Possible values: * FINANCIAL_EVENT_GROUP_ID: the financial event group ID associated with the transaction. Note: FINANCIAL_EVENT_GROUP_ID is the only relatedIdentifier with filtering capabilities at the moment. While other relatedIdentifier values will be included in the response when available, they cannot be used for filtering purposes.

  • related_identifier_value (String) (defaults to: nil)

    The value of the relatedIdentifier.

  • next_token (String) (defaults to: nil)

    The response includes nextToken when the number of results exceeds the specified pageSize value. 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.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/peddler/apis/finances_2024_06_19.rb', line 45

def list_transactions(posted_after: nil, posted_before: nil, marketplace_id: nil, transaction_status: nil,
  related_identifier_name: nil, related_identifier_value: nil, next_token: nil, rate_limit: 0.5)
  path = "/finances/2024-06-19/transactions"
  params = {
    "postedAfter" => posted_after,
    "postedBefore" => posted_before,
    "marketplaceId" => marketplace_id,
    "transactionStatus" => transaction_status,
    "relatedIdentifierName" => related_identifier_name,
    "relatedIdentifierValue" => related_identifier_value,
    "nextToken" => next_token,
  }.compact
  parser = -> { ListTransactionsResponse }
  meter(rate_limit).get(path, params:, parser:)
end