Class: VisaAcceptanceMergedSpec::SellerProtection

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

Overview

SellerProtection 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(type: SKIP, eligibility: SKIP, dispute_categories: SKIP, eligibility_type: SKIP, additional_properties: nil) ⇒ SellerProtection

Returns a new instance of SellerProtection.



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

def initialize(type: SKIP, eligibility: SKIP, dispute_categories: SKIP,
               eligibility_type: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @eligibility = eligibility unless eligibility == SKIP
  @dispute_categories = dispute_categories unless dispute_categories == SKIP
  @eligibility_type = eligibility_type unless eligibility_type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#dispute_categoriesArray[String]

An array of conditions that are covered for the transaction.

Returns:

  • (Array[String])


36
37
38
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 36

def dispute_categories
  @dispute_categories
end

#eligibilityString

Indicates whether the transaction is eligible for seller protection. The values returned are described below. Possible values:

  • ELIGIBLE
  • PARTIALLY_ELIGIBLE
  • INELIGIBLE
  • NOT_ELIGIBLE

Returns:

  • (String)


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

def eligibility
  @eligibility
end

#eligibility_typeString

The kind of seller protection in force for the transaction. This field is returned only when the protection_eligibility property is set to ELIGIBLE or PARTIALLY_ELIGIBLE. Possible values:

  • ITEM_NOT_RECEIVED_ELIGIBLE: Sellers are protected against claims for items not received.
  • UNAUTHORIZED_PAYMENT_ELIGIBLE: Sellers are protected against claims for unauthorized payments. One or both values can be returned.

Returns:

  • (String)


48
49
50
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 48

def eligibility_type
  @eligibility_type
end

#typeString

The kind of seller protection in force for the transaction. This field is returned only when the protection eligibility value is set to ELIGIBLE or PARTIALLY_ELIGIBLE. Possible values

  • ITEM_NOT_RECEIVED_ELIGIBLE: Sellers are protected against claims for items not received.
  • UNAUTHORIZED_PAYMENT_ELIGIBLE: Sellers are protected against claims for unauthorized payments. One or both values can be returned.

Returns:

  • (String)


22
23
24
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 22

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 88

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  eligibility = hash.key?('eligibility') ? hash['eligibility'] : SKIP
  dispute_categories =
    hash.key?('disputeCategories') ? hash['disputeCategories'] : SKIP
  eligibility_type =
    hash.key?('eligibilityType') ? hash['eligibilityType'] : 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.
  SellerProtection.new(type: type,
                       eligibility: eligibility,
                       dispute_categories: dispute_categories,
                       eligibility_type: eligibility_type,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['eligibility'] = 'eligibility'
  @_hash['dispute_categories'] = 'disputeCategories'
  @_hash['eligibility_type'] = 'eligibilityType'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 71

def self.nullables
  []
end

.optionalsObject

An array for optional fields



61
62
63
64
65
66
67
68
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 61

def self.optionals
  %w[
    type
    eligibility
    dispute_categories
    eligibility_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 123

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

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
120
# File 'lib/visa_acceptance_merged_spec/models/seller_protection.rb', line 115

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