bradleypriest/pxpay — Issue #1: params hash values aren't symbols, just strings
Author: tuttinator
Created: 2011-11-08 09:25:01+00:00
State: open

Please excuse me if this is a novice mistake on my part, but I've been trying to get this gem to play nice with Spree and I've been writing a wrapper gem to extend Spree's Payment Methods, and have no problem generating a URL to redirect to, but the Response method seem to fail.

I'm running Rails 3.1.1, Ruby 1.9.2p290.

I've been testing with it in [pry] (http://pry.github.com/) - with this result:

```

pry(main)> response = Pxpay::Response.new(params).response

=> #

StartIndex cannot be less than zero.\r\nParameter name: startIndex
">

```

Even though
```
StartIndex cannot be less than zero.
Parameter name: startIndex
```
isn't overly helpful, I'm assuming from other tests that the 'result' variable sent to the build_xml method in pxpay / lib / pxpay / response.rb is a blank string.

I don't know if this is a Rails 3.1 issue or something else, but I think it would work just by changing
```
def initialize(params)
@result = params[:result]
@user_id = params[:userid]
@post = build_xml( params[:result] )
end
```

to

```
def initialize(params)
@result = params["result"]
@user_id = params["userid"]
@post = build_xml( params["result"] )
end
```

so I will just fork your gem and make these changes to test out.

I'm fairly new to Ruby and Rails, so I apologise again if I'm wrong here.

Thanks again for your work writing this.