e-invoice-api 0.7.0 → 0.8.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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +5 -5
  4. data/lib/e_invoice_api/client.rb +4 -0
  5. data/lib/e_invoice_api/internal/type/base_model.rb +5 -5
  6. data/lib/e_invoice_api/models/allowance.rb +96 -0
  7. data/lib/e_invoice_api/models/charge.rb +96 -0
  8. data/lib/e_invoice_api/models/document_create_from_pdf_params.rb +32 -0
  9. data/lib/e_invoice_api/models/document_create_from_pdf_response.rb +584 -0
  10. data/lib/e_invoice_api/models/document_response.rb +6 -192
  11. data/lib/e_invoice_api/models/document_validate_params.rb +14 -0
  12. data/lib/e_invoice_api/models/documents/ubl_create_from_ubl_params.rb +22 -0
  13. data/lib/e_invoice_api/models/me_retrieve_params.rb +14 -0
  14. data/lib/e_invoice_api/models/me_retrieve_response.rb +149 -0
  15. data/lib/e_invoice_api/models.rb +10 -0
  16. data/lib/e_invoice_api/resources/documents/ubl.rb +22 -0
  17. data/lib/e_invoice_api/resources/documents.rb +52 -0
  18. data/lib/e_invoice_api/resources/me.rb +32 -0
  19. data/lib/e_invoice_api/version.rb +1 -1
  20. data/lib/e_invoice_api.rb +9 -0
  21. data/rbi/e_invoice_api/client.rbi +3 -0
  22. data/rbi/e_invoice_api/models/allowance.rbi +124 -0
  23. data/rbi/e_invoice_api/models/charge.rbi +122 -0
  24. data/rbi/e_invoice_api/models/document_create_from_pdf_params.rbi +56 -0
  25. data/rbi/e_invoice_api/models/document_create_from_pdf_response.rbi +1014 -0
  26. data/rbi/e_invoice_api/models/document_response.rbi +6 -388
  27. data/rbi/e_invoice_api/models/document_validate_params.rbi +30 -0
  28. data/rbi/e_invoice_api/models/documents/ubl_create_from_ubl_params.rbi +43 -0
  29. data/rbi/e_invoice_api/models/me_retrieve_params.rbi +27 -0
  30. data/rbi/e_invoice_api/models/me_retrieve_response.rbi +195 -0
  31. data/rbi/e_invoice_api/models.rbi +10 -0
  32. data/rbi/e_invoice_api/resources/documents/ubl.rbi +10 -0
  33. data/rbi/e_invoice_api/resources/documents.rbi +34 -0
  34. data/rbi/e_invoice_api/resources/me.rbi +21 -0
  35. data/sig/e_invoice_api/client.rbs +2 -0
  36. data/sig/e_invoice_api/models/allowance.rbs +69 -0
  37. data/sig/e_invoice_api/models/charge.rbs +69 -0
  38. data/sig/e_invoice_api/models/document_create_from_pdf_params.rbs +36 -0
  39. data/sig/e_invoice_api/models/document_create_from_pdf_response.rbs +512 -0
  40. data/sig/e_invoice_api/models/document_response.rbs +8 -140
  41. data/sig/e_invoice_api/models/document_validate_params.rbs +15 -0
  42. data/sig/e_invoice_api/models/documents/ubl_create_from_ubl_params.rbs +26 -0
  43. data/sig/e_invoice_api/models/me_retrieve_params.rbs +15 -0
  44. data/sig/e_invoice_api/models/me_retrieve_response.rbs +107 -0
  45. data/sig/e_invoice_api/models.rbs +10 -0
  46. data/sig/e_invoice_api/resources/documents/ubl.rbs +5 -0
  47. data/sig/e_invoice_api/resources/documents.rbs +12 -0
  48. data/sig/e_invoice_api/resources/me.rbs +11 -0
  49. metadata +28 -1
@@ -549,10 +549,8 @@ module EInvoiceAPI
549
549
  # @!attribute allowances
550
550
  # The allowances of the line item.
