Class: CyberSourceMergedSpec::InvoiceInformation4

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/invoice_information4.rb

Overview

Contains the updatable invoice information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(description:, due_date:, expiration_date: SKIP, send_immediately: false, allow_partial_payments: false, delivery_mode: SKIP, additional_properties: nil) ⇒ InvoiceInformation4

Returns a new instance of InvoiceInformation4.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 70

def initialize(description:, due_date:, expiration_date: SKIP,
               send_immediately: false, allow_partial_payments: false,
               delivery_mode: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @description = description
  @due_date = due_date
  @expiration_date = expiration_date unless expiration_date == SKIP
  @send_immediately = send_immediately unless send_immediately == SKIP
  @allow_partial_payments = allow_partial_payments unless allow_partial_payments == SKIP
  @delivery_mode = delivery_mode unless delivery_mode == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#allow_partial_paymentsTrueClass | FalseClass

If set to true, the payer can make a partial invoice payment.

Returns:

  • (TrueClass | FalseClass)


33
34
35
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 33

def allow_partial_payments
  @allow_partial_payments
end

#delivery_modeString

If this field is set to 'None', an invoice will be generated with the status 'CREATED', but no email will be dispatched.
Possible values:

  • None
  • Email

Returns:

  • (String)


41
42
43
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 41

def delivery_mode
  @delivery_mode
end

#descriptionString

The description included in the invoice.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 14

def description
  @description
end

#due_dateDate

The invoice due date. This field is required for creating an invoice. Format: YYYY-MM-DD, where YYYY = year, MM = month, and DD = day

Returns:

  • (Date)


19
20
21
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 19

def due_date
  @due_date
end

#expiration_dateDate

Define an expiration date for the link. Format: YYYY-MM-DD, where YYYY = year, MM = month, and DD = day

Returns:

  • (Date)


24
25
26
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 24

def expiration_date
  @expiration_date
end

#send_immediatelyTrueClass | FalseClass

If set to true, we send the invoice immediately. If set to false, the invoice remains in draft mode.

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 29

def send_immediately
  @send_immediately
end

Class Method Details

.from_element(root) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 115

def self.from_element(root)
  description = XmlUtilities.from_element(root, 'description', String)
  due_date = XmlUtilities.from_element(root, 'dueDate', String)
  expiration_date = XmlUtilities.from_element(root, 'expirationDate',
                                              String)
  send_immediately = XmlUtilities.from_element(root, 'sendImmediately',
                                               TrueClass)
  allow_partial_payments = XmlUtilities.from_element(root,
                                                     'allowPartialPayments',
                                                     TrueClass)
  delivery_mode = XmlUtilities.from_element(root, 'deliveryMode', String)

  new(description: description,
      due_date: due_date,
      expiration_date: expiration_date,
      send_immediately: send_immediately,
      allow_partial_payments: allow_partial_payments,
      delivery_mode: delivery_mode,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  description = hash.key?('description') ? hash['description'] : nil
  due_date = hash.key?('dueDate') ? hash['dueDate'] : nil
  expiration_date =
    hash.key?('expirationDate') ? hash['expirationDate'] : SKIP
  send_immediately = hash['sendImmediately'] ||= false
  allow_partial_payments = hash['allowPartialPayments'] ||= false
  delivery_mode = hash.key?('deliveryMode') ? hash['deliveryMode'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  InvoiceInformation4.new(description: description,
                          due_date: due_date,
                          expiration_date: expiration_date,
                          send_immediately: send_immediately,
                          allow_partial_payments: allow_partial_payments,
                          delivery_mode: delivery_mode,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['due_date'] = 'dueDate'
  @_hash['expiration_date'] = 'expirationDate'
  @_hash['send_immediately'] = 'sendImmediately'
  @_hash['allow_partial_payments'] = 'allowPartialPayments'
  @_hash['delivery_mode'] = 'deliveryMode'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 56

def self.optionals
  %w[
    expiration_date
    send_immediately
    allow_partial_payments
    delivery_mode
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



164
165
166
167
168
169
170
171
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 164

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description.inspect}, due_date: #{@due_date.inspect},"\
  " expiration_date: #{@expiration_date.inspect}, send_immediately:"\
  " #{@send_immediately.inspect}, allow_partial_payments: #{@allow_partial_payments.inspect},"\
  " delivery_mode: #{@delivery_mode.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



155
156
157
158
159
160
161
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 155

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} description: #{@description}, due_date: #{@due_date}, expiration_date:"\
  " #{@expiration_date}, send_immediately: #{@send_immediately}, allow_partial_payments:"\
  " #{@allow_partial_payments}, delivery_mode: #{@delivery_mode}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/cyber_source_merged_spec/models/invoice_information4.rb', line 136

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'description', description)
  XmlUtilities.add_as_subelement(doc, root, 'dueDate', due_date)
  XmlUtilities.add_as_subelement(doc, root, 'expirationDate',
                                 expiration_date)
  XmlUtilities.add_as_subelement(doc, root, 'sendImmediately',
                                 send_immediately)
  XmlUtilities.add_as_subelement(doc, root, 'allowPartialPayments',
                                 allow_partial_payments)
  XmlUtilities.add_as_subelement(doc, root, 'deliveryMode', delivery_mode)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end