Sha256: cee261808a02cb5cfeeecb1a88e420105cb4a1d7aa506b0b20f35ffe18a4aa59

Contents?: true

Size: 966 Bytes

Versions: 8

Compression:

Stored size: 966 Bytes

Contents

module CatarsePaypalExpress
  class Gateway
    include ActiveMerchant::Billing::Integrations

    def initialize configuration = PaymentEngines.configuration
      @configuration = configuration
    end

    def self.instance
      new.setup_gateway
    rescue Exception => e
      puts e.message
    end

    def setup_gateway
      check_default_configurations!
      ActiveMerchant::Billing::PaypalExpressGateway.new({
        login: @configuration[:paypal_username],
        password: @configuration[:paypal_password],
        signature: @configuration[:paypal_signature]
      })
    end

    private

    def check_default_configurations!
      %i(paypal_username paypal_password paypal_signature).each do |key|
        raise pending_configuration_message unless @configuration[key].present?
      end
    end

    def pending_configuration_message
      "[PayPal] An API Certificate or API Signature is required to make requests to PayPal"
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
catarse_paypal_express-2.2.4 lib/catarse_paypal_express/gateway.rb
catarse_paypal_express-3.0.2 lib/catarse_paypal_express/gateway.rb
funddit_paypal_express-3.0.1 lib/catarse_paypal_express/gateway.rb
catarse_paypal_express-3.0.1 lib/catarse_paypal_express/gateway.rb
catarse_paypal_express-3.0.0 lib/catarse_paypal_express/gateway.rb
catarse_paypal_express-2.2.3 lib/catarse_paypal_express/gateway.rb
catarse_paypal_express-2.2.2 lib/catarse_paypal_express/gateway.rb
catarse_paypal_express-2.2.1 lib/catarse_paypal_express/gateway.rb