Class: CyberSourceMergedSpec::ProgramIndicators

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

Overview

Contains program-specific indicators for transaction processing.

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(quick_payment: SKIP, qr_initiated: SKIP, additional_properties: nil) ⇒ ProgramIndicators

Returns a new instance of ProgramIndicators.



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

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

  @quick_payment = quick_payment unless quick_payment == SKIP
  @qr_initiated = qr_initiated unless qr_initiated == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#qr_initiatedTrueClass | FalseClass

Indicator that the transaction was made via QR Payment. This field is supported for Mastercard QR e-commerce payment programs in Peru. Possible values:

  • true: Transaction was initiated via QR code
  • false: Transaction was not initiated via QR code Default: null

Returns:

  • (TrueClass | FalseClass)


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

def qr_initiated
  @qr_initiated
end

#quick_paymentTrueClass | FalseClass

Indicator for when a Quick Payment transaction. A Quick Payment Service (QPS) Transaction is a magnetic stripe-based or contact chip-based face-to-face Mastercard POS transaction that occurs at a Peruvian merchant in an eligible merchant category and for an amount equal or less to the CVM limit. This field is supported for Mastercard transactions in Peru. Possible values:

  • true: This is a Quick Payment Service transaction
  • false: This is not a Quick Payment Service transaction Default: null

Returns:

  • (TrueClass | FalseClass)


23
24
25
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 23

def quick_payment
  @quick_payment
end

Class Method Details

.from_element(root) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 87

def self.from_element(root)
  quick_payment = XmlUtilities.from_element(root, 'quickPayment', TrueClass)
  qr_initiated = XmlUtilities.from_element(root, 'qrInitiated', TrueClass)

  new(quick_payment: quick_payment,
      qr_initiated: qr_initiated,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  quick_payment = hash.key?('quickPayment') ? hash['quickPayment'] : SKIP
  qr_initiated = hash.key?('qrInitiated') ? hash['qrInitiated'] : 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.
  ProgramIndicators.new(quick_payment: quick_payment,
                        qr_initiated: qr_initiated,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['quick_payment'] = 'quickPayment'
  @_hash['qr_initiated'] = 'qrInitiated'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 52

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 44

def self.optionals
  %w[
    quick_payment
    qr_initiated
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 115

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

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 108

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

#to_xml_element(doc, root_name) ⇒ Object



96
97
98
99
100
101
102
103
104
105
# File 'lib/cyber_source_merged_spec/models/program_indicators.rb', line 96

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

  XmlUtilities.add_as_subelement(doc, root, 'quickPayment', quick_payment)
  XmlUtilities.add_as_subelement(doc, root, 'qrInitiated', qr_initiated)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end