Class: Batches::Card
- Defined in:
- lib/batches/models/card.rb
Overview
Card Model.
Instance Attribute Summary collapse
-
#authcode ⇒ String
Code generated by the card provider when the card is successfully authorized.
-
#avs_address ⇒ String
First line of the address associated with the card.
-
#avs_address_result ⇒ AvsAddressResultBatchesTransactionsPaymentMethodCardAvsAddressResult
The result of the AVS address check.
-
#avs_postal_code_result ⇒ AvsPostalCodeResultBatchesTransactionsPaymentMethodCardAvsPostalCodeResult
The result of the AVS postal code check.
-
#brand ⇒ BrandBatchesTransactionsPaymentMethodCardBrand
Indicates the card brand that issued the card.
-
#cvv_result ⇒ CvvResultBatchesTransactionsPaymentMethodCardCvvResult
The result of the CVV check.
-
#funding ⇒ FundingBatchesTransactionsPaymentMethodCardFunding
Indicates how the card is funded: *
DEBIT- indicates the card is a debit card where the funds may be present in an account to fulfill the transaction amount. -
#masked_number_first6last4 ⇒ String
Masked card number with the front 6 and last 4 digits visible.
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.
Instance Method Summary collapse
-
#initialize(funding: SKIP, brand: SKIP, masked_number_first6last4: SKIP, authcode: SKIP, cvv_result: SKIP, avs_address: SKIP, avs_address_result: SKIP, avs_postal_code_result: SKIP, additional_properties: nil) ⇒ Card
constructor
A new instance of Card.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(funding: SKIP, brand: SKIP, masked_number_first6last4: SKIP, authcode: SKIP, cvv_result: SKIP, avs_address: SKIP, avs_address_result: SKIP, avs_postal_code_result: SKIP, additional_properties: nil) ⇒ Card
Returns a new instance of Card.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/batches/models/card.rb', line 92 def initialize(funding: SKIP, brand: SKIP, masked_number_first6last4: SKIP, authcode: SKIP, cvv_result: SKIP, avs_address: SKIP, avs_address_result: SKIP, avs_postal_code_result: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @funding = funding unless funding == SKIP @brand = brand unless brand == SKIP unless masked_number_first6last4 == SKIP @masked_number_first6last4 = masked_number_first6last4 end @authcode = authcode unless authcode == SKIP @cvv_result = cvv_result unless cvv_result == SKIP @avs_address = avs_address unless avs_address == SKIP @avs_address_result = avs_address_result unless avs_address_result == SKIP @avs_postal_code_result = avs_postal_code_result unless avs_postal_code_result == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#authcode ⇒ String
Code generated by the card provider when the card is successfully authorized.
41 42 43 |
# File 'lib/batches/models/card.rb', line 41 def authcode @authcode end |
#avs_address ⇒ String
First line of the address associated with the card.
49 50 51 |
# File 'lib/batches/models/card.rb', line 49 def avs_address @avs_address end |
#avs_address_result ⇒ AvsAddressResultBatchesTransactionsPaymentMethodCardAvsAddressResult
The result of the AVS address check.
53 54 55 |
# File 'lib/batches/models/card.rb', line 53 def avs_address_result @avs_address_result end |
#avs_postal_code_result ⇒ AvsPostalCodeResultBatchesTransactionsPaymentMethodCardAvsPostalCodeResult
The result of the AVS postal code check.
57 58 59 |
# File 'lib/batches/models/card.rb', line 57 def avs_postal_code_result @avs_postal_code_result end |
#brand ⇒ BrandBatchesTransactionsPaymentMethodCardBrand
Indicates the card brand that issued the card.
32 33 34 |
# File 'lib/batches/models/card.rb', line 32 def brand @brand end |
#cvv_result ⇒ CvvResultBatchesTransactionsPaymentMethodCardCvvResult
The result of the CVV check.
45 46 47 |
# File 'lib/batches/models/card.rb', line 45 def cvv_result @cvv_result end |
#funding ⇒ FundingBatchesTransactionsPaymentMethodCardFunding
Indicates how the card is funded:
* DEBIT - indicates the card is a debit card
where the funds may be present in an account to fulfill the transaction
amount.
* CREDIT - indicates the card is a credit
card where the funds may be available on credit to the payer to fulfill
the transaction amount.
* FOOD_STAMP - indicates the card is an,
Electronic Benefits Transfer, for food stamps.
* CASH_BENEFITS - indicates the card is an,
Electronic Benefits Transfer, for cash benefits.
* PREPAID - indicates the card is a prepaid
card where the funds are loaded to the card account to fulfill the
transaction amount. Unlike a debit card, a prepaid is not linked to a bank
account.
28 29 30 |
# File 'lib/batches/models/card.rb', line 28 def funding @funding end |
#masked_number_first6last4 ⇒ String
Masked card number with the front 6 and last 4 digits visible.
36 37 38 |
# File 'lib/batches/models/card.rb', line 36 def masked_number_first6last4 @masked_number_first6last4 end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
114 115 116 117 118 119 120 121 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 |
# File 'lib/batches/models/card.rb', line 114 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. funding = hash.key?('funding') ? hash['funding'] : SKIP brand = hash.key?('brand') ? hash['brand'] : SKIP masked_number_first6last4 = hash.key?('masked_number_first6last4') ? hash['masked_number_first6last4'] : SKIP authcode = hash.key?('authcode') ? hash['authcode'] : SKIP cvv_result = hash.key?('cvv_result') ? hash['cvv_result'] : SKIP avs_address = hash.key?('avs_address') ? hash['avs_address'] : SKIP avs_address_result = hash.key?('avs_address_result') ? hash['avs_address_result'] : SKIP avs_postal_code_result = hash.key?('avs_postal_code_result') ? hash['avs_postal_code_result'] : 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. Card.new(funding: funding, brand: brand, masked_number_first6last4: masked_number_first6last4, authcode: authcode, cvv_result: cvv_result, avs_address: avs_address, avs_address_result: avs_address_result, avs_postal_code_result: avs_postal_code_result, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/batches/models/card.rb', line 60 def self.names @_hash = {} if @_hash.nil? @_hash['funding'] = 'funding' @_hash['brand'] = 'brand' @_hash['masked_number_first6last4'] = 'masked_number_first6last4' @_hash['authcode'] = 'authcode' @_hash['cvv_result'] = 'cvv_result' @_hash['avs_address'] = 'avs_address' @_hash['avs_address_result'] = 'avs_address_result' @_hash['avs_postal_code_result'] = 'avs_postal_code_result' @_hash end |
.nullables ⇒ Object
An array for nullable fields
88 89 90 |
# File 'lib/batches/models/card.rb', line 88 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/batches/models/card.rb', line 74 def self.optionals %w[ funding brand masked_number_first6last4 authcode cvv_result avs_address avs_address_result avs_postal_code_result ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
160 161 162 163 164 165 166 167 168 |
# File 'lib/batches/models/card.rb', line 160 def inspect class_name = self.class.name.split('::').last "<#{class_name} funding: #{@funding.inspect}, brand: #{@brand.inspect},"\ " masked_number_first6last4: #{@masked_number_first6last4.inspect}, authcode:"\ " #{@authcode.inspect}, cvv_result: #{@cvv_result.inspect}, avs_address:"\ " #{@avs_address.inspect}, avs_address_result: #{@avs_address_result.inspect},"\ " avs_postal_code_result: #{@avs_postal_code_result.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
150 151 152 153 154 155 156 157 |
# File 'lib/batches/models/card.rb', line 150 def to_s class_name = self.class.name.split('::').last "<#{class_name} funding: #{@funding}, brand: #{@brand}, masked_number_first6last4:"\ " #{@masked_number_first6last4}, authcode: #{@authcode}, cvv_result: #{@cvv_result},"\ " avs_address: #{@avs_address}, avs_address_result: #{@avs_address_result},"\ " avs_postal_code_result: #{@avs_postal_code_result}, additional_properties:"\ " #{@additional_properties}>" end |