Class: SolidusBolt::Payments::CreditSyncService
- Inherits:
-
BaseService
- Object
- BaseService
- SolidusBolt::Payments::CreditSyncService
- Defined in:
- app/services/solidus_bolt/payments/credit_sync_service.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#payment ⇒ Object
readonly
Returns the value of attribute payment.
-
#refund_reason ⇒ Object
readonly
Returns the value of attribute refund_reason.
-
#transaction_id ⇒ Object
readonly
Returns the value of attribute transaction_id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(payment:, amount:, transaction_id:) ⇒ CreditSyncService
constructor
A new instance of CreditSyncService.
Methods inherited from BaseService
Constructor Details
#initialize(payment:, amount:, transaction_id:) ⇒ CreditSyncService
Returns a new instance of CreditSyncService.
8 9 10 11 12 13 14 15 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 8 def initialize(payment:, amount:, transaction_id:) @payment = payment @amount = amount @transaction_id = transaction_id @refund_reason = Spree::RefundReason.return_processing_reason&.id @order = payment.order super end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
6 7 8 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 6 def amount @amount end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
6 7 8 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 6 def order @order end |
#payment ⇒ Object (readonly)
Returns the value of attribute payment.
6 7 8 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 6 def payment @payment end |
#refund_reason ⇒ Object (readonly)
Returns the value of attribute refund_reason.
6 7 8 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 6 def refund_reason @refund_reason end |
#transaction_id ⇒ Object (readonly)
Returns the value of attribute transaction_id.
6 7 8 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 6 def transaction_id @transaction_id end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 |
# File 'app/services/solidus_bolt/payments/credit_sync_service.rb', line 17 def call return if Spree::Refund.find_by(transaction_id: transaction_id) create_refund order.recalculate end |