Class: Datatrans::JSON::Transaction
- Inherits:
-
Object
- Object
- Datatrans::JSON::Transaction
- Defined in:
- lib/datatrans/json/transaction.rb,
lib/datatrans/json/transaction/init.rb,
lib/datatrans/json/transaction/settle.rb,
lib/datatrans/json/transaction/status.rb,
lib/datatrans/json/transaction/response.rb,
lib/datatrans/json/transaction/authorize.rb,
lib/datatrans/json/transaction/merchant_authorize.rb
Defined Under Namespace
Classes: Authorize, AuthorizeResponse, Init, InitResponse, MerchantAuthorize, MerchantAuthorizeResponse, Response, Settle, SettleResponse, Status, StatusResponse
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
- #init ⇒ Object
-
#initialize(datatrans, params) ⇒ Transaction
constructor
A new instance of Transaction.
- #merchant_authorize ⇒ Object
- #settle ⇒ Object
- #status ⇒ Object
- #transaction_path ⇒ Object
Constructor Details
#initialize(datatrans, params) ⇒ Transaction
Returns a new instance of Transaction.
8 9 10 11 |
# File 'lib/datatrans/json/transaction.rb', line 8 def initialize(datatrans, params) @datatrans = datatrans @params = params end |
Instance Attribute Details
#datatrans ⇒ Object (readonly)
Returns the value of attribute datatrans.
6 7 8 |
# File 'lib/datatrans/json/transaction.rb', line 6 def datatrans @datatrans end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/datatrans/json/transaction.rb', line 6 def params @params end |
#request ⇒ Object
Returns the value of attribute request.
5 6 7 |
# File 'lib/datatrans/json/transaction.rb', line 5 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/datatrans/json/transaction.rb', line 6 def response @response end |
Instance Method Details
#authorize ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/datatrans/json/transaction.rb', line 13 def warn "[DEPRECATION] `Datatrans::JSON::Transaction#authorize` is deprecated. Please use `Datatrans::JSON::Transaction#init` instead." self.request = Authorize.new(datatrans, params) @response = AuthorizeResponse.new(datatrans, request.process) @response.successful? end |
#init ⇒ Object
21 22 23 24 25 |
# File 'lib/datatrans/json/transaction.rb', line 21 def init self.request = Init.new(datatrans, params) @response = InitResponse.new(datatrans, request.process) @response.successful? end |
#merchant_authorize ⇒ Object
27 28 29 30 31 |
# File 'lib/datatrans/json/transaction.rb', line 27 def self.request = MerchantAuthorize.new(datatrans, params) @response = MerchantAuthorizeResponse.new(datatrans, request.process) @response.successful? end |
#settle ⇒ Object
39 40 41 42 43 |
# File 'lib/datatrans/json/transaction.rb', line 39 def settle self.request = Settle.new(datatrans, params) @response = SettleResponse.new(datatrans, request.process) @response.successful? end |
#status ⇒ Object
33 34 35 36 37 |
# File 'lib/datatrans/json/transaction.rb', line 33 def status self.request = Status.new(datatrans, params) @response = StatusResponse.new(datatrans, request.process) @response.successful? end |
#transaction_path ⇒ Object
45 46 47 |
# File 'lib/datatrans/json/transaction.rb', line 45 def transaction_path datatrans.url(:start_json_transaction, transaction_id: params[:transaction_id]) end |