Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added request_id for redirect_url #2

Merged
merged 3 commits into from

2 participants

@janjiss

Added request_id for redirect_url, now it is as optional argument.

@ebeigarts
Owner

I think this could have been written with less complexity -

def redirect_url(trans_id = nil)
  url = test? ? test_redirect_url : live_redirect_url
  url += "?trans_id=#{CGI.escape trans_id}" if trans_id
  url
end
@ebeigarts ebeigarts merged commit a814ac6 into from
@ebeigarts
Owner

@janjiss paldies :)

@janjiss

Glad to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
6 lib/active_merchant/billing/first_data_gateway.rb
@@ -280,8 +280,10 @@ def endpoint_url
test? ? test_url : live_url
end
- def redirect_url
- test? ? test_redirect_url : live_redirect_url
+ def redirect_url(trans_id = nil)
+ url = test? ? test_redirect_url : live_redirect_url
+ url += "?trans_id=#{CGI.escape trans_id}" if trans_id
+ url
end
private
View
7 spec/active_merchant/billing/first_data_gateway_spec.rb
@@ -685,6 +685,13 @@
end
end
+ it "26) return correct redirect url with transaction id" do
+ @gateway.redirect_url.should == @gateway.test_redirect_url
+ end
+
+ it "27) return correct redirect url without transaction id" do
+ @gateway.redirect_url("2SGip+TK/dVYe+XMSeQuECMs//S=").should == @gateway.test_redirect_url + "?trans_id=2SGip%2BTK%2FdVYe%2BXMSeQuECMs%2F%2FS%3D"
+ end
end
def submit_form(url, params, cassette_prefix)
Something went wrong with that request. Please try again.