Sha256: 92f8fa39b4e488190db772844c1c7eff246ef2eaf11632c9d45e5de522256cc3

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module SolidusPaypalBraintree
  module BraintreeAdminHelper
    # Returns a link to the Braintree web UI for the given Braintree payment
    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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
solidus_paypal_braintree-1.2.0 app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb
solidus_paypal_braintree-1.1.2 app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb
solidus_paypal_braintree-1.1.1 app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb
solidus_paypal_braintree-1.1.0 app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb
solidus_paypal_braintree-1.0.0 app/helpers/solidus_paypal_braintree/braintree_admin_helper.rb