Sha256: 305c83b146a602857dda1d7b962bc7c4e52bdbc4da71daa287b0c0cae9aa1646
Contents?: true
Size: 804 Bytes
Versions: 3
Compression:
Stored size: 804 Bytes
Contents
# frozen_string_literal: true module Workarea decorate Payment::Capture::CreditCard, with: :cim do def complete! validate_reference! transaction.response = handle_active_merchant_errors do gateway.create_customer_profile_transaction(capture_args) end end def cancel! # noop, can't cancel a capture end private def capture_args { transaction: { type: :prior_auth_capture, amount: auth_amount, trans_id: transaction_ref_id } } end def transaction_ref_id transaction.reference.response.params['direct_response']['transaction_id'] end # cim requires dollar amount (not cents) # eg $4.25 def auth_amount transaction.amount.to_s.to_f end end end
Version data entries
3 entries across 3 versions & 1 rubygems