Class: VisaAcceptanceMergedSpec::CaptureOptions

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/capture_options.rb

Overview

CaptureOptions Model.

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(capture_sequence_number: SKIP, total_capture_count: SKIP, date_to_capture: SKIP, is_final: SKIP, notes: SKIP, reconciliation_id: SKIP, reconciliation_id_alternate: SKIP, additional_properties: nil) ⇒ CaptureOptions

Returns a new instance of CaptureOptions.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 95

def initialize(capture_sequence_number: SKIP, total_capture_count: SKIP,
               date_to_capture: SKIP, is_final: SKIP, notes: SKIP,
               reconciliation_id: SKIP, reconciliation_id_alternate: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @capture_sequence_number = capture_sequence_number unless capture_sequence_number == SKIP
  @total_capture_count = total_capture_count unless total_capture_count == SKIP
  @date_to_capture = date_to_capture unless date_to_capture == SKIP
  @is_final = is_final unless is_final == SKIP
  @notes = notes unless notes == SKIP
  @reconciliation_id = reconciliation_id unless reconciliation_id == SKIP
  unless reconciliation_id_alternate == SKIP
    @reconciliation_id_alternate =
      reconciliation_id_alternate
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#capture_sequence_numberInteger

Capture number when requesting multiple partial captures for one authorization. Used along with totalCaptureCount to track which capture is being processed. For example, the second of five captures would be passed to Visa Acceptance as:

- `captureSequenceNumber_ = 2`, and
- `totalCaptureCount = 5`

Returns:

  • (Integer)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 21

def capture_sequence_number
  @capture_sequence_number
end

#date_to_captureString

Date on which you want the capture to occur. This field is supported only for Visa Acceptance through VisaNet. Format: MMDD

Used by

Authorization Optional field.

Returns:

  • (String)


41
42
43
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 41

def date_to_capture
  @date_to_capture
end

#is_finalString

Indicates whether to release the authorization hold on the remaining funds.
Possible Values:

  • true
  • false

Returns:

  • (String)


49
50
51
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 49

def is_final
  @is_final
end

#notesString

An informational note about this settlement. Appears in both the payer's transaction history and the emails that the payer receives.

Returns:

  • (String)


54
55
56
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 54

def notes
  @notes
end

#reconciliation_idString

Used for authbill request when capture field equals true

Returns:

  • (String)


58
59
60
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 58

def reconciliation_id
  @reconciliation_id
end

#reconciliation_id_alternateString

Used by Nike merchant to send 12 digit order number

Returns:

  • (String)


62
63
64
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 62

def reconciliation_id_alternate
  @reconciliation_id_alternate
end

#total_capture_countInteger

Total number of captures when requesting multiple partial captures for one payment. Used along with captureSequenceNumber field to track which capture is being processed. For example, the second of five captures would be passed to Visa Acceptance as:

- `captureSequenceNumber = 2`, and
- `totalCaptureCount = 5`

Returns:

  • (Integer)


32
33
34
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 32

def total_capture_count
  @total_capture_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 116

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  capture_sequence_number =
    hash.key?('captureSequenceNumber') ? hash['captureSequenceNumber'] : SKIP
  total_capture_count =
    hash.key?('totalCaptureCount') ? hash['totalCaptureCount'] : SKIP
  date_to_capture =
    hash.key?('dateToCapture') ? hash['dateToCapture'] : SKIP
  is_final = hash.key?('isFinal') ? hash['isFinal'] : SKIP
  notes = hash.key?('notes') ? hash['notes'] : SKIP
  reconciliation_id =
    hash.key?('reconciliationId') ? hash['reconciliationId'] : SKIP
  reconciliation_id_alternate =
    hash.key?('reconciliationIdAlternate') ? hash['reconciliationIdAlternate'] : 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.
  CaptureOptions.new(capture_sequence_number: capture_sequence_number,
                     total_capture_count: total_capture_count,
                     date_to_capture: date_to_capture,
                     is_final: is_final,
                     notes: notes,
                     reconciliation_id: reconciliation_id,
                     reconciliation_id_alternate: reconciliation_id_alternate,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['capture_sequence_number'] = 'captureSequenceNumber'
  @_hash['total_capture_count'] = 'totalCaptureCount'
  @_hash['date_to_capture'] = 'dateToCapture'
  @_hash['is_final'] = 'isFinal'
  @_hash['notes'] = 'notes'
  @_hash['reconciliation_id'] = 'reconciliationId'
  @_hash['reconciliation_id_alternate'] = 'reconciliationIdAlternate'
  @_hash
end

.nullablesObject

An array for nullable fields



91
92
93
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 91

def self.nullables
  []
end

.optionalsObject

An array for optional fields



78
79
80
81
82
83
84
85
86
87
88
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 78

def self.optionals
  %w[
    capture_sequence_number
    total_capture_count
    date_to_capture
    is_final
    notes
    reconciliation_id
    reconciliation_id_alternate
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



161
162
163
164
165
166
167
168
169
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 161

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} capture_sequence_number: #{@capture_sequence_number.inspect},"\
  " total_capture_count: #{@total_capture_count.inspect}, date_to_capture:"\
  " #{@date_to_capture.inspect}, is_final: #{@is_final.inspect}, notes: #{@notes.inspect},"\
  " reconciliation_id: #{@reconciliation_id.inspect}, reconciliation_id_alternate:"\
  " #{@reconciliation_id_alternate.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



152
153
154
155
156
157
158
# File 'lib/visa_acceptance_merged_spec/models/capture_options.rb', line 152

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} capture_sequence_number: #{@capture_sequence_number}, total_capture_count:"\
  " #{@total_capture_count}, date_to_capture: #{@date_to_capture}, is_final: #{@is_final},"\
  " notes: #{@notes}, reconciliation_id: #{@reconciliation_id}, reconciliation_id_alternate:"\
  " #{@reconciliation_id_alternate}, additional_properties: #{@additional_properties}>"
end