Class: Hipay::Transaction

Inherits:
Object
  • Object
show all
Defined in:
lib/hipay.rb

Instance Method Summary collapse

Constructor Details

#initialize(wsLogin, wsPassword, test: false) ⇒ Transaction

Returns a new instance of Transaction.



124
125
126
127
128
# File 'lib/hipay.rb', line 124

def initialize(wsLogin, wsPassword, test: false)
  @wsLogin = wsLogin
  @wsPassword = wsPassword
  @test = test
end

Instance Method Details

#build_basic_requestObject



144
145
146
# File 'lib/hipay.rb', line 144

def build_basic_request
  { wsLogin: @wsLogin, wsPassword: @wsPassword, transactionPublicId: @transactionPublicId }
end

#cancel(transactionPublicId) ⇒ Object



137
138
139
140
141
142
# File 'lib/hipay.rb', line 137

def cancel(transactionPublicId)
  @transactionPublicId = transactionPublicId
  operation = :cancel
  parameters = build_basic_request
  Hipay::call_api("transaction-v2", operation, @test, { parameters: parameters })[:cancel_response][:cancel_result]
end

#confirm(transactionPublicId) ⇒ Object



130
131
132
133
134
135
# File 'lib/hipay.rb', line 130

def confirm(transactionPublicId)
  @transactionPublicId = transactionPublicId
  operation = :confirm
  parameters = build_basic_request
  Hipay::call_api("transaction-v2", operation, @test, { parameters: parameters })[:confirm_response][:confirm_result]
end