551
551
  #
552
- # @return [Array<EInvoiceAPI::Models::DocumentResponse::Item::Allowance>, nil]
553
- optional :allowances,
554
- -> { EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::DocumentResponse::Item::Allowance] },
555
- nil?: true
552
+ # @return [Array<EInvoiceAPI::Models::Allowance>, nil]
553
+ optional :allowances, -> { EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::Allowance] }, nil?: true
556
554
 
557
555
  # @!attribute amount
558
556
  # The total amount of the line item, exclusive of VAT, after subtracting line
@@ -565,10 +563,8 @@ module EInvoiceAPI
565
563
  # @!attribute charges
566
564
  # The charges of the line item.
567
565
  #
568
- # @return [Array<EInvoiceAPI::Models::DocumentResponse::Item::Charge>, nil]
569
- optional :charges,
570
- -> { EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::DocumentResponse::Item::Charge] },
571
- nil?: true
566
+ # @return [Array<EInvoiceAPI::Models::Charge>, nil]
567
+ optional :charges, -> { EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::Charge] }, nil?: true
572
568
 
573
569
  # @!attribute date
574
570
  #
@@ -622,11 +618,11 @@ module EInvoiceAPI
622
618
  # Some parameter documentations has been truncated, see
623
619
  # {EInvoiceAPI::Models::DocumentResponse::Item} for more details.
624
620
  #
625
- # @param allowances [Array<EInvoiceAPI::Models::DocumentResponse::Item::Allowance>, nil] The allowances of the line item.
621
+ # @param allowances [Array<EInvoiceAPI::Models::Allowance>, nil] The allowances of the line item.
626
622
  #
627
623
  # @param amount [String, nil] The total amount of the line item, exclusive of VAT, after subtracting line leve
628
624
  #
629
- # @param charges [Array<EInvoiceAPI::Models::DocumentResponse::Item::Charge>, nil] The charges of the line item.
625
+ # @param charges [Array<EInvoiceAPI::Models::Charge>, nil] The charges of the line item.
630
626
  #
631
627
  # @param date [nil]
632
628
  #
@@ -643,188 +639,6 @@ module EInvoiceAPI
643
639
  # @param unit [Symbol, EInvoiceAPI::Models::UnitOfMeasureCode, nil] Unit of Measure Codes from UNECERec20 used in Peppol BIS Billing 3.0.
644
640
  #
645
641
  # @param unit_price [String, nil] The unit price of the line item. Must be rounded to maximum 2 decimals
