You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an order with a payment from a non-traditional payment source
Go back to cart page
Open debugger in browser
Refresh page
You should see an api request which returns a 500 status code in the response. This also causes the page to not load entirely (Add Item button greyed out).
The error is as follows:
ActionView::Template::Error (undefined method `month' for #<Spree::GiftCard:0x00007fcdb9bee298>):
25: json.payment_method { json.(payment.payment_method, :id, :name) }
26: json.source do
27: if payment.source
28: json.(payment.source, *payment_source_attributes)
29:
30: if @current_user_roles.include?("admin")
31: json.(payment.source, :gateway_customer_profile_id, :gateway_payment_profile_id)
The reason this happens is due to the view trying to render attributes for payment sources which not all payment sources might have.
Steps to reproduce
You should see an api request which returns a 500 status code in the response. This also causes the page to not load entirely (Add Item button greyed out).
The error is as follows:
The reason this happens is due to the view trying to render attributes for payment sources which not all payment sources might have.
See: https://github.com/solidusio/solidus/blob/master/api/app/views/spree/api/orders/_big.json.jbuilder#L28-L32L144
See: https://github.com/solidusio/solidus/blob/master/api/app/helpers/spree/api/api_helpers.rb#L142-L144
System configuration
Solidus Version:
2.4
Possible Resolution
I think what should be done is much like what is done on the frontend.
See: https://github.com/solidusio/solidus/tree/master/frontend/app/views/spree/checkout/payment
See: https://github.com/solidusio/solidus/blob/master/frontend/app/views/spree/checkout/_payment.html.erb#L53
Where each payment source is given a partial which is rendered based on the payment source type.
The text was updated successfully, but these errors were encountered: