Class: Payment::BankUpdater
- Inherits:
-
Object
- Object
- Payment::BankUpdater
- Defined in:
- app/models/spree/payment/bank_updater.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#params ⇒ Object
Returns the value of attribute params.
-
#payment ⇒ Object
Returns the value of attribute payment.
Instance Method Summary collapse
-
#initialize(payment, params = {}) ⇒ BankUpdater
constructor
A new instance of BankUpdater.
- #update ⇒ Object
Constructor Details
#initialize(payment, params = {}) ⇒ BankUpdater
Returns a new instance of BankUpdater.
5 6 7 8 9 |
# File 'app/models/spree/payment/bank_updater.rb', line 5 def initialize(payment, params = {}) @payment = payment @params = params @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'app/models/spree/payment/bank_updater.rb', line 3 def errors @errors end |
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'app/models/spree/payment/bank_updater.rb', line 3 def params @params end |
#payment ⇒ Object
Returns the value of attribute payment.
3 4 5 |
# File 'app/models/spree/payment/bank_updater.rb', line 3 def payment @payment end |
Instance Method Details
#update ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/spree/payment/bank_updater.rb', line 11 def update if @payment.details_submitted? @errors << "Payment Details can be submitted only once." return false end @payment.validate_bank_details = true ActiveRecord::Base.transaction do unless @payment.update(permit_params) raise StandardError, @payment.errors..to_sentence end unless update_order_state raise StandardError, "Failed to update order state." end end true rescue StandardError => e @errors << e. false end |