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
- #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 |
# File 'lib/datatrans/web/transaction.rb', line 10 def initialize(datatrans, params) @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
27 28 29 30 31 32 33 |
# File 'lib/datatrans/web/transaction.rb', line 27 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
22 23 24 25 |
# File 'lib/datatrans/web/transaction.rb', line 22 def @response = AuthorizeResponse.new(datatrans, params) @response.successful? end |
#signature ⇒ Object
18 19 20 |
# File 'lib/datatrans/web/transaction.rb', line 18 def signature sign(self.datatrans.merchant_id, params[:amount], params[:currency], params[:refno]) end |