646
-
647
- class Allowance < EInvoiceAPI::Internal::Type::BaseModel
648
- # @!attribute amount
649
- # The allowance amount, without VAT. Must be rounded to maximum 2 decimals
650
- #
651
- # @return [String, nil]
652
- optional :amount, String, nil?: true
653
-
654
- # @!attribute base_amount
655
- # The base amount that may be used, in conjunction with the allowance percentage,
656
- # to calculate the allowance amount. Must be rounded to maximum 2 decimals
657
- #
658
- # @return [String, nil]
659
- optional :base_amount, String, nil?: true
660
-
661
- # @!attribute multiplier_factor
662
- # The percentage that may be used, in conjunction with the allowance base amount,
663
- # to calculate the allowance amount. To state 20%, use value 20
664
- #
665
- # @return [String, nil]
666
- optional :multiplier_factor, String, nil?: true
667
-
668
- # @!attribute reason
669
- # The reason for the allowance
670
- #
671
- # @return [String, nil]
672
- optional :reason, String, nil?: true
673
-
674
- # @!attribute reason_code
675
- # The code for the allowance reason
676
- #
677
- # @return [String, nil]
678
- optional :reason_code, String, nil?: true
679
-
680
- # @!attribute tax_code
681
- # Duty or tax or fee category codes (Subset of UNCL5305)
682
- #
683
- # Agency: UN/CEFACT Version: D.16B Subset: OpenPEPPOL
684
- #
685
- # @return [Symbol, EInvoiceAPI::Models::DocumentResponse::Item::Allowance::TaxCode, nil]
686
- optional :tax_code, enum: -> { EInvoiceAPI::DocumentResponse::Item::Allowance::TaxCode }, nil?: true
687
-
688
- # @!attribute tax_rate
689
- # The VAT rate, represented as percentage that applies to the allowance
690
- #
691
- # @return [String, nil]
692
- optional :tax_rate, String, nil?: true
693
-
694
- # @!method initialize(amount: nil, base_amount: nil, multiplier_factor: nil, reason: nil, reason_code: nil, tax_code: nil, tax_rate: nil)
695
- # Some parameter documentations has been truncated, see
696
- # {EInvoiceAPI::Models::DocumentResponse::Item::Allowance} for more details.
697
- #
698
- # An allowance is a discount for example for early payment, volume discount, etc.
699
- #
700
- # @param amount [String, nil] The allowance amount, without VAT. Must be rounded to maximum 2 decimals
701
- #
702
- # @param base_amount [String, nil] The base amount that may be used, in conjunction with the allowance percentage,
703
- #
704
- # @param multiplier_factor [String, nil] The percentage that may be used, in conjunction with the allowance base amount,
705
- #
706
- # @param reason [String, nil] The reason for the allowance
707
- #
708
- # @param reason_code [String, nil] The code for the allowance reason
709
- #
710
- # @param tax_code [Symbol, EInvoiceAPI::Models::DocumentResponse::Item::Allowance::TaxCode, nil] Duty or tax or fee category codes (Subset of UNCL5305)
711
- #
712
- # @param tax_rate [String, nil] The VAT rate, represented as percentage that applies to the allowance
713
-
714
- # Duty or tax or fee category codes (Subset of UNCL5305)
715
- #
716
- # Agency: UN/CEFACT Version: D.16B Subset: OpenPEPPOL
717
- #
718
- # @see EInvoiceAPI::Models::DocumentResponse::Item::Allowance#tax_code
719
- module TaxCode
720
- extend EInvoiceAPI::Internal::Type::Enum
721
-
722
- AE = :AE
723
- E = :E
724
- S = :S
725
- Z = :Z
726
- G = :G
727
- O = :O
728
- K = :K
729
- L = :L
730
- M = :M
731
- B = :B
732
-
733
- # @!method self.values
734
- # @return [Array<Symbol>]
735
- end
736
- end
737
-
738
- class Charge < EInvoiceAPI::Internal::Type::BaseModel
739
- # @!attribute amount
740
- # The charge amount, without VAT. Must be rounded to maximum 2 decimals
741
- #
742
- # @return [String, nil]
743
- optional :amount, String, nil?: true
744
-
745
- # @!attribute base_amount
746
- # The base amount that may be used, in conjunction with the charge percentage, to
747
- # calculate the charge amount. Must be rounded to maximum 2 decimals
748
- #
749
- # @return [String, nil]
750
- optional :base_amount, String, nil?: true
751
-
752
- # @!attribute multiplier_factor
753
- # The percentage that may be used, in conjunction with the charge base amount, to
754
- # calculate the charge amount. To state 20%, use value 20
755
- #
756
- # @return [String, nil]
757
- optional :multiplier_factor, String, nil?: true
758
-
759
- # @!attribute reason
760
- # The reason for the charge
761
- #
762
- # @return [String, nil]
763
- optional :reason, String, nil?: true
764
-
765
- # @!attribute reason_code
766
- # The code for the charge reason
767
- #
768
- # @return [String, nil]
769
- optional :reason_code, String, nil?: true
770
-
771
- # @!attribute tax_code
772
- # Duty or tax or fee category codes (Subset of UNCL5305)
773
- #
774
- # Agency: UN/CEFACT Version: D.16B Subset: OpenPEPPOL
775
- #
776
- # @return [Symbol, EInvoiceAPI::Models::DocumentResponse::Item::Charge::TaxCode, nil]
777
- optional :tax_code, enum: -> { EInvoiceAPI::DocumentResponse::Item::Charge::TaxCode }, nil?: true
778
-
779
- # @!attribute tax_rate
780
- # The VAT rate, represented as percentage that applies to the charge
781
- #
782
- # @return [String, nil]
783
- optional :tax_rate, String, nil?: true
784
-
785
- # @!method initialize(amount: nil, base_amount: nil, multiplier_factor: nil, reason: nil, reason_code: nil, tax_code: nil, tax_rate: nil)
786
- # Some parameter documentations has been truncated, see
787
- # {EInvoiceAPI::Models::DocumentResponse::Item::Charge} for more details.
788
- #
789
- # A charge is an additional fee for example for late payment, late delivery, etc.
790
- #
791
- # @param amount [String, nil] The charge amount, without VAT. Must be rounded to maximum 2 decimals
792
- #
793
- # @param base_amount [String, nil] The base amount that may be used, in conjunction with the charge percentage, to
794
- #
795
- # @param multiplier_factor [String, nil] The percentage that may be used, in conjunction with the charge base amount, to
796
- #
797
- # @param reason [String, nil] The reason for the charge
798
- #
799
- # @param reason_code [String, nil] The code for the charge reason
800
- #
801
- # @param tax_code [Symbol, EInvoiceAPI::Models::DocumentResponse::Item::Charge::TaxCode, nil] Duty or tax or fee category codes (Subset of UNCL5305)
802
- #
803
- # @param tax_rate [String, nil] The VAT rate, represented as percentage that applies to the charge
804
-
805
- # Duty or tax or fee category codes (Subset of UNCL5305)
806
- #
807
- # Agency: UN/CEFACT Version: D.16B Subset: OpenPEPPOL
808
- #
809
- # @see EInvoiceAPI::Models::DocumentResponse::Item::Charge#tax_code
810
- module TaxCode
811
- extend EInvoiceAPI::Internal::Type::Enum
812
-
813
- AE = :AE
814
- E = :E
815
- S = :S
816
- Z = :Z
817
- G = :G
818
- O = :O
819
- K = :K
820
- L = :L
821
- M = :M
822
- B = :B
823
-
824
- # @!method self.values
825
- # @return [Array<Symbol>]
826
- end
827
- end
828
642
  end
