cxml-ruby 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +23 -0
- data/.gitignore +14 -0
- data/.rspec +1 -0
- data/.rubocop.yml +175 -0
- data/Gemfile +2 -0
- data/LICENSE +18 -0
- data/README.md +94 -0
- data/Rakefile +6 -0
- data/cxml-ruby.gemspec +27 -0
- data/lib/cxml/accounting.rb +27 -0
- data/lib/cxml/additional_cost.rb +10 -0
- data/lib/cxml/additional_deduction.rb +12 -0
- data/lib/cxml/address.rb +16 -0
- data/lib/cxml/bill_to.rb +10 -0
- data/lib/cxml/browser_form_post.rb +13 -0
- data/lib/cxml/charge.rb +9 -0
- data/lib/cxml/classification.rb +9 -0
- data/lib/cxml/confirmation_header.rb +16 -0
- data/lib/cxml/confirmation_item.rb +14 -0
- data/lib/cxml/confirmation_request.rb +25 -0
- data/lib/cxml/confirmation_status.rb +32 -0
- data/lib/cxml/contact.rb +16 -0
- data/lib/cxml/country.rb +9 -0
- data/lib/cxml/credential.rb +49 -0
- data/lib/cxml/credential_mac.rb +26 -0
- data/lib/cxml/deducted_price.rb +9 -0
- data/lib/cxml/deduction_amount.rb +9 -0
- data/lib/cxml/description.rb +9 -0
- data/lib/cxml/discount.rb +10 -0
- data/lib/cxml/discount_percent.rb +9 -0
- data/lib/cxml/distribution.rb +11 -0
- data/lib/cxml/document.rb +71 -0
- data/lib/cxml/document_node.rb +126 -0
- data/lib/cxml/document_reference.rb +9 -0
- data/lib/cxml/due_amount.rb +9 -0
- data/lib/cxml/email.rb +10 -0
- data/lib/cxml/errors.rb +7 -0
- data/lib/cxml/extrinsic.rb +10 -0
- data/lib/cxml/from.rb +9 -0
- data/lib/cxml/gross_amount.rb +9 -0
- data/lib/cxml/header.rb +29 -0
- data/lib/cxml/id_reference.rb +13 -0
- data/lib/cxml/invoice_detail_discount.rb +13 -0
- data/lib/cxml/invoice_detail_header_indicator.rb +11 -0
- data/lib/cxml/invoice_detail_header_order.rb +24 -0
- data/lib/cxml/invoice_detail_item.rb +55 -0
- data/lib/cxml/invoice_detail_item_reference.rb +17 -0
- data/lib/cxml/invoice_detail_line_indicator.rb +14 -0
- data/lib/cxml/invoice_detail_line_shipping.rb +11 -0
- data/lib/cxml/invoice_detail_line_special_handling.rb +11 -0
- data/lib/cxml/invoice_detail_order.rb +24 -0
- data/lib/cxml/invoice_detail_order_info.rb +10 -0
- data/lib/cxml/invoice_detail_order_summary.rb +32 -0
- data/lib/cxml/invoice_detail_request.rb +40 -0
- data/lib/cxml/invoice_detail_request_header.rb +54 -0
- data/lib/cxml/invoice_detail_shipping.rb +27 -0
- data/lib/cxml/invoice_detail_summary.rb +18 -0
- data/lib/cxml/invoice_id_info.rb +10 -0
- data/lib/cxml/invoice_partner.rb +10 -0
- data/lib/cxml/item_detail.rb +27 -0
- data/lib/cxml/item_id.rb +10 -0
- data/lib/cxml/item_in.rb +14 -0
- data/lib/cxml/item_out.rb +17 -0
- data/lib/cxml/master_agreement_reference.rb +9 -0
- data/lib/cxml/message.rb +13 -0
- data/lib/cxml/modification.rb +15 -0
- data/lib/cxml/modification_detail.rb +16 -0
- data/lib/cxml/modifications.rb +23 -0
- data/lib/cxml/money.rb +35 -0
- data/lib/cxml/name.rb +9 -0
- data/lib/cxml/net_amount.rb +9 -0
- data/lib/cxml/order_reference.rb +12 -0
- data/lib/cxml/order_request.rb +33 -0
- data/lib/cxml/order_request_header.rb +66 -0
- data/lib/cxml/parser.rb +37 -0
- data/lib/cxml/payment_term.rb +28 -0
- data/lib/cxml/period.rb +10 -0
- data/lib/cxml/postal_address.rb +35 -0
- data/lib/cxml/protocol.rb +57 -0
- data/lib/cxml/punch_out_order_message.rb +33 -0
- data/lib/cxml/punch_out_order_message_header.rb +20 -0
- data/lib/cxml/punch_out_setup_request.rb +31 -0
- data/lib/cxml/punch_out_setup_response.rb +9 -0
- data/lib/cxml/request.rb +21 -0
- data/lib/cxml/response.rb +20 -0
- data/lib/cxml/segment.rb +12 -0
- data/lib/cxml/sender.rb +10 -0
- data/lib/cxml/ship_to.rb +10 -0
- data/lib/cxml/shipping.rb +10 -0
- data/lib/cxml/shipping_amount.rb +10 -0
- data/lib/cxml/special_handling_amount.rb +11 -0
- data/lib/cxml/start_page.rb +13 -0
- data/lib/cxml/state.rb +9 -0
- data/lib/cxml/status.rb +27 -0
- data/lib/cxml/subtotal_amount.rb +9 -0
- data/lib/cxml/supplier_setup.rb +13 -0
- data/lib/cxml/tax.rb +42 -0
- data/lib/cxml/tax_adjustment_amount.rb +9 -0
- data/lib/cxml/tax_amount.rb +9 -0
- data/lib/cxml/tax_detail.rb +44 -0
- data/lib/cxml/tax_location.rb +9 -0
- data/lib/cxml/taxable_amount.rb +9 -0
- data/lib/cxml/to.rb +9 -0
- data/lib/cxml/total.rb +10 -0
- data/lib/cxml/total_allowances.rb +9 -0
- data/lib/cxml/total_amount_without_tax.rb +9 -0
- data/lib/cxml/total_charges.rb +9 -0
- data/lib/cxml/unit_price.rb +9 -0
- data/lib/cxml/version.rb +5 -0
- data/lib/cxml.rb +39 -0
- data/spec/credential_spec.rb +37 -0
- data/spec/cxml_spec.rb +6 -0
- data/spec/document_spec.rb +155 -0
- data/spec/fixtures/.gitkeep +0 -0
- data/spec/fixtures/envelope.xml +31 -0
- data/spec/fixtures/envelope2.xml +36 -0
- data/spec/fixtures/invoice_backed_and_unbacked_by_pos.xml +106 -0
- data/spec/fixtures/invoice_backed_by_multiple_pos.xml +97 -0
- data/spec/fixtures/invoice_taxes_at_line.xml +82 -0
- data/spec/fixtures/invoice_taxes_at_line_multiple_taxes.xml +403 -0
- data/spec/fixtures/invoice_taxes_at_total.xml +78 -0
- data/spec/fixtures/item_in.xml +11 -0
- data/spec/fixtures/order_request.cxml +121 -0
- data/spec/fixtures/punch_out_order_message_doc.xml +32 -0
- data/spec/fixtures/punch_out_setup_request_doc.xml +32 -0
- data/spec/fixtures/punch_out_setup_request_doc_coupa.xml +42 -0
- data/spec/fixtures/punch_out_setup_request_doc_with_ship_to.xml +46 -0
- data/spec/fixtures/purchase_order_request_200.xml +132 -0
- data/spec/fixtures/request_doc.xml +79 -0
- data/spec/fixtures/response_status_200.xml +11 -0
- data/spec/fixtures/response_status_400.xml +5 -0
- data/spec/header_spec.rb +54 -0
- data/spec/invoice_detail_request_spec.rb +88 -0
- data/spec/item_detail_spec.rb +44 -0
- data/spec/item_id_spec.rb +40 -0
- data/spec/item_in_spec.rb +41 -0
- data/spec/money_spec.rb +44 -0
- data/spec/parser_spec.rb +6 -0
- data/spec/protocol_spec.rb +16 -0
- data/spec/punch_out_order_message_header_spec.rb +36 -0
- data/spec/punch_out_order_message_spec.rb +43 -0
- data/spec/punch_out_setup_request_spec.rb +60 -0
- data/spec/purchase_order_request_spec.rb +40 -0
- data/spec/request_spec.rb +36 -0
- data/spec/response_spec.rb +58 -0
- data/spec/sender_spec.rb +32 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/status_spec.rb +44 -0
- data/spec/support/helpers.rb +5 -0
- metadata +317 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# The CredentialMac element is used for the Message Authentication Code (MAC)
|
|
4
|
+
# authentication method. This authentication method is used in situations where the
|
|
5
|
+
# sender must prove to the receiver that it has been authenticated by shared secret by a
|
|
6
|
+
# trusted third party. For example, a direct PunchOut request can travel directly from a
|
|
7
|
+
# buyer to a supplier without going through a network commerce hub, because it
|
|
8
|
+
# contains a MAC (generated by the network commerce hub) that allows the supplier to
|
|
9
|
+
# authenticate it.
|
|
10
|
+
# The trusted third party computes the MAC and transfers it to the sender through the
|
|
11
|
+
# Profile transaction. The MAC is opaque to the sender (it is secure and non-reversible).
|
|
12
|
+
# To see how the MAC is transmitted from the trusted third party to the sender, see
|
|
13
|
+
# "ProfileResponse" on page 63.
|
|
14
|
+
#
|
|
15
|
+
# Page 45 cXML reference
|
|
16
|
+
|
|
17
|
+
module CXML
|
|
18
|
+
class CredentialMac < DocumentNode
|
|
19
|
+
accessible_attributes %i[
|
|
20
|
+
type
|
|
21
|
+
algorithm
|
|
22
|
+
creation_date
|
|
23
|
+
expiration_date
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require('time')
|
|
4
|
+
|
|
5
|
+
module CXML
|
|
6
|
+
class Document < DocumentNode
|
|
7
|
+
accessible_attributes %i[
|
|
8
|
+
version
|
|
9
|
+
payload_id
|
|
10
|
+
xml_lang
|
|
11
|
+
timestamp
|
|
12
|
+
]
|
|
13
|
+
accessible_nodes %i[
|
|
14
|
+
header
|
|
15
|
+
message
|
|
16
|
+
request
|
|
17
|
+
response
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
def initialize_timestamp(value)
|
|
21
|
+
@timestamp = Time.parse(value)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def timestamp
|
|
25
|
+
@timestamp ||= Time.now.utc
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def version
|
|
29
|
+
@version ||= '1.2.037'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def from_xml(xml_string)
|
|
33
|
+
initialize(Parser.new.parse(xml_string))
|
|
34
|
+
self
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Check if document is request
|
|
38
|
+
# @return [Boolean]
|
|
39
|
+
def request?
|
|
40
|
+
!request.nil?
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Check if document is a response
|
|
44
|
+
# @return [Boolean]
|
|
45
|
+
def response?
|
|
46
|
+
!response.nil?
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Check if document is a message
|
|
50
|
+
# @return [Boolean]
|
|
51
|
+
def message?
|
|
52
|
+
!message.nil?
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def render
|
|
56
|
+
node = CXML.builder
|
|
57
|
+
node.doc.create_internal_subset(
|
|
58
|
+
'cXML',
|
|
59
|
+
nil,
|
|
60
|
+
"http://xml.cxml.org/schemas/cXML/#{version}/cXML.dtd"
|
|
61
|
+
)
|
|
62
|
+
node.cXML(node_attributes) do |doc|
|
|
63
|
+
header&.render(doc)
|
|
64
|
+
request&.render(doc)
|
|
65
|
+
response&.render(doc)
|
|
66
|
+
message&.render(doc)
|
|
67
|
+
end
|
|
68
|
+
node
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
# base class for document nodes
|
|
5
|
+
class DocumentNode
|
|
6
|
+
attr_accessor :content
|
|
7
|
+
|
|
8
|
+
def self.accessible_attributes(attrs)
|
|
9
|
+
raise(ArgumentError) unless attrs.is_a?(Array)
|
|
10
|
+
|
|
11
|
+
@attributes = attrs
|
|
12
|
+
attr_accessor(*attrs)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.attributes
|
|
16
|
+
@attributes || []
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.accessible_nodes(new_nodes)
|
|
20
|
+
raise(ArgumentError) unless new_nodes.is_a?(Array)
|
|
21
|
+
|
|
22
|
+
@nodes = new_nodes
|
|
23
|
+
attr_accessor(*new_nodes)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.nodes
|
|
27
|
+
@nodes || []
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def initialize(data = {})
|
|
31
|
+
if data.is_a?(String)
|
|
32
|
+
@content = data
|
|
33
|
+
return
|
|
34
|
+
end
|
|
35
|
+
data = data.serializable_hash if data.is_a?(self.class)
|
|
36
|
+
return unless data.is_a?(Hash)
|
|
37
|
+
|
|
38
|
+
data.each(&method(:initialize_attribute))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def serializable_hash
|
|
42
|
+
(self.class.attributes + self.class.nodes + [:content]).each_with_object({}) do |attr, obj|
|
|
43
|
+
value = send(attr)
|
|
44
|
+
value = value.iso8601 if value.is_a?(Time)
|
|
45
|
+
next if value.respond_to?(:empty?) ? value.empty? : !value
|
|
46
|
+
|
|
47
|
+
obj[attr] = value.is_a?(DocumentNode) ? value.serializable_hash : value
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def render(node = CXML.builder)
|
|
52
|
+
node.send(self.class.name.split('::').last, node_attributes) do |n|
|
|
53
|
+
n.text(content) if content
|
|
54
|
+
render_nodes(n)
|
|
55
|
+
end
|
|
56
|
+
node
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def render_nodes(node)
|
|
60
|
+
self.class.nodes.each do |child_node_name|
|
|
61
|
+
child_value = send(child_node_name)
|
|
62
|
+
if child_value.is_a?(Array)
|
|
63
|
+
child_value.each do |child_value_n|
|
|
64
|
+
render_child_node(node, child_node_name, child_value_n)
|
|
65
|
+
end
|
|
66
|
+
else
|
|
67
|
+
render_child_node(node, child_node_name, child_value)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def render_child_node(node, name, value)
|
|
75
|
+
return if value.respond_to?(:empty?) ? value.empty? : !value
|
|
76
|
+
|
|
77
|
+
if value.is_a?(DocumentNode)
|
|
78
|
+
value.render(node)
|
|
79
|
+
else
|
|
80
|
+
node.send(camelize(name), value)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def node_attributes
|
|
85
|
+
self.class.attributes.each_with_object({}) do |attr, obj|
|
|
86
|
+
value = send(attr)
|
|
87
|
+
value = value.iso8601 if value.is_a?(Time)
|
|
88
|
+
next if value.respond_to?(:empty?) ? value.empty? : !value
|
|
89
|
+
|
|
90
|
+
string_attr = if attr.to_sym == :xml_lang
|
|
91
|
+
'xml:lang'
|
|
92
|
+
else
|
|
93
|
+
camelize(attr, false)
|
|
94
|
+
end
|
|
95
|
+
obj[string_attr] = value
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def initialize_attribute(key, val)
|
|
100
|
+
return send("initialize_#{key}", val) if respond_to?("initialize_#{key}")
|
|
101
|
+
return send("#{key}=", val) if self.class.attributes.include?(key)
|
|
102
|
+
|
|
103
|
+
klass = "CXML::#{camelize(key)}"
|
|
104
|
+
send("#{key}=", Object.const_get(klass).new(val))
|
|
105
|
+
rescue NoMethodError => e
|
|
106
|
+
raise(UnknownAttributeError, e) if CXML.raise_unknown_elements
|
|
107
|
+
|
|
108
|
+
CXML.logger.warn(e)
|
|
109
|
+
rescue NameError => e
|
|
110
|
+
raise(e) unless e.to_s.match?(klass)
|
|
111
|
+
|
|
112
|
+
send("#{key}=", val)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def camelize(string, uppercase_first_letter = true)
|
|
116
|
+
string = if uppercase_first_letter
|
|
117
|
+
string.to_s.sub(/^[a-z\d]*/, &:capitalize)
|
|
118
|
+
else
|
|
119
|
+
string.to_s.sub(/^(?:(?=\b|[A-Z_])|\w)/, &:downcase)
|
|
120
|
+
end
|
|
121
|
+
string.gsub(/_id(_)?$/, '_ID\1').gsub(%r{(?:_|(/))([a-z\d]*)}) do
|
|
122
|
+
"#{Regexp.last_match(1)}#{Regexp.last_match(2).capitalize}"
|
|
123
|
+
end.gsub('/', '::')
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
data/lib/cxml/email.rb
ADDED
data/lib/cxml/errors.rb
ADDED
data/lib/cxml/from.rb
ADDED
data/lib/cxml/header.rb
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# The Header element contains addressing and authentication information. The Header
|
|
4
|
+
# element is the same regardless of the specific Request or Response within the body of
|
|
5
|
+
# the cXML message. Applications need the requestor's identity, but not validation that
|
|
6
|
+
# the information provided for identity is correct.
|
|
7
|
+
#
|
|
8
|
+
# The From and To elements are synonymous with From and To in SMTP mail
|
|
9
|
+
# messages; they are the logical source and destination of the messages. Sender is the
|
|
10
|
+
# party that opens the HTTP connection and sends the cXML document.
|
|
11
|
+
# Sender contains the Credential element, which allows the receiving party to authenticate
|
|
12
|
+
# the sending party. This credential allows strong authentication without requiring a
|
|
13
|
+
# public-key end-to-end digital certificate infrastructure. Only a user name and
|
|
14
|
+
# password need to be issued by the receiving party to allow the sending party to
|
|
15
|
+
# perform Requests.
|
|
16
|
+
#
|
|
17
|
+
# When the document is initially sent, Sender and From are the same, However, if the
|
|
18
|
+
# cXML document travels through e-commerce network hubs, the Sender element
|
|
19
|
+
# changes to indicate current sending party.
|
|
20
|
+
|
|
21
|
+
module CXML
|
|
22
|
+
class Header < DocumentNode
|
|
23
|
+
accessible_nodes %i[
|
|
24
|
+
from
|
|
25
|
+
to
|
|
26
|
+
sender
|
|
27
|
+
]
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailHeaderOrder < DocumentNode
|
|
5
|
+
accessible_nodes %i[
|
|
6
|
+
invoice_detail_order_info
|
|
7
|
+
invoice_detail_order_summaries
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
def initialize_invoice_detail_order_summary(value)
|
|
11
|
+
value = [value] unless value.is_a?(Array)
|
|
12
|
+
@invoice_detail_order_summaries = value.map do |item|
|
|
13
|
+
InvoiceDetailOrderSummary.new(item)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def initialize_invoice_detail_order_summaries(value)
|
|
18
|
+
value = [value] unless value.is_a?(Array)
|
|
19
|
+
@invoice_detail_order_summaries = value.map do |item|
|
|
20
|
+
InvoiceDetailOrderSummary.new(item)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailItem < DocumentNode
|
|
5
|
+
accessible_attributes %i[
|
|
6
|
+
composite_item_type
|
|
7
|
+
inspection_date
|
|
8
|
+
invoice_line_number
|
|
9
|
+
is_ad_hoc
|
|
10
|
+
item_type
|
|
11
|
+
parent_invoice_line_number
|
|
12
|
+
quantity
|
|
13
|
+
reason
|
|
14
|
+
reference_date
|
|
15
|
+
]
|
|
16
|
+
accessible_nodes %i[
|
|
17
|
+
comments
|
|
18
|
+
distribution
|
|
19
|
+
extrinsics
|
|
20
|
+
gross_amount
|
|
21
|
+
invoice_detail_discount
|
|
22
|
+
invoice_detail_item_industry
|
|
23
|
+
invoice_detail_item_reference
|
|
24
|
+
invoice_detail_line_shipping
|
|
25
|
+
invoice_detail_line_special_handling
|
|
26
|
+
invoice_item_modifications
|
|
27
|
+
net_amount
|
|
28
|
+
packaging
|
|
29
|
+
price_basis_quantity
|
|
30
|
+
ship_notice_id_info
|
|
31
|
+
ship_notice_line_item_reference
|
|
32
|
+
subtotal_amount
|
|
33
|
+
tax
|
|
34
|
+
total_allowances
|
|
35
|
+
total_amount_without_tax
|
|
36
|
+
total_charges
|
|
37
|
+
unit_of_measure
|
|
38
|
+
unit_price
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
def initialize_extrinsic(value)
|
|
42
|
+
value = [value] unless value.is_a?(Array)
|
|
43
|
+
@extrinsics = value.map do |item|
|
|
44
|
+
Extrinsic.new(item)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def initialize_extrinsics(value)
|
|
49
|
+
value = [value] unless value.is_a?(Array)
|
|
50
|
+
@extrinsics = value.map do |item|
|
|
51
|
+
Extrinsic.new(item)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailItemReference < DocumentNode
|
|
5
|
+
accessible_attributes %i[
|
|
6
|
+
line_number
|
|
7
|
+
]
|
|
8
|
+
accessible_nodes %i[
|
|
9
|
+
description
|
|
10
|
+
item_id
|
|
11
|
+
classification
|
|
12
|
+
manufacturer_part_id
|
|
13
|
+
manufacturer_name
|
|
14
|
+
country
|
|
15
|
+
]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailLineIndicator < DocumentNode
|
|
5
|
+
accessible_attributes %i[
|
|
6
|
+
is_tax_in_line
|
|
7
|
+
is_special_handling_in_line
|
|
8
|
+
is_shipping_in_line
|
|
9
|
+
is_discount_in_line
|
|
10
|
+
is_accounting_in_line
|
|
11
|
+
is_price_adjustment_in_line
|
|
12
|
+
]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailOrder < DocumentNode
|
|
5
|
+
accessible_nodes %i[
|
|
6
|
+
invoice_detail_order_info
|
|
7
|
+
invoice_detail_items
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
def initialize_invoice_detail_item(value)
|
|
11
|
+
value = [value] unless value.is_a?(Array)
|
|
12
|
+
@invoice_detail_items = value.map do |item|
|
|
13
|
+
InvoiceDetailItem.new(item)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def initialize_invoice_detail_items(value)
|
|
18
|
+
value = [value] unless value.is_a?(Array)
|
|
19
|
+
@invoice_detail_items = value.map do |item|
|
|
20
|
+
InvoiceDetailItem.new(item)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailOrderSummary < DocumentNode
|
|
5
|
+
accessible_attributes %i[
|
|
6
|
+
invoice_line_number
|
|
7
|
+
inspection_date
|
|
8
|
+
]
|
|
9
|
+
accessible_nodes %i[
|
|
10
|
+
subtotal_amount
|
|
11
|
+
period
|
|
12
|
+
tax
|
|
13
|
+
invoice_detail_line_special_handling
|
|
14
|
+
invoice_detail_line_shipping
|
|
15
|
+
gross_amount
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
def initialize_invoice_detail_order_summary(value)
|
|
19
|
+
value = [value] unless value.is_a?(Array)
|
|
20
|
+
@invoice_detail_order_summaries = value.map do |item|
|
|
21
|
+
InvoiceDetailOrderSummary.new(item)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def initialize_invoice_detail_order_summaries(value)
|
|
26
|
+
value = [value] unless value.is_a?(Array)
|
|
27
|
+
@invoice_detail_order_summaries = value.map do |item|
|
|
28
|
+
InvoiceDetailOrderSummary.new(item)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CXML
|
|
4
|
+
class InvoiceDetailRequest < DocumentNode
|
|
5
|
+
accessible_nodes %i[
|
|
6
|
+
invoice_detail_request_header
|
|
7
|
+
invoice_detail_header_orders
|
|
8
|
+
invoice_detail_orders
|
|
9
|
+
invoice_detail_summary
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
def initialize_invoice_detail_orders(value)
|
|
13
|
+
value = [value] unless value.is_a?(Array)
|
|
14
|
+
@invoice_detail_orders = value.map do |item|
|
|
15
|
+
InvoiceDetailOrder.new(item)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def initialize_invoice_detail_order(value)
|
|
20
|
+
value = [value] unless value.is_a?(Array)
|
|
21
|
+
@invoice_detail_orders = value.map do |item|
|
|
22
|
+
InvoiceDetailOrder.new(item)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize_invoice_detail_header_orders(value)
|
|
27
|
+
value = [value] unless value.is_a?(Array)
|
|
28
|
+
@invoice_detail_header_orders = value.map do |item|
|
|
29
|
+
InvoiceDetailHeaderOrder.new(item)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def initialize_invoice_detail_header_order(value)
|
|
34
|
+
value = [value] unless value.is_a?(Array)
|
|
35
|
+
@invoice_detail_header_orders = value.map do |item|
|
|
36
|
+
InvoiceDetailHeaderOrder.new(item)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|