amazon-archives/spree_pay_with_amazon

extension installed and found an issue when amazon payment is disable

gogo52cn opened this issue · 4 comments

when the exntion installed but the payment method is not enabled in the back end. The view, _login.html.erb will throw an exception because the code call the "preferred_test_mode" method on "nil".

I suggest adding conditions to avoid this issue.

<% amazon_payment_instances = Spree::Gateway::Amazon.all
if amazon_payment_instances.count == 1
amazon = amazon_payment_instances.last

if amazon.preferences[:test_mode] && spree_current_user.try(:admin?) || !amazon.preferences[:test_mode] %>

also the

of the button messes up the layout. Looks like a
is missing.

@gogo52cn

It looks like there was a formatting error with the last part of your issue (also the... onwards) so I'm unable to comment on that.

Test mode isn't necessarily meant to be restricted to admin users.

I've solved this in PR #17 by hiding the ability to get to the amazon screens when it isn't configured.

Hi Matt.

Sorry. I meant there seems to be a closing div tag missing in this partial which may mess up the footer part of the site.

@gogo52cn
It looks like there was a self closing div which could cause issues in a few browsers. I've gone ahead and updated this to use a separate opening / closing tag in PR #18.

@gogo52cn A fix for this has now been merged.