Sha256: ad854d32456e8a744bc7a02eea88494761ae008e34ca7e3bd6ea3771e1bd8e4c
Contents?: true
Size: 895 Bytes
Versions: 2
Compression:
Stored size: 895 Bytes
Contents
# frozen_string_literal: true module Workarea decorate Payment::Refund::CreditCard, with: :cim do def complete! return false unless tender.valid_capture_date? validate_reference! transaction.response = handle_active_merchant_errors do gateway.create_customer_profile_transaction_for_refund(options) end end private def options { transaction: { customer_profile_id: customer_profile_id, customer_payment_profile_id: customer_payment_profile_id, amount: refund_amount, trans_id: transaction.reference.response.params['direct_response']['transaction_id'] } } end def refund_amount transaction.amount.to_s.to_f end def customer_profile_id tender.gateway_profile_id end def customer_payment_profile_id tender.token end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-authorize_cim-2.1.2 | app/models/workarea/payment/refund/credit_card.decorator |
workarea-authorize_cim-2.1.1 | app/models/workarea/payment/refund/credit_card.decorator |