Sha256: 1165d387a097f99917881babc6b10beba01027dfb747c64a37f855ae48a2bae7
Contents?: true
Size: 1.03 KB
Versions: 18
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module SolidusNexio module NexioPaymentCommons def purchase(money, source, options = {}) super(money, source, add_transaction_options(source, options)) end def authorize(money, source, options = {}) super(money, source, add_transaction_options(source, options)) end def cancel(id) transaction = gateway.get_transaction(id) return unless transaction if Mappings.settled?(transaction.status) credit(transaction.amount.to_money.cents, id) else void(id) end end private def add_transaction_options(source, options) result = %i[currency billing_address].each_with_object({}) do |key, acc| acc[key] = options[key] if options[key].present? end result[:address] = options[:shipping_address] if options[:shipping_address].present? if options[:originator].respond_to?(:order) result.merge!(SolidusNexio::NexioData.purchase(options[:originator].order)) end result end end end
Version data entries
18 entries across 18 versions & 1 rubygems