Class: Spree::Cart::ChangeCurrency
- Inherits:
-
Object
- Object
- Spree::Cart::ChangeCurrency
- Includes:
- ServiceModule::Base
- Defined in:
- app/services/spree/cart/change_currency.rb
Instance Method Summary collapse
Methods included from ServiceModule::Base
Instance Method Details
#call(order:, new_currency:) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/services/spree/cart/change_currency.rb', line 6 def call(order:, new_currency:) return failure('Currency not supported') unless supported_currency?(order, new_currency) result = order.update!(currency: new_currency) rescue false if result success(order) else failure('Failed to update order') end end |