Sha256: 9270f962ca2c494cdcb1cc452ba387c7c549d9de8e432400f52f223d4e801e15
Contents?: true
Size: 555 Bytes
Versions: 10
Compression:
Stored size: 555 Bytes
Contents
# frozen_string_literal: true module SolidusBolt module Payments class CaptureSyncService < SolidusBolt::BaseService attr_reader :payment, :capture_amount def initialize(payment:, capture_amount:) @payment = payment @capture_amount = capture_amount super end def call return if payment.completed? amount = Money.new(capture_amount).to_d payment.capture_events.create!(amount: amount) payment.update!(amount: amount, state: 'completed') end end end end
Version data entries
10 entries across 10 versions & 1 rubygems