Method: Agms::TransactionResponse#initialize

Defined in:
lib/agms/response/transaction_response.rb

#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