Class: CyberSourceMergedSpec::PaymentInformation31
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::PaymentInformation31
- Defined in:
- lib/cyber_source_merged_spec/models/payment_information31.rb
Overview
Contains the payment data for this transaction.
Instance Attribute Summary collapse
-
#bank ⇒ Bank
Use this object to submit a payment network token instead of card-based values.
-
#card ⇒ Card120
Use this for a non-tokenized payment card.
-
#customer ⇒ Customer
Use this object to submit a payment network token instead of card-based values.
-
#method ⇒ String
Method of payment used for the order.
-
#tokenized_card ⇒ TokenizedCard14
Use this object to submit a payment network token instead of card-based values.
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(card: SKIP, tokenized_card: SKIP, customer: SKIP, bank: SKIP, method: SKIP, additional_properties: nil) ⇒ PaymentInformation31
constructor
A new instance of PaymentInformation31.
-
#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(card: SKIP, tokenized_card: SKIP, customer: SKIP, bank: SKIP, method: SKIP, additional_properties: nil) ⇒ PaymentInformation31
Returns a new instance of PaymentInformation31.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 71 def initialize(card: SKIP, tokenized_card: SKIP, customer: SKIP, bank: SKIP, method: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @card = card unless card == SKIP @tokenized_card = tokenized_card unless tokenized_card == SKIP @customer = customer unless customer == SKIP @bank = bank unless bank == SKIP @method = method unless method == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#bank ⇒ Bank
Use this object to submit a payment network token instead of card-based values.
29 30 31 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 29 def bank @bank end |
#card ⇒ Card120
Use this for a non-tokenized payment card.
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 14 def card @card end |
#customer ⇒ Customer
Use this object to submit a payment network token instead of card-based values.
24 25 26 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 24 def customer @customer end |
#method ⇒ String
Method of payment used for the order. This field can contain one of the following values:
- `consumer` (default): Customer credit card
- `corporate`: Corporate credit card
- `debit`: Debit card, such as a Maestro (UK Domestic) card
- `cod`: Collect on delivery
- `check`: Electronic check
- `p2p`: Person-to-person payment
- `private1`: Private label credit card
- `other`: Other payment method
42 43 44 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 42 def method @method end |
#tokenized_card ⇒ TokenizedCard14
Use this object to submit a payment network token instead of card-based values.
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 19 def tokenized_card @tokenized_card end |
Class Method Details
.from_element(root) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 111 def self.from_element(root) card = XmlUtilities.from_element(root, 'Card120', Card120) tokenized_card = XmlUtilities.from_element(root, 'TokenizedCard14', TokenizedCard14) customer = XmlUtilities.from_element(root, 'Customer', Customer) bank = XmlUtilities.from_element(root, 'Bank', Bank) method = XmlUtilities.from_element(root, 'method', String) new(card: card, tokenized_card: tokenized_card, customer: customer, bank: bank, method: method, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. card = Card120.from_hash(hash['card']) if hash['card'] tokenized_card = TokenizedCard14.from_hash(hash['tokenizedCard']) if hash['tokenizedCard'] customer = Customer.from_hash(hash['customer']) if hash['customer'] bank = Bank.from_hash(hash['bank']) if hash['bank'] method = hash.key?('method') ? hash['method'] : 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. PaymentInformation31.new(card: card, tokenized_card: tokenized_card, customer: customer, bank: bank, method: method, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['card'] = 'card' @_hash['tokenized_card'] = 'tokenizedCard' @_hash['customer'] = 'customer' @_hash['bank'] = 'bank' @_hash['method'] = 'method' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 56 def self.optionals %w[ card tokenized_card customer bank method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
150 151 152 153 154 155 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 150 def inspect class_name = self.class.name.split('::').last "<#{class_name} card: #{@card.inspect}, tokenized_card: #{@tokenized_card.inspect},"\ " customer: #{@customer.inspect}, bank: #{@bank.inspect}, method: #{@method.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
143 144 145 146 147 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 143 def to_s class_name = self.class.name.split('::').last "<#{class_name} card: #{@card}, tokenized_card: #{@tokenized_card}, customer: #{@customer},"\ " bank: #{@bank}, method: #{@method}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/cyber_source_merged_spec/models/payment_information31.rb', line 127 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'Card120', card) XmlUtilities.add_as_subelement(doc, root, 'TokenizedCard14', tokenized_card) XmlUtilities.add_as_subelement(doc, root, 'Customer', customer) XmlUtilities.add_as_subelement(doc, root, 'Bank', bank) XmlUtilities.add_as_subelement(doc, root, 'method', method) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |