Sha256: a90d27e010c9f74253304cdb8fc8e0d0aac55308da735659ecb0bb6c4a658545

Contents?: true

Size: 738 Bytes

Versions: 5

Compression:

Stored size: 738 Bytes

Contents

module WirecardGiropay
  class Gateway
    attr_reader :business_case_signature, :username, :password

    def initialize(opts = {})
      @business_case_signature = opts.fetch(:business_case_signature)
      @username = opts.fetch(:username)
      @password = opts.fetch(:password)
    end

    def online_wire(params)
      request  = Request.new params.merge(business_case_signature: business_case_signature)
      response = Typhoeus.post(WirecardGiropay.gateway_url, body: request.to_xml, userpwd: http_auth_credentials)
      Response.from_xml response.body
    end

    private

    def http_auth_credentials
      WirecardGiropay.sandboxed? ? WirecardGiropay.sandbox_credentials : [username, password].join(':')
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wirecard_giropay-1.0.2 lib/wirecard_giropay/gateway.rb
wirecard_giropay-1.0.1 lib/wirecard_giropay/gateway.rb
wirecard_giropay-1.0.0 lib/wirecard_giropay/gateway.rb
wirecard_giropay-0.0.2 lib/wirecard_giropay/gateway.rb
wirecard_giropay-0.0.1 lib/wirecard_giropay/gateway.rb