solidusio / solidus_paypal_braintree

⛔️ [Archived] Use solidus_braintree instead!
https://github.com/solidusio/solidus_braintree
BSD 3-Clause "New" or "Revised" License
37 stars 78 forks source link

Invalid transactions, NoMethodError (strip) when cancelling order with invalid payment #158

Closed mntmn closed 4 years ago

mntmn commented 6 years ago

I made some test orders with solidus_paypal_braintree and using the Paypal Checkout button. Everything works fine except that some of the orders have at least one invalid transaction under payments in addition to the valid transaction.

When cancelling an order like this, the "find" method in transaction_gateway.rb chokes on these invalid transactions.

Any advice?

Solidus is 2.5.0.beta2

F, [2018-03-14T11:53:56.312363 #9569] FATAL -- : [2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] NoMethodError (undefined method `strip' for #<Spree::Payment:0x000000095ecb40>):
F, [2018-03-14T11:53:56.312635 #9569] FATAL -- : [2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1]   
F, [2018-03-14T11:53:56.312707 #9569] FATAL -- : [2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/activemodel-5.1.5/lib/active_model/attribute_methods.rb:432:in `method_missing'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/braintree-2.82.0/lib/braintree/transaction_gateway.rb:57:in `find'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/bundler/gems/solidus_paypal_braintree-898eb2cad543/app/models/solidus_paypal_braintree/gateway.rb:177:in `try_void'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/solidus_core-2.5.0.beta2/app/models/spree/payment/cancellation.rb:29:in `cancel'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/solidus_core-2.5.0.beta2/app/models/spree/payment/processing.rb:82:in `cancel!'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/solidus_core-2.5.0.beta2/app/models/spree/order.rb:887:in `block in after_cancel'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.5/lib/active_record/relation/delegation.rb:39:in `each'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.5/lib/active_record/relation/delegation.rb:39:in `each'
[2ac1b19f-eba8-4f2c-8082-ad4480b9f7a1] vendor/bundle/ruby/2.3.0/gems/solidus_core-2.5.0.beta2/app/models/spree/order.rb:887:in `after_cancel'
mntmn commented 5 years ago

I updated to the latest master. The problem was fixed by a08ae6d0a442ef8d892dd2089129bef59508ed35