Class: ApiReference::PaymentConfigurationItem

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/payment_configuration_item.rb

Overview

PaymentConfigurationItem 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(excluded_payment_method_types:, default_shared_payment_token: SKIP, additional_properties: nil) ⇒ PaymentConfigurationItem

Returns a new instance of PaymentConfigurationItem.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/api_reference/models/payment_configuration_item.rb', line 55

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

  @provider_type = 'stripe'
  unless excluded_payment_method_types == SKIP
    @excluded_payment_method_types =
      excluded_payment_method_types
  end
  unless default_shared_payment_token == SKIP
    @default_shared_payment_token =
      default_shared_payment_token
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#default_shared_payment_tokenString

The ID of a shared payment token granted by an agent to use as the default payment instrument for this customer. When set, auto-collection will use this token instead of the customer's default payment method.

Returns:

  • (String)


28
29
30
# File 'lib/api_reference/models/payment_configuration_item.rb', line 28

def default_shared_payment_token
  @default_shared_payment_token
end

#excluded_payment_method_typesArray[String]

List of Stripe payment method types to exclude for this customer. Excluded payment methods will not be available for the customer to select during payment, and will not be used for auto-collection. If a customer's default payment method becomes excluded, Orb will attempt to use the next available compatible payment method for auto-collection.

Returns:

  • (Array[String])


22
23
24
# File 'lib/api_reference/models/payment_configuration_item.rb', line 22

def excluded_payment_method_types
  @excluded_payment_method_types
end

#provider_typeString (readonly)

The payment provider to configure.

Returns:

  • (String)


14
15
16
# File 'lib/api_reference/models/payment_configuration_item.rb', line 14

def provider_type
  @provider_type
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
# File 'lib/api_reference/models/payment_configuration_item.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  excluded_payment_method_types = hash['excluded_payment_method_types'] ||= 
  default_shared_payment_token =
    hash.key?('default_shared_payment_token') ? hash['default_shared_payment_token'] : 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.
  PaymentConfigurationItem.new(excluded_payment_method_types: excluded_payment_method_types,
                               default_shared_payment_token: default_shared_payment_token,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/api_reference/models/payment_configuration_item.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['provider_type'] = 'provider_type'
  @_hash['excluded_payment_method_types'] =
    'excluded_payment_method_types'
  @_hash['default_shared_payment_token'] = 'default_shared_payment_token'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
52
53
# File 'lib/api_reference/models/payment_configuration_item.rb', line 49

def self.nullables
  %w[
    default_shared_payment_token
  ]
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
# File 'lib/api_reference/models/payment_configuration_item.rb', line 41

def self.optionals
  %w[
    excluded_payment_method_types
    default_shared_payment_token
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



97
98
99
100
101
102
103
104
105
106
107
# File 'lib/api_reference/models/payment_configuration_item.rb', line 97

def self.validate(value)
  if value.instance_of? self
    return APIHelper.valid_type?(value.provider_type,
                                 ->(val) { val.instance_of? String })
  end

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['provider_type'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



118
119
120
121
122
123
124
# File 'lib/api_reference/models/payment_configuration_item.rb', line 118

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

#to_sObject

Provides a human-readable string representation of the object.



110
111
112
113
114
115
# File 'lib/api_reference/models/payment_configuration_item.rb', line 110

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