829
643
 
830
644
  class PaymentDetail < EInvoiceAPI::Internal::Type::BaseModel
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ # @see EInvoiceAPI::Resources::Documents#validate
6
+ class DocumentValidateParams < EInvoiceAPI::Internal::Type::BaseModel
7
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
8
+ include EInvoiceAPI::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ module Documents
6
+ # @see EInvoiceAPI::Resources::Documents::Ubl#create_from_ubl
7
+ class UblCreateFromUblParams < EInvoiceAPI::Internal::Type::BaseModel
8
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
9
+ include EInvoiceAPI::Internal::Type::RequestParameters
10
+
11
+ # @!attribute file
12
+ #
13
+ # @return [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart]
14
+ required :file, EInvoiceAPI::Internal::Type::FileInput
15
+
16
+ # @!method initialize(file:, request_options: {})
17
+ # @param file [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart]
18
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ # @see EInvoiceAPI::Resources::Me#retrieve
6
+ class MeRetrieveParams < EInvoiceAPI::Internal::Type::BaseModel
7
+ extend EInvoiceAPI::Internal::Type::RequestParameters::Converter
8
+ include EInvoiceAPI::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,149 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Models
5
+ # @see EInvoiceAPI::Resources::Me#retrieve
6
+ class MeRetrieveResponse < EInvoiceAPI::Internal::Type::BaseModel
7
+ # @!attribute credit_balance
8
+ # Credit balance of the tenant
9
+ #
10
+ # @return [Integer]
11
+ required :credit_balance, Integer
12
+
13
+ # @!attribute name
14
+ #
15
+ # @return [String]
16
+ required :name, String
17
+
18
+ # @!attribute plan
19
+ # Plan of the tenant
20
+ #
21
+ # @return [Symbol, EInvoiceAPI::Models::MeRetrieveResponse::Plan]
22
+ required :plan, enum: -> { EInvoiceAPI::Models::MeRetrieveResponse::Plan }
23
+
24
+ # @!attribute bcc_recipient_email
25
+ # BCC recipient email to deliver documents
26
+ #
27
+ # @return [String, nil]
28
+ optional :bcc_recipient_email, String, nil?: true
29
+
30
+ # @!attribute company_address
31
+ # Address of the company
32
+ #
33
+ # @return [String, nil]
34
+ optional :company_address, String, nil?: true
35
+
36
+ # @!attribute company_city
37
+ # City of the company
38
+ #
39
+ # @return [String, nil]
40
+ optional :company_city, String, nil?: true
41
+
42
+ # @!attribute company_country
43
+ # Country of the company
44
+ #
45
+ # @return [String, nil]
46
+ optional :company_country, String, nil?: true
47
+
48
+ # @!attribute company_email
49
+ # Email of the company
50
+ #
51
+ # @return [String, nil]
52
+ optional :company_email, String, nil?: true
53
+
54
+ # @!attribute company_name
55
+ # Name of the company
56
+ #
57
+ # @return [String, nil]
58
+ optional :company_name, String, nil?: true
59
+
60
+ # @!attribute company_number
61
+ # Company number
62
+ #
63
+ # @return [String, nil]
64
+ optional :company_number, String, nil?: true
65
+
66
+ # @!attribute company_zip
67
+ # Zip code of the company
68
+ #
69
+ # @return [String, nil]
70
+ optional :company_zip, String, nil?: true
71
+
72
+ # @!attribute description
73
+ #
74
+ # @return [String, nil]
75
+ optional :description, String, nil?: true
76
+
77
+ # @!attribute ibans
78
+ # IBANs of the tenant
79
+ #
80
+ # @return [Array<String>, nil]
81
+ optional :ibans, EInvoiceAPI::Internal::Type::ArrayOf[String], nil?: true
82
+
83
+ # @!attribute peppol_ids
84
+ # Peppol IDs of the tenant
85
+ #
86
+ # @return [Array<String>, nil]
87
+ optional :peppol_ids, EInvoiceAPI::Internal::Type::ArrayOf[String], nil?: true
88
+
89
+ # @!attribute smp_registration
90
+ # Whether the tenant is registered on our SMP
91
+ #
92
+ # @return [Boolean, nil]
93
+ optional :smp_registration, EInvoiceAPI::Internal::Type::Boolean, nil?: true
94
+
95
+ # @!attribute smp_registration_date
96
+ # Date when the tenant was registered on SMP
97
+ #
98
+ # @return [Time, nil]
99
+ optional :smp_registration_date, Time, nil?: true
100
+
101
+ # @!method initialize(credit_balance:, name:, plan:, bcc_recipient_email: nil, company_address: nil, company_city: nil, company_country: nil, company_email: nil, company_name: nil, company_number: nil, company_zip: nil, description: nil, ibans: nil, peppol_ids: nil, smp_registration: nil, smp_registration_date: nil)
102
+ # @param credit_balance [Integer] Credit balance of the tenant
103
+ #
104
+ # @param name [String]
105
+ #
106
+ # @param plan [Symbol, EInvoiceAPI::Models::MeRetrieveResponse::Plan] Plan of the tenant
107
+ #
108
+ # @param bcc_recipient_email [String, nil] BCC recipient email to deliver documents
109
+ #
110
+ # @param company_address [String, nil] Address of the company
111
+ #
112
+ # @param company_city [String, nil] City of the company
113
+ #
114
+ # @param company_country [String, nil] Country of the company
115
+ #
116
+ # @param company_email [String, nil] Email of the company
117
+ #
118
+ # @param company_name [String, nil] Name of the company
119
+ #
120
+ # @param company_number [String, nil] Company number
121
+ #
122
+ # @param company_zip [String, nil] Zip code of the company
123
+ #
124
+ # @param description [String, nil]
125
+ #
126
+ # @param ibans [Array<String>, nil] IBANs of the tenant
127
+ #
128
+ # @param peppol_ids [Array<String>, nil] Peppol IDs of the tenant
129
+ #
130
+ # @param smp_registration [Boolean, nil] Whether the tenant is registered on our SMP
131
+ #
132
+ # @param smp_registration_date [Time, nil] Date when the tenant was registered on SMP
133
+
134
+ # Plan of the tenant
135
+ #
136
+ # @see EInvoiceAPI::Models::MeRetrieveResponse#plan
137
+ module Plan
138
+ extend EInvoiceAPI::Internal::Type::Enum
139
+
140
+ STARTER = :starter
141
+ PRO = :pro
142
+ ENTERPRISE = :enterprise
143
+
144
+ # @!method self.values
145
+ # @return [Array<Symbol>]
146
+ end
147
+ end
148
+ end
149
+ end
@@ -39,14 +39,20 @@ module EInvoiceAPI
39
39
  mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
