mrglass-qbxml 1.0.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/.gitignore +21 -0
- data/.travis.yml +26 -0
- data/Appraisals +23 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +86 -0
- data/Rakefile +7 -0
- data/gemfiles/rails_5.0.gemfile +7 -0
- data/gemfiles/rails_5.0.gemfile.lock +69 -0
- data/gemfiles/rails_5.1.gemfile +7 -0
- data/gemfiles/rails_5.1.gemfile.lock +69 -0
- data/gemfiles/rails_5.2.gemfile +7 -0
- data/gemfiles/rails_5.2.gemfile.lock +69 -0
- data/gemfiles/rails_6.0.gemfile +7 -0
- data/gemfiles/rails_6.0.gemfile.lock +71 -0
- data/gemfiles/rails_6.1.gemfile +7 -0
- data/gemfiles/rails_6.1.gemfile.lock +70 -0
- data/lib/qbxml/hash.rb +188 -0
- data/lib/qbxml/qbxml.rb +124 -0
- data/lib/qbxml/types.rb +45 -0
- data/lib/qbxml/version.rb +3 -0
- data/lib/qbxml.rb +11 -0
- data/qbxml.gemspec +29 -0
- data/schema/qbposxmlops30.xml +8343 -0
- data/schema/qbxmlops100.xml +30100 -0
- data/schema/qbxmlops110.xml +32241 -0
- data/schema/qbxmlops120.xml +34129 -0
- data/schema/qbxmlops130.xml +35788 -0
- data/schema/qbxmlops140.xml +35792 -0
- data/schema/qbxmlops20.xml +13140 -0
- data/schema/qbxmlops30.xml +18229 -0
- data/schema/qbxmlops40.xml +19811 -0
- data/schema/qbxmlops41.xml +19979 -0
- data/schema/qbxmlops50.xml +29931 -0
- data/schema/qbxmlops60.xml +24555 -0
- data/schema/qbxmlops70.xml +29844 -0
- data/schema/qbxmlops80.xml +28447 -0
- data/schema/qbxmlopsCA30.xml +18409 -0
- data/spec/backwards_compatibility.rb +26 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/requests/account_query_rq.xml +8 -0
- data/spec/support/requests/customer_add_rq.xml +28 -0
- data/spec/support/requests/customer_query_iterator_rq.xml +11 -0
- data/spec/support/requests/customer_query_rq.xml +9 -0
- data/spec/support/requests/estimate_add_rq.xml +45 -0
- data/spec/support/requests/invoice_add_rq.xml +40 -0
- data/spec/support/requests/item_inventory_add_rq.xml +22 -0
- data/spec/support/requests/purchase_order_query_rq.xml +14 -0
- data/spec/support/requests/receive_payment_add_rq.xml +35 -0
- data/spec/support/requests/receive_payment_query_rq.xml +9 -0
- data/spec/support/requests/sales_receipt_add_rq.xml +49 -0
- data/spec/support/responses/account_query_rs.xml +42 -0
- data/spec/support/responses/customer_add_rs.xml +37 -0
- data/spec/support/responses/customer_query_rs.xml +49 -0
- data/spec/support/responses/customer_query_terator_rs.xml +34 -0
- data/spec/support/responses/item_inventory_add_rs.xml +40 -0
- data/spec/support/responses/purchase_order_query_rs.xml +84 -0
- data/spec/support/responses/receive_payment_query_rs.xml +51 -0
- data/spec/support/responses/sales_receipt_add_rs.xml +89 -0
- data/test/unit/hash_to_xml_test.rb +78 -0
- data/test/unit/version_test.rb +24 -0
- data/test/unit/xml_to_hash_test.rb +281 -0
- metadata +242 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<QBXML>
|
|
3
|
+
<QBXMLMsgsRs>
|
|
4
|
+
<ReceivePaymentQueryRs requestID="UmVjZWl2ZVBheW1lbnRRdWVyeXwyNDg0LTEyNjM0OTkyMzE=" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
|
|
5
|
+
<ReceivePaymentRet>
|
|
6
|
+
<TxnID>2484-1263499231</TxnID>
|
|
7
|
+
<TimeCreated>2010-01-14T12:00:31-08:00</TimeCreated>
|
|
8
|
+
<TimeModified>2010-10-03T19:15:35-08:00</TimeModified>
|
|
9
|
+
<EditSequence>1286158535</EditSequence>
|
|
10
|
+
<TxnNumber>1664</TxnNumber>
|
|
11
|
+
<CustomerRef>
|
|
12
|
+
<ListID>800002FB-1263497272</ListID>
|
|
13
|
+
<FullName>Greg F</FullName>
|
|
14
|
+
</CustomerRef>
|
|
15
|
+
<ARAccountRef>
|
|
16
|
+
<ListID>80000068-1257362264</ListID>
|
|
17
|
+
<FullName>Accounts Receivable - USD</FullName>
|
|
18
|
+
</ARAccountRef>
|
|
19
|
+
<TxnDate>2009-10-02</TxnDate>
|
|
20
|
+
<RefNumber>101</RefNumber>
|
|
21
|
+
<TotalAmount>112.35</TotalAmount>
|
|
22
|
+
<PaymentMethodRef>
|
|
23
|
+
<ListID>80000005-1257354059</ListID>
|
|
24
|
+
<FullName>Visa</FullName>
|
|
25
|
+
</PaymentMethodRef>
|
|
26
|
+
<DepositToAccountRef>
|
|
27
|
+
<ListID>8000006A-1257362708</ListID>
|
|
28
|
+
<FullName>Undeposited Funds</FullName>
|
|
29
|
+
</DepositToAccountRef>
|
|
30
|
+
<CreditCardTxnInfo>
|
|
31
|
+
<CreditCardTxnInputInfo>
|
|
32
|
+
<CreditCardNumber>xxxxxxxxxxxx1234</CreditCardNumber>
|
|
33
|
+
<ExpirationMonth>1</ExpirationMonth>
|
|
34
|
+
<ExpirationYear>2011</ExpirationYear>
|
|
35
|
+
<TransactionMode>CardNotPresent</TransactionMode>
|
|
36
|
+
</CreditCardTxnInputInfo>
|
|
37
|
+
</CreditCardTxnInfo>
|
|
38
|
+
<UnusedPayment>0.00</UnusedPayment>
|
|
39
|
+
<UnusedCredits>0.00</UnusedCredits>
|
|
40
|
+
<AppliedToTxnRet>
|
|
41
|
+
<TxnID>244B-1263497335</TxnID>
|
|
42
|
+
<TxnType>Invoice</TxnType>
|
|
43
|
+
<TxnDate>2009-09-30</TxnDate>
|
|
44
|
+
<RefNumber>OP13988</RefNumber>
|
|
45
|
+
<BalanceRemaining>0.00</BalanceRemaining>
|
|
46
|
+
<Amount>112.35</Amount>
|
|
47
|
+
</AppliedToTxnRet>
|
|
48
|
+
</ReceivePaymentRet>
|
|
49
|
+
</ReceivePaymentQueryRs>
|
|
50
|
+
</QBXMLMsgsRs>
|
|
51
|
+
</QBXML>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<?xml version="1.0" ?>
|
|
2
|
+
<QBXML>
|
|
3
|
+
<QBXMLMsgsRs>
|
|
4
|
+
<SalesReceiptAddRs requestID="U2FsZXNSZWNlaXB0QWRkfDE2NDY2" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
|
|
5
|
+
<SalesReceiptRet>
|
|
6
|
+
<TxnID>141CA5-1231522949</TxnID>
|
|
7
|
+
<TimeCreated>2009-01-09T12:42:29-05:00</TimeCreated>
|
|
8
|
+
<TimeModified>2009-01-09T12:42:29-05:00</TimeModified>
|
|
9
|
+
<EditSequence>1231522949</EditSequence>
|
|
10
|
+
<TxnNumber>64951</TxnNumber>
|
|
11
|
+
<CustomerRef>
|
|
12
|
+
<ListID>80003579-1231522938</ListID>
|
|
13
|
+
<FullName>Test, Tom</FullName>
|
|
14
|
+
</CustomerRef>
|
|
15
|
+
<TemplateRef>
|
|
16
|
+
<ListID>E0000-1129903256</ListID>
|
|
17
|
+
<FullName>Custom Sales Receipt</FullName>
|
|
18
|
+
</TemplateRef>
|
|
19
|
+
<TxnDate>2009-01-09</TxnDate>
|
|
20
|
+
<RefNumber>16466</RefNumber>
|
|
21
|
+
<BillAddress>
|
|
22
|
+
<Addr1>Tom Test</Addr1>
|
|
23
|
+
<Addr2>123 Test St</Addr2>
|
|
24
|
+
<City>Concord</City>
|
|
25
|
+
<State>MA</State>
|
|
26
|
+
<PostalCode>01742</PostalCode>
|
|
27
|
+
<Country>USA</Country>
|
|
28
|
+
</BillAddress>
|
|
29
|
+
<BillAddressBlock>
|
|
30
|
+
<Addr1>Tom Test</Addr1>
|
|
31
|
+
<Addr3>123 Test St</Addr3>
|
|
32
|
+
<Addr4>Concord, Massachusetts 01742</Addr4>
|
|
33
|
+
<Addr5>United States</Addr5>
|
|
34
|
+
</BillAddressBlock>
|
|
35
|
+
<IsPending>true</IsPending>
|
|
36
|
+
<DueDate>2009-01-09</DueDate>
|
|
37
|
+
<ShipDate>2009-01-09</ShipDate>
|
|
38
|
+
<Subtotal>150.00</Subtotal>
|
|
39
|
+
<ItemSalesTaxRef>
|
|
40
|
+
<ListID>20C0000-1129494968</ListID>
|
|
41
|
+
<FullName>MA State Tax</FullName>
|
|
42
|
+
</ItemSalesTaxRef>
|
|
43
|
+
<SalesTaxPercentage>5.00</SalesTaxPercentage>
|
|
44
|
+
<SalesTaxTotal>0.00</SalesTaxTotal>
|
|
45
|
+
<TotalAmount>150.00</TotalAmount>
|
|
46
|
+
<IsToBePrinted>true</IsToBePrinted>
|
|
47
|
+
<IsToBeEmailed>false</IsToBeEmailed>
|
|
48
|
+
<CustomerSalesTaxCodeRef>
|
|
49
|
+
<ListID>10000-1128983215</ListID>
|
|
50
|
+
<FullName>Tax</FullName>
|
|
51
|
+
</CustomerSalesTaxCodeRef>
|
|
52
|
+
<DepositToAccountRef>
|
|
53
|
+
<ListID>960000-1129903123</ListID>
|
|
54
|
+
<FullName>*Undeposited Funds</FullName>
|
|
55
|
+
</DepositToAccountRef>
|
|
56
|
+
<SalesReceiptLineRet>
|
|
57
|
+
<TxnLineID>141CA7-1231522949</TxnLineID>
|
|
58
|
+
<ItemRef>
|
|
59
|
+
<ListID>200001-1143815300</ListID>
|
|
60
|
+
<FullName>gift certificate</FullName>
|
|
61
|
+
</ItemRef>
|
|
62
|
+
<Desc>$150.00 gift certificate</Desc>
|
|
63
|
+
<Quantity>1</Quantity>
|
|
64
|
+
<Rate>150.00</Rate>
|
|
65
|
+
<Amount>150.00</Amount>
|
|
66
|
+
<SalesTaxCodeRef>
|
|
67
|
+
<ListID>20000-1128983215</ListID>
|
|
68
|
+
<FullName>Non</FullName>
|
|
69
|
+
</SalesTaxCodeRef>
|
|
70
|
+
</SalesReceiptLineRet>
|
|
71
|
+
<SalesReceiptLineRet>
|
|
72
|
+
<TxnLineID>141CA9-1231522949</TxnLineID>
|
|
73
|
+
<ItemRef>
|
|
74
|
+
<ListID>80000857-1231503074</ListID>
|
|
75
|
+
<FullName>Handling Item - QuickBooks Inte</FullName>
|
|
76
|
+
</ItemRef>
|
|
77
|
+
<Desc>Handling Charge</Desc>
|
|
78
|
+
<Rate>0.00</Rate>
|
|
79
|
+
<Amount>0.00</Amount>
|
|
80
|
+
<SalesTaxCodeRef>
|
|
81
|
+
<ListID>20000-1128983215</ListID>
|
|
82
|
+
<FullName>Non</FullName>
|
|
83
|
+
</SalesTaxCodeRef>
|
|
84
|
+
</SalesReceiptLineRet>
|
|
85
|
+
</SalesReceiptRet>
|
|
86
|
+
</SalesReceiptAddRs>
|
|
87
|
+
</QBXMLMsgsRs>
|
|
88
|
+
</QBXML>
|
|
89
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'qbxml'
|
|
3
|
+
|
|
4
|
+
class HashToXmlTest < Minitest::Test
|
|
5
|
+
|
|
6
|
+
def test_hash_to_xml_customer_query
|
|
7
|
+
qbxml = Qbxml.new
|
|
8
|
+
assert_equal "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<?qbxml version=\"7.0\"?>\n<QBXML>\n <QBXMLMsgsRq>\n <CustomerQueryRq>\n <ListID>GUID-GOES-HERE</ListID>\n </CustomerQueryRq>\n </QBXMLMsgsRq>\n</QBXML>\n", qbxml.to_qbxml({:qbxml => {:qbxml_msgs_rq => {:customer_query_rq => {:list_id => 'GUID-GOES-HERE'}}}})
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def test_hash_to_xml_invoice_mod
|
|
12
|
+
qbxml = Qbxml.new
|
|
13
|
+
xml = <<-EOF
|
|
14
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
15
|
+
<?qbxml version="7.0"?>
|
|
16
|
+
<QBXML>
|
|
17
|
+
<QBXMLMsgsRq>
|
|
18
|
+
<InvoiceModRq>
|
|
19
|
+
<InvoiceMod>
|
|
20
|
+
<TxnID>1929B9-1423150873</TxnID>
|
|
21
|
+
<EditSequence/>
|
|
22
|
+
<CustomerRef>
|
|
23
|
+
<ListID>4A50001-1013529664</ListID>
|
|
24
|
+
</CustomerRef>
|
|
25
|
+
<TxnDate>2015-01-28</TxnDate>
|
|
26
|
+
<RefNumber>12345678</RefNumber>
|
|
27
|
+
<Memo></Memo>
|
|
28
|
+
<InvoiceLineMod>
|
|
29
|
+
<TxnLineID>-1</TxnLineID>
|
|
30
|
+
<ItemRef>
|
|
31
|
+
<FullName>Sales</FullName>
|
|
32
|
+
</ItemRef>
|
|
33
|
+
<Desc>Contract 123</Desc>
|
|
34
|
+
<Quantity>23.44165</Quantity>
|
|
35
|
+
<Rate>515.0</Rate>
|
|
36
|
+
<SalesTaxCodeRef>
|
|
37
|
+
<FullName>E</FullName>
|
|
38
|
+
</SalesTaxCodeRef>
|
|
39
|
+
</InvoiceLineMod>
|
|
40
|
+
</InvoiceMod>
|
|
41
|
+
</InvoiceModRq>
|
|
42
|
+
</QBXMLMsgsRq>
|
|
43
|
+
</QBXML>
|
|
44
|
+
EOF
|
|
45
|
+
assert_equal xml, qbxml.to_qbxml({:invoice_mod_rq=>{:invoice_mod=>{:txn_id=>"1929B9-1423150873", :edit_sequence=>nil, :customer_ref=>{:list_id=>"4A50001-1013529664"}, :txn_date=>"2015-01-28", :ref_number=>"12345678", :memo=>"", :invoice_line_mod=>[{:txn_line_id=>-1, :item_ref=>{:full_name=>"Sales"}, :desc=>"Contract 123", :quantity=>"23.44165", :rate=> 515.0, :sales_tax_code_ref=>{:full_name=>"E"}}]}}})
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def test_hash_to_xml_customer_add
|
|
49
|
+
qbxml = Qbxml.new
|
|
50
|
+
xml = <<-EOF
|
|
51
|
+
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
52
|
+
<?qbxml version="7.0"?>
|
|
53
|
+
<QBXML>
|
|
54
|
+
<QBXMLMsgsRq>
|
|
55
|
+
<CustomerAddRq>
|
|
56
|
+
<CustomerAdd>
|
|
57
|
+
<Name>Joe Blow</Name>
|
|
58
|
+
<CompanyName>Joe Blow Inc.</CompanyName>
|
|
59
|
+
<BillAddress>
|
|
60
|
+
<Addr1>123 Fake Street</Addr1>
|
|
61
|
+
<City>Springfield</City>
|
|
62
|
+
<State>Texachussets</State>
|
|
63
|
+
<PostalCode>99999</PostalCode>
|
|
64
|
+
<Country>USA</Country>
|
|
65
|
+
</BillAddress>
|
|
66
|
+
</CustomerAdd>
|
|
67
|
+
</CustomerAddRq>
|
|
68
|
+
</QBXMLMsgsRq>
|
|
69
|
+
</QBXML>
|
|
70
|
+
EOF
|
|
71
|
+
assert_equal xml, qbxml.to_qbxml({:customer_add_rq=>{:customer_add=>{:name=>"Joe Blow", :company_name=>"Joe Blow Inc.", :bill_address=>{:addr1=>"123 Fake Street", :city=>"Springfield", :state=>"Texachussets", :postal_code=>"99999", :country=>"USA"}}}})
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def test_array_of_strings
|
|
75
|
+
assert_equal "<foo>\n <bar>baz</bar>\n <bar>guh</bar>\n</foo>\n", Qbxml::Hash.to_xml({:foo => {:bar => ['baz', 'guh']}}, {skip_instruct: true})
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'qbxml'
|
|
3
|
+
|
|
4
|
+
class VersionTest < Minitest::Test
|
|
5
|
+
|
|
6
|
+
def test_string_version
|
|
7
|
+
Qbxml.new(:qb, '7.0')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def test_bad_version
|
|
11
|
+
assert_raises RuntimeError do
|
|
12
|
+
Qbxml.new(:qb, '3.14')
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def test_float_version
|
|
17
|
+
Qbxml.new(:qb, 7.0)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def test_int_version
|
|
21
|
+
Qbxml.new(:qb, 7)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
require 'minitest/autorun'
|
|
2
|
+
require 'qbxml'
|
|
3
|
+
|
|
4
|
+
class XmlToHashTest < Minitest::Test
|
|
5
|
+
|
|
6
|
+
def test_xml_to_hash
|
|
7
|
+
qbxml = Qbxml.new
|
|
8
|
+
h = {"qbxml"=>{"xml_attributes"=>{}, "qbxml_msgs_rq"=>{"xml_attributes"=>{}, "customer_query_rq"=>{"xml_attributes"=>{}, "list_id"=>"GUID-GOES-HERE"}}}}
|
|
9
|
+
assert_equal h, qbxml.from_qbxml("<?qbxml version=\"7.0\"?>\n<QBXML>\n <QBXMLMsgsRq>\n <CustomerQueryRq>\n <ListID>GUID-GOES-HERE</ListID>\n </CustomerQueryRq>\n </QBXMLMsgsRq>\n</QBXML>\n")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def test_array_of_strings
|
|
13
|
+
qbxml = Qbxml.new
|
|
14
|
+
h = {
|
|
15
|
+
"qbxml" => {
|
|
16
|
+
"xml_attributes" => {},
|
|
17
|
+
"qbxml_msgs_rq" => {
|
|
18
|
+
"xml_attributes" => {},
|
|
19
|
+
'invoice_query_rq' => {
|
|
20
|
+
"xml_attributes" => {},
|
|
21
|
+
'include_ret_element' => ['TxnID', 'RefNumber']
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
assert_equal h, qbxml.from_qbxml("<?qbxml version=\"7.0\"?>\n<QBXML>\n <QBXMLMsgsRq>\n <InvoiceQueryRq>\n <IncludeRetElement>TxnID</IncludeRetElement>\n <IncludeRetElement>RefNumber</IncludeRetElement>\n </InvoiceQueryRq>\n </QBXMLMsgsRq>\n</QBXML>\n")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_array_with_one_element
|
|
30
|
+
qbxml = Qbxml.new
|
|
31
|
+
h = {
|
|
32
|
+
"qbxml" => {
|
|
33
|
+
"xml_attributes" => {},
|
|
34
|
+
"qbxml_msgs_rs" => {
|
|
35
|
+
"xml_attributes" => {},
|
|
36
|
+
'customer_query_rs' => {
|
|
37
|
+
"xml_attributes" => {},
|
|
38
|
+
'customer_ret' => [{
|
|
39
|
+
"xml_attributes"=> {},
|
|
40
|
+
'list_id' => 'abc'
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
assert_equal h, qbxml.from_qbxml("<?qbxml version=\"7.0\"?>\n<QBXML>\n <QBXMLMsgsRs>\n <CustomerQueryRs>\n <CustomerRet><ListID>abc</ListID></CustomerRet>\n </CustomerQueryRs>\n </QBXMLMsgsRs>\n</QBXML>\n")
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_float_percentage
|
|
50
|
+
qbxml = Qbxml.new
|
|
51
|
+
h = {
|
|
52
|
+
"qbxml" => {
|
|
53
|
+
"xml_attributes" => {},
|
|
54
|
+
"qbxml_msgs_rs" => {
|
|
55
|
+
"xml_attributes" => {},
|
|
56
|
+
"item_query_rs" => {
|
|
57
|
+
"xml_attributes" => {
|
|
58
|
+
"requestID" => "Retrieve items",
|
|
59
|
+
"statusCode" => "0",
|
|
60
|
+
"statusSeverity" => "Info",
|
|
61
|
+
"statusMessage" => "Status OK",
|
|
62
|
+
"iteratorRemainingCount" => "0",
|
|
63
|
+
"iteratorID" => "{10c05cbd-b25b-4a85-8aa0-8bce89e6e900}"
|
|
64
|
+
},
|
|
65
|
+
"item_service_ret" => {
|
|
66
|
+
"xml_attributes" => {},
|
|
67
|
+
"list_id" => "80000005-1468535148",
|
|
68
|
+
"time_created" => "2016-07-14T15:25:48+00:00",
|
|
69
|
+
"time_modified" => "2016-07-14T15:25:48+00:00",
|
|
70
|
+
"edit_sequence" => "1468535148",
|
|
71
|
+
"name" => "let's get intuit",
|
|
72
|
+
"full_name" => "let's get intuit",
|
|
73
|
+
"is_active" => true,
|
|
74
|
+
"sublevel" => 0,
|
|
75
|
+
"sales_or_purchase" => {
|
|
76
|
+
"xml_attributes" => {},
|
|
77
|
+
"price_percent" => 18.0,
|
|
78
|
+
"account_ref" => {
|
|
79
|
+
"xml_attributes" => {},
|
|
80
|
+
"list_id" => "80000015-1457547358",
|
|
81
|
+
"full_name" => "Repairs and Maintenance"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
xml = <<-XML
|
|
91
|
+
<QBXML>
|
|
92
|
+
<QBXMLMsgsRs>
|
|
93
|
+
<ItemQueryRs requestID="Retrieve items"
|
|
94
|
+
statusCode="0"
|
|
95
|
+
statusSeverity="Info"
|
|
96
|
+
statusMessage="Status OK"
|
|
97
|
+
iteratorRemainingCount="0"
|
|
98
|
+
iteratorID="{10c05cbd-b25b-4a85-8aa0-8bce89e6e900}">
|
|
99
|
+
<ItemServiceRet>
|
|
100
|
+
<ListID>80000005-1468535148</ListID>
|
|
101
|
+
<TimeCreated>2016-07-14T15:25:48+00:00</TimeCreated>
|
|
102
|
+
<TimeModified>2016-07-14T15:25:48+00:00</TimeModified>
|
|
103
|
+
<EditSequence>1468535148</EditSequence>
|
|
104
|
+
<Name>let's get intuit</Name>
|
|
105
|
+
<FullName>let's get intuit</FullName>
|
|
106
|
+
<IsActive>true</IsActive>
|
|
107
|
+
<Sublevel>0</Sublevel>
|
|
108
|
+
<SalesOrPurchase>
|
|
109
|
+
<PricePercent>18.0%</PricePercent>
|
|
110
|
+
<AccountRef>
|
|
111
|
+
<ListID>80000015-1457547358</ListID>
|
|
112
|
+
<FullName>Repairs and Maintenance</FullName>
|
|
113
|
+
</AccountRef>
|
|
114
|
+
</SalesOrPurchase>
|
|
115
|
+
</ItemServiceRet>
|
|
116
|
+
</ItemQueryRs>
|
|
117
|
+
</QBXMLMsgsRs>
|
|
118
|
+
</QBXML>
|
|
119
|
+
XML
|
|
120
|
+
|
|
121
|
+
assert_equal h, qbxml.from_qbxml(xml)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def test_bigdecimal
|
|
125
|
+
injected_time = Time.now.strftime("%Y-%m-%dT%H:%M:%S%:z")
|
|
126
|
+
|
|
127
|
+
qbxml = Qbxml.new
|
|
128
|
+
h = {
|
|
129
|
+
"qbxml" => {
|
|
130
|
+
"xml_attributes" => {},
|
|
131
|
+
"qbxml_msgs_rs"=> {
|
|
132
|
+
"xml_attributes" => {},
|
|
133
|
+
"sales_receipt_add_rs" => {
|
|
134
|
+
"xml_attributes" => {
|
|
135
|
+
"statusCode" => "0",
|
|
136
|
+
"statusSeverity" => "Info",
|
|
137
|
+
"statusMessage" => "Status OK"
|
|
138
|
+
},
|
|
139
|
+
"sales_receipt_ret" => {
|
|
140
|
+
"xml_attributes" => {},
|
|
141
|
+
"txn_id" => "1C0-1433857054",
|
|
142
|
+
"time_created" => injected_time,
|
|
143
|
+
"time_modified" => injected_time,
|
|
144
|
+
"edit_sequence" => "1433850554",
|
|
145
|
+
"txn_number" => 89,
|
|
146
|
+
"customer_ref" => {
|
|
147
|
+
"xml_attributes" => {},
|
|
148
|
+
"list_id" => "80000013-1433852150",
|
|
149
|
+
"full_name" => "custfullname"
|
|
150
|
+
},
|
|
151
|
+
"template_ref" => {
|
|
152
|
+
"xml_attributes" => {},
|
|
153
|
+
"list_id" => "80000009-1433199758",
|
|
154
|
+
"full_name" => "Custom Sales Receipt"
|
|
155
|
+
},
|
|
156
|
+
"txn_date" => "2019-06-09",
|
|
157
|
+
"ref_number" => "1040000529",
|
|
158
|
+
"is_pending" => false,
|
|
159
|
+
"payment_method_ref" => {
|
|
160
|
+
"xml_attributes" => {},
|
|
161
|
+
"list_id" => "8000000A-1433718272",
|
|
162
|
+
"full_name" => "paymentmethod"
|
|
163
|
+
},
|
|
164
|
+
"due_date" => "2019-06-09",
|
|
165
|
+
"ship_date" => "2019-06-09",
|
|
166
|
+
"subtotal" => 0.2,
|
|
167
|
+
"item_sales_tax_ref" => {
|
|
168
|
+
"xml_attributes" => {},
|
|
169
|
+
"list_id" => "80000009-1433719484",
|
|
170
|
+
"full_name" => "Tax agency"
|
|
171
|
+
},
|
|
172
|
+
"sales_tax_percentage" => 8.25,
|
|
173
|
+
"sales_tax_total" => 0.02,
|
|
174
|
+
"total_amount" => 0.22,
|
|
175
|
+
"is_to_be_printed" => true,
|
|
176
|
+
"is_to_be_emailed" => false,
|
|
177
|
+
"customer_sales_tax_code_ref" => {
|
|
178
|
+
"xml_attributes" => {},
|
|
179
|
+
"list_id" => "80000002-1403304324",
|
|
180
|
+
"full_name" => "Non"
|
|
181
|
+
},
|
|
182
|
+
"deposit_to_account_ref" => {
|
|
183
|
+
"xml_attributes" => {},
|
|
184
|
+
"list_id" => "8000003D-1433719666",
|
|
185
|
+
"full_name" => "Undeposited Funds"
|
|
186
|
+
},
|
|
187
|
+
"sales_receipt_line_ret" => {
|
|
188
|
+
"xml_attributes" => {},
|
|
189
|
+
"txn_line_id" => "1C2-1433632154",
|
|
190
|
+
"item_ref" => {
|
|
191
|
+
"xml_attributes" => {},
|
|
192
|
+
"list_id" => "8000001F-1433854453",
|
|
193
|
+
"full_name" => "ABCD0000"
|
|
194
|
+
},
|
|
195
|
+
"desc" => "description",
|
|
196
|
+
"quantity" => 0.2,
|
|
197
|
+
"rate" => 1.0,
|
|
198
|
+
"amount" => 0.2,
|
|
199
|
+
"service_date" => "2019-06-09",
|
|
200
|
+
"sales_tax_code_ref"=> {
|
|
201
|
+
"xml_attributes" => {},
|
|
202
|
+
"list_id" => "80000001-1403304324",
|
|
203
|
+
"full_name"=>"Tax"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
xml = <<-XML
|
|
213
|
+
<QBXML>
|
|
214
|
+
<QBXMLMsgsRs>
|
|
215
|
+
<SalesReceiptAddRs statusCode="0" statusSeverity="Info" statusMessage="Status OK">
|
|
216
|
+
<SalesReceiptRet>
|
|
217
|
+
<TxnID>1C0-1433857054</TxnID>
|
|
218
|
+
<TimeCreated>#{injected_time}</TimeCreated>
|
|
219
|
+
<TimeModified>#{injected_time}</TimeModified>
|
|
220
|
+
<EditSequence>1433850554</EditSequence>
|
|
221
|
+
<TxnNumber>89</TxnNumber>
|
|
222
|
+
<CustomerRef>
|
|
223
|
+
<ListID>80000013-1433852150</ListID>
|
|
224
|
+
<FullName>custfullname</FullName>
|
|
225
|
+
</CustomerRef>
|
|
226
|
+
<TemplateRef>
|
|
227
|
+
<ListID>80000009-1433199758</ListID>
|
|
228
|
+
<FullName>Custom Sales Receipt</FullName>
|
|
229
|
+
</TemplateRef>
|
|
230
|
+
<TxnDate>2019-06-09</TxnDate>
|
|
231
|
+
<RefNumber>1040000529</RefNumber>
|
|
232
|
+
<IsPending>false</IsPending>
|
|
233
|
+
<PaymentMethodRef>
|
|
234
|
+
<ListID>8000000A-1433718272</ListID>
|
|
235
|
+
<FullName>paymentmethod</FullName>
|
|
236
|
+
</PaymentMethodRef>
|
|
237
|
+
<DueDate>2019-06-09</DueDate>
|
|
238
|
+
<ShipDate>2019-06-09</ShipDate>
|
|
239
|
+
<Subtotal>0.20</Subtotal>
|
|
240
|
+
<ItemSalesTaxRef>
|
|
241
|
+
<ListID>80000009-1433719484</ListID>
|
|
242
|
+
<FullName>Tax agency</FullName>
|
|
243
|
+
</ItemSalesTaxRef>
|
|
244
|
+
<SalesTaxPercentage>8.25</SalesTaxPercentage>
|
|
245
|
+
<SalesTaxTotal>0.02</SalesTaxTotal>
|
|
246
|
+
<TotalAmount>0.22</TotalAmount>
|
|
247
|
+
<IsToBePrinted>true</IsToBePrinted>
|
|
248
|
+
<IsToBeEmailed>false</IsToBeEmailed>
|
|
249
|
+
<CustomerSalesTaxCodeRef>
|
|
250
|
+
<ListID>80000002-1403304324</ListID>
|
|
251
|
+
<FullName>Non</FullName>
|
|
252
|
+
</CustomerSalesTaxCodeRef>
|
|
253
|
+
<DepositToAccountRef>
|
|
254
|
+
<ListID>8000003D-1433719666</ListID>
|
|
255
|
+
<FullName>Undeposited Funds</FullName>
|
|
256
|
+
</DepositToAccountRef>
|
|
257
|
+
<SalesReceiptLineRet>
|
|
258
|
+
<TxnLineID>1C2-1433632154</TxnLineID>
|
|
259
|
+
<ItemRef>
|
|
260
|
+
<ListID>8000001F-1433854453</ListID>
|
|
261
|
+
<FullName>ABCD0000</FullName>
|
|
262
|
+
</ItemRef>
|
|
263
|
+
<Desc>description</Desc>
|
|
264
|
+
<Quantity>0.2</Quantity>
|
|
265
|
+
<Rate>1.00</Rate>
|
|
266
|
+
<Amount>0.20</Amount>
|
|
267
|
+
<ServiceDate>2019-06-09</ServiceDate>
|
|
268
|
+
<SalesTaxCodeRef>
|
|
269
|
+
<ListID>80000001-1403304324</ListID>
|
|
270
|
+
<FullName>Tax</FullName>
|
|
271
|
+
</SalesTaxCodeRef>
|
|
272
|
+
</SalesReceiptLineRet>
|
|
273
|
+
</SalesReceiptRet>
|
|
274
|
+
</SalesReceiptAddRs>
|
|
275
|
+
</QBXMLMsgsRs>
|
|
276
|
+
</QBXML>
|
|
277
|
+
XML
|
|
278
|
+
|
|
279
|
+
assert_equal h, qbxml.from_qbxml(xml)
|
|
280
|
+
end
|
|
281
|
+
end
|