Class: CyberSourceMergedSpec::PaymentInstrument25
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::PaymentInstrument25
- Defined in:
- lib/cyber_source_merged_spec/models/payment_instrument25.rb
Overview
Payment instrument used during Follow-On Transaction.
Instance Attribute Summary collapse
-
#bank_account ⇒ BankAccount46
The Id of the Payment Instrument Token.
-
#bill_to ⇒ BillTo15
The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.
-
#buyer_information ⇒ FollowOnTransactionBuyerInformation
The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.
-
#card ⇒ Card128
The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.
-
#id ⇒ String
The Id of the Payment Instrument Token.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.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(id: SKIP, bank_account: SKIP, card: SKIP, bill_to: SKIP, buyer_information: SKIP, additional_properties: nil) ⇒ PaymentInstrument25
constructor
A new instance of PaymentInstrument25.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ 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(id: SKIP, bank_account: SKIP, card: SKIP, bill_to: SKIP, buyer_information: SKIP, additional_properties: nil) ⇒ PaymentInstrument25
Returns a new instance of PaymentInstrument25.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 62 def initialize(id: SKIP, bank_account: SKIP, card: SKIP, bill_to: SKIP, buyer_information: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @bank_account = bank_account unless bank_account == SKIP @card = card unless card == SKIP @bill_to = bill_to unless bill_to == SKIP @buyer_information = buyer_information unless buyer_information == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#bank_account ⇒ BankAccount46
The Id of the Payment Instrument Token.
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 18 def bank_account @bank_account end |
#bill_to ⇒ BillTo15
The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.
28 29 30 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 28 def bill_to @bill_to end |
#buyer_information ⇒ FollowOnTransactionBuyerInformation
The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.
33 34 35 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 33 def buyer_information @buyer_information end |
#card ⇒ Card128
The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 23 def card @card end |
#id ⇒ String
The Id of the Payment Instrument Token.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 14 def id @id end |
Class Method Details
.from_element(root) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 103 def self.from_element(root) id = XmlUtilities.from_element(root, 'id', String) bank_account = XmlUtilities.from_element(root, 'BankAccount46', BankAccount46) card = XmlUtilities.from_element(root, 'Card128', Card128) bill_to = XmlUtilities.from_element(root, 'BillTo15', BillTo15) buyer_information = XmlUtilities.from_element( root, 'followOnTransactionBuyerInformation', FollowOnTransactionBuyerInformation ) new(id: id, bank_account: bank_account, card: card, bill_to: bill_to, buyer_information: buyer_information, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP bank_account = BankAccount46.from_hash(hash['bankAccount']) if hash['bankAccount'] card = Card128.from_hash(hash['card']) if hash['card'] bill_to = BillTo15.from_hash(hash['billTo']) if hash['billTo'] buyer_information = FollowOnTransactionBuyerInformation.from_hash(hash['buyerInformation']) if hash['buyerInformation'] # 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. PaymentInstrument25.new(id: id, bank_account: bank_account, card: card, bill_to: bill_to, buyer_information: buyer_information, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['bank_account'] = 'bankAccount' @_hash['card'] = 'card' @_hash['bill_to'] = 'billTo' @_hash['buyer_information'] = 'buyerInformation' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 53 54 55 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 47 def self.optionals %w[ id bank_account card bill_to buyer_information ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
147 148 149 150 151 152 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 147 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, bank_account: #{@bank_account.inspect}, card:"\ " #{@card.inspect}, bill_to: #{@bill_to.inspect}, buyer_information:"\ " #{@buyer_information.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
139 140 141 142 143 144 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 139 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, bank_account: #{@bank_account}, card: #{@card}, bill_to:"\ " #{@bill_to}, buyer_information: #{@buyer_information}, additional_properties:"\ " #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 122 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'id', id) XmlUtilities.add_as_subelement(doc, root, 'BankAccount46', bank_account) XmlUtilities.add_as_subelement(doc, root, 'Card128', card) XmlUtilities.add_as_subelement(doc, root, 'BillTo15', bill_to) XmlUtilities.add_as_subelement(doc, root, 'followOnTransactionBuyerInformation', buyer_information) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |