Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
swombat committed Dec 4, 2008
1 parent 552597c commit 37c27d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
6 changes: 2 additions & 4 deletions lib/peeves/config.rb
@@ -1,8 +1,6 @@
module Peeves
module Config

VENDOR = "woobius"


VENDOR = "yourvendor"
GATEWAY_MODE = :simulator
end
end
7 changes: 6 additions & 1 deletion lib/peeves/protx_response.rb
Expand Up @@ -4,7 +4,8 @@ def initialize(response)
@response = response
if @response.is_a?(String)
response.split("\r\n").each do |line|
key, value = line.split("=")
key, *value = line.split("=")
value = value.join("=")
self[key] = value
end
elsif @response.is_a?(Hash)
Expand Down Expand Up @@ -50,6 +51,10 @@ def verify!

self
end

def approved?
self.status == PeevesGateway::APPROVED
end

private
def mapping
Expand Down
6 changes: 3 additions & 3 deletions lib/peeves_gateway.rb
Expand Up @@ -27,7 +27,7 @@ class PeevesGateway
"NOTMATCHED" => 'N'
}

def initialize(mode)
def initialize(mode=Peeves::Config::GATEWAY_MODE)
@mode = mode
end

Expand Down Expand Up @@ -250,11 +250,11 @@ def refund(money, options)
commit! :refund
end

def parse_notification(params)
def self.parse_notification(params)
Peeves::ProtxResponse.new(params).verify!
end

def response(status, redirect_url, status_detail)
def self.response(status, redirect_url, status_detail)
"Status=#{CGI.escape(status)}\r\n" +
"RedirectURL=#{CGI.escape(redirect_url)}\r\n" +
"StatusDetail=#{CGI.escape(status_detail)}"
Expand Down

0 comments on commit 37c27d9

Please sign in to comment.