Class: PaypalServerSdk::TransactionSearchController

Inherits:
BaseController show all
Defined in:
lib/paypal_server_sdk/controllers/transaction_search_controller.rb

Overview

TransactionSearchController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from PaypalServerSdk::BaseController

Instance Method Details

#search_balances(options = {}) ⇒ ApiResponse

List all balances. Specify date time to list balances for that time that appear in the response. Notes: It takes a maximum of three hours for balances to appear in the list balances call. This call lists balances upto the previous three years. response at the date time provided, will return the last refreshed balance in the system when not provided. in the response by a [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) for the PayPal transaction currency.

Parameters:

  • as_of_time (String)

    Optional parameter: List balances in the

  • currency_code (String)

    Optional parameter: Filters the transactions

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/paypal_server_sdk/controllers/transaction_search_controller.rb', line 149

def search_balances(options = {})
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/reporting/balances',
                                 Server::DEFAULT)
               .query_param(new_parameter(options['as_of_time'], key: 'as_of_time'))
               .query_param(new_parameter(options['currency_code'], key: 'currency_code'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(BalancesResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('400',
                             'The request is not well-formed, is syntactically incorrect, or'\
                              ' violates schema.',
                             DefaultErrorException)
                .local_error('403',
                             'Authorization failed due to insufficient permissions.',
                             DefaultErrorException)
                .local_error('500',
                             'An internal server error occurred.',
                             DefaultErrorException)
                .local_error('default',
                             'The error response.',
                             DefaultErrorException))
    .execute
end

#search_transactions(options = {}) ⇒ ApiResponse

Lists transactions. Specify one or more query parameters to filter the transaction that appear in the response. Notes: If you specify one or more optional query parameters, the ending_balance response field is empty. It takes a maximum of three hours for executed transactions to appear in the list transactions call. This call lists transaction for the previous three years. the response by a start date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required. Fractional seconds are optional. the response by an end date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required. Fractional seconds are optional. The maximum supported range is 31 days. transactions in the response by a PayPal transaction ID. A valid transaction ID is 17 characters long, except for an order ID, which is 19 characters long. Note: A transaction ID is not unique in the reporting system. The response can list two transactions with the same ID. One transaction can be balance affecting while the other is non-balance affecting. transactions in the response by a PayPal transaction event code. See [Transaction event codes](/docs/integration/direct/transaction-search/transaction-event-codes /). transactions in the response by a PayPal transaction status code. Value is: Status code Description D PayPal or merchant rules denied the transaction. P The transaction is pending. The transaction was created but waits for another payment process to complete, such as an ACH transaction, before the status changes to S. S The transaction successfully completed without a denial and after any pending statuses. V A successful transaction was reversed and funds were refunded to the original sender. transactions in the response by a gross transaction amount range. Specify the range as ‘ TO `, where ` ` is the lower limit of the gross PayPal transaction amount and ` ` is the upper limit of the gross transaction amount. Specify the amounts in lower denominations. For example, to search for transactions from $5.00 to $10.05, specify `[500 TO 1005]`. Note:The values must be URL encoded. transactions in the response by a [three-character ISO-4217 currency code](/api/rest/reference/currency-codes/) for the PayPal transaction currency. transactions in the response by a payment instrument type. Value is either: CREDITCARD. Returns a direct credit card transaction with a corresponding value. DEBITCARD. Returns a debit card transaction with a corresponding value. If you omit this parameter, the API does not apply this filter. the response by a store ID. in the response by a terminal ID. in the response. Value is a single field or a comma-separated list of fields. The transaction_info value returns only the transaction details in the response. To include all fields in the response, specify fields=all. Valid fields are: transaction_info. The transaction information. Includes the ID of the PayPal account of the payee, the PayPal-generated transaction ID, the PayPal-generated base ID, the PayPal reference ID type, the transaction event code, the date and time when the transaction was initiated and was last updated, the transaction amounts including the PayPal fee, any discounts, insurance, the transaction status, and other information about the transaction. payer_info. The payer information. Includes the PayPal customer account ID and the payer’s email address, primary phone number, name, country code, address, and whether the payer is verified or unverified. shipping_info. The shipping information. Includes the recipient’s name, the shipping method for this order, the shipping address for this order, and the secondary address associated with this order. auction_info. The auction information. Includes the name of the auction site, the auction site URL, the ID of the customer who makes the purchase in the auction, and the date and time when the auction closes. cart_info. The cart information. Includes an array of item details, whether the item amount or the shipping amount already includes tax, and the ID of the invoice for PayPal-generated invoices. incentive_info. An array of incentive detail objects. Each object includes the incentive, such as a special offer or coupon, the incentive amount, and the incentive program code that identifies a merchant loyalty or incentive program. store_info. The store information. Includes the ID of the merchant store and the terminal ID for the checkout stand in the merchant store. Indicates whether the response includes only balance-impacting transactions or all transactions. Value is either: Y. The default. The response includes only balance transactions. N. The response includes all transactions. return in the response. So, the combination of ‘page=1` and `page_size=20` returns the first 20 items. The combination of `page=2` and `page_size=20` returns the next 20 items. the entire list of items that are returned in the response. So, the combination of `page=1` and `page_size=20` returns the first 20 items.

Parameters:

  • start_date (String)

    Required parameter: Filters the transactions in

  • end_date (String)

    Required parameter: Filters the transactions in

  • transaction_id (String)

    Optional parameter: Filters the

  • transaction_type (String)

    Optional parameter: Filters the

  • transaction_status (String)

    Optional parameter: Filters the

  • transaction_amount (String)

    Optional parameter: Filters the

  • transaction_currency (String)

    Optional parameter: Filters the

  • payment_instrument_type (String)

    Optional parameter: Filters the

  • store_id (String)

    Optional parameter: Filters the transactions in

  • terminal_id (String)

    Optional parameter: Filters the transactions

  • fields (String)

    Optional parameter: Indicates which fields appear

  • balance_affecting_records_only (String)

    Optional parameter:

  • page_size (Integer)

    Optional parameter: The number of items to

  • page (Integer)

    Optional parameter: The zero-relative start index of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/paypal_server_sdk/controllers/transaction_search_controller.rb', line 106

def search_transactions(options = {})
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/reporting/transactions',
                                 Server::DEFAULT)
               .query_param(new_parameter(options['start_date'], key: 'start_date'))
               .query_param(new_parameter(options['end_date'], key: 'end_date'))
               .query_param(new_parameter(options['transaction_id'], key: 'transaction_id'))
               .query_param(new_parameter(options['transaction_type'], key: 'transaction_type'))
               .query_param(new_parameter(options['transaction_status'], key: 'transaction_status'))
               .query_param(new_parameter(options['transaction_amount'], key: 'transaction_amount'))
               .query_param(new_parameter(options['transaction_currency'], key: 'transaction_currency'))
               .query_param(new_parameter(options['payment_instrument_type'], key: 'payment_instrument_type'))
               .query_param(new_parameter(options['store_id'], key: 'store_id'))
               .query_param(new_parameter(options['terminal_id'], key: 'terminal_id'))
               .query_param(new_parameter(options['fields'], key: 'fields'))
               .query_param(new_parameter(options['balance_affecting_records_only'], key: 'balance_affecting_records_only'))
               .query_param(new_parameter(options['page_size'], key: 'page_size'))
               .query_param(new_parameter(options['page'], key: 'page'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('Oauth2')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(SearchResponse.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'The error response.',
                             SearchErrorException))
    .execute
end