Class: Spree::SolidusSixSaferpay::AuthorizePayment
- Inherits:
-
Object
- Object
- Spree::SolidusSixSaferpay::AuthorizePayment
- Defined in:
- app/services/spree/solidus_six_saferpay/authorize_payment.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#saferpay_payment ⇒ Object
readonly
Returns the value of attribute saferpay_payment.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #gateway ⇒ Object
-
#initialize(saferpay_payment) ⇒ AuthorizePayment
constructor
A new instance of AuthorizePayment.
- #success? ⇒ Boolean
Constructor Details
#initialize(saferpay_payment) ⇒ AuthorizePayment
Returns a new instance of AuthorizePayment.
10 11 12 13 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 10 def initialize(saferpay_payment) @saferpay_payment = saferpay_payment @order = saferpay_payment.order end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 4 def order @order end |
#saferpay_payment ⇒ Object (readonly)
Returns the value of attribute saferpay_payment.
4 5 6 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 4 def saferpay_payment @saferpay_payment end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
4 5 6 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 4 def success @success end |
Class Method Details
.call(saferpay_payment) ⇒ Object
6 7 8 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 6 def self.call(saferpay_payment) new(saferpay_payment).call end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 15 def call = gateway.(order.total, saferpay_payment) if .success? saferpay_payment.update_attributes!(saferpay_payment_attributes(.api_response)) @success = true end self end |
#gateway ⇒ Object
30 31 32 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 30 def gateway raise NotImplementedError, "Must be implemented in AssertPaymentPage or AuthorizeTransaction with UsePaymentPageGateway or UseTransactionGateway" end |
#success? ⇒ Boolean
25 26 27 |
# File 'app/services/spree/solidus_six_saferpay/authorize_payment.rb', line 25 def success? @success end |