Class: Ebanx::Command::Refund

Inherits:
Ebanx::Command show all
Defined in:
lib/ebanx/command/refund.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Refund

Returns a new instance of Refund.



4
5
6
7
8
9
# File 'lib/ebanx/command/refund.rb', line 4

def initialize(params)
  @params         = params
  @request_method = :post
  @request_action = 'refund'
  @response_type  = :json
end

Instance Method Details

#validateObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ebanx/command/refund.rb', line 11

def validate
  validate_presence :operation

  # Validation for a new refund request
  if @params[:operation] == 'request'
    validate_presence :hash
    validate_presence :amount
    validate_presence :description
  #Validation for a refund cancel request
  else
    validate_presence_or :merchant_refund_code, :refund_id
  end
end