Class: SixSaferpay::SixTransaction::RefundDirect

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/api/six_transaction/requests/refund_direct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, terminal_id:, refund:, payment_means:) ⇒ RefundDirect

Returns a new instance of RefundDirect.



12
13
14
15
16
17
18
19
20
21
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 12

def initialize(request_header: nil,
               terminal_id:,
               refund:,
               payment_means:
              )
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @terminal_id = terminal_id
  @refund = SixSaferpay::Refund.new(**refund.to_h) if refund
  @payment_means = SixSaferpay::RequestPaymentMeans.new(**payment_means.to_h) if payment_means
end

Instance Attribute Details

#payment_meansObject

Returns the value of attribute payment_means.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 5

def payment_means
  @payment_means
end

#refundObject

Returns the value of attribute refund.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 5

def refund
  @refund
end

#request_headerObject

Returns the value of attribute request_header.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 5

def request_header
  @request_header
end

#terminal_idObject

Returns the value of attribute terminal_id.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 5

def terminal_id
  @terminal_id
end

Instance Method Details

#response_classObject



41
42
43
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 41

def response_class
  SixSaferpay::SixTransaction::RefundDirectResponse
end

#to_hashObject Also known as: to_h



23
24
25
26
27
28
29
30
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 23

def to_hash
  hash = Hash.new
  hash.merge!(request_header: @request_header.to_h) if @request_header
  hash.merge!(terminal_id: @terminal_id) if @terminal_id
  hash.merge!(refund: @refund.to_h) if @refund
  hash.merge!(payment_means: @payment_means.to_h) if @payment_means
  hash
end

#to_jsonObject



33
34
35
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 33

def to_json
  to_hash.to_json
end

#urlObject



37
38
39
# File 'lib/six_saferpay/api/six_transaction/requests/refund_direct.rb', line 37

def url
  '/Payment/v1/Transaction/RefundDirect'
end