@@ -541,6 +541,105 @@ def make_fr_invoice
541541 )
542542 end
543543
544+ def make_de_invoice_with_float_quantity
545+ seller = TradeParty . new (
546+ name : 'Depfu inc' ,
547+ street1 : 'Quickbornstr. 46' ,
548+ city : 'Hamburg' ,
549+ postal_code : '20253' ,
550+ country_id : 'DE' ,
551+ vat_id : 'DE304755032'
552+ )
553+ buyer = TradeParty . new (
554+ name : 'Depfu inc' ,
555+ person_name : 'Max Mustermann' ,
556+ street1 : 'Quickbornstr. 46' ,
557+ city : 'Hamburg' ,
558+ postal_code : '20253' ,
559+ country_id : 'DE' ,
560+ vat_id : 'DE304755032'
561+ )
562+ line_item1 = LineItem . new (
563+ name : 'Depfu Starter Plan' ,
564+ quantity : 78.367 ,
565+ unit : :PIECE ,
566+ gross_amount : BigDecimal ( '49.6' ) ,
567+ net_amount : BigDecimal ( '26.6' ) ,
568+ charge_amount : BigDecimal ( '2084.56' ) ,
569+ discount_amount : BigDecimal ( '23' ) ,
570+ discount_reason : 'Rabatt' ,
571+ tax_category : :STANDARDRATE ,
572+ tax_percent : '19' ,
573+ tax_amount : BigDecimal ( "396.07" ) ,
574+ origin_country_code : 'DE' ,
575+ currency_code : 'EUR'
576+ )
577+ line_item2 = LineItem . new (
578+ name : 'Depfu Starter Plan' ,
579+ quantity : 35.207 ,
580+ unit : :PIECE ,
581+ gross_amount : BigDecimal ( '46.25' ) ,
582+ net_amount : BigDecimal ( '22.87' ) ,
583+ charge_amount : BigDecimal ( '805.18' ) ,
584+ discount_amount : BigDecimal ( '23.38' ) ,
585+ discount_reason : 'Rabatt' ,
586+ tax_category : :STANDARDRATE ,
587+ tax_percent : '19' ,
588+ tax_amount : BigDecimal ( "152.98" ) ,
589+ origin_country_code : 'DE' ,
590+ currency_code : 'EUR'
591+ )
592+ Invoice . new (
593+ id : '12345' ,
594+ issue_date : Date . today ,
595+ service_period_start : Date . today ,
596+ service_period_end : Date . today + 30 ,
597+ seller : seller ,
598+ buyer : buyer ,
599+ buyer_reference : "112233" ,
600+ line_items : [ line_item1 , line_item2 ] ,
601+ currency_code : 'USD' ,
602+ payment_type : :CREDITCARD ,
603+ payment_text : 'Kreditkarte' ,
604+ payment_reference : 'INV 123123123' ,
605+ payment_iban : 'DE02120300000000202051' ,
606+ payment_terms_text : "Zahlbar innerhalb von 14 Tagen ohne Abzug" ,
607+ tax_category : :STANDARDRATE ,
608+ tax_amount : BigDecimal ( '549.05' ) ,
609+ basis_amount : BigDecimal ( '2889.74' ) ,
610+ grand_total_amount : BigDecimal ( '3438.79' ) ,
611+ due_amount : BigDecimal ( '3438.79' ) ,
612+ paid_amount : BigDecimal ( '0' ) ,
613+ payment_due_date : Date . today + 14 ,
614+ subject_code : 'REG' # BT-21
615+ )
616+ end
617+
618+ def test_simple_de_invoice_with_decimal_quantity_v2
619+ xml = make_de_invoice_with_float_quantity . to_xml ( version : 2 )
620+ v = Validator . new ( xml , version : 2 )
621+ errors = v . validate_against_schema
622+ if !errors . empty?
623+ puts xml
624+ errors . each do |error |
625+ puts error
626+ end
627+ end
628+ assert_equal [ ] , errors
629+ end
630+
631+ def test_simple_de_invoice_with_decimal_quantity_v1
632+ xml = make_de_invoice_with_float_quantity . to_xml ( version : 1 )
633+ v = Validator . new ( xml , version : 1 )
634+ errors = v . validate_against_schema
635+ if !errors . empty?
636+ puts xml
637+ errors . each do |error |
638+ puts error
639+ end
640+ end
641+ assert_equal [ ] , errors
642+ end
544643
545644 def test_simple_eu_invoice_v2
546645 begin
0 commit comments