Class: OnlinePayments::SDK::Domain::CancelPaymentRequest

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/cancel_payment_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#amount_of_moneyOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of amount_of_money.

Returns:



16
17
18
# File 'lib/onlinepayments/sdk/domain/cancel_payment_request.rb', line 16

def amount_of_money
  @amount_of_money
end

#is_finaltrue/false

Returns the current value of is_final.

Returns:

  • (true/false)

    the current value of is_final



16
17
18
# File 'lib/onlinepayments/sdk/domain/cancel_payment_request.rb', line 16

def is_final
  @is_final
end

#line_item_detailsArray<OnlinePayments::SDK::Domain::LineItemDetail>

Returns the current value of line_item_details.

Returns:



16
17
18
# File 'lib/onlinepayments/sdk/domain/cancel_payment_request.rb', line 16

def line_item_details
  @line_item_details
end

#operation_referencesOnlinePayments::SDK::Domain::OperationPaymentReferences

Returns the current value of operation_references.

Returns:



16
17
18
# File 'lib/onlinepayments/sdk/domain/cancel_payment_request.rb', line 16

def operation_references
  @operation_references
end

Instance Method Details

#from_hash(hash) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/onlinepayments/sdk/domain/cancel_payment_request.rb', line 36

def from_hash(hash)
  super
  if hash.has_key? 'amountOfMoney'
    raise TypeError, "value '%s' is not a Hash" % [hash['amountOfMoney']] unless hash['amountOfMoney'].is_a? Hash
    @amount_of_money = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['amountOfMoney'])
  end
  if hash.has_key? 'isFinal'
    @is_final = hash['isFinal']
  end
  if hash.has_key? 'lineItemDetails'
    raise TypeError, "value '%s' is not an Array" % [hash['lineItemDetails']] unless hash['lineItemDetails'].is_a? Array
    @line_item_details = []
    hash['lineItemDetails'].each do |e|
      @line_item_details << OnlinePayments::SDK::Domain::LineItemDetail.new_from_hash(e)
    end
  end
  if hash.has_key? 'operationReferences'
    raise TypeError, "value '%s' is not a Hash" % [hash['operationReferences']] unless hash['operationReferences'].is_a? Hash
    @operation_references = OnlinePayments::SDK::Domain::OperationPaymentReferences.new_from_hash(hash['operationReferences'])
  end
end

#to_hHash

Returns:

  • (Hash)


27
28
29
30
31
32
33
34
# File 'lib/onlinepayments/sdk/domain/cancel_payment_request.rb', line 27

def to_h
  hash = super
  hash['amountOfMoney'] = @amount_of_money.to_h unless @amount_of_money.nil?
  hash['isFinal'] = @is_final unless @is_final.nil?
  hash['lineItemDetails'] = @line_item_details.collect{|val| val.to_h} unless @line_item_details.nil?
  hash['operationReferences'] = @operation_references.to_h unless @operation_references.nil?
  hash
end