Module: SolidusBraintree::BraintreeAdminHelper

Defined in:
app/helpers/solidus_braintree/braintree_admin_helper.rb

Instance Method Summary collapse

Instance Method Details

Returns a link to the Braintree web UI for the given Braintree payment



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/helpers/solidus_braintree/braintree_admin_helper.rb', line 6

def braintree_transaction_link(payment)
  environment = payment.payment_method.preferred_environment == 'sandbox' ? 'sandbox' : 'www'
  merchant_id = payment.payment_method.preferred_merchant_id
  response_code = payment.response_code

  return if response_code.blank?
  return response_code if merchant_id.blank?

  link_to(
    response_code,
    "https://#{environment}.braintreegateway.com/merchants/#{merchant_id}/transactions/#{response_code}",
    title: 'Show payment on Braintree',
    target: '_blank',
    rel: 'noopener'
  )
end