Sha256: c1882184720bd43bb6d129ab47c76311711917e8af8c419c47fa56a83df27932
Contents?: true
Size: 678 Bytes
Versions: 5
Compression:
Stored size: 678 Bytes
Contents
module Pay module Braintree class Charge attr_reader :pay_charge delegate :processor_id, to: :pay_charge def initialize(pay_charge) @pay_charge = pay_charge end def charge Pay.braintree_gateway.transaction.find(processor_id) rescue ::Braintree::Braintree::Error => e raise Pay::Braintree::Error, e end def refund!(amount_to_refund) Pay.braintree_gateway.transaction.refund(processor_id, amount_to_refund / 100.0) pay_charge.update(amount_refunded: amount_to_refund) rescue ::Braintree::BraintreeError => e raise Pay::Braintree::Error, e end end end end
Version data entries
5 entries across 5 versions & 1 rubygems