Class: ThePlaidApi::PaymentOptions

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/payment_options.rb

Overview

Additional payment options

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(request_refund_details: SKIP, iban: SKIP, bacs: SKIP, scheme: SKIP, additional_properties: nil) ⇒ PaymentOptions

Returns a new instance of PaymentOptions.



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/payment_options.rb', line 77

def initialize(request_refund_details: SKIP, iban: SKIP, bacs: SKIP,
               scheme: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @request_refund_details = request_refund_details unless request_refund_details == SKIP
  @iban = iban unless iban == SKIP
  @bacs = bacs unless bacs == SKIP
  @scheme = scheme unless scheme == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bacsPaymentInitiationOptionalRestrictionBacs

An optional object used to restrict the accounts used for payments. If provided, the end user will be able to send payments only from the specified bank account.



29
30
31
# File 'lib/the_plaid_api/models/payment_options.rb', line 29

def bacs
  @bacs
end

#ibanString

The International Bank Account Number (IBAN) for the payer’s account. Where possible, the end user will be able to send payments only from the specified bank account if provided.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/payment_options.rb', line 23

def iban
  @iban
end

#request_refund_detailsTrueClass | FalseClass

When ‘true`, Plaid will attempt to request refund details from the payee’s financial institution. Support varies between financial institutions and will not always be available. If refund details could be retrieved, they will be available in the ‘/payment_initiation/payment/get` response.

Returns:

  • (TrueClass | FalseClass)


17
18
19
# File 'lib/the_plaid_api/models/payment_options.rb', line 17

def request_refund_details
  @request_refund_details
end

#schemePaymentScheme

Payment scheme. If not specified - the default in the region will be used (e.g. ‘SEPA_CREDIT_TRANSFER` for EU). In responses, if the scheme is not explicitly specified in the request, this value will be `null`. Using unsupported values will result in a failed payment. `LOCAL_DEFAULT`: The default payment scheme for the selected market and currency will be used. `LOCAL_INSTANT`: The instant payment scheme for the selected market and currency will be used (if applicable). Fees may be applied by the institution. `SEPA_CREDIT_TRANSFER`: The standard payment to a beneficiary within the SEPA area. `SEPA_CREDIT_TRANSFER_INSTANT`: Instant payment within the SEPA area. May involve additional fees and may not be available at some banks.

Returns:



45
46
47
# File 'lib/the_plaid_api/models/payment_options.rb', line 45

def scheme
  @scheme
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/the_plaid_api/models/payment_options.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_refund_details =
    hash.key?('request_refund_details') ? hash['request_refund_details'] : SKIP
  iban = hash.key?('iban') ? hash['iban'] : SKIP
  bacs = PaymentInitiationOptionalRestrictionBacs.from_hash(hash['bacs']) if hash['bacs']
  scheme = hash.key?('scheme') ? hash['scheme'] : 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.
  PaymentOptions.new(request_refund_details: request_refund_details,
                     iban: iban,
                     bacs: bacs,
                     scheme: scheme,
                     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/the_plaid_api/models/payment_options.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_refund_details'] = 'request_refund_details'
  @_hash['iban'] = 'iban'
  @_hash['bacs'] = 'bacs'
  @_hash['scheme'] = 'scheme'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/payment_options.rb', line 68

def self.nullables
  %w[
    request_refund_details
    iban
    bacs
    scheme
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    request_refund_details
    iban
    bacs
    scheme
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_refund_details: #{@request_refund_details.inspect}, iban:"\
  " #{@iban.inspect}, bacs: #{@bacs.inspect}, scheme: #{@scheme.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
# File 'lib/the_plaid_api/models/payment_options.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_refund_details: #{@request_refund_details}, iban: #{@iban}, bacs:"\
  " #{@bacs}, scheme: #{@scheme}, additional_properties: #{@additional_properties}>"
end