40
40
  end
41
41
 
42
+ Allowance = EInvoiceAPI::Models::Allowance
43
+
42
44
  Certificate = EInvoiceAPI::Models::Certificate
43
45
 
46
+ Charge = EInvoiceAPI::Models::Charge
47
+
44
48
  CurrencyCode = EInvoiceAPI::Models::CurrencyCode
45
49
 
46
50
  DocumentAttachmentCreate = EInvoiceAPI::Models::DocumentAttachmentCreate
47
51
 
48
52
  DocumentCreate = EInvoiceAPI::Models::DocumentCreate
49
53
 
54
+ DocumentCreateFromPdfParams = EInvoiceAPI::Models::DocumentCreateFromPdfParams
55
+
50
56
  DocumentCreateParams = EInvoiceAPI::Models::DocumentCreateParams
51
57
 
52
58
  DocumentDeleteParams = EInvoiceAPI::Models::DocumentDeleteParams
@@ -65,6 +71,8 @@ module EInvoiceAPI
65
71
 
66
72
  DocumentType = EInvoiceAPI::Models::DocumentType
67
73
 
74
+ DocumentValidateParams = EInvoiceAPI::Models::DocumentValidateParams
75
+
68
76
  InboxListCreditNotesParams = EInvoiceAPI::Models::InboxListCreditNotesParams
