lib/active_merchant/billing/gateways/blue_pay.rb in activemerchant-1.103.0 vs lib/active_merchant/billing/gateways/blue_pay.rb in activemerchant-1.104.0

- old
+ new

@@ -8,12 +8,12 @@ self.live_url = 'https://secure.bluepay.com/interfaces/bp20post' self.rebilling_url = 'https://secure.bluepay.com/interfaces/bp20rebadmin' self.ignore_http_status = true - CARD_CODE_ERRORS = %w( N S ) - AVS_ERRORS = %w( A E N R W Z ) + CARD_CODE_ERRORS = %w(N S) + AVS_ERRORS = %w(A E N R W Z) AVS_REASON_CODES = %w(27 45) FIELD_MAP = { 'TRANS_ID' => :transaction_id, 'STATUS' => :response_code, @@ -153,11 +153,11 @@ # or a token. The token is called the Master ID. This is a unique transaction ID returned from a previous transaction. This token associates all the stored information for a previous transaction. # If the payment_object is a token, then the transaction type will reverse a previous capture or purchase transaction, returning the funds to the customer. If the amount is nil, a full credit will be processed. This is referred to a REFUND transaction in BluePay. # If the payment_object is either a CreditCard or Check object, then the transaction type will be an unmatched credit placing funds in the specified account. This is referred to a CREDIT transaction in BluePay. # * <tt>options</tt> -- A hash of parameters. def refund(money, identification, options = {}) - if(identification && !identification.kind_of?(String)) + if identification && !identification.kind_of?(String) ActiveMerchant.deprecated 'refund should only be used to refund a referenced transaction' return credit(money, identification, options) end post = {} @@ -315,11 +315,11 @@ end private def commit(action, money, fields, options = {}) - fields[:AMOUNT] = amount(money) unless(fields[:TRANS_TYPE] == 'VOID' || action == 'rebill') + 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' @@ -370,11 +370,11 @@ ) end def message_from(parsed) message = parsed[:message] - if(parsed[:response_code].to_i == 2) + if parsed[:response_code].to_i == 2 if CARD_CODE_ERRORS.include?(parsed[:card_code]) message = CVVResult.messages[parsed[:card_code]] elsif AVS_ERRORS.include?(parsed[:avs_result_code]) message = AVSResult.messages[parsed[:avs_result_code]] else @@ -511,9 +511,10 @@ ) end def handle_response(response) return response.body if ignore_http_status || (200...300).cover?(response.code.to_i) + raise ResponseError.new(response) end end end end