lib/active_merchant/billing/gateways/element.rb in activemerchant-1.124.0 vs lib/active_merchant/billing/gateways/element.rb in activemerchant-1.125.0
- old
+ new
@@ -80,10 +80,23 @@
end
commit('CreditCardReturn', request, money)
end
+ def credit(money, payment, options = {})
+ request = build_soap_request do |xml|
+ xml.CreditCardCredit(xmlns: 'https://transaction.elementexpress.com') do
+ add_credentials(xml)
+ add_payment_method(xml, payment)
+ add_transaction(xml, money, options)
+ add_terminal(xml, options)
+ end
+ end
+
+ commit('CreditCardCredit', request, money)
+ end
+
def void(authorization, options = {})
trans_id, trans_amount = split_authorization(authorization)
options.merge!({ trans_id: trans_id, trans_amount: trans_amount, reversal_type: 'Full' })
request = build_soap_request do |xml|
@@ -184,18 +197,23 @@
def add_transaction(xml, money, options = {})
xml.transaction do
xml.ReversalType options[:reversal_type] if options[:reversal_type]
xml.TransactionID options[:trans_id] if options[:trans_id]
xml.TransactionAmount amount(money.to_i) if money
- xml.MarketCode 'Default' if money
+ xml.MarketCode market_code(money, options) if options[:market_code] || money
xml.ReferenceNumber options[:order_id] || SecureRandom.hex(20)
-
+ xml.TicketNumber options[:ticket_number] if options[:ticket_number]
+ xml.MerchantSuppliedTransactionId options[:merchant_supplied_transaction_id] if options[:merchant_supplied_transaction_id]
xml.PaymentType options[:payment_type] if options[:payment_type]
xml.SubmissionType options[:submission_type] if options[:submission_type]
xml.DuplicateCheckDisableFlag options[:duplicate_check_disable_flag].to_s == 'true' ? 'True' : 'False' unless options[:duplicate_check_disable_flag].nil?
xml.DuplicateOverrideFlag options[:duplicate_override_flag].to_s == 'true' ? 'True' : 'False' unless options[:duplicate_override_flag].nil?
xml.MerchantDescriptor options[:merchant_descriptor] if options[:merchant_descriptor]
end
+ end
+
+ def market_code(money, options)
+ options[:market_code] || 'Default'
end
def add_terminal(xml, options)
xml.terminal do
xml.TerminalID options[:terminal_id] || '01'