lib/active_merchant/billing/gateways/safe_charge.rb in activemerchant-1.114.0 vs lib/active_merchant/billing/gateways/safe_charge.rb in activemerchant-1.116.0

- old
+ new

@@ -13,86 +13,86 @@ self.homepage_url = 'https://www.safecharge.com' self.display_name = 'SafeCharge' VERSION = '4.1.0' - def initialize(options={}) + def initialize(options = {}) requires!(options, :client_login_id, :client_password) super end - def purchase(money, payment, options={}) + def purchase(money, payment, options = {}) post = {} post[:sg_APIType] = 1 if options[:three_d_secure] trans_type = options[:three_d_secure] ? 'Sale3D' : 'Sale' add_transaction_data(trans_type, post, money, options) add_payment(post, payment, options) add_customer_details(post, payment, options) commit(post) end - def authorize(money, payment, options={}) + def authorize(money, payment, options = {}) post = {} add_transaction_data('Auth', post, money, options) add_payment(post, payment, options) add_customer_details(post, payment, options) commit(post) end - def capture(money, authorization, options={}) + def capture(money, authorization, options = {}) post = {} auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|') - add_transaction_data('Settle', post, money, options.merge!({currency: original_currency})) + add_transaction_data('Settle', post, money, options.merge!({ currency: original_currency })) post[:sg_AuthCode] = auth post[:sg_TransactionID] = transaction_id post[:sg_CCToken] = token post[:sg_ExpMonth] = exp_month post[:sg_ExpYear] = exp_year commit(post) end - def refund(money, authorization, options={}) + def refund(money, authorization, options = {}) post = {} auth, transaction_id, token, exp_month, exp_year, _, original_currency = authorization.split('|') - add_transaction_data('Credit', post, money, options.merge!({currency: original_currency})) + add_transaction_data('Credit', post, money, options.merge!({ currency: original_currency })) post[:sg_CreditType] = 2 post[:sg_AuthCode] = auth post[:sg_TransactionID] = transaction_id post[:sg_CCToken] = token post[:sg_ExpMonth] = exp_month post[:sg_ExpYear] = exp_year commit(post) end - def credit(money, payment, options={}) + def credit(money, payment, options = {}) post = {} add_payment(post, payment, options) add_transaction_data('Credit', post, money, options) post[:sg_CreditType] = 1 commit(post) end - def void(authorization, options={}) + def void(authorization, options = {}) post = {} auth, transaction_id, token, exp_month, exp_year, original_amount, original_currency = authorization.split('|') - add_transaction_data('Void', post, (original_amount.to_f * 100), options.merge!({currency: original_currency})) + add_transaction_data('Void', post, (original_amount.to_f * 100), options.merge!({ currency: original_currency })) post[:sg_CreditType] = 2 post[:sg_AuthCode] = auth post[:sg_TransactionID] = transaction_id post[:sg_CCToken] = token post[:sg_ExpMonth] = exp_month post[:sg_ExpYear] = exp_year commit(post) end - def verify(credit_card, options={}) + def verify(credit_card, options = {}) MultiResponse.run(:use_first_response) do |r| r.process { authorize(100, credit_card, options) } r.process(:ignore_result) { void(r.authorization, options) } end end @@ -128,10 +128,10 @@ post[:sg_Descriptor] = options[:merchant_descriptor] if options[:merchant_descriptor] post[:sg_MerchantPhoneNumber] = options[:merchant_phone_number] if options[:merchant_phone_number] post[:sg_MerchantName] = options[:merchant_name] if options[:merchant_name] end - def add_payment(post, payment, options={}) + def add_payment(post, payment, options = {}) post[:sg_NameOnCard] = payment.name post[:sg_CardNumber] = payment.number post[:sg_ExpMonth] = format(payment.month, :two_digits) post[:sg_ExpYear] = format(payment.year, :two_digits) post[:sg_CVV2] = payment.verification_value