Class: CyberSourceMergedSpec::PaymentInstrument25

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/payment_instrument25.rb

Overview

Payment instrument used during Follow-On Transaction.

Instance Attribute Summary collapse

Class Method Summary collapse

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(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 =  unless  == 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_accountBankAccount46

The Id of the Payment Instrument Token.

Returns:



18
19
20
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 18

def 
  @bank_account
end

#bill_toBillTo15

The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.

Returns:



28
29
30
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 28

def bill_to
  @bill_to
end

#buyer_informationFollowOnTransactionBuyerInformation

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

#cardCard128

The masked number (PAN), expirationMonth, expirationYear and type of the card used during transaction.

Returns:



23
24
25
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 23

def card
  @card
end

#idString

The Id of the Payment Instrument Token.

Returns:

  • (String)


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)
   = 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: ,
      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
   = 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: ,
                          card: card,
                          bill_to: bill_to,
                          buyer_information: buyer_information,
                          additional_properties: additional_properties)
end

.namesObject

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

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/cyber_source_merged_spec/models/payment_instrument25.rb', line 58

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_sObject

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', )
  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