Class: Spree::Mollie::PaymentStateUpdater
- Inherits:
-
Object
- Object
- Spree::Mollie::PaymentStateUpdater
- Defined in:
- app/models/spree/mollie/payment_state_updater.rb
Instance Attribute Summary collapse
-
#mollie_order ⇒ Object
readonly
Returns the value of attribute mollie_order.
-
#payment ⇒ Object
readonly
Returns the value of attribute payment.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(mollie_order, payment) ⇒ PaymentStateUpdater
constructor
A new instance of PaymentStateUpdater.
Constructor Details
#initialize(mollie_order, payment) ⇒ PaymentStateUpdater
Returns a new instance of PaymentStateUpdater.
8 9 10 11 |
# File 'app/models/spree/mollie/payment_state_updater.rb', line 8 def initialize(mollie_order, payment) @mollie_order = mollie_order @payment = payment end |
Instance Attribute Details
#mollie_order ⇒ Object (readonly)
Returns the value of attribute mollie_order.
6 7 8 |
# File 'app/models/spree/mollie/payment_state_updater.rb', line 6 def mollie_order @mollie_order end |
#payment ⇒ Object (readonly)
Returns the value of attribute payment.
5 6 7 |
# File 'app/models/spree/mollie/payment_state_updater.rb', line 5 def payment @payment end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/models/spree/mollie/payment_state_updater.rb', line 13 def call case mollie_order.status when 'created' transition_to_created! when 'expired' transition_to_failed! when 'authorized' transition_to_pending! when 'paid', 'completed' transition_to_complete! when 'canceled' transition_to_void! when 'shipping' transition_to_shipping! else MollieLogger.debug("Unhandled Mollie payment state received: #{mollie_order.status}. Therefore we did not update the payment state.") end end |