Class: GatewayTransaction

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
ArtfullyOseHelper
Includes:
AdminTimeZone
Defined in:
app/models/gateway_transaction.rb

Instance Method Summary collapse

Methods included from ArtfullyOseHelper

amount_and_nongift, bootstrapped_type, build_action_path, build_order_location, channel_checkbox, channel_text, check_mark, clean_full_error_messages, contextual_menu, credit_card_message, date_field_tag, datetime_field_tag, events_to_options, fully_qualified_asset_path, get_selected_class, icon_link_to, icon_tag, link_to_add_fields, link_to_remove_fields, nav_dropdown, number_as_cents, number_to_dollars, pluralize_word, refund_header, select_event_for_sales_search, select_membership_type_for_sales_search, select_pass_type_for_sales_search, select_show_for_sales_search, sorted_us_state_abbreviations, sorted_us_state_names, thanks_message, ticket_seller_name, time_ago_sentence, time_zone_description, us_states, verb_for_save, widget_script, with_kit

Methods included from LinkHelper

#active?, #active_link_to, #active_section, #calendar_active_link_to, #in_section, #in_section?, #in_sub_section

Instance Method Details

#card_typeObject



47
48
49
# File 'app/models/gateway_transaction.rb', line 47

def card_type
  self.response.params.fetch("braintree_transaction",{}).fetch("credit_card_details", {}).fetch("card_type", nil)
end

#cleanObject



34
35
36
37
38
39
40
41
# File 'app/models/gateway_transaction.rb', line 34

def clean
  unless (self.response.params.nil? || 
          self.response.params["braintree_transaction"].nil? || 
          self.response.params.fetch("braintree_transaction",{}).fetch("credit_card_details", {}).fetch("masked_number", nil).nil?)
    self.response.params["braintree_transaction"]["credit_card_details"]["masked_number"] = nil
    self.response.params["braintree_transaction"]["credit_card_details"]["bin"] = nil
  end
end

#created_at_commaObject



30
31
32
# File 'app/models/gateway_transaction.rb', line 30

def created_at_comma
  I18n.l(created_at_local_to_admins, :format => :short)
end

#last_4Object



43
44
45
# File 'app/models/gateway_transaction.rb', line 43

def last_4
  self.response.params.fetch("braintree_transaction",{}).fetch("credit_card_details", {}).fetch("last_4", nil)
end

#netObject



26
27
28
# File 'app/models/gateway_transaction.rb', line 26

def net
  amount - service_fee
end