lib/active_merchant/billing/gateways/blue_pay.rb in activemerchant-1.91.0 vs lib/active_merchant/billing/gateways/blue_pay.rb in activemerchant-1.92.0

- old
+ new

@@ -22,11 +22,11 @@ 'AUTH_CODE' => :authorization, 'MESSAGE' => :message, 'REBID' => :rebid, 'TRANS_TYPE' => :trans_type, 'PAYMENT_ACCOUNT_MASK' => :acct_mask, - 'CARD_TYPE' => :card_type, + 'CARD_TYPE' => :card_type } REBILL_FIELD_MAP = { 'REBILL_ID' => :rebill_id, 'ACCOUNT_ID'=> :account_id, @@ -39,10 +39,11 @@ 'SCHED_EXPR' => :schedule, 'CYCLES_REMAIN' => :cycles_remain, 'REB_AMOUNT' => :rebill_amount, 'NEXT_AMOUNT' => :next_amount, 'USUAL_DATE' => :undoc_usual_date, # Not found in the bp20rebadmin API doc. + 'CUST_TOKEN' => :cust_token } self.supported_countries = ['US', 'CA'] self.supported_cardtypes = [:visa, :master, :american_express, :discover, :diners_club, :jcb] self.homepage_url = 'http://www.bluepay.com/' @@ -82,11 +83,11 @@ add_address(post, options) add_customer_data(post, options) add_rebill(post, options) if options[:rebill] add_duplicate_override(post, options) post[:TRANS_TYPE] = 'AUTH' - commit('AUTH_ONLY', money, post) + commit('AUTH_ONLY', money, post, options) end # Perform a purchase, which is essentially an authorization and capture in a single operation. # This is referred to a SALE transaction in BluePay # @@ -105,11 +106,11 @@ add_address(post, options) add_customer_data(post, options) add_rebill(post, options) if options[:rebill] add_duplicate_override(post, options) post[:TRANS_TYPE] = 'SALE' - commit('AUTH_CAPTURE', money, post) + commit('AUTH_CAPTURE', money, post, options) end # Captures the funds from an authorize transaction. # This is referred to a CAPTURE transaction in BluePay # @@ -121,11 +122,11 @@ post = {} add_address(post, options) add_customer_data(post, options) post[:MASTER_ID] = identification post[:TRANS_TYPE] = 'CAPTURE' - commit('PRIOR_AUTH_CAPTURE', money, post) + commit('PRIOR_AUTH_CAPTURE', money, post, options) end # Void a previous transaction # This is referred to a VOID transaction in BluePay # @@ -134,11 +135,11 @@ # * <tt>identification</tt> - The Master ID, or token, returned from a previous authorize transaction. def void(identification, options = {}) post = {} post[:MASTER_ID] = identification post[:TRANS_TYPE] = 'VOID' - commit('VOID', nil, post) + commit('VOID', nil, post, options) end # Performs a credit. # # This transaction indicates that money should flow from the merchant to the customer. @@ -167,11 +168,11 @@ post[:NAME2] = options[:last_name] if options[:last_name] post[:ZIP] = options[:zip] if options[:zip] add_invoice(post, options) add_address(post, options) add_customer_data(post, options) - commit('CREDIT', money, post) + commit('CREDIT', money, post, options) end def credit(money, payment_object, options = {}) if payment_object&.kind_of?(String) ActiveMerchant.deprecated 'credit should only be used to credit a payment method' @@ -187,11 +188,11 @@ post[:NAME2] = options[:last_name] if options[:last_name] post[:ZIP] = options[:zip] if options[:zip] add_invoice(post, options) add_address(post, options) add_customer_data(post, options) - commit('CREDIT', money, post) + commit('CREDIT', money, post, options) end # Create a new recurring payment. # # ==== Parameters @@ -311,13 +312,14 @@ gsub(%r((&?TAMPER_PROOF_SEAL=)[^&"]*)i, '\1[FILTERED]') end private - def commit(action, money, fields) + def commit(action, money, fields, options = {}) fields[:AMOUNT] = amount(money) unless(fields[:TRANS_TYPE] == 'VOID' || action == 'rebill') fields[:MODE] = (test? ? 'TEST' : 'LIVE') fields[:ACCOUNT_ID] = @options[:login] + fields[:CUSTOMER_IP] = options[:ip] if options[:ip] if action == 'rebill' url = rebilling_url fields[:TAMPER_PROOF_SEAL] = calc_rebill_tps(fields) else