Class: Plaid::PaymentOptions

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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, emi_account_id: SKIP, additional_properties: nil) ⇒ PaymentOptions

Returns a new instance of PaymentOptions.



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/plaid/models/payment_options.rb', line 67

def initialize(request_refund_details: SKIP, iban: SKIP, bacs: SKIP,
               emi_account_id: 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
  @emi_account_id =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#bacsPaymentInitiationOptionalRestrictionBacs

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



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

def bacs
  @bacs
end

#emi_account_idString

The EMI (E-Money Institution) account that this payment is associated with, if any. This EMI account is used as an intermediary account to enable Plaid to reconcile the settlement of funds for Payment Initiation requests.

Returns:

  • (String)


36
37
38
# File 'lib/plaid/models/payment_options.rb', line 36

def 
  @emi_account_id
end

#ibanString

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

Returns:

  • (String)


23
24
25
# File 'lib/plaid/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/plaid/models/payment_options.rb', line 17

def request_refund_details
  @request_refund_details
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/plaid/models/payment_options.rb', line 80

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']
   =
    hash.key?('emi_account_id') ? hash['emi_account_id'] : 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,
                     emi_account_id: ,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
# File 'lib/plaid/models/payment_options.rb', line 39

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    request_refund_details
    iban
    emi_account_id
  ]
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
# File 'lib/plaid/models/payment_options.rb', line 49

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/plaid/models/payment_options.rb', line 107

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