lib/braintree/transaction.rb in braintree-4.15.0 vs lib/braintree/transaction.rb in braintree-4.16.0
- old
+ new
@@ -75,13 +75,13 @@
Other = "other"
All = constants.map { |c| const_get(c) }
end
- module Type # :nodoc:
- Credit = "credit" # :nodoc:
- Sale = "sale" # :nodoc:
+ module Type
+ Credit = "credit"
+ Sale = "sale"
All = constants.map { |c| const_get(c) }
end
module ExternalVault
@@ -129,10 +129,12 @@
attr_reader :installments
attr_reader :local_payment_details
attr_reader :merchant_account_id
attr_reader :merchant_advice_code
attr_reader :merchant_advice_code_text
+ attr_reader :meta_checkout_card_details
+ attr_reader :meta_checkout_token_details
attr_reader :network_response_code # Response code from the card network
attr_reader :network_response_text # Response text from the card network
attr_reader :network_token_details
attr_reader :network_transaction_id
attr_reader :order_id
@@ -140,16 +142,16 @@
attr_reader :payment_instrument_type
attr_reader :payment_receipt
attr_reader :paypal_details
attr_reader :paypal_here_details
attr_reader :plan_id
- attr_reader :processor_authorization_code # Authorization code from the processor.
- attr_reader :processor_response_code # Response code from the processor.
- attr_reader :processor_response_text # Response text from the processor.
- attr_reader :processor_response_type # Response type from the processor.
- attr_reader :processor_settlement_response_code # Settlement response code from the processor.
- attr_reader :processor_settlement_response_text # Settlement response text from the processor.
+ attr_reader :processor_authorization_code
+ attr_reader :processor_response_code
+ attr_reader :processor_response_text
+ attr_reader :processor_response_type
+ attr_reader :processor_settlement_response_code
+ attr_reader :processor_settlement_response_text
attr_reader :product_sku
attr_reader :purchase_order_number
attr_reader :recurring
attr_reader :refund_ids
attr_reader :refunded_installments
@@ -173,11 +175,11 @@
attr_reader :subscription_details
attr_reader :subscription_id
attr_reader :tax_amount
attr_reader :tax_exempt
attr_reader :three_d_secure_info
- attr_reader :type # Will either be "sale" or "credit"
+ attr_reader :type
attr_reader :updated_at
attr_reader :us_bank_account_details
attr_reader :venmo_account_details
attr_reader :visa_checkout_card_details
attr_reader :voice_referral_number
@@ -296,11 +298,11 @@
def self.void!(*args)
Configuration.gateway.transaction.void!(*args)
end
- def initialize(gateway, attributes) # :nodoc:
+ 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)
@@ -311,10 +313,12 @@
@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])
@@ -340,11 +344,11 @@
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
- def inspect # :nodoc:
+ 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)
@@ -357,51 +361,53 @@
def line_items
@gateway.transaction_line_item.find_all(id)
end
- # Returns true if the transaction has been refunded. False otherwise.
def refunded?
!@refund_id.nil?
end
- # Returns true if the transaction has been disbursed. False otherwise.
def disbursed?
@disbursement_details.valid?
end
# 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
def vault_billing_address
return nil if billing_details.id.nil?
@gateway.address.find(customer_details.id, billing_details.id)
end
# 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
def vault_credit_card
return nil if credit_card_details.token.nil?
@gateway.credit_card.find(credit_card_details.token)
end
# 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
def vault_customer
return nil if customer_details.id.nil?
@gateway.customer.find(customer_details.id)
end
# 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
def vault_shipping_address
return nil if shipping_details.id.nil?
@gateway.address.find(customer_details.id, shipping_details.id)
end
@@ -409,15 +415,15 @@
@processed_with_network_token
end
class << self
protected :new
- def _new(*args) # :nodoc:
+ def _new(*args)
self.new(*args)
end
end
- def self._attributes # :nodoc:
+ def self._attributes
[:amount, :created_at, :credit_card_details, :customer_details, :id, :status, :subscription_details, :type, :updated_at, :processed_with_network_token?]
end
end
end