Class: AdvancedBilling::PaymentProfileAttributes
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::PaymentProfileAttributes
- Defined in:
- lib/advanced_billing/models/payment_profile_attributes.rb
Overview
alias to credit_card_attributes
Instance Attribute Summary collapse
-
#billing_address ⇒ String
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing street address (i.e. 123 Main St.).
-
#billing_address_2 ⇒ String
(Optional) Second line of the customer’s billing address i.e.
-
#billing_city ⇒ String
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address city (i.e. “Boston”).
-
#billing_country ⇒ String
(Optional, may be required by your product configuration or gateway settings) 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
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address state (i.e. MA).
-
#billing_zip ⇒ String
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address zip code (i.e. 12345).
-
#card_type ⇒ CardType
(Optional, used only for Subscription Import) If you know the card type (i.e. Visa, MC, etc) you may supply it here so that we may display the card type in the UI.
-
#chargify_token ⇒ String
(Optional) Token received after sending billing information using chargify.js.
-
#current_vault ⇒ AllVaults
(Optional, used only for Subscription Import) The vault that stores the payment profile with the provided vault_token.
-
#customer_id ⇒ Integer
(Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
-
#customer_vault_token ⇒ String
(Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
-
#cvv ⇒ String
(Optional, may be required by your gateway settings) The 3- or 4-digit Card Verification Value.
-
#expiration_month ⇒ Object
(Optional when performing a Subscription 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 Subscription Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, i.e.
-
#first_name ⇒ String
(Optional) First name on card or bank account.
-
#full_number ⇒ String
The full credit card number (string representation, i.e. 5424000000000015).
-
#gateway_handle ⇒ String
(Optional) This attribute is only available if MultiGateway feature is enabled for your Site.
-
#id ⇒ Integer
(Optional) Token received after sending billing information using chargify.js.
-
#last_four ⇒ String
(Optional, used only for Subscription Import) If you have the last 4 digits of the credit card number, you may supply them here so that we may create a masked card number (i.e. XXXX-XXXX-XXXX-1234) for display in the UI.
-
#last_name ⇒ String
(Optional) Last name on card or bank account.
-
#masked_card_number ⇒ String
(Optional) Last name on card or bank account.
-
#payment_method_nonce ⇒ String
(Required for Square unless importing with vault_token and customer_vault_token) The nonce generated by the Square Javascript library (SqPaymentForm).
-
#payment_type ⇒ PaymentType
(Optional) Token received after sending billing information using chargify.js.
-
#paypal_email ⇒ String
(Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
-
#vault_token ⇒ String
(Optional, used only for Subscription Import) 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
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, last_four: SKIP, additional_properties: {}) ⇒ PaymentProfileAttributes
Returns a new instance of PaymentProfileAttributes.
237 238 239 240 241 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 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 237 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, last_four: SKIP, additional_properties: {}) @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 @last_four = last_four unless last_four == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#billing_address ⇒ String
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the payment gateway.
71 72 73 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 71 def billing_address @billing_address end |
#billing_address_2 ⇒ String
(Optional) Second line of the customer’s billing address i.e. Apt. 100
75 76 77 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 75 def billing_address_2 @billing_address_2 end |
#billing_city ⇒ String
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway.
81 82 83 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 81 def billing_city @billing_city end |
#billing_country ⇒ String
(Optional, may be required by your product configuration or gateway settings) 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.
101 102 103 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 101 def billing_country @billing_country end |
#billing_state ⇒ String
(Optional, may be required by your product configuration or gateway settings) 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.
90 91 92 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 90 def billing_state @billing_state end |
#billing_zip ⇒ String
(Optional, may be required by your product configuration or gateway settings) The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway.
107 108 109 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 107 def billing_zip @billing_zip end |
#card_type ⇒ CardType
(Optional, used only for Subscription Import) If you know the card type (i.e. Visa, MC, etc) you may supply it here so that we may display the card type in the UI.
53 54 55 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 53 def card_type @card_type end |
#chargify_token ⇒ String
(Optional) Token received after sending billing information using chargify.js. This token must be passed as a sole attribute of ‘payment_profile_attributes` (i.e. tok_9g6hw85pnpt6knmskpwp4ttt)
16 17 18 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 16 def chargify_token @chargify_token end |
#current_vault ⇒ AllVaults
(Optional, used only for Subscription Import) The vault that stores the payment profile with the provided vault_token.
112 113 114 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 112 def current_vault @current_vault end |
#customer_id ⇒ Integer
(Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
129 130 131 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 129 def customer_id @customer_id end |
#customer_vault_token ⇒ String
(Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
123 124 125 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 123 def customer_vault_token @customer_vault_token end |
#cvv ⇒ String
(Optional, may be required by your gateway settings) The 3- or 4-digit Card Verification Value. This value is merely passed through to the payment gateway.
159 160 161 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 159 def cvv @cvv end |
#expiration_month ⇒ Object
(Optional when performing a Subscription Import via vault_token, required otherwise) The 1- or 2-digit credit card expiration month, as an integer or string, i.e. 5
59 60 61 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 59 def expiration_month @expiration_month end |
#expiration_year ⇒ Object
(Optional when performing a Subscription Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, i.e. 2012
65 66 67 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 65 def expiration_year @expiration_year end |
#first_name ⇒ String
(Optional) First name on card or bank account. If omitted, the first_name from customer attributes will be used.
33 34 35 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 33 def first_name @first_name end |
#full_number ⇒ String
The full credit card number (string representation, i.e. 5424000000000015)
47 48 49 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 47 def full_number @full_number end |
#gateway_handle ⇒ String
(Optional) 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.
153 154 155 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 153 def gateway_handle @gateway_handle end |
#id ⇒ Integer
(Optional) Token received after sending billing information using chargify.js. This token must be passed as a sole attribute of ‘payment_profile_attributes` (i.e. tok_9g6hw85pnpt6knmskpwp4ttt)
22 23 24 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 22 def id @id end |
#last_four ⇒ String
(Optional, used only for Subscription Import) If you have the last 4 digits of the credit card number, you may supply them here so that we may create a masked card number (i.e. XXXX-XXXX-XXXX-1234) for display in the UI. Last 4 digits are required for refunds in Auth.Net.
166 167 168 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 166 def last_four @last_four end |
#last_name ⇒ String
(Optional) Last name on card or bank account. If omitted, the last_name from customer attributes will be used.
38 39 40 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 38 def last_name @last_name end |
#masked_card_number ⇒ String
(Optional) Last name on card or bank account. If omitted, the last_name from customer attributes will be used.
43 44 45 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 43 def masked_card_number @masked_card_number end |
#payment_method_nonce ⇒ String
(Required for Square unless importing with vault_token and customer_vault_token) The nonce generated by the Square Javascript library (SqPaymentForm)
141 142 143 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 141 def payment_method_nonce @payment_method_nonce end |
#payment_type ⇒ PaymentType
(Optional) Token received after sending billing information using chargify.js. This token must be passed as a sole attribute of ‘payment_profile_attributes` (i.e. tok_9g6hw85pnpt6knmskpwp4ttt)
28 29 30 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 28 def payment_type @payment_type end |
#paypal_email ⇒ String
(Optional, used only for Subscription Import) (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
135 136 137 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 135 def paypal_email @paypal_email end |
#vault_token ⇒ String
(Optional, used only for Subscription Import) The “token” provided by your vault storage for an already stored payment profile
117 118 119 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 117 def vault_token @vault_token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 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 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 281 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(:PaymentProfileAttributesExpirationMonth), hash['expiration_month'] ) : SKIP expiration_year = hash.key?('expiration_year') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:PaymentProfileAttributesExpirationYear), 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 last_four = hash.key?('last_four') ? hash['last_four'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. PaymentProfileAttributes.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, last_four: last_four, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 169 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['last_four'] = 'last_four' @_hash end |
.nullables ⇒ Object
An array for nullable fields
231 232 233 234 235 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 231 def self.nullables %w[ billing_address_2 ] end |
.optionals ⇒ Object
An array for optional fields
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 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 200 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 last_four ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
357 358 359 360 361 362 363 |
# File 'lib/advanced_billing/models/payment_profile_attributes.rb', line 357 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |