Class: VisaAcceptanceMergedSpec::PurchaseOptions

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

Overview

PurchaseOptions 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(is_electronic_benefits_transfer: SKIP, type: SKIP, eligibility_indicator: SKIP, benefit_amount: SKIP, benefit_type: SKIP, additional_properties: nil) ⇒ PurchaseOptions

Returns a new instance of PurchaseOptions.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 91

def initialize(is_electronic_benefits_transfer: SKIP, type: SKIP,
               eligibility_indicator: SKIP, benefit_amount: SKIP,
               benefit_type: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  unless is_electronic_benefits_transfer == SKIP
    @is_electronic_benefits_transfer =
      is_electronic_benefits_transfer
  end
  @type = type unless type == SKIP
  @eligibility_indicator = eligibility_indicator unless eligibility_indicator == SKIP
  @benefit_amount = benefit_amount unless benefit_amount == SKIP
  @benefit_type = benefit_type unless benefit_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#benefit_amountString

Workplace benefit amount.

Returns:

  • (String)


46
47
48
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 46

def benefit_amount
  @benefit_amount
end

#benefit_typeString

Workplace benefit type. Possible values:

  • 70 = employee benefit
  • 4T = transportation / transit
  • 52 = general benefit
  • 53 = meal voucher
  • 54 = fuel
  • 55 = ecological / sustainability
  • 58 = philanthropy / patronage / consumption
  • 59 = gift
  • 5S = sport / culture
  • 5T = book / education

Returns:

  • (String)


61
62
63
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 61

def benefit_type
  @benefit_type
end

#eligibility_indicatorString

This field contains installment data defined by MasterCard. Possible values:

- Y = eligible
- N = not eligile

Returns:

  • (String)


42
43
44
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 42

def eligibility_indicator
  @eligibility_indicator
end

#is_electronic_benefits_transferTrueClass | FalseClass

Flag that indicates whether this transaction is an EBT transaction. Possible values:

  • true
  • false

PIN debit

Required field for EBT and EBT voucher transactions that use PIN debit credit or PIN debit purchase; otherwise, not used.

Returns:

  • (TrueClass | FalseClass)


20
21
22
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 20

def is_electronic_benefits_transfer
  @is_electronic_benefits_transfer
end

#typeString

Flag that indicates an EBT voucher transaction. Possible value:

  • EBT_VOUCHER: Indicates the PIN debit transaction is an EBT voucher.
  • BUY
  • RENT
  • BOOK
  • SUBSCRIBE
  • DOWNLOAD
  • ORDER
  • CONTINUE

PIN debit

Required field for EBT voucher transactions that use PIN debit purchase; otherwise, not used.

Returns:

  • (String)


35
36
37
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 35

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 109

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  is_electronic_benefits_transfer =
    hash.key?('isElectronicBenefitsTransfer') ? hash['isElectronicBenefitsTransfer'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  eligibility_indicator =
    hash.key?('eligibilityIndicator') ? hash['eligibilityIndicator'] : SKIP
  benefit_amount = hash.key?('benefitAmount') ? hash['benefitAmount'] : SKIP
  benefit_type = hash.key?('benefitType') ? hash['benefitType'] : 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.
  PurchaseOptions.new(is_electronic_benefits_transfer: is_electronic_benefits_transfer,
                      type: type,
                      eligibility_indicator: eligibility_indicator,
                      benefit_amount: benefit_amount,
                      benefit_type: benefit_type,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['is_electronic_benefits_transfer'] =
    'isElectronicBenefitsTransfer'
  @_hash['type'] = 'type'
  @_hash['eligibility_indicator'] = 'eligibilityIndicator'
  @_hash['benefit_amount'] = 'benefitAmount'
  @_hash['benefit_type'] = 'benefitType'
  @_hash
end

.nullablesObject

An array for nullable fields



87
88
89
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 87

def self.nullables
  []
end

.optionalsObject

An array for optional fields



76
77
78
79
80
81
82
83
84
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 76

def self.optionals
  %w[
    is_electronic_benefits_transfer
    type
    eligibility_indicator
    benefit_amount
    benefit_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



147
148
149
150
151
152
153
154
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 147

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} is_electronic_benefits_transfer:"\
  " #{@is_electronic_benefits_transfer.inspect}, type: #{@type.inspect},"\
  " eligibility_indicator: #{@eligibility_indicator.inspect}, benefit_amount:"\
  " #{@benefit_amount.inspect}, benefit_type: #{@benefit_type.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



138
139
140
141
142
143
144
# File 'lib/visa_acceptance_merged_spec/models/purchase_options.rb', line 138

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} is_electronic_benefits_transfer: #{@is_electronic_benefits_transfer}, type:"\
  " #{@type}, eligibility_indicator: #{@eligibility_indicator}, benefit_amount:"\
  " #{@benefit_amount}, benefit_type: #{@benefit_type}, additional_properties:"\
  " #{@additional_properties}>"
end