Class: AdvancedBilling::BankAccountPaymentProfile
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::BankAccountPaymentProfile
- Defined in:
- lib/advanced_billing/models/bank_account_payment_profile.rb
Overview
BankAccountPaymentProfile Model.
Instance Attribute Summary collapse
-
#bank_account_holder_type ⇒ BankAccountHolderType
Defaults to personal.
-
#bank_account_type ⇒ BankAccountType
Defaults to checking.
-
#bank_name ⇒ String
The bank where the account resides.
-
#billing_address ⇒ String
The current billing street address for the bank account.
-
#billing_address_2 ⇒ String
The current billing street address, second line, for the bank account.
-
#billing_city ⇒ String
The current billing address city for the bank account.
-
#billing_country ⇒ String
The current billing address country for the bank account.
-
#billing_state ⇒ String
The current billing address state for the bank account.
-
#billing_zip ⇒ String
The current billing address zip code for the bank account.
-
#created_at ⇒ DateTime
A timestamp indicating when this payment profile was created.
-
#current_vault ⇒ BankAccountVault
The vault that stores the payment profile with the provided vault_token.
-
#customer_id ⇒ Integer
The Chargify-assigned id for the customer record to which the bank account belongs.
-
#customer_vault_token ⇒ String
(only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
-
#first_name ⇒ String
The first name of the bank account holder.
-
#gateway_handle ⇒ String
denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account.
-
#id ⇒ Integer
The Chargify-assigned ID of the stored bank account.
-
#last_name ⇒ String
The last name of the bank account holder.
-
#masked_bank_account_number ⇒ String
A string representation of the stored bank account number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’).
-
#masked_bank_routing_number ⇒ String
A string representation of the stored bank routing number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’).
-
#payment_type ⇒ PaymentType
Defaults to personal.
-
#site_gateway_setting_id ⇒ Integer
denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account.
-
#updated_at ⇒ DateTime
A timestamp indicating when this payment profile was last updated.
-
#vault_token ⇒ String
The “token” provided by your vault storage for an already stored payment profile.
-
#verified ⇒ TrueClass | FalseClass
denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(masked_bank_account_number:, payment_type: PaymentType::BANK_ACCOUNT, id: SKIP, first_name: SKIP, last_name: SKIP, customer_id: SKIP, current_vault: SKIP, vault_token: SKIP, billing_address: SKIP, billing_city: SKIP, billing_state: SKIP, billing_zip: SKIP, billing_country: SKIP, customer_vault_token: SKIP, billing_address_2: SKIP, bank_name: SKIP, masked_bank_routing_number: SKIP, bank_account_type: SKIP, bank_account_holder_type: SKIP, verified: false, site_gateway_setting_id: SKIP, gateway_handle: SKIP, created_at: SKIP, updated_at: SKIP, additional_properties: {}) ⇒ BankAccountPaymentProfile
constructor
A new instance of BankAccountPaymentProfile.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #get_additional_properties, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(masked_bank_account_number:, payment_type: PaymentType::BANK_ACCOUNT, id: SKIP, first_name: SKIP, last_name: SKIP, customer_id: SKIP, current_vault: SKIP, vault_token: SKIP, billing_address: SKIP, billing_city: SKIP, billing_state: SKIP, billing_zip: SKIP, billing_country: SKIP, customer_vault_token: SKIP, billing_address_2: SKIP, bank_name: SKIP, masked_bank_routing_number: SKIP, bank_account_type: SKIP, bank_account_holder_type: SKIP, verified: false, site_gateway_setting_id: SKIP, gateway_handle: SKIP, created_at: SKIP, updated_at: SKIP, additional_properties: {}) ⇒ BankAccountPaymentProfile
Returns a new instance of BankAccountPaymentProfile.
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 194 def initialize(masked_bank_account_number:, payment_type: PaymentType::BANK_ACCOUNT, id: SKIP, first_name: SKIP, last_name: SKIP, customer_id: SKIP, current_vault: SKIP, vault_token: SKIP, billing_address: SKIP, billing_city: SKIP, billing_state: SKIP, billing_zip: SKIP, billing_country: SKIP, customer_vault_token: SKIP, billing_address_2: SKIP, bank_name: SKIP, masked_bank_routing_number: SKIP, bank_account_type: SKIP, bank_account_holder_type: SKIP, verified: false, site_gateway_setting_id: SKIP, gateway_handle: SKIP, created_at: SKIP, updated_at: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @id = id unless id == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @customer_id = customer_id unless customer_id == SKIP @current_vault = current_vault unless current_vault == SKIP @vault_token = vault_token unless vault_token == SKIP @billing_address = billing_address unless billing_address == SKIP @billing_city = billing_city unless billing_city == SKIP @billing_state = billing_state unless billing_state == SKIP @billing_zip = billing_zip unless billing_zip == SKIP @billing_country = billing_country unless billing_country == SKIP @customer_vault_token = customer_vault_token unless customer_vault_token == SKIP @billing_address_2 = billing_address_2 unless billing_address_2 == SKIP @bank_name = bank_name unless bank_name == SKIP unless masked_bank_routing_number == SKIP @masked_bank_routing_number = masked_bank_routing_number end @masked_bank_account_number = masked_bank_account_number @bank_account_type = bank_account_type unless bank_account_type == SKIP @bank_account_holder_type = bank_account_holder_type unless bank_account_holder_type == SKIP @payment_type = payment_type @verified = verified unless verified == SKIP @site_gateway_setting_id = site_gateway_setting_id unless site_gateway_setting_id == SKIP @gateway_handle = gateway_handle unless gateway_handle == SKIP @created_at = created_at unless created_at == SKIP @updated_at = updated_at unless updated_at == SKIP end |
Instance Attribute Details
#bank_account_holder_type ⇒ BankAccountHolderType
Defaults to personal
92 93 94 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 92 def bank_account_holder_type @bank_account_holder_type end |
#bank_account_type ⇒ BankAccountType
Defaults to checking
88 89 90 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 88 def bank_account_type @bank_account_type end |
#bank_name ⇒ String
The bank where the account resides
73 74 75 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 73 def bank_name @bank_name end |
#billing_address ⇒ String
The current billing street address for the bank account
44 45 46 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 44 def billing_address @billing_address end |
#billing_address_2 ⇒ String
The current billing street address, second line, for the bank account
69 70 71 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 69 def billing_address_2 @billing_address_2 end |
#billing_city ⇒ String
The current billing address city for the bank account
48 49 50 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 48 def billing_city @billing_city end |
#billing_country ⇒ String
The current billing address country for the bank account
60 61 62 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 60 def billing_country @billing_country end |
#billing_state ⇒ String
The current billing address state for the bank account
52 53 54 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 52 def billing_state @billing_state end |
#billing_zip ⇒ String
The current billing address zip code for the bank account
56 57 58 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 56 def billing_zip @billing_zip end |
#created_at ⇒ DateTime
A timestamp indicating when this payment profile was created
115 116 117 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 115 def created_at @created_at end |
#current_vault ⇒ BankAccountVault
The vault that stores the payment profile with the provided vault_token. Use ‘bogus` for testing.
35 36 37 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 35 def current_vault @current_vault end |
#customer_id ⇒ Integer
The Chargify-assigned id for the customer record to which the bank account belongs
30 31 32 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 30 def customer_id @customer_id end |
#customer_vault_token ⇒ String
(only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
65 66 67 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 65 def customer_vault_token @customer_vault_token end |
#first_name ⇒ String
The first name of the bank account holder
21 22 23 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 21 def first_name @first_name end |
#gateway_handle ⇒ String
denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
111 112 113 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 111 def gateway_handle @gateway_handle end |
#id ⇒ Integer
The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer
17 18 19 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 17 def id @id end |
#last_name ⇒ String
The last name of the bank account holder
25 26 27 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 25 def last_name @last_name end |
#masked_bank_account_number ⇒ String
A string representation of the stored bank account number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’)
84 85 86 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 84 def masked_bank_account_number @masked_bank_account_number end |
#masked_bank_routing_number ⇒ String
A string representation of the stored bank routing number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’). payment_type will be bank_account
79 80 81 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 79 def masked_bank_routing_number @masked_bank_routing_number end |
#payment_type ⇒ PaymentType
Defaults to personal
96 97 98 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 96 def payment_type @payment_type end |
#site_gateway_setting_id ⇒ Integer
denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
106 107 108 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 106 def site_gateway_setting_id @site_gateway_setting_id end |
#updated_at ⇒ DateTime
A timestamp indicating when this payment profile was last updated
119 120 121 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 119 def updated_at @updated_at end |
#vault_token ⇒ String
The “token” provided by your vault storage for an already stored payment profile
40 41 42 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 40 def vault_token @vault_token end |
#verified ⇒ TrueClass | FalseClass
denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
101 102 103 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 101 def verified @verified end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 242 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. masked_bank_account_number = hash.key?('masked_bank_account_number') ? hash['masked_bank_account_number'] : nil payment_type = hash['payment_type'] ||= PaymentType::BANK_ACCOUNT id = hash.key?('id') ? hash['id'] : SKIP first_name = hash.key?('first_name') ? hash['first_name'] : SKIP last_name = hash.key?('last_name') ? hash['last_name'] : SKIP customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP current_vault = hash.key?('current_vault') ? hash['current_vault'] : SKIP vault_token = hash.key?('vault_token') ? hash['vault_token'] : SKIP billing_address = hash.key?('billing_address') ? hash['billing_address'] : SKIP billing_city = hash.key?('billing_city') ? hash['billing_city'] : SKIP billing_state = hash.key?('billing_state') ? hash['billing_state'] : SKIP billing_zip = hash.key?('billing_zip') ? hash['billing_zip'] : SKIP billing_country = hash.key?('billing_country') ? hash['billing_country'] : SKIP customer_vault_token = hash.key?('customer_vault_token') ? hash['customer_vault_token'] : SKIP billing_address_2 = hash.key?('billing_address_2') ? hash['billing_address_2'] : SKIP bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP masked_bank_routing_number = hash.key?('masked_bank_routing_number') ? hash['masked_bank_routing_number'] : SKIP bank_account_type = hash.key?('bank_account_type') ? hash['bank_account_type'] : SKIP bank_account_holder_type = hash.key?('bank_account_holder_type') ? hash['bank_account_holder_type'] : SKIP verified = hash['verified'] ||= false site_gateway_setting_id = hash.key?('site_gateway_setting_id') ? hash['site_gateway_setting_id'] : SKIP gateway_handle = hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) else SKIP end updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) else SKIP end # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. BankAccountPaymentProfile.new(masked_bank_account_number: masked_bank_account_number, payment_type: payment_type, id: id, first_name: first_name, last_name: last_name, customer_id: customer_id, current_vault: current_vault, vault_token: vault_token, billing_address: billing_address, billing_city: billing_city, billing_state: billing_state, billing_zip: billing_zip, billing_country: billing_country, customer_vault_token: customer_vault_token, billing_address_2: billing_address_2, bank_name: bank_name, masked_bank_routing_number: masked_bank_routing_number, bank_account_type: bank_account_type, bank_account_holder_type: bank_account_holder_type, verified: verified, site_gateway_setting_id: site_gateway_setting_id, gateway_handle: gateway_handle, created_at: created_at, updated_at: updated_at, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 122 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['customer_id'] = 'customer_id' @_hash['current_vault'] = 'current_vault' @_hash['vault_token'] = 'vault_token' @_hash['billing_address'] = 'billing_address' @_hash['billing_city'] = 'billing_city' @_hash['billing_state'] = 'billing_state' @_hash['billing_zip'] = 'billing_zip' @_hash['billing_country'] = 'billing_country' @_hash['customer_vault_token'] = 'customer_vault_token' @_hash['billing_address_2'] = 'billing_address_2' @_hash['bank_name'] = 'bank_name' @_hash['masked_bank_routing_number'] = 'masked_bank_routing_number' @_hash['masked_bank_account_number'] = 'masked_bank_account_number' @_hash['bank_account_type'] = 'bank_account_type' @_hash['bank_account_holder_type'] = 'bank_account_holder_type' @_hash['payment_type'] = 'payment_type' @_hash['verified'] = 'verified' @_hash['site_gateway_setting_id'] = 'site_gateway_setting_id' @_hash['gateway_handle'] = 'gateway_handle' @_hash['created_at'] = 'created_at' @_hash['updated_at'] = 'updated_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
180 181 182 183 184 185 186 187 188 189 190 191 192 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 180 def self.nullables %w[ billing_address billing_city billing_state billing_zip billing_country customer_vault_token billing_address_2 site_gateway_setting_id gateway_handle ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 152 def self.optionals %w[ id first_name last_name customer_id current_vault vault_token billing_address billing_city billing_state billing_zip billing_country customer_vault_token billing_address_2 bank_name masked_bank_routing_number bank_account_type bank_account_holder_type verified site_gateway_setting_id gateway_handle created_at updated_at ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 330 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.masked_bank_account_number, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.payment_type, ->(val) { PaymentType.validate(val) }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['masked_bank_account_number'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['payment_type'], ->(val) { PaymentType.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 368 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, first_name: #{@first_name.inspect}, last_name:"\ " #{@last_name.inspect}, customer_id: #{@customer_id.inspect}, current_vault:"\ " #{@current_vault.inspect}, vault_token: #{@vault_token.inspect}, billing_address:"\ " #{@billing_address.inspect}, billing_city: #{@billing_city.inspect}, billing_state:"\ " #{@billing_state.inspect}, billing_zip: #{@billing_zip.inspect}, billing_country:"\ " #{@billing_country.inspect}, customer_vault_token: #{@customer_vault_token.inspect},"\ " billing_address_2: #{@billing_address_2.inspect}, bank_name: #{@bank_name.inspect},"\ " masked_bank_routing_number: #{@masked_bank_routing_number.inspect},"\ " masked_bank_account_number: #{@masked_bank_account_number.inspect}, bank_account_type:"\ " #{@bank_account_type.inspect}, bank_account_holder_type:"\ " #{@bank_account_holder_type.inspect}, payment_type: #{@payment_type.inspect}, verified:"\ " #{@verified.inspect}, site_gateway_setting_id: #{@site_gateway_setting_id.inspect},"\ " gateway_handle: #{@gateway_handle.inspect}, created_at: #{@created_at.inspect},"\ " updated_at: #{@updated_at.inspect}, additional_properties: #{get_additional_properties}>" end |
#to_custom_created_at ⇒ Object
320 321 322 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 320 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
324 325 326 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 324 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
# File 'lib/advanced_billing/models/bank_account_payment_profile.rb', line 351 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, first_name: #{@first_name}, last_name: #{@last_name},"\ " customer_id: #{@customer_id}, current_vault: #{@current_vault}, vault_token:"\ " #{@vault_token}, billing_address: #{@billing_address}, billing_city: #{@billing_city},"\ " billing_state: #{@billing_state}, billing_zip: #{@billing_zip}, billing_country:"\ " #{@billing_country}, customer_vault_token: #{@customer_vault_token}, billing_address_2:"\ " #{@billing_address_2}, bank_name: #{@bank_name}, masked_bank_routing_number:"\ " #{@masked_bank_routing_number}, masked_bank_account_number:"\ " #{@masked_bank_account_number}, bank_account_type: #{@bank_account_type},"\ " bank_account_holder_type: #{@bank_account_holder_type}, payment_type: #{@payment_type},"\ " verified: #{@verified}, site_gateway_setting_id: #{@site_gateway_setting_id},"\ " gateway_handle: #{@gateway_handle}, created_at: #{@created_at}, updated_at:"\ " #{@updated_at}, additional_properties: #{get_additional_properties}>" end |