Sha256: da02669ef6cef14e0570fec5f0f88ae6ad4ae55656806d461a8e9e711e043dee

Contents?: true

Size: 1.6 KB

Versions: 1

Compression:

Stored size: 1.6 KB

Contents

module EasyPayULatam
  class Configuration
    attr_accessor :api_key, :merchant_id, :account_id, :placeholder, :root_url, :test_root_url, :payu_url, :test_api_key, :test_merchan_id, :test_account_id, :test_payu_url, :currency_precision

    def initialize
      # Path for PayU responses
      @currency_precision = 0
      @root_url = nil
      @test_root_url = nil

      @placeholder = nil

      # For production
      @api_key = nil
      @merchant_id = nil
      @account_id = nil
      @payu_url = "https://gateway.payulatam.com/ppp-web-gateway/"

      # For testing
      @test_api_key = "4Vj8eK4rloUd272L48hsrarnUA"
      @test_merchant_id = "508029"
      @test_account_id = "512321"
      @test_payu_url = "https://sandbox.gateway.payulatam.com/ppp-web-gateway/"
    end

    def get_api_key
      if ENV["RAILS_ENV"] == "development" || ENV["RAILS_ENV"] == "test"
        @test_api_key
      else
        @api_key
      end
    end

    def get_merchant_id
      if ENV["RAILS_ENV"] == "development" || ENV["RAILS_ENV"] == "test"
        @test_merchant_id
      else
        @merchant_id
      end
    end

    def get_account_id
      if ENV["RAILS_ENV"] == "development" || ENV["RAILS_ENV"] == "test"
        @test_account_id
      else
        @account_id
      end
    end

    def get_payu_url
      if ENV["RAILS_ENV"] == "development" || ENV["RAILS_ENV"] == "test"
        @test_payu_url
      else
        @payu_url
      end
    end

    def get_root_url
      if ENV["RAILS_ENV"] == "development" || ENV["RAILS_ENV"] == "test"
        @test_root_url
      else
        @root_url
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
easy_pay_u_latam-0.1.6 lib/easy_pay_u_latam/Configuration.rb