Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added :state argument for new limit url

  • Loading branch information...
commit 4136dc015b5d7c51a2d480ec2ecd827c2f201519 1 parent 267ba2d
@tomblomfield tomblomfield authored
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
@@ -317,6 +317,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,
@@ -325,6 +326,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
@@ -296,6 +296,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
Please sign in to comment.
Something went wrong with that request. Please try again.