Class: Hipay::Refund

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

Instance Method Summary collapse

Constructor Details

#initialize(wsLogin, wsPassword, websiteId, test: false) ⇒ Refund

Returns a new instance of Refund.



81
82
83
84
85
86
# File 'lib/hipay.rb', line 81

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

Instance Method Details

#account(transactionPublicId, currency, amount) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/hipay.rb', line 102

def (transactionPublicId, currency, amount)
  @transactionPublicId = transactionPublicId
  operation = :account
  parameters = build_basic_request

  if !amount.nil?
    parameters[:amount] = amount
  end
  if !currency.nil?
    parameters[:currency] = currency
  end
  Hipay::call_api("refund-v2", operation, @test, { parameters: parameters })[:account_response][:account_result]
end

#build_basic_requestObject



116
117
118
# File 'lib/hipay.rb', line 116

def build_basic_request()
  { wsLogin: @wsLogin, wsPassword: @wsPassword, websiteId: @websiteId, transactionPublicId: @transactionPublicId }
end

#card(transactionPublicId, currency, amount) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/hipay.rb', line 88

def card(transactionPublicId, currency, amount)
  @transactionPublicId = transactionPublicId
  operation = :card
  parameters = build_basic_request

  if !amount.nil?
      parameters[:amount] = amount
  end
  if !currency.nil?
    parameters[:currency] = currency
  end
  Hipay::call_api("refund-v2", operation, @test, {parameters: parameters})[:card_response][:card_result]
end