Class: Batches::PaymentMethod
- Defined in:
- lib/batches/models/payment_method.rb
Overview
PaymentMethod Model.
Instance Attribute Summary collapse
-
#card ⇒ Card
Indicates how the payment method information was obtained by the Merchant for this transaction.
-
#entry_mode ⇒ EntryModeBatchesTransactionsPaymentMethodEntryMode
Indicates how the payment method information was obtained by the Merchant for this transaction.
-
#name ⇒ String
The name of the owner of the payment method.
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(name: SKIP, entry_mode: SKIP, card: SKIP, additional_properties: nil) ⇒ PaymentMethod
constructor
A new instance of PaymentMethod.
-
#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(name: SKIP, entry_mode: SKIP, card: SKIP, additional_properties: nil) ⇒ PaymentMethod
Returns a new instance of PaymentMethod.
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/batches/models/payment_method.rb', line 119 def initialize(name: SKIP, entry_mode: SKIP, card: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @name = name unless name == SKIP @entry_mode = entry_mode unless entry_mode == SKIP @card = card unless card == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#card ⇒ Card
Indicates how the payment method information was obtained by the Merchant
for this transaction.
* MOTO - A CNP channel entry mode where the
payment method information was obtained over the phone or via postal mail.
* `ECOM` - A CNP channel entry mode where the
payment method was obtained via a browser.
* IN_APP - A CNP channel entry mode where the
payment method was obtained via an application and applies to digital
wallets only.
* CHIP - A CP channel entry mode where the
payment method information was obtained from a chip. E.g. card is inserted
into a device to read the chip.
* SWIPE - A CP channel entry mode where the
payment method information was obtained from swiping a magnetic strip.
E.g. card's magnetic strip is swiped through a device to read the card
information.
* MANUAL - A CP channel entry mode where the
payment method information was obtained by manually keying the payment
method information into the device.
* CONTACTLESS_CHIP - A CP channel entry mode
where the payment method information was obtained by bringing the payment
method to close proximity of a device. E.g. tap a card on or near a device
to exchange card information.
* CONTACTLESS_SWIPE - A CP channel entry mode
where the payment method information was obtained by bringing the payment
method to close proximity of a device and also swiping the card. E.g. tap
a card on or near a device and swipe it through device to exchange card
information
* PHONE - A CNP channel entry mode where the
payment method was obtained over the phone.
* MAIL - A CNP channel entry mode where the
payment method was obtained via postal mail.
* PRESENT- The entry mode cannot be determined
but it is a Customer Present transaction.
* UNKNOWN - The entry mode for this transaction
cannot be determined.
94 95 96 |
# File 'lib/batches/models/payment_method.rb', line 94 def card @card end |
#entry_mode ⇒ EntryModeBatchesTransactionsPaymentMethodEntryMode
Indicates how the payment method information was obtained by the Merchant
for this transaction.
* MOTO - A CNP channel entry mode where the
payment method information was obtained over the phone or via postal mail.
* `ECOM` - A CNP channel entry mode where the
payment method was obtained via a browser.
* IN_APP - A CNP channel entry mode where the
payment method was obtained via an application and applies to digital
wallets only.
* CHIP - A CP channel entry mode where the
payment method information was obtained from a chip. E.g. card is inserted
into a device to read the chip.
* SWIPE - A CP channel entry mode where the
payment method information was obtained from swiping a magnetic strip.
E.g. card's magnetic strip is swiped through a device to read the card
information.
* MANUAL - A CP channel entry mode where the
payment method information was obtained by manually keying the payment
method information into the device.
* CONTACTLESS_CHIP - A CP channel entry mode
where the payment method information was obtained by bringing the payment
method to close proximity of a device. E.g. tap a card on or near a device
to exchange card information.
* CONTACTLESS_SWIPE - A CP channel entry mode
where the payment method information was obtained by bringing the payment
method to close proximity of a device and also swiping the card. E.g. tap
a card on or near a device and swipe it through device to exchange card
information
* PHONE - A CNP channel entry mode where the
payment method was obtained over the phone.
* MAIL - A CNP channel entry mode where the
payment method was obtained via postal mail.
* PRESENT- The entry mode cannot be determined
but it is a Customer Present transaction.
* UNKNOWN - The entry mode for this transaction
cannot be determined.
54 55 56 |
# File 'lib/batches/models/payment_method.rb', line 54 def entry_mode @entry_mode end |
#name ⇒ String
The name of the owner of the payment method
14 15 16 |
# File 'lib/batches/models/payment_method.rb', line 14 def name @name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/batches/models/payment_method.rb', line 131 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : SKIP entry_mode = hash.key?('entry_mode') ? hash['entry_mode'] : SKIP card = Card.from_hash(hash['card']) if hash['card'] # 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. PaymentMethod.new(name: name, entry_mode: entry_mode, card: card, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
97 98 99 100 101 102 103 |
# File 'lib/batches/models/payment_method.rb', line 97 def self.names @_hash = {} if @_hash.nil? @_hash['name'] = 'name' @_hash['entry_mode'] = 'entry_mode' @_hash['card'] = 'card' @_hash end |
.nullables ⇒ Object
An array for nullable fields
115 116 117 |
# File 'lib/batches/models/payment_method.rb', line 115 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
106 107 108 109 110 111 112 |
# File 'lib/batches/models/payment_method.rb', line 106 def self.optionals %w[ name entry_mode card ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
161 162 163 164 165 |
# File 'lib/batches/models/payment_method.rb', line 161 def inspect class_name = self.class.name.split('::').last "<#{class_name} name: #{@name.inspect}, entry_mode: #{@entry_mode.inspect}, card:"\ " #{@card.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
154 155 156 157 158 |
# File 'lib/batches/models/payment_method.rb', line 154 def to_s class_name = self.class.name.split('::').last "<#{class_name} name: #{@name}, entry_mode: #{@entry_mode}, card: #{@card},"\ " additional_properties: #{@additional_properties}>" end |