Sha256: 76332cd274fd644b89eca2ec96af3e9eba2e5b70a6c00baf6c7dc2b3580e7e88

Contents?: true

Size: 617 Bytes

Versions: 11

Compression:

Stored size: 617 Bytes

Contents

module Pay
  module Braintree
    module Charge
      extend ActiveSupport::Concern

      def braintree?
        processor == "braintree"
      end

      def braintree_charge
        Pay.braintree_gateway.transaction.find(processor_id)
      rescue ::Braintree::BraintreeError => e
        raise Error, e.message
      end

      def braintree_refund!(amount_to_refund)
        Pay.braintree_gateway.transaction.refund(processor_id, amount_to_refund / 100.0)

        update(amount_refunded: amount_to_refund)
      rescue ::Braintree::BraintreeError => e
        raise Error, e.message
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pay-2.2.2 lib/pay/braintree/charge.rb
pay-2.2.1 lib/pay/braintree/charge.rb
pay-2.2.0 lib/pay/braintree/charge.rb
pay-2.1.3 lib/pay/braintree/charge.rb
pay-2.1.2 lib/pay/braintree/charge.rb
pay-2.1.1 lib/pay/braintree/charge.rb
pay-2.1.0 lib/pay/braintree/charge.rb
pay-2.0.3 lib/pay/braintree/charge.rb
pay-2.0.2 lib/pay/braintree/charge.rb
pay-2.0.1 lib/pay/braintree/charge.rb
pay-2.0.0 lib/pay/braintree/charge.rb