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 9 10 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 5 def initialize(datatrans, params) warn "DEPRECATION WARNING: Support for the payment page is deprecated and will be removed in the next major version. Please use the JSON API instead." @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
53 54 55 56 57 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 53 def params[:authorizationCode] rescue nil end |
#creditcard_alias ⇒ Object
83 84 85 86 87 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 83 def creditcard_alias params[:aliasCC] rescue nil end |
#error_code ⇒ Object
89 90 91 92 93 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 89 def error_code params[:errorCode] rescue nil end |
#error_detail ⇒ Object
101 102 103 104 105 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 101 def error_detail params[:errorDetail] rescue nil end |
#error_message ⇒ Object
95 96 97 98 99 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 95 def params[:errorMessage] rescue nil end |
#exp_month ⇒ Object
77 78 79 80 81 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 77 def exp_month params[:expm] rescue nil end |
#exp_year ⇒ Object
71 72 73 74 75 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 71 def exp_year params[:expy] rescue nil end |
#masked_cc ⇒ Object
65 66 67 68 69 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 65 def masked_cc params[:maskedCC] rescue nil end |
#payment_method ⇒ Object
59 60 61 62 63 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 59 def payment_method params[:pmethod] rescue nil end |
#reference_number ⇒ Object
47 48 49 50 51 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 47 def reference_number params[:refno] rescue nil end |
#response_code ⇒ Object
29 30 31 32 33 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 29 def response_code params[:responseCode] rescue nil end |
#response_message ⇒ Object
35 36 37 38 39 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 35 def params[:responseMessage] rescue nil end |
#status ⇒ Object
23 24 25 26 27 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 23 def status params[:status] rescue nil end |
#successful? ⇒ Boolean
12 13 14 15 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 12 def successful? raise Datatrans::InvalidSignatureError unless valid_signature? response_code == "01" && status == "success" && !errors_occurred? end |
#transaction_id ⇒ Object
41 42 43 44 45 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 41 def transaction_id params[:uppTransactionId] rescue nil end |
#valid_signature? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/datatrans/web/transaction/authorize.rb', line 17 def valid_signature? # TODO: does not make sense... true if errors? return true if errors_occurred? # no sign2 sent on error sign(datatrans.merchant_id, params[:amount], params[:currency], params[:uppTransactionId]) == params[:sign2] end |