Class: Killbill::BraintreeBlue::BraintreeBlueResponse

Inherits:
Plugin::ActiveMerchant::ActiveRecord::Response
  • Object
show all
Defined in:
lib/braintree_blue/models/response.rb

Class Method Summary collapse

Class Method Details

.from_response(api_call, kb_account_id, kb_payment_id, kb_payment_transaction_id, transaction_type, payment_processor_account_id, kb_tenant_id, response, extra_params = {}, model = ::Killbill::BraintreeBlue::BraintreeBlueResponse) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/braintree_blue/models/response.rb', line 9

def self.from_response(api_call, , kb_payment_id, kb_payment_transaction_id, transaction_type, , kb_tenant_id, response, extra_params = {}, model = ::Killbill::BraintreeBlue::BraintreeBlueResponse)
  super(api_call,
        ,
        kb_payment_id,
        kb_payment_transaction_id,
        transaction_type,
        ,
        kb_tenant_id,
        response,
        {
      :params_braintree_customer_id => extract(response, 'braintree_customer','id'),
      :params_braintree_customer_first_name => extract(response, 'braintree_customer','first_name'),
      :params_braintree_customer_last_name => extract(response, 'braintree_customer','last_name'),
      :params_braintree_customer_email => extract(response, 'braintree_customer','email'),
      :params_braintree_customer_customer_vault_id => extract(response, 'braintree_customer','customer_vault_id'),
      :params_braintree_customer_credit_card_token => extract(response, 'braintree_customer','credit_card_token'),
            :params_braintree_customer_credit_card_bin             => extract(response, 'card_response','bin'),
            :params_braintree_customer_credit_card_expiration_date => extract(response, 'card_response','expiration_date'),
            :params_braintree_customer_credit_card_last_4          => extract(response, 'card_response','last_4'),
            :params_braintree_customer_credit_card_card_type       => extract(response, 'card_response','card_type'),
            :params_braintree_customer_credit_card_masked_number   => extract(response, 'card_response','masked_number')
        }.merge!(extra_params),
        model)
end

.search_where_clause(t, search_key) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/braintree_blue/models/response.rb', line 34

def self.search_where_clause(t, search_key)
  where_clause = t[:params_braintree_customer_id].eq(search_key)
             .or(t[:params_braintree_customer_credit_card_token].eq(search_key))

  # Only search successful payments and refunds
  where_clause = where_clause.and(t[:success].eq(true))

  super.or(where_clause)
end