Permalink
Browse files

Also fix redirect string to use merchantReturnData, added specs for it.

  • Loading branch information...
wvanbergen committed Apr 20, 2011
1 parent c81c5b1 commit 2c7e636676544f4b2001c77c94dc5f93b3f41490
Showing with 9 additions and 1 deletion.
  1. +2 −1 lib/adyen/form.rb
  2. +7 −0 spec/form_spec.rb
View
@@ -207,7 +207,8 @@ def calculate_signature(parameters, shared_secret = nil)
# @param [Hash] params A hash of HTTP GET parameters for the redirect request.
# @return [String] The signature string.
def redirect_signature_string(params)
- params[:authResult].to_s + params[:pspReference].to_s + params[:merchantReference].to_s + params[:skinCode].to_s
+ params[:authResult].to_s + params[:pspReference].to_s + params[:merchantReference].to_s +
+ params[:skinCode].to_s + params[:merchantReturnData].to_s
end
# Computes the redirect signature using the request parameters, so that the
View
@@ -1,5 +1,6 @@
# encoding: UTF-8
+require 'date'
require 'spec_helper'
require 'adyen/form'
@@ -63,6 +64,8 @@
it "should calculate the signature string correctly" do
Adyen::Form.redirect_signature_string(@params).should == 'AUTHORISED1211992213193029Internet Order 123454aD37dJA'
+ params = @params.merge(:merchantReturnData => 'testing1234')
+ Adyen::Form.redirect_signature_string(params).should == 'AUTHORISED1211992213193029Internet Order 123454aD37dJAtesting1234'
end
it "should calculate the signature correctly" do
@@ -145,6 +148,10 @@
it "should construct the signature string correctly" do
signature_string = Adyen::Form.calculate_signature_string(@parameters)
signature_string.should == "10000GBP2007-10-20Internet Order 123454aD37dJATestMerchant2007-10-11T11:00:00Z"
+
+ signature_string = Adyen::Form.calculate_signature_string(@parameters.merge(:merchant_return_data => 'testing123'))
+ signature_string.should == "10000GBP2007-10-20Internet Order 123454aD37dJATestMerchant2007-10-11T11:00:00Ztesting123"
+
end
it "should calculate the signature correctly" do

0 comments on commit 2c7e636

Please sign in to comment.