Sha256: a388c3ca29b787f1cb0334401de81f6021bc195bff44d9fae2bbf6d4a64d079e

Contents?: true

Size: 1.97 KB

Versions: 2

Compression:

Stored size: 1.97 KB

Contents

module GmxCheckout
  module Models
    class Notification < Model
      # property :subscription_code, from: 'recorrencia.idRecorrenciaEmpresa'
      # property :transaction_amount, from: 'venda.valor'
      # property :transaction_owner_id, from: 'venda.idVendaEmpresa'

      property :subscription_code, from: 'recorrencia.idRecorrencia'

      property :subscription_status, from: 'recorrencia.status',
                                     with: -> (value) { value.to_i }

      property :subscription_created_at, from: 'recorrencia.dataRegistro',
                                         with: -> (value) { value.to_date }

      property :subscription_latest_payment,
               from: 'recorrencia.valorUltimoProcessamento'

      property :transaction_date, from: 'venda.dataRegistro',
                                  with: -> (value) { value.to_date }

      property :transaction_amount, from: 'venda.valor',
                                    with: -> (value) { value.to_i }

      property :transaction_id, from: 'venda.idVenda',
                                with: -> (value) { value.to_i }

      property :transaction_status, from: 'venda.status',
                                    with: -> (value) { value.to_i }

      property :transaction_gateway_id, from: 'venda.tid'
      property :transaction_gateway_uuid, from: 'venda.nsu'
      property :transaction_rejected_status, from: 'venda.lr'
      property :transaction_rejected_message, from: 'venda.lrDescricao'
      property :transaction_rejected_suggestion, from: 'venda.lrOrientacao'

      property :credit_card_mask, from: 'venda.cartaoCredito.numeroMask'
      property :credit_card_brand, from: 'venda.formaPagamento'

      property :transaction_auth_code, from: 'venda.arp'
      property :transaction_eci, from: 'venda.eci'
      property :transaction_message, from: 'venda.msgErro'
      property :transaction_gateway, from: 'venda.adquirente'

      def success?
        transaction_message.blank?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gmxcheckout-0.2.0 lib/gmxcheckout/models/notification.rb
gmxcheckout-0.1.0 lib/gmxcheckout/models/notification.rb