Class: Spree::SolidusSixSaferpay::CancelAuthorizedPayment
- Inherits:
-
Object
- Object
- Spree::SolidusSixSaferpay::CancelAuthorizedPayment
- Defined in:
- app/services/spree/solidus_six_saferpay/cancel_authorized_payment.rb
Instance Attribute Summary collapse
-
#saferpay_payment ⇒ Object
readonly
Returns the value of attribute saferpay_payment.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(saferpay_payment) ⇒ CancelAuthorizedPayment
constructor
A new instance of CancelAuthorizedPayment.
Constructor Details
#initialize(saferpay_payment) ⇒ CancelAuthorizedPayment
Returns a new instance of CancelAuthorizedPayment.
11 12 13 |
# File 'app/services/spree/solidus_six_saferpay/cancel_authorized_payment.rb', line 11 def initialize(saferpay_payment) @saferpay_payment = saferpay_payment end |
Instance Attribute Details
#saferpay_payment ⇒ Object (readonly)
Returns the value of attribute saferpay_payment.
5 6 7 |
# File 'app/services/spree/solidus_six_saferpay/cancel_authorized_payment.rb', line 5 def saferpay_payment @saferpay_payment end |
Class Method Details
.call(saferpay_payment) ⇒ Object
7 8 9 |
# File 'app/services/spree/solidus_six_saferpay/cancel_authorized_payment.rb', line 7 def self.call(saferpay_payment) new(saferpay_payment).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/services/spree/solidus_six_saferpay/cancel_authorized_payment.rb', line 15 def call if transaction_id = saferpay_payment.transaction_id gateway.void(saferpay_payment.transaction_id) else ::SolidusSixSaferpay::ErrorHandler.handle( ::SolidusSixSaferpay::InvalidSaferpayPayment.new( details: "Can not cancel payment #{saferpay_payment.id} because it has no transaction ID.") ) end end |