69
77
 
70
78
  InboxListInvoicesParams = EInvoiceAPI::Models::InboxListInvoicesParams
@@ -75,6 +83,8 @@ module EInvoiceAPI
75
83
 
76
84
  LookupRetrieveParticipantsParams = EInvoiceAPI::Models::LookupRetrieveParticipantsParams
77
85
 
86
+ MeRetrieveParams = EInvoiceAPI::Models::MeRetrieveParams
87
+
78
88
  OutboxListDraftDocumentsParams = EInvoiceAPI::Models::OutboxListDraftDocumentsParams
79
89
 
80
90
  OutboxListReceivedDocumentsParams = EInvoiceAPI::Models::OutboxListReceivedDocumentsParams
@@ -4,6 +4,28 @@ module EInvoiceAPI
4
4
  module Resources
5
5
  class Documents
6
6
  class Ubl
7
+ # Create a new invoice or credit note from a UBL file
8
+ #
9
+ # @overload create_from_ubl(file:, request_options: {})
10
+ #
11
+ # @param file [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart]
12
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [EInvoiceAPI::Models::DocumentResponse]
15
+ #
16
+ # @see EInvoiceAPI::Models::Documents::UblCreateFromUblParams
17
+ def create_from_ubl(params)
18
+ parsed, options = EInvoiceAPI::Documents::UblCreateFromUblParams.dump_request(params)
19
+ @client.request(
20
+ method: :post,
21
+ path: "api/documents/ubl",
22
+ headers: {"content-type" => "multipart/form-data"},
23
+ body: parsed,
24
+ model: EInvoiceAPI::DocumentResponse,
25
+ options: options
26
+ )
27
+ end
28
+
7
29
  # Get the UBL for an invoice or credit note
