Class: AdvancedBilling::BankAccountAttributes

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/bank_account_attributes.rb

Overview

BankAccountAttributes 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(chargify_token: SKIP, bank_name: SKIP, bank_routing_number: SKIP, bank_account_number: SKIP, bank_account_type: SKIP, bank_branch_code: SKIP, bank_iban: SKIP, bank_account_holder_type: SKIP, payment_type: SKIP, current_vault: SKIP, vault_token: SKIP, customer_vault_token: SKIP, additional_properties: {}) ⇒ BankAccountAttributes

Returns a new instance of BankAccountAttributes.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 111

def initialize(chargify_token: SKIP, bank_name: SKIP,
               bank_routing_number: SKIP, bank_account_number: SKIP,
               bank_account_type: SKIP, bank_branch_code: SKIP,
               bank_iban: SKIP, bank_account_holder_type: SKIP,
               payment_type: SKIP, current_vault: SKIP, vault_token: SKIP,
               customer_vault_token: SKIP, additional_properties: {})
  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end

  @chargify_token = chargify_token unless chargify_token == SKIP
  @bank_name = bank_name unless bank_name == SKIP
  @bank_routing_number = bank_routing_number unless bank_routing_number == SKIP
  @bank_account_number =  unless  == SKIP
  @bank_account_type =  unless  == SKIP
  @bank_branch_code = bank_branch_code unless bank_branch_code == SKIP
  @bank_iban = bank_iban unless bank_iban == SKIP
  @bank_account_holder_type =  unless  == SKIP
  @payment_type = payment_type unless payment_type == SKIP
  @current_vault = current_vault unless current_vault == SKIP
  @vault_token = vault_token unless vault_token == SKIP
  @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP
end

Instance Attribute Details

#bank_account_holder_typeBankAccountHolderType

Defaults to personal



49
50
51
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 49

def 
  @bank_account_holder_type
end

#bank_account_numberString

(Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number

Returns:

  • (String)


31
32
33
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 31

def 
  @bank_account_number
end

#bank_account_typeBankAccountType

Defaults to checking

Returns:



35
36
37
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 35

def 
  @bank_account_type
end

#bank_branch_codeString

(Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided

Returns:

  • (String)


40
41
42
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 40

def bank_branch_code
  @bank_branch_code
end

#bank_ibanString

(Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided

Returns:

  • (String)


45
46
47
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 45

def bank_iban
  @bank_iban
end

#bank_nameString

(Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides

Returns:

  • (String)


19
20
21
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 19

def bank_name
  @bank_name
end

#bank_routing_numberString

(Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API

Returns:

  • (String)


25
26
27
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 25

def bank_routing_number
  @bank_routing_number
end

#chargify_tokenString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 14

def chargify_token
  @chargify_token
end

#current_vaultBankAccountVault

The vault that stores the payment profile with the provided vault_token. Use ‘bogus` for testing.

Returns:



58
59
60
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 58

def current_vault
  @current_vault
end

#customer_vault_tokenString

(only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token

Returns:

  • (String)


68
69
70
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 68

def customer_vault_token
  @customer_vault_token
end

#payment_typePaymentType

Defaults to personal

Returns:



53
54
55
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 53

def payment_type
  @payment_type
end

#vault_tokenString

The vault that stores the payment profile with the provided vault_token. Use ‘bogus` for testing.

Returns:

  • (String)


63
64
65
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 63

def vault_token
  @vault_token
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 137

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  chargify_token =
    hash.key?('chargify_token') ? hash['chargify_token'] : SKIP
  bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP
  bank_routing_number =
    hash.key?('bank_routing_number') ? hash['bank_routing_number'] : SKIP
   =
    hash.key?('bank_account_number') ? hash['bank_account_number'] : SKIP
   =
    hash.key?('bank_account_type') ? hash['bank_account_type'] : SKIP
  bank_branch_code =
    hash.key?('bank_branch_code') ? hash['bank_branch_code'] : SKIP
  bank_iban = hash.key?('bank_iban') ? hash['bank_iban'] : SKIP
   =
    hash.key?('bank_account_holder_type') ? hash['bank_account_holder_type'] : SKIP
  payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP
  current_vault = hash.key?('current_vault') ? hash['current_vault'] : SKIP
  vault_token = hash.key?('vault_token') ? hash['vault_token'] : SKIP
  customer_vault_token =
    hash.key?('customer_vault_token') ? hash['customer_vault_token'] : SKIP

  # Clean out expected properties from Hash.
  additional_properties = hash.reject { |k, _| names.value?(k) }

  # Create object from extracted values.
  BankAccountAttributes.new(chargify_token: chargify_token,
                            bank_name: bank_name,
                            bank_routing_number: bank_routing_number,
                            bank_account_number: ,
                            bank_account_type: ,
                            bank_branch_code: bank_branch_code,
                            bank_iban: bank_iban,
                            bank_account_holder_type: ,
                            payment_type: payment_type,
                            current_vault: current_vault,
                            vault_token: vault_token,
                            customer_vault_token: customer_vault_token,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 71

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['chargify_token'] = 'chargify_token'
  @_hash['bank_name'] = 'bank_name'
  @_hash['bank_routing_number'] = 'bank_routing_number'
  @_hash['bank_account_number'] = 'bank_account_number'
  @_hash['bank_account_type'] = 'bank_account_type'
  @_hash['bank_branch_code'] = 'bank_branch_code'
  @_hash['bank_iban'] = 'bank_iban'
  @_hash['bank_account_holder_type'] = 'bank_account_holder_type'
  @_hash['payment_type'] = 'payment_type'
  @_hash['current_vault'] = 'current_vault'
  @_hash['vault_token'] = 'vault_token'
  @_hash['customer_vault_token'] = 'customer_vault_token'
  @_hash
end

.nullablesObject

An array for nullable fields



107
108
109
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 107

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 89

def self.optionals
  %w[
    chargify_token
    bank_name
    bank_routing_number
    bank_account_number
    bank_account_type
    bank_branch_code
    bank_iban
    bank_account_holder_type
    payment_type
    current_vault
    vault_token
    customer_vault_token
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



182
183
184
185
186
187
188
# File 'lib/advanced_billing/models/bank_account_attributes.rb', line 182

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end