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/balance.rb,
lib/peddler/apis/finances_2024_06_19/context.rb,
lib/peddler/apis/finances_2024_06_19/summary.rb,
lib/peddler/apis/finances_2024_06_19/balances.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/partner_metadata.rb,
lib/peddler/apis/finances_2024_06_19/payments_context.rb,
lib/peddler/apis/finances_2024_06_19/summary_response.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/list_balances_response.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,
sig/peddler/apis/finances_2024_06_19.rbs

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: AmazonPayContext, Balance, Balances, Breakdown, Breakdowns, BusinessContext, Context, Contexts, DeferredContext, Error, ErrorList, Item, ItemRelatedIdentifier, ItemRelatedIdentifiers, Items, ListBalancesResponse, ListTransactionsResponse, MarketplaceDetails, PartnerMetadata, PaymentsContext, ProductContext, RelatedIdentifier, RelatedIdentifiers, SellingPartnerMetadata, Summary, SummaryResponse, TimeRangeContext, Transaction, Transactions, TransactionsPayload

Constant Summary

Constants inherited from Peddler::API

Peddler::API::TRANSIENT_STATUSES

Instance Attribute Summary

Attributes inherited from Peddler::API

#access_token, #base_url, #endpoint, #retries

Instance Method Summary collapse

Methods inherited from Peddler::API

#cannot_sandbox!, #delete, #endpoint_uri, #get, #host_header, #http, #initialize, #must_sandbox!, #parse_base_url, #patch, #percent_encode, #post, #put, #request, #sandbox, #sandbox?, #stringify_array, #timestamp, #user_agent

Constructor Details

This class inherits a constructor from Peddler::API

Instance Method Details

#list_balances(marketplace_ids: nil, balance_type: nil, account_type: nil, as_of_date: nil, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve a balance. This balance can be a past balances at a specified date, or a current balance. Sub-balances are listed by account type and marketplace.

Parameters:

  • marketplace_ids (Array<String>) (defaults to: nil)

    The marketplaces from which to retrieve balances. If omitted, balances from all applicable marketplaces may be returned. To find the marketplace ID for a region, refer to Marketplace IDs.

  • balance_type (String) (defaults to: nil)

    The type of balance to include in the response. If omitted, all balance types may be included in the response. Possible values: AVAILABLE, RESERVED, TOTAL

  • account_type (String) (defaults to: nil)

    The type of account to include in the response.

  • as_of_date (String) (defaults to: nil)

    The date from which you want to retrieve balances. If provided, the response includes historical balances at the specified date. The value must be in ISO 8601 date format. If omitted, the point in time balance is provided.

  • next_token (String) (defaults to: nil)

    A token that you use to retrieve subsequent pages of results. When there are more than 500 results available, the response will include a nextToken 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. Repeat this process until the nextToken value is null to retrieve all results.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

  • marketplace_ids: (Array[String], nil) (defaults to: nil)
  • balance_type: (String, nil) (defaults to: nil)
  • account_type: (String, nil) (defaults to: nil)
  • as_of_date: (String, nil) (defaults to: nil)
  • next_token: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.5)

Returns:



81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/peddler/apis/finances_2024_06_19.rb', line 81

def list_balances(marketplace_ids: nil, balance_type: nil, account_type: nil, as_of_date: nil, next_token: nil,
  rate_limit: 0.5)
  path = "/finances/2024-06-19/balances"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "balanceType" => balance_type,
    "accountType" => ,
    "asOfDate" => as_of_date,
    "nextToken" => next_token,
  }.compact
  parser = -> { ListBalancesResponse }
  get(path, params:, rate_limit:, parser:)
end

#list_summary(marketplace_ids: nil, account_type: nil, related_identifier_name: nil, related_identifier_value: nil, period_start: nil, period_end: nil, next_token: nil, rate_limit: 0.5) ⇒ Peddler::Response

Note:

This operation can make a static sandbox call.

Retrieve the financial summary for the specified time period or settlement period.

Parameters:

  • marketplace_ids (Array<String>) (defaults to: nil)

    The marketplaces from which to retrieve summaries. If omitted, summaries from all applicable marketplaces may be returned. To find the marketplace ID for a region, refer to Marketplace IDs.

  • account_type (String) (defaults to: nil)

    The type of account to include in the response.

  • related_identifier_name (String) (defaults to: nil)

    The name of the relatedIdentifier. The only possible value is SETTLEMENT_ID, the settlement ID associated with the summary.

  • related_identifier_value (String) (defaults to: nil)

    The value of the relatedIdentifier.

  • period_start (String) (defaults to: nil)

    The start of the period for which to retrieve summaries. When provided, the response will only include summaries with transactions that occurred on or after the specified date. The value must be formatted in ISO 8601 date format.

  • period_end (String) (defaults to: nil)

    The end of the period for which to retrieve summaries. When provided, the response will only include summaries with transactions that occurred on or before the specified date. The value must be formatted in ISO 8601 date format.

  • next_token (String) (defaults to: nil)

    A token that you use to retrieve subsequent pages of results. When there are more results available, the response will include a nextToken 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. Repeat this process until the nextToken value is null to retrieve all results.

  • rate_limit (Float) (defaults to: 0.5)

    Requests per second

  • marketplace_ids: (Array[String], nil) (defaults to: nil)
  • account_type: (String, nil) (defaults to: nil)
  • related_identifier_name: (String, nil) (defaults to: nil)
  • related_identifier_value: (String, nil) (defaults to: nil)
  • period_start: (String, nil) (defaults to: nil)
  • period_end: (String, nil) (defaults to: nil)
  • next_token: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.5)

Returns:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/peddler/apis/finances_2024_06_19.rb', line 117

def list_summary(marketplace_ids: nil, account_type: nil, related_identifier_name: nil,
  related_identifier_value: nil, period_start: nil, period_end: nil, next_token: nil, rate_limit: 0.5)
  path = "/finances/2024-06-19/summary"
  params = {
    "marketplaceIds" => stringify_array(marketplace_ids),
    "accountType" => ,
    "relatedIdentifierName" => related_identifier_name,
    "relatedIdentifierValue" => related_identifier_value,
    "periodStart" => period_start,
    "periodEnd" => period_end,
    "nextToken" => next_token,
  }.compact
  parser = -> { SummaryResponse }
  get(path, params:, rate_limit:, parser:)
end

#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 a 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. * ORDER_ID: the order ID associated with the transaction. Note: FINANCIAL_EVENT_GROUP_ID and ORDER_ID are 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

  • posted_after: (String, nil) (defaults to: nil)
  • posted_before: (String, nil) (defaults to: nil)
  • marketplace_id: (String, nil) (defaults to: nil)
  • transaction_status: (String, nil) (defaults to: nil)
  • related_identifier_name: (String, nil) (defaults to: nil)
  • related_identifier_value: (String, nil) (defaults to: nil)
  • next_token: (String, nil) (defaults to: nil)
  • rate_limit: (Float) (defaults to: 0.5)

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 }
  get(path, params:, rate_limit:, parser:)
end