Sha256: 14b26525a906d6a13d544e1905c88da8ba442b6e2ba0d945b13efa69cb790dbd
Contents?: true
Size: 881 Bytes
Versions: 4
Compression:
Stored size: 881 Bytes
Contents
# frozen_string_literal: true module SolidusNexio PaymentConfirmationService = Struct.new(:payment) do class << self def call(payment) return unless payment.nexio_apm? && payment.auth_confirmation_required new(payment).confirm_payment_auth! clear_auth_confirmation(payment) end protected def clear_auth_confirmation(payment) payment.update!(auth_confirmation_required: false) end end def confirm_payment_auth! return unless auth_confirmed invalidate_payment unless update_payment_state_from_nexio('Auth Confirmation') && auth_confirmed end private delegate :update_payment_state_from_nexio, to: :payment def auth_confirmed payment.completed? || payment.pending? end def invalidate_payment payment.order&.cancel! or payment.void! end end end
Version data entries
4 entries across 4 versions & 1 rubygems