8
30
  #
9
31
  # @overload get(document_id, request_options: {})
@@ -162,6 +162,39 @@ module EInvoiceAPI
162
162
  )
163
163
  end
164
164
 
165
+ # Create a new invoice or credit note from a PDF file. If the 'ubl_document' field
166
+ # is set in the response, it indicates that sufficient details were extracted from
167
+ # the PDF to automatically generate a valid UBL document ready for sending. If
168
+ # 'ubl_document' is not set, human intervention may be required to ensure
169
+ # compliance.
170
+ #
171
+ # @overload create_from_pdf(file:, customer_tax_id: nil, vendor_tax_id: nil, request_options: {})
172
+ #
173
+ # @param file [Pathname, StringIO, IO, String, EInvoiceAPI::FilePart] Body param:
174
+ #
175
+ # @param customer_tax_id [String, nil] Query param:
176
+ #
177
+ # @param vendor_tax_id [String, nil] Query param:
178
+ #
179
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
180
+ #
181
+ # @return [EInvoiceAPI::Models::DocumentCreateFromPdfResponse]
182
+ #
183
+ # @see EInvoiceAPI::Models::DocumentCreateFromPdfParams
184
+ def create_from_pdf(params)
185
+ parsed, options = EInvoiceAPI::DocumentCreateFromPdfParams.dump_request(params)
186
+ query_params = [:customer_tax_id, :vendor_tax_id]
187
+ @client.request(
188
+ method: :post,
189
+ path: "api/documents/pdf",
190
+ query: parsed.slice(*query_params),
191
+ headers: {"content-type" => "multipart/form-data"},
192
+ body: parsed.except(*query_params),
193
+ model: EInvoiceAPI::Models::DocumentCreateFromPdfResponse,
194
+ options: options
195
+ )
196
+ end
197
+
165
198
  # Send an invoice or credit note via Peppol
166
199
  #
167
200
  # @overload send_(document_id, email: nil, receiver_peppol_id: nil, receiver_peppol_scheme: nil, sender_peppol_id: nil, sender_peppol_scheme: nil, request_options: {})
@@ -188,6 +221,25 @@ module EInvoiceAPI
188
221
  )
189
222
  end
190
223
 
224
+ # Validate a UBL document according to Peppol BIS Billing 3.0
225
+ #
226
+ # @overload validate(document_id, request_options: {})
227
+ #
228
+ # @param document_id [String]
229
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
230
+ #
231
+ # @return [EInvoiceAPI::Models::UblDocumentValidation]
232
+ #
233
+ # @see EInvoiceAPI::Models::DocumentValidateParams
234
+ def validate(document_id, params = {})
235
+ @client.request(
236
+ method: :post,
237
+ path: ["api/documents/%1$s/validate", document_id],
238
+ model: EInvoiceAPI::UblDocumentValidation,
239
+ options: params[:request_options]
240
+ )
241
+ end
242
+
191
243
  # @api private
192
244
  #
193
245
  # @param client [EInvoiceAPI::Client]
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EInvoiceAPI
4
+ module Resources
5
+ class Me
6
+ # Retrieve information about your account.
7
+ #
8
+ # @overload retrieve(request_options: {})
9
+ #
10
+ # @param request_options [EInvoiceAPI::RequestOptions, Hash{Symbol=>Object}, nil]
11
+ #
12
+ # @return [EInvoiceAPI::Models::MeRetrieveResponse]
13
+ #
14
+ # @see EInvoiceAPI::Models::MeRetrieveParams
15
+ def retrieve(params = {})
16
+ @client.request(
17
+ method: :get,
18
+ path: "api/me/",
19
+ model: EInvoiceAPI::Models::MeRetrieveResponse,
20
+ options: params[:request_options]
21
+ )
22
+ end
23
+
24
+ # @api private
25
+ #
26
+ # @param client [EInvoiceAPI::Client]
27
+ def initialize(client:)
28
+ @client = client
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EInvoiceAPI
4
- VERSION = "0.7.0"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/e_invoice_api.rb CHANGED
@@ -52,9 +52,13 @@ require_relative "e_invoice_api/internal/transport/pooled_net_requester"
52
52
  require_relative "e_invoice_api/client"
