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

- old
+ new

@@ -19,22 +19,22 @@ SUCCESS_MESSAGE = 'The transaction was successful.' MONETARY_CHANGE_STATUSES = ['SETTLE', 'AUTHORIZE', 'AUTHORIZE ADDITIONAL', 'CREDIT', 'SPLITSETTLE'] - CARD_CODE_ERRORS = %w( N S "" ) + CARD_CODE_ERRORS = %w(N S "") CARD_CODE_MESSAGES = { 'M' => 'Card verification number matched', 'N' => "Card verification number didn't match", 'P' => 'Card verification number was not processed', 'S' => 'Card verification number should be on card but was not indicated', 'U' => 'Issuer was not certified for card verification', '' => 'Transaction failed because incorrect card verification number was entered or no number was entered' } - AVS_ERRORS = %w( A B C E I N O P R W Z ) + AVS_ERRORS = %w(A B C E I N O P R W Z) AVS_MESSAGES = { 'A' => 'Street address matches billing information, zip/postal code does not', 'B' => 'Street address match for international transaction. Postal code not verified due to incompatible formats', 'C' => 'Street address and postal code not verified for internation transaction due to incompatible formats', @@ -298,13 +298,13 @@ def parse(body, action) case action when :authorization parse_authorization_response(body) when :get_status - parse_status_response(body, [ :SerialNumber, :TransactionAmount, :TransactionStatusCode, :TransactionStatusMessage, :OrderNumber, :TransactionDateTime, :TransactionID, :ApprovalCode, :BatchNumber ]) + parse_status_response(body, [:SerialNumber, :TransactionAmount, :TransactionStatusCode, :TransactionStatusMessage, :OrderNumber, :TransactionDateTime, :TransactionID, :ApprovalCode, :BatchNumber]) else - parse_status_response(body, [ :SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID ]) + parse_status_response(body, [:SerialNumber, :TransactionAmount, :DesiredStatus, :StatusResponse, :StatusResponseMessage, :OrderNumber, :AuditID]) end end def split_lines(body) body.split(/[\r\n]+/) @@ -327,11 +327,11 @@ end def parse_status_response(body, response_keys) lines = split_lines(body) - keys = [ :szSerialNumber, :szErrorCode, :szNumberRecords] + keys = [:szSerialNumber, :szErrorCode, :szNumberRecords] values = split_line(lines[0])[0..2] result = Hash[*keys.zip(values).flatten] result[:szErrorMessage] = '' @@ -432,9 +432,10 @@ return SUCCESS_MESSAGE else return CARD_CODE_MESSAGES[response[:szCVV2ResponseCode]] if CARD_CODE_ERRORS.include?(response[:szCVV2ResponseCode]) return AVS_MESSAGES[response[:szAVSResponseMessage]] if AVS_ERRORS.include?(response[:szAVSResponseCode]) return RETURN_CODE_MESSAGES[response[:szReturnCode]] if response[:szReturnCode] != '1' + return response[:szAuthorizationDeclinedMessage] end end def message_from_status(response)