class Braintree::Transaction

Attributes

ach_return_code[R]
ach_return_responses[R]
acquirer_reference_number[R]
add_ons[R]
additional_processor_response[R]
amount[R]
apple_pay_details[R]
authorization_adjustments[R]
authorization_expires_at[R]
authorized_transaction_id[R]
avs_error_response_code[R]
avs_postal_code_response_code[R]
avs_street_address_response_code[R]
billing_details[R]
channel[R]
created_at[R]
credit_card_details[R]
currency_iso_code[R]
custom_fields[R]
customer_details[R]
cvv_response_code[R]
debit_network[R]
descriptor[R]
disbursement_details[R]
discount_amount[R]
discounts[R]
disputes[R]
escrow_status[R]
facilitated_details[R]
facilitator_details[R]
foreign_retailer[R]
gateway_rejection_reason[R]
google_pay_details[R]
graphql_id[R]
id[R]
installment_count[R]
installments[R]
local_payment_details[R]
merchant_account_id[R]
merchant_advice_code[R]
merchant_advice_code_text[R]
meta_checkout_card_details[R]
meta_checkout_token_details[R]
network_response_code[R]
network_response_text[R]
network_token_details[R]
network_transaction_id[R]
order_id[R]
packages[R]
partial_settlement_transaction_ids[R]
payment_instrument_type[R]
payment_receipt[R]
paypal_details[R]
paypal_here_details[R]
plan_id[R]
processor_authorization_code[R]
processor_response_code[R]
processor_response_text[R]
processor_response_type[R]
processor_settlement_response_code[R]
processor_settlement_response_text[R]
product_sku[R]
purchase_order_number[R]
recurring[R]
refund_ids[R]
refunded_installments[R]
refunded_transaction_id[R]
retried[R]
retried_transaction_id[R]
retrieval_reference_number[R]
retry_ids[R]
risk_data[R]
samsung_pay_card_details[R]
sca_exemption_requested[R]
sepa_direct_debit_account_details[R]
sepa_direct_debit_return_code[R]
service_fee_amount[R]
settlement_batch_id[R]
shipping_amount[R]
shipping_details[R]
shipping_tax_amount[R]
ships_from_postal_code[R]
status[R]
status_history[R]
subscription_details[R]
subscription_id[R]
tax_amount[R]
tax_exempt[R]
three_d_secure_info[R]
type[R]
updated_at[R]
us_bank_account_details[R]
venmo_account_details[R]
visa_checkout_card_details[R]
voice_referral_number[R]

Public Class Methods

_attributes() click to toggle source
# File lib/braintree/transaction.rb, line 438
def self._attributes
  [:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at, :processed_with_network_token?]
end
_new(*args) click to toggle source
# File lib/braintree/transaction.rb, line 433
def _new(*args)
  self.new(*args)
end
adjust_authorization(*args) click to toggle source
# File lib/braintree/transaction.rb, line 190
def self.adjust_authorization(*args)
  Configuration.gateway.transaction.adjust_authorization(*args)
end
adjust_authorization!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 194
def self.adjust_authorization!(*args)
  Configuration.gateway.transaction.adjust_authorization!(*args)
end
cancel_release(*args) click to toggle source
# File lib/braintree/transaction.rb, line 206
def self.cancel_release(*args)
  Configuration.gateway.transaction.cancel_release(*args)
end
cancel_release!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 210
def self.cancel_release!(*args)
  Configuration.gateway.transaction.cancel_release!(*args)
end
clone_transaction(*args) click to toggle source
# File lib/braintree/transaction.rb, line 214
def self.clone_transaction(*args)
  Configuration.gateway.transaction.clone_transaction(*args)
end
clone_transaction!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 218
def self.clone_transaction!(*args)
  Configuration.gateway.transaction.clone_transaction!(*args)
end
create(*args) click to toggle source
# File lib/braintree/transaction.rb, line 198
def self.create(*args)
  Configuration.gateway.transaction.create(*args)
end
create!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 202
def self.create!(*args)
  return_object_or_raise(:transaction) { create(*args) }
end
credit(*args) click to toggle source
# File lib/braintree/transaction.rb, line 222
def self.credit(*args)
  Configuration.gateway.transaction.credit(*args)
end
credit!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 226
def self.credit!(*args)
  Configuration.gateway.transaction.credit!(*args)
end
find(*args) click to toggle source
# File lib/braintree/transaction.rb, line 230
def self.find(*args)
  Configuration.gateway.transaction.find(*args)
end
hold_in_escrow(*args) click to toggle source
# File lib/braintree/transaction.rb, line 238
def self.hold_in_escrow(*args)
  Configuration.gateway.transaction.hold_in_escrow(*args)
