Class: Datatrans::Web::Transaction::AuthorizeResponse
- Inherits:
-
Object
- Object
- Datatrans::Web::Transaction::AuthorizeResponse
- Includes:
- Common
- Defined in:
- lib/datatrans/web/transaction/authorize.rb
Instance Attribute Summary collapse
-
#datatrans ⇒ Object
Returns the value of attribute datatrans.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #authorization_code ⇒ Object
- #creditcard_alias ⇒ Object
- #error_code ⇒ Object
- #error_detail ⇒ Object
- #error_message ⇒ Object
- #exp_month ⇒ Object
- #exp_year ⇒ Object
-
#initialize(datatrans, params) ⇒ AuthorizeResponse
constructor
A new instance of AuthorizeResponse.
- #masked_cc ⇒ Object
- #payment_method ⇒ Object
- #reference_number ⇒ Object
- #response_code ⇒ Object
- #response_message ⇒ Object
- #status ⇒ Object
- #successful? ⇒ Boolean
- #transaction_id ⇒ Object
- #valid_signature? ⇒ Boolean
Methods included from Common
Constructor Details
#initialize(datatrans, params) ⇒ AuthorizeResponse
Returns a new instance of AuthorizeResponse.
5 6 7 8 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 5 def initialize(datatrans, params) @datatrans = datatrans @params = params end |
Instance Attribute Details
#datatrans ⇒ Object
Returns the value of attribute datatrans.
3 4 5 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 3 def datatrans @datatrans end |
#params ⇒ Object
Returns the value of attribute params.
3 4 5 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 3 def params @params end |
Instance Method Details
#authorization_code ⇒ Object
41 42 43 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 41 def params[:authorizationCode] rescue nil end |
#creditcard_alias ⇒ Object
61 62 63 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 61 def creditcard_alias params[:aliasCC] rescue nil end |
#error_code ⇒ Object
65 66 67 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 65 def error_code params[:errorCode] rescue nil end |
#error_detail ⇒ Object
73 74 75 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 73 def error_detail params[:errorDetail] rescue nil end |
#error_message ⇒ Object
69 70 71 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 69 def params[:errorMessage] rescue nil end |
#exp_month ⇒ Object
57 58 59 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 57 def exp_month params[:expm] rescue nil end |
#exp_year ⇒ Object
53 54 55 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 53 def exp_year params[:expy] rescue nil end |
#masked_cc ⇒ Object
49 50 51 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 49 def masked_cc params[:maskedCC] rescue nil end |
#payment_method ⇒ Object
45 46 47 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 45 def payment_method params[:pmethod] rescue nil end |
#reference_number ⇒ Object
37 38 39 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 37 def reference_number params[:refno] rescue nil end |
#response_code ⇒ Object
25 26 27 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 25 def response_code params[:responseCode] rescue nil end |
#response_message ⇒ Object
29 30 31 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 29 def params[:responseMessage] rescue nil end |
#status ⇒ Object
21 22 23 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 21 def status params[:status] rescue nil end |
#successful? ⇒ Boolean
10 11 12 13 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 10 def successful? raise Datatrans::InvalidSignatureError unless valid_signature? response_code == '01' && status == 'success' && !errors_occurred? end |
#transaction_id ⇒ Object
33 34 35 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 33 def transaction_id params[:uppTransactionId] rescue nil end |
#valid_signature? ⇒ Boolean
15 16 17 18 19 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 15 def valid_signature? # TODO: does not make sense... true if errors? return true if errors_occurred? # no sign2 sent on error sign(self.datatrans.merchant_id, params[:amount], params[:currency], params[:uppTransactionId]) == params[:sign2] end |