Class: Datatrans::Web::Transaction
- Inherits:
-
Object
- Object
- Datatrans::Web::Transaction
- Includes:
- Common
- Defined in:
- lib/datatrans/web/transaction.rb,
lib/datatrans/web/transaction/authorize.rb
Defined Under Namespace
Classes: AuthorizeResponse
Instance Attribute Summary collapse
-
#datatrans ⇒ Object
readonly
Returns the value of attribute datatrans.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize(datatrans, params) ⇒ Transaction
constructor
A new instance of Transaction.
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to_missing?(method) ⇒ Boolean
- #signature ⇒ Object
Methods included from Common
Constructor Details
#initialize(datatrans, params) ⇒ Transaction
Returns a new instance of Transaction.
10 11 12 13 14 15 16 17 18 |
# File 'lib/datatrans/web/transaction.rb', line 10 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.to_hash params.symbolize_keys! params.reverse_merge!(reqtype: "NOA", useAlias: "yes", hiddenMode: "yes") @params = params end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/datatrans/web/transaction.rb', line 33 def method_missing(method, *args, &block) if response.respond_to? method.to_sym response.send(method) else super end end |
Instance Attribute Details
#datatrans ⇒ Object (readonly)
Returns the value of attribute datatrans.
8 9 10 |
# File 'lib/datatrans/web/transaction.rb', line 8 def datatrans @datatrans end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/datatrans/web/transaction.rb', line 8 def params @params end |
#request ⇒ Object
Returns the value of attribute request.
7 8 9 |
# File 'lib/datatrans/web/transaction.rb', line 7 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
8 9 10 |
# File 'lib/datatrans/web/transaction.rb', line 8 def response @response end |
Instance Method Details
#authorize ⇒ Object
24 25 26 27 |
# File 'lib/datatrans/web/transaction.rb', line 24 def @response = AuthorizeResponse.new(datatrans, params) @response.successful? end |
#respond_to_missing?(method) ⇒ Boolean
29 30 31 |
# File 'lib/datatrans/web/transaction.rb', line 29 def respond_to_missing?(method, *) response.respond_to?(method.to_sym) || super end |
#signature ⇒ Object
20 21 22 |
# File 'lib/datatrans/web/transaction.rb', line 20 def signature sign(datatrans.merchant_id, params[:amount], params[:currency], params[:refno]) end |