@@ -82,6 +82,7 @@ We provide enums for the following values:
8282| Enum | Values |
8383|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
8484| Accounts: SearchFieldEnum | ACCOUNT_NO(), self FIBU_ACCOUNT_GROUP_ID(), NAME(), ACCOUNT_TYPE() |
85+ | Accounts: AccountTypeEnum | EARNINGS(), EXPENDITURES(), ACTIVE_ACCOUNTS(), PASSIVE_ACCOUNTS(), COMPLETE_ACCOUNTS() |
8586| AdditionalAddresses: AddSearchTypeEnum | ID(), ID_ASC(), ID_DESC(), NAME(), NAME_ASC(), NAME_DESC() |
8687| CalendarYears: VatAccountingMethodEnum | EFFECTIVE(), NET_TAX() |
8788| CalendarYears: VatAccountingTypeEnum | AGREED(), COLLECTED() |
@@ -108,42 +109,58 @@ We provide enums for the following values:
108109
109110We provide DTOs for the following:
110111
111- | DTO |
112- |-----------------------------|
113- | AccountGroupDTO |
114- | AccountDTO |
115- | BankAccountDTO |
116- | AdditionalAddressDTO |
117- | BankAccountDTO |
118- | BusinessYearDTO |
119- | CalendarYearDTO |
120- | CompanyProfileDTO |
121- | ContactAdditionalAddressDTO |
122- | ContactGroupDTO |
123- | ContactRelationDTO |
124- | ContactDTO |
125- | ContactSectorDTO |
126- | CurrencyDTO |
127- | ExchangeCurrencyDTO |
128- | FileDTO |
129- | FileUsageDTO |
130- | EntryDTO |
131- | ManualEntryDTO |
132- | FileDTO |
133- | NoteDTO |
134- | PaymentDTO |
135- | JournalDTO |
136- | SalutationDTO |
137- | TaxDTO |
138- | TitleDTO |
139- | VatPeriodDTO |
112+ | DTO |
113+ |---------------------------------------|
114+ | AccountGroupDTO |
115+ | AccountDTO |
116+ | BankAccountDTO |
117+ | AdditionalAddressDTO |
118+ | BankAccountDTO |
119+ | BusinessActivityDTO |
120+ | BusinessYearDTO |
121+ | CalendarYearDTO |
122+ | CompanyProfileDTO |
123+ | ContactAdditionalAddressDTO |
124+ | ContactGroupDTO |
125+ | ContactRelationDTO |
126+ | ContactDTO |
127+ | CreateEditContactDTO |
128+ | ContactSectorDTO |
129+ | CurrencyDTO |
130+ | CreateCurrencyDTO |
131+ | EditCurrencyDTO |
132+ | ExchangeCurrencyDTO |
133+ | DocumentSettingDTO |
134+ | FileDTO |
135+ | EditFileDTO |
136+ | FileUsageDTO |
137+ | InvoiceDTO |
138+ | InvoicePositionDTO |
139+ | InvoiceTaxDTO |
140+ | PdfDTO |
141+ | LanguageDTO |
142+ | AddFileDTO |
143+ | EntryDTO |
144+ | FileDTO |
145+ | ManualEntryDTO |
146+ | NoteDTO |
147+ | PaymentDTO |
148+ | PaymentTypeDTO |
149+ | ProjectDTO |
150+ | JournalDTO |
151+ | SalutationDTO |
152+ | TaxDTO |
153+ | TitleDTO |
154+ | UnitDTO |
155+ | UserDTO |
156+ | VatPeriodDTO |
140157
141158In addition to the above, we also provide DTOs to be used for create and edit request for the following:
142159
143160| DTO |
144161|---------------------------------------|
145- | CreateEditAdditionalAddressDTO |
146162| CreateCalendarYearDTO |
163+ | CreateEditAdditionalAddressDTO |
147164| CreateEditContactAdditionalAddressDTO |
148165| CreateEditContactGroupDTO |
149166| CreateEditContactRelationDTO |
@@ -876,6 +893,178 @@ $payment = $connector->send(new EditIbanPaymentRequest(
876893))->dto();
877894```
878895
896+ ### Invoices
897+ ``` php
898+ /**
899+ * Fetch A List Of Invoices
900+ */
901+ $invoices = $connector->send(new FetchAListOfInvoicesRequest())->dto();
902+ ```
903+
904+ ``` php
905+ /**
906+ * Fetch An Invoice
907+ */
908+ $invoice = $connector->send(new FetchAnInvoiceRequest(
909+ invoice_id: 1
910+ ))->dto();
911+ ```
912+
913+ ``` php
914+ /**
915+ * Create An Invoice
916+ */
917+ $contacts = $connector->send(new FetchAListOfContactsRequest);
918+ $user = $connector->send(new FetchAuthenticatedUserRequest);
919+ $languages = $connector->send(new FetchAListOfLanguagesRequest);
920+ $banks = $connector->send(new FetchAListOfBankAccountsRequest);
921+ $currencies = $connector->send(new FetchAListOfCurrenciesRequest);
922+ $paymentTypes = $connector->send(new FetchAListOfPaymentTypesRequest);
923+ $units = $connector->send(new FetchAListOfUnitsRequest);
924+ $accounts = $connector->send(new FetchAListOfAccountsRequest);
925+ $taxes = $connector->send(new FetchAListOfTaxesRequest(scope: 'active', types: 'sales_tax'));
926+
927+ $newInvoice = InvoiceDTO::fromArray([
928+ 'title' => 'Test',
929+ 'contact_id' => $contacts->dto()->first()->id,
930+ 'user_id' => $user->dto()->id,
931+ 'pr_project_id' => null,
932+ 'language_id' => $languages->dto()->first()->id,
933+ 'bank_account_id' => $banks->dto()->first()->id,
934+ 'currency_id' => $currencies->dto()->first()->id,
935+ 'payment_type_id' => $paymentTypes->dto()->first()->id,
936+ 'mwst_type' => 1,
937+ 'mwst_is_net' => true,
938+ 'show_position_taxes' => true,
939+ 'is_valid_from' => now()->format('Y-m-d h:m:s'),
940+ 'is_valid_to' => now()->addDays(5)->format('Y-m-d h:m:s'),
941+ 'api_reference' => Str::uuid(),
942+ 'positions' => [
943+ InvoicePositionDTO::fromArray([
944+ 'type' => 'KbPositionText',
945+ 'show_pos_nr' => true,
946+ 'text' => Str::uuid(),
947+ ]),
948+ InvoicePositionDTO::fromArray([
949+ 'type' => 'KbPositionCustom',
950+ 'amount' => 1,
951+ 'unit_id' => $units->dto()->first()->id,
952+ 'account_id' => $accounts->dto()->filter(fn ($account) => $account->account_type_enum === AccountTypeEnum::ACTIVE_ACCOUNTS())->first()->id,
953+ 'tax_id' => $taxes->dto()->first()->id,
954+ 'text' => Str::uuid(),
955+ 'unit_price' => 100,
956+ 'discount_in_percent' => '0',
957+ ]),
958+ ],
959+ ]);
960+
961+ $invoice = $connector->send(new CreateAnInvoiceRequest(invoice: $newInvoice))->dto();
962+ ```
963+
964+ ``` php
965+ /**
966+ * Edit An Invoice
967+ */
968+ $editInvoice = $connector->send(new FetchAnInvoiceRequest(invoice_id: 1))->dto();
969+
970+ $editInvoice->title = 'Test Invoice';
971+
972+ $invoice = $connector->send(new EditAnInvoiceRequest(invoice_id: 1, invoice: $editInvoice));
973+ ```
974+
975+ ``` php
976+ /**
977+ * Delete An Invoice
978+ */
979+ $response = $connector->send(new DeleteAnInvoiceRequest(
980+ invoice_id: 1
981+ ));
982+ ```
983+
984+ ``` php
985+ /**
986+ * Cancel An Invoice
987+ */
988+ $response = $connector->send(new CancelAnInvoiceRequest(
989+ invoice_id: 1
990+ ));
991+ ```
992+
993+ ``` php
994+ /**
995+ * Create A Default Position For An Invoice
996+ */
997+ $units = $connector->send(new FetchAListOfUnitsRequest);
998+ $accounts = $connector->send(new FetchAListOfAccountsRequest);
999+ $taxes = $connector->send(new FetchAListOfTaxesRequest(scope: 'active', types: 'sales_tax'));
1000+
1001+ $position = InvoicePositionDTO::fromArray([
1002+ 'type' => 'KbPositionCustom',
1003+ 'amount' => 1,
1004+ 'unit_id' => $units->dto()->first()->id,
1005+ 'account_id' => $accounts->dto()->filter(fn ($account) => $account->account_type === 1)->first()->id,
1006+ 'tax_id' => $taxes->dto()->first()->id,
1007+ 'text' => Str::uuid(),
1008+ 'unit_price' => 100,
1009+ 'discount_in_percent' => '0',
1010+ ]);
1011+
1012+ $response = $connector->send(new CreateADefaultPositionRequest(
1013+ kb_document_type: 'kb_invoice',
1014+ invoice_id: 1,
1015+ position: $position,
1016+ ));
1017+ ```
1018+
1019+ ``` php
1020+ /**
1021+ * Create A Sub Position For An Invoice
1022+ */
1023+ $position = InvoicePositionDTO::fromArray([
1024+ 'type' => 'KbSubPosition',
1025+ 'text' => Str::uuid(),
1026+ 'show_pos_nr' => true,
1027+ ]);
1028+
1029+ $response = $connector->send(new CreateASubPositionRequest(
1030+ kb_document_type: 'kb_invoice',
1031+ invoice_id: 1,
1032+ position: $position,
1033+ ));
1034+ ```
1035+
1036+ ``` php
1037+ /**
1038+ * Show PDF
1039+ */
1040+ $pdf = $connector->send(new ShowPdfRequest(
1041+ invoice_id: 1
1042+ ))->dto();
1043+
1044+ /**
1045+ * Saving PDF from response
1046+ */
1047+ Storage::disk('local')->put('your/directory/'. $pdf->name, base64_decode($pdf->content));
1048+
1049+ /**
1050+ * Download PDF from response
1051+ */
1052+ return response(base64_decode($pdf->content))
1053+ ->header('Content-Type', $pdf->mime)
1054+ ->header('Content-Disposition', 'attachment; filename="'.$pdf->name.'"')
1055+ ->header('Content-Length', $pdf->size);
1056+ ```
1057+
1058+
1059+
1060+ ### Languages
1061+ ``` php
1062+ /**
1063+ * Fetch A List Of Languages
1064+ */
1065+ $languages = $connector->send(new FetchAListOfLanguagesRequest())->dto();
1066+ ```
1067+
8791068### Manual Entries
8801069``` php
8811070/**
0 commit comments