Sha256: 045f1196f354cce85b4d0e19324cb1f64284f7528c0cba651928576ff0dda587
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module CatarsePagarme class TransactionBase attr_accessor :attributes, :contribution, :transaction, :user, :subscription def initialize(attributes, contribution) self.attributes = attributes self.contribution = contribution self.user = contribution.user end def change_contribution_state self.contribution.update_attributes(attributes_to_contribution) self.contribution.payment_notifications.create(extra_data: self.transaction.to_json) delegator.change_status_by_transaction(self.transaction.status) end def payment_method PaymentType::CREDIT_CARD end def attributes_to_contribution { payment_choice: payment_method, payment_service_fee: delegator.get_fee(payment_method, self.transaction.acquirer_name), payment_id: self.transaction.id, payment_method: 'Pagarme', slip_url: self.transaction.boleto_url, installments: (self.transaction.installments || 1), installment_value: (delegator.value_with_installment_tax(self.transaction.installments || 1) / 100), acquirer_name: self.transaction.acquirer_name, acquirer_tid: self.transaction.tid } end def delegator self.contribution.pagarme_delegator end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
catarse_pagarme-2.2.0 | app/models/catarse_pagarme/transaction_base.rb |
catarse_pagarme-1.3.0 | app/models/catarse_pagarme/transaction_base.rb |