end
hold_in_escrow!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 242
def self.hold_in_escrow!(*args)
  Configuration.gateway.transaction.hold_in_escrow!(*args)
end
line_items(*args) click to toggle source
# File lib/braintree/transaction.rb, line 234
def self.line_items(*args)
  Configuration.gateway.transaction_line_item.find_all(*args)
end
package_tracking(*args) click to toggle source
# File lib/braintree/transaction.rb, line 290
def self.package_tracking(*args)
  Configuration.gateway.transaction.package_tracking(*args)
end
package_tracking!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 294
def self.package_tracking!(*args)
  Configuration.gateway.transaction.package_tracking!(*args)
end
refund(*args) click to toggle source
# File lib/braintree/transaction.rb, line 246
def self.refund(*args)
  Configuration.gateway.transaction.refund(*args)
end
refund!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 250
def self.refund!(*args)
  Configuration.gateway.transaction.refund!(*args)
end
release_from_escrow(*args) click to toggle source
# File lib/braintree/transaction.rb, line 266
def self.release_from_escrow(*args)
  Configuration.gateway.transaction.release_from_escrow(*args)
end
release_from_escrow!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 270
def self.release_from_escrow!(*args)
  Configuration.gateway.transaction.release_from_escrow!(*args)
end
sale(*args) click to toggle source
# File lib/braintree/transaction.rb, line 254
def self.sale(*args)
  Configuration.gateway.transaction.sale(*args)
end
sale!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 258
def self.sale!(*args)
  Configuration.gateway.transaction.sale!(*args)
end
submit_for_partial_settlement(*args) click to toggle source
# File lib/braintree/transaction.rb, line 298
def self.submit_for_partial_settlement(*args)
  Configuration.gateway.transaction.submit_for_partial_settlement(*args)
end
submit_for_partial_settlement!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 302
def self.submit_for_partial_settlement!(*args)
  Configuration.gateway.transaction.submit_for_partial_settlement!(*args)
end
submit_for_settlement(*args) click to toggle source
# File lib/braintree/transaction.rb, line 274
def self.submit_for_settlement(*args)
  Configuration.gateway.transaction.submit_for_settlement(*args)
end
submit_for_settlement!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 278
def self.submit_for_settlement!(*args)
  Configuration.gateway.transaction.submit_for_settlement!(*args)
end
update_details(*args) click to toggle source
# File lib/braintree/transaction.rb, line 282
def self.update_details(*args)
  Configuration.gateway.transaction.update_details(*args)
end
update_details!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 286
def self.update_details!(*args)
  return_object_or_raise(:transaction) { update_details(*args) }
end
void(*args) click to toggle source
# File lib/braintree/transaction.rb, line 306
def self.void(*args)
  Configuration.gateway.transaction.void(*args)
end
void!(*args) click to toggle source
# File lib/braintree/transaction.rb, line 310
def self.void!(*args)
  Configuration.gateway.transaction.void!(*args)
end

Protected Class Methods

new(gateway, attributes) click to toggle source

NEXT_MAJOR_VERSION remove SamsungPayCardDetails

