Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Merge Dev #1

Merged
merged 2 commits into from

1 participant

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.
Showing with 14 additions and 0 deletions.
  1. +2 −0  lib/gocardless/client.rb
  2. +12 −0 spec/client_spec.rb
View
2  lib/gocardless/client.rb
@@ -326,6 +326,7 @@ def new_limit_url(type, limit_params)
limit_params[:merchant_id] = merchant_id
redirect_uri = limit_params.delete(:redirect_uri)
+ state = limit_params.delete(:state)
params = {
:nonce => generate_nonce,
@@ -334,6 +335,7 @@ def new_limit_url(type, limit_params)
type => limit_params,
}
params[:redirect_uri] = redirect_uri unless redirect_uri.nil?
+ params[:state] = state unless state.nil?
sign_params(params)
View
12 spec/client_spec.rb
@@ -329,6 +329,18 @@ def get_params(url)
end
end
+ it "should include the state in the URL query" do
+ params = { 'a' => '1', 'b' => '2', :state => "blah" }
+ url = @client.send(:new_limit_url, :subscription, params)
+ get_params(url)["state"].should == "blah"
+ end
+
+ it "should include the redirect_uri in the URL query" do
+ params = { 'a' => '1', 'b' => '2', :redirect_uri => "http://www.google.com" }
+ url = @client.send(:new_limit_url, :subscription, params)
+ get_params(url)["redirect_uri"].should == "http://www.google.com"
+ end
+
it "should add merchant_id to the limit" do
url = @client.send(:new_limit_url, :subscription, {})
get_params(url)['subscription[merchant_id]'].should == @merchant_id
Something went wrong with that request. Please try again.