Class: VisaAcceptanceMergedSpec::TokenizedPaymentMethod2

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

Overview

TokenizedPaymentMethod2 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(description: SKIP, usage_pattern: SKIP, usage_type: SKIP, allow_multiple_tokens: SKIP, additional_properties: nil) ⇒ TokenizedPaymentMethod2

Returns a new instance of TokenizedPaymentMethod2.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 72

def initialize(description: SKIP, usage_pattern: SKIP, usage_type: SKIP,
               allow_multiple_tokens: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @description = description unless description == SKIP
  @usage_pattern = usage_pattern unless usage_pattern == SKIP
  @usage_type = usage_type unless usage_type == SKIP
  @allow_multiple_tokens = allow_multiple_tokens unless allow_multiple_tokens == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#allow_multiple_tokensTrueClass | FalseClass

Create multiple payment tokens for the same payer, merchant/platform combination. This helps to identify customers distinctly even though they may share the same PayPal account.

Returns:

  • (TrueClass | FalseClass)


45
46
47
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 45

def allow_multiple_tokens
  @allow_multiple_tokens
end

#descriptionString

Description of the vaulted payment method shown to the buyer during checkout and in their PayPal account.

Returns:

  • (String)


15
16
17
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 15

def description
  @description
end

#usage_patternString

Indicates how the merchant will primarily use the vaulted payment method. Valid values:

  • “IMMEDIATE”: For on-demand, instant payments. These payments are variable in both amount and frequency and will be used to pay for goods or services before they are rendered to the buyer
  • “DEFERRED”: For post-pay payments; that is, payments for goods or services that have already been rendered to the buyer
  • “RECURRING_PREPAID”: For recurring payments before services are rendered.
  • “RECURRING_POSTPAID”: For recurring payments after services are rendered.
  • “THRESHOLD_PREPAID”: For payments when a pre-defined threshold is reached before services are rendered.
  • “THRESHOLD_POSTPAID”: For payments when a pre-defined threshold is reached after services are rendered.

Returns:

  • (String)


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

def usage_pattern
  @usage_pattern
end

#usage_typeString

Indicates the type of vaulting relationship. Valid values:

  • “MERCHANT”: Single merchant relationship.
  • “PLATFORM”: Platform hosting multiple merchants.

Returns:

  • (String)


39
40
41
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 39

def usage_type
  @usage_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  description = hash.key?('description') ? hash['description'] : SKIP
  usage_pattern = hash.key?('usagePattern') ? hash['usagePattern'] : SKIP
  usage_type = hash.key?('usageType') ? hash['usageType'] : SKIP
  allow_multiple_tokens =
    hash.key?('allowMultipleTokens') ? hash['allowMultipleTokens'] : 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.
  TokenizedPaymentMethod2.new(description: description,
                              usage_pattern: usage_pattern,
                              usage_type: usage_type,
                              allow_multiple_tokens: allow_multiple_tokens,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['description'] = 'description'
  @_hash['usage_pattern'] = 'usagePattern'
  @_hash['usage_type'] = 'usageType'
  @_hash['allow_multiple_tokens'] = 'allowMultipleTokens'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



58
59
60
61
62
63
64
65
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 58

def self.optionals
  %w[
    description
    usage_pattern
    usage_type
    allow_multiple_tokens
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



119
120
121
122
123
124
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 119

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

#to_sObject

Provides a human-readable string representation of the object.



111
112
113
114
115
116
# File 'lib/visa_acceptance_merged_spec/models/tokenized_payment_method2.rb', line 111

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