module Oschadbank module Constants DEFAULT_API_URL = 'https://3ds.oschadnybank.com/cgi-bin/cgi_link/' TR_TYPE = { pre_auth: '0', auth: '1', charge: '21', refund: '24', }.freeze MAC_PARAMS_ORDER = { auth: [ 'AMOUNT', 'CURRENCY', 'ORDER', 'DESC', 'MERCH_NAME', 'MERCH_URL', 'MERCHANT', 'TERMINAL', 'EMAIL', 'TRTYPE', 'COUNTRY', 'MERCH_GMT', 'TIMESTAMP', 'NONCE', 'BACKREF', ].freeze, charge: [ 'ORDER', 'AMOUNT', 'CURRENCY', 'RRN', 'INT_REF', 'TRTYPE', 'TERMINAL', 'BACKREF', 'TIMESTAMP', 'NONCE', ].freeze, refund: [ 'ORDER', 'ORG_AMOUNT', 'AMOUNT', 'CURRENCY', 'RRN', 'INT_REF', 'TRTYPE', 'TERMINAL', 'BACKREF', 'TIMESTAMP', 'NONCE', ].freeze, response: [ 'TERMINAL', 'TRTYPE', 'Order', 'Amount', 'Currency', 'Result', 'RC', 'AuthCode', 'RRN', 'Int_Ref', 'TIMESTAMP', 'NONCE', ].freeze }.freeze RESULT_MESSAGES = { '0' => 'Transaction successfully completed', '1' => 'Duplicate transaction detected', '2' => 'Transaction declined', '3' => 'Transaction processing fault', '4' => 'Information message', }.freeze RC_MESSAGES = { '-1' => 'Mandatory field is empty', '-2' => 'Bad CGI request', '-3' => 'No or Invalid response received', '-4' => 'Server is not responding', '-5' => 'Connect failed', '-6' => 'Configuration error', '-7' => 'Invalid response', '-8' => 'Error in card number field', '-9' => 'Error in card expiration date field', '-10' => 'Error in amount field', '-11' => 'Error in currency field', '-12' => 'Error in merchant terminal field', '-13' => 'Unknown referrer', '-15' => 'Invalid Retrieval reference number', '-16' => 'Terminal is locked, please try again', '-17' => 'Access denied', '-18' => 'Error in CVC2 or CVC2 Description fields', '-19' => 'Authentication failed', '-20' => 'Expired transaction', '-21' => 'Duplicate transaction', '-22' => 'Error in the request information required for client identification', '00' => 'Approved', '01' => 'Call your bank', '02' => 'Call your bank', '03' => 'Invalid merchant', '04' => 'Your card is restricted', '05' => 'Transaction declined', '06' => 'Error - retry', '07' => 'Your card is disabled', '08' => 'Additional identification required', '09' => 'Request in progress', '10' => 'Partially approved', '11' => 'Approved (VIP)', '12' => 'Invalid transaction', '13' => 'Invalid amount', '14' => 'No such card', '15' => 'No such card/issuer', '16' => 'Approved, update track 3', '17' => 'Customer cancellation', '18' => 'Customer dispute', '19' => 'Re-enter transaction', '20' => 'Invalid response', '21' => 'No action taken', '22' => 'Suspected malfunction', '23' => 'Unacceptable fee', '24' => 'Update not supported', '25' => 'No such record', '26' => 'Duplicate update/replaced', '27' => 'Field update error', '28' => 'File locked out', '29' => 'Error, contact acquirer', '30' => 'Format error', '31' => 'Issuer signed-off', '32' => 'Completed partially', '33' => 'Expired card', '34' => 'Suspected fraud', '35' => 'Acceptor contact acquirer', '36' => 'Restricted card', '37' => 'Call your bank', '38' => 'PIN tries exceeded', '39' => 'No credit account', '40' => 'Function not supported', '41' => 'Lost card', '42' => 'No universal account', '43' => 'Stolen card', '44' => 'No investment account', '45' => 'Reserved', '46' => 'Reserved', '47' => 'Reserved', '48' => 'Reserved', '49' => 'Reserved', '50' => 'Reserved', '51' => 'Not sufficient funds', '52' => 'No chequing account', '53' => 'No savings account', '54' => 'Expired card', '55' => 'Incorrect PIN', '56' => 'No card record', '57' => 'Not permitted to client', '58' => 'Not permitted to merchant', '59' => 'Suspected fraud', '60' => 'Acceptor call acquirer', '61' => 'Exceeds amount limit', '62' => 'Restricted card', '63' => 'Security violation', '64' => 'Wrong original amount', '65' => 'Exceeds frequency limit', '66' => 'Acceptor call acquirer', '67' => 'Pick up at ATM', '68' => 'Reply received too late', '69' => 'Reserved', '70' => 'Reserved', '71' => 'Reserved', '72' => 'Reserved', '73' => 'Reserved', '74' => 'Reserved', '75' => 'PIN tries exceeded', '76' => 'Wrong PIN, tries exceeded', '77' => 'Wrong Reference No', '78' => 'Reserved', '80' => 'Network error', '81' => 'Foreign network error', '82' => 'Time-out at issuer', '83' => 'Transaction failed', '84' => 'Pre-authorization timed out', '85' => 'Account verification required', '86' => 'Unable to verify PIN', '87' => 'Reserved', '88' => 'Cryptographic failure', '89' => 'Authentication failure', '90' => 'Cutoff is in progress', '91' => 'Issuer unavailable', '92' => 'Router unavailable', '93' => 'Violation of law', '94' => 'Duplicate transmission', '95' => 'Reconcile error', '96' => 'System malfunction', '97' => 'Reserved', '98' => 'Reserved', '99' => 'Reserved', }.freeze RESULT_SUCCESS = ['0', '1'].freeze RC_SUCCESS = ['00', '11', '16'].freeze end end