Sha256: 865c2cd32e5b9b4eee4f8600be5c813752e7c2478b8b26f7921e8c87bc3ba8fc

Contents?: true

Size: 1.82 KB

Versions: 1

Compression:

Stored size: 1.82 KB

Contents

# encoding: utf-8
require "rubygems"
require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/deprecation'

module MoIP

  class ValidationError < StandardError; end

  class MissingPaymentTypeError < ValidationError; end
  class MissingPayerError < ValidationError; end
  class MissingBirthdate < ValidationError; end

  class InvalidCellphone < ValidationError; end
  class InvalidExpiry < ValidationError; end
  class InvalidInstitution < ValidationError; end    
  class InvalidPhone < ValidationError; end
  class InvalidReceiving < ValidationError; end
  class InvalidValue < ValidationError; end

  autoload :DirectPayment, 'moip/direct_payment'
  autoload :Client,        'moip/client'

  # URI para acessar o serviço
  mattr_accessor :uri
  @@uri = 'https://www.moip.com.br'

  # Token de autenticação
  mattr_accessor :token

  # Chave de acesso ao serviço
  mattr_accessor :key

  def self.setup
    yield self
  end

  STATUS = {1 => "authorized", 2 => "started", 3 => "printed", 4 => "completed", 5 => "canceled", 6 => "analysing"}

  class << self
    def checkout(attributes = {})
      ActiveSupport::Deprecation.warn("MoIP.checkout has been deprecated. Use MoIP::Client.checkout instead", caller)
      MoIP::Client.checkout(attributes)
    end

    def query(token)
      ActiveSupport::Deprecation.warn("MoIP.query has been deprecated. Use MoIP::Client.query instead", caller)
      MoIP::Client.query(token)
    end

    def moip_page(token)
      ActiveSupport::Deprecation.warn("MoIP.moip_page has been deprecated. use MoIP::Client.moip_page instead", caller)
      MoIP::Client.moip_page(token)
    end

    def notification(params)
      ActiveSupport::Deprecation.warn("MoIP.notification has been deprecated. use MoIP::Client.notification instead", caller)
      MoIP::Client.moip_page(token)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
marnen-moip-1.0.2.pre.39f9dab38fc33fe9bf614deb8e90ca166ab2d6bf lib/moip.rb