Class: Plaid::PaymentInitiationMetadata

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/payment_initiation_metadata.rb

Overview

Metadata that captures what specific payment configurations an institution supports when making Payment Initiation requests.

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(supports_international_payments:, maximum_payment_amount:, supports_refund_details:, standing_order_metadata:, additional_properties: nil) ⇒ PaymentInitiationMetadata

Returns a new instance of PaymentInitiationMetadata.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 55

def initialize(supports_international_payments:, maximum_payment_amount:,
               supports_refund_details:, standing_order_metadata:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @supports_international_payments = supports_international_payments
  @maximum_payment_amount = maximum_payment_amount
  @supports_refund_details = supports_refund_details
  @standing_order_metadata = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#maximum_payment_amountHash[String, String]

A mapping of currency to maximum payment amount (denominated in the smallest unit of currency) supported by the insitution. Example: ‘“10000”`

Returns:

  • (Hash[String, String])


22
23
24
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 22

def maximum_payment_amount
  @maximum_payment_amount
end

#standing_order_metadataPaymentInitiationStandingOrderMetadata

Metadata specifically related to valid Payment Initiation standing order configurations for the institution.



32
33
34
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 32

def 
  @standing_order_metadata
end

#supports_international_paymentsTrueClass | FalseClass

Indicates whether the institution supports payments from a different country.

Returns:

  • (TrueClass | FalseClass)


16
17
18
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 16

def supports_international_payments
  @supports_international_payments
end

#supports_refund_detailsTrueClass | FalseClass

Indicates whether the institution supports returning refund details when initiating a payment.

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 27

def supports_refund_details
  @supports_refund_details
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 69

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  supports_international_payments =
    hash.key?('supports_international_payments') ? hash['supports_international_payments'] : nil
  maximum_payment_amount =
    hash.key?('maximum_payment_amount') ? hash['maximum_payment_amount'] : nil
  supports_refund_details =
    hash.key?('supports_refund_details') ? hash['supports_refund_details'] : nil
  if hash['standing_order_metadata']
     = PaymentInitiationStandingOrderMetadata.from_hash(hash['standing_order_metadata'])
  end

  # 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.
  PaymentInitiationMetadata.new(supports_international_payments: supports_international_payments,
                                maximum_payment_amount: maximum_payment_amount,
                                supports_refund_details: supports_refund_details,
                                standing_order_metadata: ,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['supports_international_payments'] =
    'supports_international_payments'
  @_hash['maximum_payment_amount'] = 'maximum_payment_amount'
  @_hash['supports_refund_details'] = 'supports_refund_details'
  @_hash['standing_order_metadata'] = 'standing_order_metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 46

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
114
115
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 108

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

#to_sObject

Provides a human-readable string representation of the object.



99
100
101
102
103
104
105
# File 'lib/plaid/models/payment_initiation_metadata.rb', line 99

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