# File lib/braintree/transaction.rb, line 315
def initialize(gateway, attributes)
  @gateway = gateway
  set_instance_variables_from_hash(attributes)

  @amount = Util.to_big_decimal(amount)
  @apple_pay_details = ApplePayDetails.new(@apple_pay)
  @billing_details = AddressDetails.new(@billing)
  @credit_card_details = CreditCardDetails.new(@credit_card)
  @network_token_details = CreditCardDetails.new(@network_token)
  @custom_fields = attributes[:custom_fields].is_a?(Hash) ? attributes[:custom_fields] : {}
  @customer_details = CustomerDetails.new(@customer)
  @descriptor = Descriptor.new(@descriptor)
  @disbursement_details = DisbursementDetails.new(@disbursement_details)
  @google_pay_details = GooglePayDetails.new(@google_pay_card)
  @local_payment_details = LocalPaymentDetails.new(@local_payment)
  @meta_checkout_card_details = MetaCheckoutCardDetails.new(attributes[:meta_checkout_card])
  @meta_checkout_token_details = MetaCheckoutTokenDetails.new(attributes[:meta_checkout_token])
  @payment_instrument_type = attributes[:payment_instrument_type]
  @payment_receipt = PaymentReceipt.new(attributes[:payment_receipt]) if attributes[:payment_receipt]
  @paypal_details = PayPalDetails.new(@paypal)
  @paypal_here_details = PayPalHereDetails.new(@paypal_here)
  @samsung_pay_card_details = SamsungPayCardDetails.new(attributes[:samsung_pay_card]) #Deprecated
  @sca_exemption_requested = attributes[:sca_exemption_requested]
  @sepa_direct_debit_account_details = SepaDirectDebitAccountDetails.new(@sepa_debit_account_detail)
  @service_fee_amount = Util.to_big_decimal(service_fee_amount)
  @packages = attributes[:shipments] ? attributes[:shipments].map { |pd| PackageDetails.new(pd) } : []
  @shipping_details = AddressDetails.new(@shipping)
  @status_history = attributes[:status_history] ? attributes[:status_history].map { |s| StatusDetails.new(s) } : []
  @subscription_details = SubscriptionDetails.new(@subscription)
  @tax_amount = Util.to_big_decimal(tax_amount)
  @venmo_account_details = VenmoAccountDetails.new(@venmo_account)
  @visa_checkout_card_details = VisaCheckoutCardDetails.new(attributes[:visa_checkout_card])

  @facilitated_details = FacilitatedDetails.new(attributes[:facilitated_details]) if attributes[:facilitated_details]
  @facilitator_details = FacilitatorDetails.new(attributes[:facilitator_details]) if attributes[:facilitator_details]
  @risk_data = RiskData.new(attributes[:risk_data]) if attributes[:risk_data]
  @three_d_secure_info = ThreeDSecureInfo.new(attributes[:three_d_secure_info]) if attributes[:three_d_secure_info]
  @us_bank_account_details = UsBankAccountDetails.new(attributes[:us_bank_account]) if attributes[:us_bank_account]

  add_ons.map! { |attrs| AddOn._new(attrs) } if add_ons
  authorization_adjustments.map! { |attrs| AuthorizationAdjustment._new(attrs) } if authorization_adjustments
  discounts.map! { |attrs| Discount._new(attrs) } if discounts
  disputes.map! { |attrs| Dispute._new(attrs) } if disputes
  installments.map! { |attrs| Installment.new(attrs) } if installments
  refunded_installments.map! { |attrs| Installment.new(attrs) } if refunded_installments
end

Public Instance Methods

disbursed?() click to toggle source
# File lib/braintree/transaction.rb, line 383
def disbursed?
  @disbursement_details.valid?
end
inspect() click to toggle source
# File lib/braintree/transaction.rb, line 362
def inspect
  first = [:id, :type, :amount, :status]
  order = first + (self.class._attributes - first)
  nice_attributes = order.map do |attr|
    if attr == :amount
      Util.inspect_amount(self.amount)
    else
      "#{attr}: #{send(attr).inspect}"
    end
  end
  "#<#{self.class} #{nice_attributes.join(', ')}>"
end
line_items() click to toggle source
# File lib/braintree/transaction.rb, line 375
def line_items
  @gateway.transaction_line_item.find_all(id)
end
processed_with_network_token?() click to toggle source
# File lib/braintree/transaction.rb, line 427
def processed_with_network_token?
  @processed_with_network_token
end
refunded?() click to toggle source
# File lib/braintree/transaction.rb, line 379
def refunded?
  !@refund_id.nil?
end
vault_billing_address() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_billing_address will return the associated Braintree::Address. Because the vault billing address can be updated after the transaction was created, the attributes on vault_billing_address may not match the attributes on billing_details. NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove

# File lib/braintree/transaction.rb, line 392
def vault_billing_address
  return nil if billing_details.id.nil?
  @gateway.address.find(customer_details.id, billing_details.id)
end
vault_credit_card() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_credit_card will return the associated Braintree::CreditCard. Because the vault credit card can be updated after the transaction was created, the attributes on vault_credit_card may not match the attributes on credit_card_details. NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove

# File lib/braintree/transaction.rb, line 402
def vault_credit_card
  return nil if credit_card_details.token.nil?
  @gateway.credit_card.find(credit_card_details.token)
end
vault_customer() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_customer will return the associated Braintree::Customer. Because the vault customer can be updated after the transaction was created, the attributes on vault_customer may not match the attributes on customer_details. NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove

# File lib/braintree/transaction.rb, line 412
def vault_customer
  return nil if customer_details.id.nil?
  @gateway.customer.find(customer_details.id)
end
vault_shipping_address() click to toggle source

If this transaction was stored in the vault, or created from vault records, vault_shipping_address will return the associated Braintree::Address. Because the vault shipping address can be updated after the transaction was created, the attributes on vault_shipping_address may not match the attributes on shipping_details. NEXT_MAJOR_VERSION these methods are not documented in the developer docs, remove

# File lib/braintree/transaction.rb, line 422
def vault_shipping_address
  return nil if shipping_details.id.nil?
  @gateway.address.find(customer_details.id, shipping_details.id)
end