Class: Agms::TransactionResponse
- Defined in:
- lib/agms/response/transaction_response.rb
Instance Method Summary collapse
- #getAuthorization ⇒ Object
-
#initialize(response, op) ⇒ TransactionResponse
constructor
A class representing AGMS Transaction Response objects.
- #isSuccessful ⇒ Object
Methods inherited from Response
#doMap, #mapResponse, #toArray
Constructor Details
#initialize(response, op) ⇒ TransactionResponse
A class representing AGMS Transaction Response objects.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/agms/response/transaction_response.rb', line 5 def initialize(response, op) super(response, op) @mapping = { 'STATUS_CODE' => 'response_code', 'STATUS_MSG' => 'response_message', 'TRANS_ID' => 'transaction_id', 'AUTH_CODE' => 'authorization_code', 'AVS_CODE' => 'avs_result', 'AVS_MSG' => 'avs_message', 'CVV2_CODE' => 'cvv_result', 'CVV2_MSG' => 'cvv_message', 'ORDERID' => 'order_id', 'SAFE_ID' => 'safe_id', 'FULLRESPONSE' => 'full_response', 'POSTSTRING' => 'post_string', 'BALANCE' => 'gift_balance', 'GIFTRESPONSE' => 'gift_response', 'MERCHANT_ID' => 'merchant_id', 'CUSTOMER_MESSAGE' => 'customer_message', 'RRN' => 'rrn' } @response = response @op = op if not isSuccessful() response_array = toArray() raise ResponseError.new("Transaction failed with error code #{response_array['response_code']} and message #{response_array['response_message']}", response_array) end end |
Instance Method Details
#getAuthorization ⇒ Object
45 46 47 48 |
# File 'lib/agms/response/transaction_response.rb', line 45 def getAuthorization response_array = toArray() return response_array['transaction_id'] end |
#isSuccessful ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/agms/response/transaction_response.rb', line 36 def isSuccessful response_array = toArray() if response_array['response_code'] != '1' and response_array['response_code'] != '2' return false else return true end end |