Class: VisaAcceptanceMergedSpec::Capture1

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

Overview

Capture1 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(status: SKIP, reason: SKIP, message: SKIP, additional_properties: nil) ⇒ Capture1

Returns a new instance of Capture1.



62
63
64
65
66
67
68
69
70
71
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 62

def initialize(status: SKIP, reason: SKIP, message: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @status = status unless status == SKIP
  @reason = reason unless reason == SKIP
  @message = message unless message == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#messageString

The detail message related to the status and reason listed above.

Returns:

  • (String)


37
38
39
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 37

def message
  @message
end

#reasonString

The reason of the status. Possible values:

  • MISSING_FIELD
  • INVALID_DATA
  • DUPLICATE_REQUEST
  • INVALID_MERCHANT_CONFIGURATION
  • EXCEEDS_AUTH_AMOUNT
  • AUTH_ALREADY_REVERSED
  • TRANSACTION_ALREADY_SETTLED
  • INVALID_AMOUNT
  • MISSING_AUTH
  • TRANSACTION_ALREADY_REVERSED_OR_SETTLED
  • NOT_SUPPORTED

Returns:

  • (String)


33
34
35
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 33

def reason
  @reason
end

#statusString

The status of the submitted transaction. Possible values:

  • PENDING
  • TRANSMITTED (Only for Online Capture enabled merchants)

Returns:

  • (String)


17
18
19
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 17

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : SKIP
  reason = hash.key?('reason') ? hash['reason'] : SKIP
  message = hash.key?('message') ? hash['message'] : 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.
  Capture1.new(status: status,
               reason: reason,
               message: message,
               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['reason'] = 'reason'
  @_hash['message'] = 'message'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 49

def self.optionals
  %w[
    status
    reason
    message
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, reason: #{@reason.inspect}, message:"\
  " #{@message.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



97
98
99
100
101
# File 'lib/visa_acceptance_merged_spec/models/capture1.rb', line 97

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, reason: #{@reason}, message: #{@message},"\
  " additional_properties: #{@additional_properties}>"
end