Class: SixSaferpay::SixTransaction::Refund

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_header: nil, refund:, capture_reference:, pending_notification: nil) ⇒ Refund

Returns a new instance of Refund.



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

def initialize(request_header: nil,
               refund: ,
               capture_reference: ,
               pending_notification: nil)
  @request_header = request_header || SixSaferpay::RequestHeader.new()
  @refund = SixSaferpay::Refund.new(**refund.to_h) if refund
  @capture_reference = SixSaferpay::CaptureReference.new(**capture_reference.to_h) if capture_reference
  @pending_notification = SixSaferpay::PendingNotification.new(**pending_notification.to_h) if pending_notification
end

Instance Attribute Details

#capture_referenceObject

Returns the value of attribute capture_reference.



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

def capture_reference
  @capture_reference
end

#pending_notificationObject

Returns the value of attribute pending_notification.



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

def pending_notification
  @pending_notification
end

#refundObject

Returns the value of attribute refund.



5
6
7
# File 'lib/six_saferpay/api/six_transaction/requests/refund.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.rb', line 5

def request_header
  @request_header
end

Instance Method Details

#response_classObject



40
41
42
# File 'lib/six_saferpay/api/six_transaction/requests/refund.rb', line 40

def response_class
  SixSaferpay::SixTransaction::RefundResponse
end

#to_hashObject Also known as: to_h



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

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

#to_jsonObject



32
33
34
# File 'lib/six_saferpay/api/six_transaction/requests/refund.rb', line 32

def to_json
  to_hash.to_json
end

#urlObject



36
37
38
# File 'lib/six_saferpay/api/six_transaction/requests/refund.rb', line 36

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