lib/active_merchant/billing/gateways/paymentez.rb in activemerchant-1.78.0 vs lib/active_merchant/billing/gateways/paymentez.rb in activemerchant-1.79.0
- old
+ new
@@ -59,22 +59,14 @@
def authorize(money, payment, options = {})
post = {}
add_invoice(post, money, options)
+ add_payment(post, payment)
add_customer_data(post, options)
- if payment.is_a?(String)
- post[:card] = { token: payment }
- commit_transaction('authorize', post)
- else
- MultiResponse.run do |r|
- r.process { store(payment, options) }
- post[:card] = { token: r.authorization }
- r.process { commit_transaction('authorize', post) }
- end
- end
+ commit_transaction('authorize', post)
end
def capture(_money, authorization, _options = {})
post = { transaction: { id: authorization } }
@@ -148,10 +140,11 @@
post[:order][:description] = options[:description] if options[:description]
post[:order][:discount] = options[:discount] if options[:discount]
post[:order][:installments] = options[:installments] if options[:installments]
post[:order][:installments_type] = options[:installments_type] if options[:installments_type]
post[:order][:taxable_amount] = options[:taxable_amount] if options[:taxable_amount]
+ post[:order][:tax_percentage] = options[:tax_percentage] if options[:tax_percentage]
end
def add_payment(post, payment)
post[:card] ||= {}
if payment.is_a?(String)
@@ -221,13 +214,13 @@
return true if response['message'] == 'card deleted'
response['card']['status'] == 'valid'
end
def message_from(response)
- if success_from(response)
- response['transaction'] && response['transaction']['message']
- else
+ if !success_from(response) && response['error']
response['error'] && response['error']['type']
+ else
+ response['transaction'] && response['transaction']['message']
end
end
def card_message_from(response)
if !response.include?('error')