Class: Pike13::API::V3::Desk::InvoiceItemTransactions

Inherits:
Base
  • Object
show all
Defined in:
lib/pike13/api/v3/desk/invoice_item_transactions.rb

Overview

Invoice Item Transactions resource Item-level details of transactions (payments and refunds) Payments and refunds are performed against the invoice, not the invoice item

Examples:

Basic query

Pike13::Reporting::InvoiceItemTransactions.query(
  fields: ['transaction_id', 'invoice_number', 'transaction_type', 'transaction_amount', 'transaction_state']
)

Query by payment method

Pike13::Reporting::InvoiceItemTransactions.query(
  fields: ['transaction_date', 'payment_method', 'transaction_amount', 'invoice_payer_name'],
  filter: ['eq', 'payment_method', 'creditcard']
)

Group by payment method

Pike13::Reporting::InvoiceItemTransactions.query(
  fields: ['transaction_count', 'total_net_paid_amount', 'settled_count'],
  group: 'payment_method'
)

Constant Summary collapse

DETAIL_FIELDS =

Available detail fields (when not grouping)

%w[
  business_id
  business_name
  business_subdomain
  commission_recipient_name
  created_by_name
  credit_card_name
  currency_code
  error_message
  external_payment_name
  failed_at
  failed_date
  franchise_id
  grants_membership
  invoice_autobill
  invoice_due_date
  invoice_id
  invoice_item_id
  invoice_number
  invoice_payer_email
  invoice_payer_home_location
  invoice_payer_id
  invoice_payer_name
  invoice_payer_phone
  invoice_payer_primary_staff_name_at_sale
  invoice_state
  key
  net_paid_amount
  net_paid_revenue_amount
  net_paid_tax_amount
  payment_method
  payment_method_detail
  payment_transaction_id
  payments_amount
  plan_id
  processing_method
  processor_transaction_id
  product_id
  product_name
  product_name_at_sale
  product_type
  refunds_amount
  revenue_category
  sale_location_name
  transaction_amount
  transaction_at
  transaction_autopay
  transaction_date
  transaction_id
  transaction_state
  transaction_type
  voided_at
].freeze
SUMMARY_FIELDS =

Available summary fields (when grouping)

%w[
  business_id_summary
  business_subdomain_summary
  failed_count
  grants_membership_count
  invoice_count
  invoice_item_count
  settled_count
  total_count
  total_net_ach_paid_amount
  total_net_american_express_paid_amount
  total_net_amex_processing_paid_amount
  total_net_cash_paid_amount
  total_net_check_paid_amount
  total_net_credit_paid_amount
  total_net_discover_paid_amount
  total_net_external_paid_amount
  total_net_global_pay_processing_paid_amount
  total_net_mastercard_paid_amount
  total_net_other_credit_card_paid_amount
  total_net_other_processing_paid_amount
  total_net_paid_amount
  total_net_paid_revenue_amount
  total_net_paid_tax_amount
  total_net_visa_paid_amount
  total_payments_amount
  total_refunds_amount
  transaction_autopay_count
  transaction_count
].freeze
GROUPINGS =

Available grouping fields

%w[
  business_id
  business_name
  business_subdomain
  commission_recipient_name
  created_by_name
  credit_card_name
  external_payment_name
  failed_date
  failed_month_start_date
  failed_quarter_start_date
  failed_week_mon_start_date
  failed_week_sun_start_date
  failed_year_start_date
  grants_membership
  invoice_autobill
  invoice_due_date
  invoice_id
  invoice_item_id
  invoice_number
  invoice_payer_home_location
  invoice_payer_id
  invoice_payer_name
  invoice_payer_primary_staff_name_at_sale
  invoice_state
  payment_method
  plan_id
  processing_method
  product_id
  product_name
  product_name_at_sale
  product_type
  revenue_category
  sale_location_name
  transaction_autopay
  transaction_date
  transaction_id
  transaction_month_start_date
  transaction_quarter_start_date
  transaction_state
  transaction_type
  transaction_week_mon_start_date
  transaction_week_sun_start_date
  transaction_year_start_date
].freeze

Class Method Summary collapse

Methods inherited from Base

client, configure

Class Method Details

.query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil) ⇒ Hash

Execute an invoice item transactions query

Parameters:

  • fields (Array<String>)

    Fields to return (detail or summary fields)

  • filter (Array, nil) (defaults to: nil)

    Filter criteria (optional)

  • group (String, nil) (defaults to: nil)

    Grouping field (optional)

  • sort (Array<String>, nil) (defaults to: nil)

    Sort order (optional)

  • page (Hash, nil) (defaults to: nil)

    Pagination options (optional)

  • total_count (Boolean) (defaults to: nil)

    Whether to return total count (optional)

Returns:

  • (Hash)

    Query result with rows, fields, and metadata

See Also:



40
41
42
43
44
45
46
47
48
49
# File 'lib/pike13/api/v3/desk/invoice_item_transactions.rb', line 40

def query(fields:, filter: nil, group: nil, sort: nil, page: nil, total_count: nil)
  query_params = { fields: fields }
  query_params[:filter] = filter if filter
  query_params[:group] = group if group
  query_params[:sort] = sort if sort
  query_params[:page] = page if page
  query_params[:total_count] = total_count if total_count

  super("invoice_item_transactions", query_params)
end