Class: AdvancedBilling::CreatePaymentProfile
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CreatePaymentProfile
- Defined in:
- lib/advanced_billing/models/create_payment_profile.rb
Overview
CreatePaymentProfile Model.
Instance Attribute Summary collapse
-
#bank_account_holder_type ⇒ BankAccountHolderType
Defaults to personal.
-
#bank_account_number ⇒ String
(Required when creating with ACH, GoCardless, Stripe BECS or BACS Direct Debit, and bank_iban is blank) The customerʼs bank account number.
-
#bank_account_type ⇒ BankAccountType
Defaults to checking.
-
#bank_branch_code ⇒ String
(Optional when creating with GoCardless, required with Stripe BECS or BACS Direct Debit) Branch/Sort code.
-
#bank_iban ⇒ String
(Optional when creating with GoCardless, required with Stripe Direct Debit).
-
#bank_name ⇒ String
(Required when creating with ACH or GoCardless, optional with Stripe Direct Debit).
-
#bank_routing_number ⇒ String
(Required when creating with ACH. Optional when creating a subscription with GoCardless).
-
#billing_address ⇒ String
The credit card or bank account billing street address (i.e. 123 Main St.).
-
#billing_address_2 ⇒ String
Second line of the customer’s billing address i.e.
-
#billing_city ⇒ String
The credit card or bank account billing address city (i.e. “Boston”).
-
#billing_country ⇒ String
The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”).
-
#billing_state ⇒ String
The credit card or bank account billing address state (i.e. MA).
-
#billing_zip ⇒ String
The credit card or bank account billing address zip code (i.e. 12345).
-
#card_type ⇒ CardType
The type of card used.
-
#chargify_token ⇒ String
Token received after sending billing informations using chargify.js.
-
#current_vault ⇒ AllVaults
The vault that stores the payment profile with the provided ‘vault_token`.
-
#customer_id ⇒ Integer
(Required when creating a new payment profile) The Chargify customer id.
-
#customer_vault_token ⇒ String
(only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
-
#cvv ⇒ String
The 3- or 4-digit Card Verification Value.
-
#expiration_month ⇒ Object
(Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit card expiration month, as an integer or string, i.e.
-
#expiration_year ⇒ Object
(Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, i.e.
-
#first_name ⇒ String
First name on card or bank account.
-
#full_number ⇒ String
The full credit card number.
-
#gateway_handle ⇒ String
This attribute is only available if MultiGateway feature is enabled for your Site.
-
#id ⇒ Integer
Token received after sending billing informations using chargify.js.
-
#last_four ⇒ String
(Optional) Used for creating subscription with payment profile imported using vault_token, for proper display in Advanced Billing UI.
-
#last_name ⇒ String
Last name on card or bank account.
-
#masked_card_number ⇒ String
Last name on card or bank account.
-
#payment_method_nonce ⇒ String
used by merchants that implemented BraintreeBlue javaScript libraries on their own.
-
#payment_type ⇒ PaymentType
Token received after sending billing informations using chargify.js.
-
#paypal_email ⇒ String
used by merchants that implemented BraintreeBlue javaScript libraries on their own.
-
#vault_token ⇒ String
The “token” provided by your vault storage for an already stored payment profile.
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
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, id: SKIP, payment_type: SKIP, first_name: SKIP, last_name: SKIP, masked_card_number: SKIP, full_number: SKIP, card_type: SKIP, expiration_month: SKIP, expiration_year: SKIP, billing_address: SKIP, billing_address_2: SKIP, billing_city: SKIP, billing_state: SKIP, billing_country: SKIP, billing_zip: SKIP, current_vault: SKIP, vault_token: SKIP, customer_vault_token: SKIP, customer_id: SKIP, paypal_email: SKIP, payment_method_nonce: SKIP, gateway_handle: SKIP, cvv: SKIP, bank_name: SKIP, bank_iban: SKIP, bank_routing_number: SKIP, bank_account_number: SKIP, bank_branch_code: SKIP, bank_account_type: SKIP, bank_account_holder_type: SKIP, last_four: SKIP, additional_properties: {}) ⇒ CreatePaymentProfile
Returns a new instance of CreatePaymentProfile.
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 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 264 def initialize(chargify_token: SKIP, id: SKIP, payment_type: SKIP, first_name: SKIP, last_name: SKIP, masked_card_number: SKIP, full_number: SKIP, card_type: SKIP, expiration_month: SKIP, expiration_year: SKIP, billing_address: SKIP, billing_address_2: SKIP, billing_city: SKIP, billing_state: SKIP, billing_country: SKIP, billing_zip: SKIP, current_vault: SKIP, vault_token: SKIP, customer_vault_token: SKIP, customer_id: SKIP, paypal_email: SKIP, payment_method_nonce: SKIP, gateway_handle: SKIP, cvv: SKIP, bank_name: SKIP, bank_iban: SKIP, bank_routing_number: SKIP, bank_account_number: SKIP, bank_branch_code: SKIP, bank_account_type: SKIP, bank_account_holder_type: SKIP, last_four: 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 @id = id unless id == SKIP @payment_type = payment_type unless payment_type == SKIP @first_name = first_name unless first_name == SKIP @last_name = last_name unless last_name == SKIP @masked_card_number = masked_card_number unless masked_card_number == SKIP @full_number = full_number unless full_number == SKIP @card_type = card_type unless card_type == SKIP @expiration_month = expiration_month unless expiration_month == SKIP @expiration_year = expiration_year unless expiration_year == SKIP @billing_address = billing_address unless billing_address == SKIP @billing_address_2 = billing_address_2 unless billing_address_2 == SKIP @billing_city = billing_city unless billing_city == SKIP @billing_state = billing_state unless billing_state == SKIP @billing_country = billing_country unless billing_country == SKIP @billing_zip = billing_zip unless billing_zip == 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 @customer_id = customer_id unless customer_id == SKIP @paypal_email = paypal_email unless paypal_email == SKIP @payment_method_nonce = payment_method_nonce unless payment_method_nonce == SKIP @gateway_handle = gateway_handle unless gateway_handle == SKIP @cvv = cvv unless cvv == SKIP @bank_name = bank_name unless bank_name == SKIP @bank_iban = bank_iban unless bank_iban == SKIP @bank_routing_number = bank_routing_number unless bank_routing_number == SKIP @bank_account_number = bank_account_number unless bank_account_number == SKIP @bank_branch_code = bank_branch_code unless bank_branch_code == SKIP @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 @last_four = last_four unless last_four == SKIP end |
Instance Attribute Details
#bank_account_holder_type ⇒ BankAccountHolderType
Defaults to personal
174 175 176 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 174 def bank_account_holder_type @bank_account_holder_type end |
#bank_account_number ⇒ String
(Required when creating with ACH, GoCardless, Stripe BECS or BACS Direct Debit, and bank_iban is blank) The customerʼs bank account number
161 162 163 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 161 def bank_account_number @bank_account_number end |
#bank_account_type ⇒ BankAccountType
Defaults to checking
170 171 172 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 170 def bank_account_type @bank_account_type end |
#bank_branch_code ⇒ String
(Optional when creating with GoCardless, required with Stripe BECS or BACS Direct Debit) Branch/Sort code. Alternatively, an IBAN can be provided
166 167 168 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 166 def bank_branch_code @bank_branch_code end |
#bank_iban ⇒ String
(Optional when creating with GoCardless, required with Stripe Direct Debit). International Bank Account Number. Alternatively, local bank details can be provided
150 151 152 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 150 def bank_iban @bank_iban end |
#bank_name ⇒ String
(Required when creating with ACH or GoCardless, optional with Stripe Direct Debit). The name of the bank where the customerʼs account resides
144 145 146 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 144 def bank_name @bank_name end |
#bank_routing_number ⇒ String
(Required when creating with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API
156 157 158 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 156 def bank_routing_number @bank_routing_number end |
#billing_address ⇒ String
The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the payment gateway.
62 63 64 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 62 def billing_address @billing_address end |
#billing_address_2 ⇒ String
Second line of the customer’s billing address i.e. Apt. 100
66 67 68 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 66 def billing_address_2 @billing_address_2 end |
#billing_city ⇒ String
The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway.
71 72 73 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 71 def billing_city @billing_city end |
#billing_country ⇒ String
The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time.
88 89 90 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 88 def billing_country @billing_country end |
#billing_state ⇒ String
The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes.
79 80 81 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 79 def billing_state @billing_state end |
#billing_zip ⇒ String
The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway.
93 94 95 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 93 def billing_zip @billing_zip end |
#card_type ⇒ CardType
The type of card used.
45 46 47 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 45 def card_type @card_type end |
#chargify_token ⇒ String
Token received after sending billing informations using chargify.js.
14 15 16 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 14 def chargify_token @chargify_token end |
#current_vault ⇒ AllVaults
The vault that stores the payment profile with the provided ‘vault_token`. Use `bogus` for testing.
98 99 100 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 98 def current_vault @current_vault end |
#customer_id ⇒ Integer
(Required when creating a new payment profile) The Chargify customer id.
112 113 114 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 112 def customer_id @customer_id end |
#customer_vault_token ⇒ String
(only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
108 109 110 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 108 def customer_vault_token @customer_vault_token end |
#cvv ⇒ String
The 3- or 4-digit Card Verification Value. This value is merely passed through to the payment gateway.
139 140 141 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 139 def cvv @cvv end |
#expiration_month ⇒ Object
(Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit card expiration month, as an integer or string, i.e. 5
51 52 53 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 51 def expiration_month @expiration_month end |
#expiration_year ⇒ Object
(Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, i.e. 2012
57 58 59 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 57 def expiration_year @expiration_year end |
#first_name ⇒ String
First name on card or bank account. If omitted, the first_name from customer attributes will be used.
27 28 29 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 27 def first_name @first_name end |
#full_number ⇒ String
The full credit card number
41 42 43 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 41 def full_number @full_number end |
#gateway_handle ⇒ String
This attribute is only available if MultiGateway feature is enabled for your Site. This feature is in the Private Beta currently. gateway_handle is used to directly select a gateway where a payment profile will be stored in. Every connected gateway must have a unique gateway handle specified. Read [Multigateway description](chargify.zendesk.com/hc/en-us/articles/4407761759643# connecting-with-multiple-gateways) to learn more about new concepts that MultiGateway introduces and the default behavior when this attribute is not passed.
134 135 136 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 134 def gateway_handle @gateway_handle end |
#id ⇒ Integer
Token received after sending billing informations using chargify.js.
18 19 20 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 18 def id @id end |
#last_four ⇒ String
(Optional) Used for creating subscription with payment profile imported using vault_token, for proper display in Advanced Billing UI
179 180 181 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 179 def last_four @last_four end |
#last_name ⇒ String
Last name on card or bank account. If omitted, the last_name from customer attributes will be used.
32 33 34 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 32 def last_name @last_name end |
#masked_card_number ⇒ String
Last name on card or bank account. If omitted, the last_name from customer attributes will be used.
37 38 39 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 37 def masked_card_number @masked_card_number end |
#payment_method_nonce ⇒ String
used by merchants that implemented BraintreeBlue javaScript libraries on their own. We recommend using Chargify.js instead.
122 123 124 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 122 def payment_method_nonce @payment_method_nonce end |
#payment_type ⇒ PaymentType
Token received after sending billing informations using chargify.js.
22 23 24 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 22 def payment_type @payment_type end |
#paypal_email ⇒ String
used by merchants that implemented BraintreeBlue javaScript libraries on their own. We recommend using Chargify.js instead.
117 118 119 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 117 def paypal_email @paypal_email end |
#vault_token ⇒ String
The “token” provided by your vault storage for an already stored payment profile
103 104 105 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 103 def vault_token @vault_token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 318 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. chargify_token = hash.key?('chargify_token') ? hash['chargify_token'] : SKIP id = hash.key?('id') ? hash['id'] : SKIP payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP first_name = hash.key?('first_name') ? hash['first_name'] : SKIP last_name = hash.key?('last_name') ? hash['last_name'] : SKIP masked_card_number = hash.key?('masked_card_number') ? hash['masked_card_number'] : SKIP full_number = hash.key?('full_number') ? hash['full_number'] : SKIP card_type = hash.key?('card_type') ? hash['card_type'] : SKIP expiration_month = hash.key?('expiration_month') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreatePaymentProfileExpirationMonth), hash['expiration_month'] ) : SKIP expiration_year = hash.key?('expiration_year') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreatePaymentProfileExpirationYear), hash['expiration_year'] ) : SKIP billing_address = hash.key?('billing_address') ? hash['billing_address'] : SKIP billing_address_2 = hash.key?('billing_address_2') ? hash['billing_address_2'] : SKIP billing_city = hash.key?('billing_city') ? hash['billing_city'] : SKIP billing_state = hash.key?('billing_state') ? hash['billing_state'] : SKIP billing_country = hash.key?('billing_country') ? hash['billing_country'] : SKIP billing_zip = hash.key?('billing_zip') ? hash['billing_zip'] : 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 customer_id = hash.key?('customer_id') ? hash['customer_id'] : SKIP paypal_email = hash.key?('paypal_email') ? hash['paypal_email'] : SKIP payment_method_nonce = hash.key?('payment_method_nonce') ? hash['payment_method_nonce'] : SKIP gateway_handle = hash.key?('gateway_handle') ? hash['gateway_handle'] : SKIP cvv = hash.key?('cvv') ? hash['cvv'] : SKIP bank_name = hash.key?('bank_name') ? hash['bank_name'] : SKIP bank_iban = hash.key?('bank_iban') ? hash['bank_iban'] : SKIP bank_routing_number = hash.key?('bank_routing_number') ? hash['bank_routing_number'] : SKIP bank_account_number = hash.key?('bank_account_number') ? hash['bank_account_number'] : SKIP bank_branch_code = hash.key?('bank_branch_code') ? hash['bank_branch_code'] : 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 last_four = hash.key?('last_four') ? hash['last_four'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. CreatePaymentProfile.new(chargify_token: chargify_token, id: id, payment_type: payment_type, first_name: first_name, last_name: last_name, masked_card_number: masked_card_number, full_number: full_number, card_type: card_type, expiration_month: expiration_month, expiration_year: expiration_year, billing_address: billing_address, billing_address_2: billing_address_2, billing_city: billing_city, billing_state: billing_state, billing_country: billing_country, billing_zip: billing_zip, current_vault: current_vault, vault_token: vault_token, customer_vault_token: customer_vault_token, customer_id: customer_id, paypal_email: paypal_email, payment_method_nonce: payment_method_nonce, gateway_handle: gateway_handle, cvv: cvv, bank_name: bank_name, bank_iban: bank_iban, bank_routing_number: bank_routing_number, bank_account_number: bank_account_number, bank_branch_code: bank_branch_code, bank_account_type: bank_account_type, bank_account_holder_type: bank_account_holder_type, last_four: last_four, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 182 def self.names @_hash = {} if @_hash.nil? @_hash['chargify_token'] = 'chargify_token' @_hash['id'] = 'id' @_hash['payment_type'] = 'payment_type' @_hash['first_name'] = 'first_name' @_hash['last_name'] = 'last_name' @_hash['masked_card_number'] = 'masked_card_number' @_hash['full_number'] = 'full_number' @_hash['card_type'] = 'card_type' @_hash['expiration_month'] = 'expiration_month' @_hash['expiration_year'] = 'expiration_year' @_hash['billing_address'] = 'billing_address' @_hash['billing_address_2'] = 'billing_address_2' @_hash['billing_city'] = 'billing_city' @_hash['billing_state'] = 'billing_state' @_hash['billing_country'] = 'billing_country' @_hash['billing_zip'] = 'billing_zip' @_hash['current_vault'] = 'current_vault' @_hash['vault_token'] = 'vault_token' @_hash['customer_vault_token'] = 'customer_vault_token' @_hash['customer_id'] = 'customer_id' @_hash['paypal_email'] = 'paypal_email' @_hash['payment_method_nonce'] = 'payment_method_nonce' @_hash['gateway_handle'] = 'gateway_handle' @_hash['cvv'] = 'cvv' @_hash['bank_name'] = 'bank_name' @_hash['bank_iban'] = 'bank_iban' @_hash['bank_routing_number'] = 'bank_routing_number' @_hash['bank_account_number'] = 'bank_account_number' @_hash['bank_branch_code'] = 'bank_branch_code' @_hash['bank_account_type'] = 'bank_account_type' @_hash['bank_account_holder_type'] = 'bank_account_holder_type' @_hash['last_four'] = 'last_four' @_hash end |
.nullables ⇒ Object
An array for nullable fields
258 259 260 261 262 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 258 def self.nullables %w[ billing_address_2 ] end |
.optionals ⇒ Object
An array for optional fields
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 220 def self.optionals %w[ chargify_token id payment_type first_name last_name masked_card_number full_number card_type expiration_month expiration_year billing_address billing_address_2 billing_city billing_state billing_country billing_zip current_vault vault_token customer_vault_token customer_id paypal_email payment_method_nonce gateway_handle cvv bank_name bank_iban bank_routing_number bank_account_number bank_branch_code bank_account_type bank_account_holder_type last_four ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
413 414 415 416 417 418 419 |
# File 'lib/advanced_billing/models/create_payment_profile.rb', line 413 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |