Class: CyberSourceMergedSpec::InvoiceDetails4
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::InvoiceDetails4
- Defined in:
- lib/cyber_source_merged_spec/models/invoice_details4.rb
Overview
InvoiceDetails4 Model.
Instance Attribute Summary collapse
-
#commodity_code ⇒ String
International description code of the overall order’s goods or services or the Categorizes purchases for VAT reporting.
-
#purchase_contact_name ⇒ String
The name of the individual or the company contacted for company authorized purchases.
-
#purchase_order_date ⇒ String
Date the order was processed.
-
#purchase_order_number ⇒ String
Value used by your customer to identify the order.
-
#taxable ⇒ TrueClass | FalseClass
Flag that indicates whether an order is taxable.
-
#transaction_advice_addendum ⇒ Array[TransactionAdviceAddendum]
International description code of the overall order’s goods or services or the Categorizes purchases for VAT reporting.
-
#vat_invoice_reference_number ⇒ String
VAT invoice number associated with the transaction.
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(purchase_order_number: SKIP, purchase_order_date: SKIP, purchase_contact_name: SKIP, taxable: SKIP, vat_invoice_reference_number: SKIP, commodity_code: SKIP, transaction_advice_addendum: SKIP, additional_properties: nil) ⇒ InvoiceDetails4
constructor
A new instance of InvoiceDetails4.
-
#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(purchase_order_number: SKIP, purchase_order_date: SKIP, purchase_contact_name: SKIP, taxable: SKIP, vat_invoice_reference_number: SKIP, commodity_code: SKIP, transaction_advice_addendum: SKIP, additional_properties: nil) ⇒ InvoiceDetails4
Returns a new instance of InvoiceDetails4.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 85 def initialize(purchase_order_number: SKIP, purchase_order_date: SKIP, purchase_contact_name: SKIP, taxable: SKIP, vat_invoice_reference_number: SKIP, commodity_code: SKIP, transaction_advice_addendum: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @purchase_order_number = purchase_order_number unless purchase_order_number == SKIP @purchase_order_date = purchase_order_date unless purchase_order_date == SKIP @purchase_contact_name = purchase_contact_name unless purchase_contact_name == SKIP @taxable = taxable unless taxable == SKIP unless vat_invoice_reference_number == SKIP @vat_invoice_reference_number = vat_invoice_reference_number end @commodity_code = commodity_code unless commodity_code == SKIP unless transaction_advice_addendum == SKIP @transaction_advice_addendum = transaction_advice_addendum end @additional_properties = additional_properties end |
Instance Attribute Details
#commodity_code ⇒ String
International description code of the overall order’s goods or services or the Categorizes purchases for VAT reporting. Contact your acquirer for a list of codes.
46 47 48 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 46 def commodity_code @commodity_code end |
#purchase_contact_name ⇒ String
The name of the individual or the company contacted for company authorized purchases.
25 26 27 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 25 def purchase_contact_name @purchase_contact_name end |
#purchase_order_date ⇒ String
Date the order was processed. Format: YYYY-MM-DD.
20 21 22 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 20 def purchase_order_date @purchase_order_date end |
#purchase_order_number ⇒ String
Value used by your customer to identify the order. This value is typically a purchase order number. CyberSource recommends that you do not populate the field with all zeros or nines.
16 17 18 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 16 def purchase_order_number @purchase_order_number end |
#taxable ⇒ TrueClass | FalseClass
Flag that indicates whether an order is taxable. This value must be true
if the sum of all lineItems.taxAmount values > 0.
If you do not include any lineItems[].taxAmount values in your request,
CyberSource does not include
invoiceDetails.taxable in the data it sends to the processor.
Possible values:
- true
- false
36 37 38 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 36 def taxable @taxable end |
#transaction_advice_addendum ⇒ Array[TransactionAdviceAddendum]
International description code of the overall order’s goods or services or the Categorizes purchases for VAT reporting. Contact your acquirer for a list of codes.
52 53 54 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 52 def transaction_advice_addendum @transaction_advice_addendum end |
#vat_invoice_reference_number ⇒ String
VAT invoice number associated with the transaction.
40 41 42 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 40 def vat_invoice_reference_number @vat_invoice_reference_number end |
Class Method Details
.from_element(root) ⇒ Object
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 153 def self.from_element(root) purchase_order_number = XmlUtilities.from_element(root, 'purchaseOrderNumber', String) purchase_order_date = XmlUtilities.from_element(root, 'purchaseOrderDate', String) purchase_contact_name = XmlUtilities.from_element(root, 'purchaseContactName', String) taxable = XmlUtilities.from_element(root, 'taxable', TrueClass) vat_invoice_reference_number = XmlUtilities.from_element( root, 'vatInvoiceReferenceNumber', String ) commodity_code = XmlUtilities.from_element(root, 'commodityCode', String) transaction_advice_addendum = XmlUtilities.from_element_to_array( root, 'TransactionAdviceAddendum', TransactionAdviceAddendum ) new(purchase_order_number: purchase_order_number, purchase_order_date: purchase_order_date, purchase_contact_name: purchase_contact_name, taxable: taxable, vat_invoice_reference_number: vat_invoice_reference_number, commodity_code: commodity_code, transaction_advice_addendum: transaction_advice_addendum, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
110 111 112 113 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 148 149 150 151 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 110 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. purchase_order_number = hash.key?('purchaseOrderNumber') ? hash['purchaseOrderNumber'] : SKIP purchase_order_date = hash.key?('purchaseOrderDate') ? hash['purchaseOrderDate'] : SKIP purchase_contact_name = hash.key?('purchaseContactName') ? hash['purchaseContactName'] : SKIP taxable = hash.key?('taxable') ? hash['taxable'] : SKIP vat_invoice_reference_number = hash.key?('vatInvoiceReferenceNumber') ? hash['vatInvoiceReferenceNumber'] : SKIP commodity_code = hash.key?('commodityCode') ? hash['commodityCode'] : SKIP # Parameter is an array, so we need to iterate through it transaction_advice_addendum = nil unless hash['transactionAdviceAddendum'].nil? transaction_advice_addendum = [] hash['transactionAdviceAddendum'].each do |structure| transaction_advice_addendum << (TransactionAdviceAddendum.from_hash(structure) if structure) end end transaction_advice_addendum = SKIP unless hash.key?('transactionAdviceAddendum') # 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. InvoiceDetails4.new(purchase_order_number: purchase_order_number, purchase_order_date: purchase_order_date, purchase_contact_name: purchase_contact_name, taxable: taxable, vat_invoice_reference_number: vat_invoice_reference_number, commodity_code: commodity_code, transaction_advice_addendum: transaction_advice_addendum, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 55 def self.names @_hash = {} if @_hash.nil? @_hash['purchase_order_number'] = 'purchaseOrderNumber' @_hash['purchase_order_date'] = 'purchaseOrderDate' @_hash['purchase_contact_name'] = 'purchaseContactName' @_hash['taxable'] = 'taxable' @_hash['vat_invoice_reference_number'] = 'vatInvoiceReferenceNumber' @_hash['commodity_code'] = 'commodityCode' @_hash['transaction_advice_addendum'] = 'transactionAdviceAddendum' @_hash end |
.nullables ⇒ Object
An array for nullable fields
81 82 83 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 81 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 68 def self.optionals %w[ purchase_order_number purchase_order_date purchase_contact_name taxable vat_invoice_reference_number commodity_code transaction_advice_addendum ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
214 215 216 217 218 219 220 221 222 223 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 214 def inspect class_name = self.class.name.split('::').last "<#{class_name} purchase_order_number: #{@purchase_order_number.inspect},"\ " purchase_order_date: #{@purchase_order_date.inspect}, purchase_contact_name:"\ " #{@purchase_contact_name.inspect}, taxable: #{@taxable.inspect},"\ " vat_invoice_reference_number: #{@vat_invoice_reference_number.inspect}, commodity_code:"\ " #{@commodity_code.inspect}, transaction_advice_addendum:"\ " #{@transaction_advice_addendum.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
204 205 206 207 208 209 210 211 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 204 def to_s class_name = self.class.name.split('::').last "<#{class_name} purchase_order_number: #{@purchase_order_number}, purchase_order_date:"\ " #{@purchase_order_date}, purchase_contact_name: #{@purchase_contact_name}, taxable:"\ " #{@taxable}, vat_invoice_reference_number: #{@vat_invoice_reference_number},"\ " commodity_code: #{@commodity_code}, transaction_advice_addendum:"\ " #{@transaction_advice_addendum}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/cyber_source_merged_spec/models/invoice_details4.rb', line 181 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'purchaseOrderNumber', purchase_order_number) XmlUtilities.add_as_subelement(doc, root, 'purchaseOrderDate', purchase_order_date) XmlUtilities.add_as_subelement(doc, root, 'purchaseContactName', purchase_contact_name) XmlUtilities.add_as_subelement(doc, root, 'taxable', taxable) XmlUtilities.add_as_subelement(doc, root, 'vatInvoiceReferenceNumber', vat_invoice_reference_number) XmlUtilities.add_as_subelement(doc, root, 'commodityCode', commodity_code) XmlUtilities.add_array_as_subelement(doc, root, 'TransactionAdviceAddendum', transaction_advice_addendum) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |