adamthedeveloper / wepay-rails

Collect payments from wepay in your rails application.
MIT License
32 stars 24 forks source link

uninitialized constant WepayRails::Helpers::ControllerHelpers::WepayCheckoutRecord #18

Closed thinkmorebetter closed 12 years ago

thinkmorebetter commented 12 years ago

Hi,

I'm having some trouble with creating a checkout. The install went fine and I've got the user authorization and account creation all working. However, now when I try to call init_checkout, I get the following error:

uninitialized constant WepayRails::Helpers::ControllerHelpers::WepayCheckoutRecord

The model is in lib/models as created by the installer. The controller itself has "include WepayRails::Payments". What am I missing?

Thanks in advance!

thinkmorebetter commented 12 years ago

So I've added the lib path to my autoload_paths in application.rb, but I'm still getting the mass assignment error:

Can't mass-assign protected attributes: type

"type" isn't a member of WepayCheckoutRecord, but is required to be part of the params sent to init_checkout, which in turn gets used to init the WepayCheckoutRecord.

Any ideas?

gilbert commented 12 years ago

I think I had a similar issue at one point, and I fixed it on my fork with a delete_if like this.

I don't recommend using my fork though. My changes are pretty ad-hoc and not formally tested.

SteveAquino commented 12 years ago

I'd really be interested to know the cause of this error, I'm performing successful WePay checkouts but I'm guessing it has to do with the fact that our gem has been modified (by me) to allow multiple authorized WePay accounts. If you're following the README for using a SINGLE WePay account, everything should be fine. If you're trying to allow dynamic authorization of multiple users, you need to create your own controller actions for responding to new wepay checkouts as well as IPN updates because of the way the gem works.

ChomeBurner, are you trying to set up your app for a single WePay account or multiple?

thinkmorebetter commented 12 years ago

Actually, I was able to get past that particular issue by removing "type" from the checkout_params that were sent to init_checkout. The gem wasn't even using it anyway, looking that info up in wepay.yml. The comment for init_checkout stated that it was required, but I realized it was unnecessary after looking at the code.

The checkout is now created, but now I have a new problem - the iframe itself doesn't show up. I've got the following in the header:

And this in the body:

Nothing shows up on my page though and there are no Javascript errors. The checkout_uri is fine, because when I go to it directly, it's the proper checkout form. However, if I open the Javascript console and save the object returned by the iframe_checkout call, it turns out there's an error and it says "The container you specified does not exist".

This may be a question for the WePay API people, but just thought I'd update this thread in the meantime.

thinkmorebetter commented 12 years ago

Ok, so I also needed to have the actual div. =)

I've updated the wiki page with that extra line, hope that's ok.

Thanks everyone!

SteveAquino commented 12 years ago

Thanks for helping with this. I will look into the use of the :type param and see what it's for and make necessary changes before closing this.

On 06/21/2012 12:32 PM, Alex Perelman wrote:

Ok, so I also needed to have the actual div. =)

I've updated the wiki page with that extra line, hope that's ok.

Thanks everyone!


Reply to this email directly or view it on GitHub: https://github.com/adamthedeveloper/wepay-rails/issues/18#issuecomment-6492211

timothyjoh commented 11 years ago

I am getting the same error, I am using it as a Single Account, in the testing mode. stage.wepay.com

Ah, I fixed it by manually adding the WePayCheckoutRecord.rb file to the models directory. I wonder why the generator didnt generate it?

adamthedeveloper commented 11 years ago

Did it copy the wepay.yml file over fine or did you have to create that too?

timothyjoh commented 11 years ago

It did copy the yml file to .yml.example just fine. Weird issue for sure.

baunuts commented 11 years ago

I had the same issue with WePayCheckoutRecord.rb not being created by the installer. Copying it into my app fixed the issue.

adamthedeveloper commented 11 years ago

What version of Rails are you running? I'd like to look into why it won't copy.

baunuts commented 11 years ago

I'm using Rails 3.2.11. I see the wepay_checkout_record.rb file in the generators of your library but for some reason it didn't install the model into my app.

adamthedeveloper commented 11 years ago

Yeah. There's a weird bug there. Go ahead and copy it over to your app directly. Ill look into why it's not copying over. Thanks. On Apr 17, 2013 7:45 AM, "Adam Bauman" notifications@github.com wrote:

I'm using Rails 3.2.11. I see the wepay_checkout_record.rb file in the generators of your library but for some reason it didn't install the model into my app.

— Reply to this email directly or view it on GitHubhttps://github.com/adamthedeveloper/wepay-rails/issues/18#issuecomment-16509967 .