53
53
  require_relative "e_invoice_api/internal/documents_number_page"
54
54
  require_relative "e_invoice_api/models/document_create"
55
+ require_relative "e_invoice_api/models/allowance"
55
56
  require_relative "e_invoice_api/models/certificate"
57
+ require_relative "e_invoice_api/models/charge"
56
58
  require_relative "e_invoice_api/models/currency_code"
57
59
  require_relative "e_invoice_api/models/document_attachment_create"
60
+ require_relative "e_invoice_api/models/document_create_from_pdf_params"
61
+ require_relative "e_invoice_api/models/document_create_from_pdf_response"
58
62
  require_relative "e_invoice_api/models/document_create_params"
59
63
  require_relative "e_invoice_api/models/document_delete_params"
60
64
  require_relative "e_invoice_api/models/document_delete_response"
@@ -68,11 +72,13 @@ require_relative "e_invoice_api/models/documents/attachment_list_params"
68
72
  require_relative "e_invoice_api/models/documents/attachment_list_response"
69
73
  require_relative "e_invoice_api/models/documents/attachment_retrieve_params"
70
74
  require_relative "e_invoice_api/models/documents/document_attachment"
75
+ require_relative "e_invoice_api/models/documents/ubl_create_from_ubl_params"
71
76
  require_relative "e_invoice_api/models/documents/ubl_get_params"
72
77
  require_relative "e_invoice_api/models/documents/ubl_get_response"
73
78
  require_relative "e_invoice_api/models/document_send_params"
74
79
  require_relative "e_invoice_api/models/document_state"
75
80
  require_relative "e_invoice_api/models/document_type"
81
+ require_relative "e_invoice_api/models/document_validate_params"
76
82
  require_relative "e_invoice_api/models/inbox_list_credit_notes_params"
77
83
  require_relative "e_invoice_api/models/inbox_list_invoices_params"
78
84
  require_relative "e_invoice_api/models/inbox_list_params"
@@ -80,6 +86,8 @@ require_relative "e_invoice_api/models/lookup_retrieve_params"
80
86
  require_relative "e_invoice_api/models/lookup_retrieve_participants_params"
81
87
  require_relative "e_invoice_api/models/lookup_retrieve_participants_response"
82
88
  require_relative "e_invoice_api/models/lookup_retrieve_response"
89
+ require_relative "e_invoice_api/models/me_retrieve_params"
90
+ require_relative "e_invoice_api/models/me_retrieve_response"
83
91
  require_relative "e_invoice_api/models/outbox_list_draft_documents_params"
84
92
  require_relative "e_invoice_api/models/outbox_list_received_documents_params"
85
93
  require_relative "e_invoice_api/models/paginated_document_response"
@@ -104,6 +112,7 @@ require_relative "e_invoice_api/resources/documents/attachments"
104
112
  require_relative "e_invoice_api/resources/documents/ubl"
105
113
  require_relative "e_invoice_api/resources/inbox"
106
114
  require_relative "e_invoice_api/resources/lookup"
115
+ require_relative "e_invoice_api/resources/me"
107
116
  require_relative "e_invoice_api/resources/outbox"
108
117
  require_relative "e_invoice_api/resources/validate"
109
118
  require_relative "e_invoice_api/resources/webhooks"
@@ -28,6 +28,9 @@ module EInvoiceAPI
28
28
  sig { returns(EInvoiceAPI::Resources::Lookup) }
29
29
  attr_reader :lookup
30
30
 
31
+ sig { returns(EInvoiceAPI::Resources::Me) }
32
+ attr_reader :me
33
+
31
34
  sig { returns(EInvoiceAPI::Resources::Webhooks) }
32
35
  attr_reader :webhooks
33
36