@@ -51,7 +51,9 @@ This package was developed to give you a quick start to the Bexio API.
5151 - [ Files] ( #files )
5252 - [ Iban Payments] ( #iban-payments )
5353 - [ Invoices] ( #invoices )
54+ - [ Item Positions] ( #item-positions )
5455 - [ Items] ( #items )
56+ - [ Quotes] ( #quotes )
5557 - [ Languages] ( #languages )
5658 - [ Manual Entries] ( #manual-entries )
5759 - [ Notes] ( #notes )
@@ -1608,7 +1610,95 @@ return response(base64_decode($pdf->content))
16081610 ->header('Content-Length', $pdf->size);
16091611```
16101612
1613+ ### Item Positions
1614+ ``` php
1615+ /**
1616+ * Fetch A List Of Item Positions
1617+ */
1618+ $itemPositions = $connector->send(new FetchAListOfItemPositionsRequest(
1619+ kb_document_id: 1,
1620+ kb_document_type: 'kb_offer'
1621+ ))->dto();
1622+ ```
1623+
1624+ ``` php
1625+ /**
1626+ * Fetch An Item Position
1627+ */
1628+ $itemPosition = $connector->send(new FetchAnItemPositionRequest(
1629+ item_position_id: 1
1630+ ))->dto();
1631+ ```
1632+
1633+ ``` php
1634+ /**
1635+ * Create An Item Position
1636+ */
1637+ $itemPosition = $connector->send(new CreateAnItemPositionRequest(
1638+ kb_document_id: 1,
1639+ itemPosition: new CreateEditItemPositionDTO(
1640+ kb_document_type: 'kb_offer',
1641+ type: 'KbPositionCustom',
1642+ amount: '1',
1643+ unit_id: 1,
1644+ account_id: 1,
1645+ tax_id: 1,
1646+ text: 'Test Item Position',
1647+ unit_price: '100.00',
1648+ discount_in_percent: '0',
1649+ )
1650+ ))->dto();
1651+ ```
1652+
1653+ ``` php
1654+ /**
1655+ * Edit An Item Position
1656+ */
1657+ $itemPosition = $connector->send(new EditAnItemPositionRequest(
1658+ item_position_id: 1,
1659+ itemPosition: new CreateEditItemPositionDTO(
1660+ kb_document_type: 'kb_offer',
1661+ type: 'KbPositionCustom',
1662+ amount: '2',
1663+ unit_id: 1,
1664+ account_id: 1,
1665+ tax_id: 1,
1666+ text: 'Updated Item Position',
1667+ unit_price: '150.00',
1668+ discount_in_percent: '0',
1669+ )
1670+ ))->dto();
1671+ ```
16111672
1673+ ``` php
1674+ /**
1675+ * Delete An Item Position
1676+ */
1677+ $response = $connector->send(new DeleteAnItemPositionRequest(
1678+ item_position_id: 1
1679+ ));
1680+ ```
1681+
1682+ ``` php
1683+ /**
1684+ * Create An Offer Item Position (with kb_document_type 'kb_offer' set by default)
1685+ */
1686+ $offerItemPosition = new OfferItemPositionDTO(
1687+ type: 'KbPositionCustom',
1688+ amount: '1',
1689+ unit_id: 1,
1690+ account_id: 1,
1691+ tax_id: 1,
1692+ text: 'Test Offer Item Position',
1693+ unit_price: '100.00',
1694+ discount_in_percent: '0',
1695+ );
1696+
1697+ $itemPosition = $connector->send(new CreateAnItemPositionRequest(
1698+ kb_document_id: 1,
1699+ itemPosition: $offerItemPosition
1700+ ))->dto();
1701+ ```
16121702
16131703### Languages
16141704``` php
@@ -2009,6 +2099,198 @@ $title = $connector->send(new DeleteATitleRequest(
20092099));
20102100```
20112101
2102+ ### Quotes
2103+ ``` php
2104+ /**
2105+ * Fetch A List Of Quotes
2106+ */
2107+ $quotes = $connector->send(new FetchAListOfQuotesRequest())->dto();
2108+ ```
2109+
2110+ ``` php
2111+ /**
2112+ * Fetch A Quote
2113+ */
2114+ $quote = $connector->send(new FetchAQuoteRequest(
2115+ quote_id: 1
2116+ ))->dto();
2117+ ```
2118+
2119+ ``` php
2120+ /**
2121+ * Search Quotes
2122+ */
2123+ $quotes = $connector->send(new SearchQuotesRequest(
2124+ searchField: 'title',
2125+ searchTerm: 'Test'
2126+ ))->dto();
2127+ ```
2128+
2129+ ``` php
2130+ /**
2131+ * Create A Quote
2132+ */
2133+ $contacts = $connector->send(new FetchAListOfContactsRequest);
2134+ $user = $connector->send(new FetchAuthenticatedUserRequest);
2135+ $languages = $connector->send(new FetchAListOfLanguagesRequest);
2136+ $banks = $connector->send(new FetchAListOfBankAccountsRequest);
2137+ $currencies = $connector->send(new FetchAListOfCurrenciesRequest);
2138+ $paymentTypes = $connector->send(new FetchAListOfPaymentTypesRequest);
2139+ $units = $connector->send(new FetchAListOfUnitsRequest);
2140+ $accounts = $connector->send(new FetchAListOfAccountsRequest);
2141+ $taxes = $connector->send(new FetchAListOfTaxesRequest(scope: 'active', types: 'sales_tax'));
2142+
2143+ $newQuote = QuoteDTO::fromArray([
2144+ 'title' => 'Test Quote',
2145+ 'contact_id' => $contacts->dto()->first()->id,
2146+ 'user_id' => $user->dto()->id,
2147+ 'pr_project_id' => null,
2148+ 'language_id' => $languages->dto()->first()->id,
2149+ 'bank_account_id' => $banks->dto()->first()->id,
2150+ 'currency_id' => $currencies->dto()->first()->id,
2151+ 'payment_type_id' => $paymentTypes->dto()->first()->id,
2152+ 'mwst_type' => 1,
2153+ 'mwst_is_net' => true,
2154+ 'show_position_taxes' => true,
2155+ 'is_valid_from' => now()->format('Y-m-d h:m:s'),
2156+ 'is_valid_to' => now()->addDays(5)->format('Y-m-d h:m:s'),
2157+ 'api_reference' => Str::uuid(),
2158+ 'positions' => [
2159+ InvoicePositionDTO::fromArray([
2160+ 'type' => 'KbPositionText',
2161+ 'show_pos_nr' => true,
2162+ 'text' => Str::uuid(),
2163+ ]),
2164+ InvoicePositionDTO::fromArray([
2165+ 'type' => 'KbPositionCustom',
2166+ 'amount' => 1,
2167+ 'unit_id' => $units->dto()->first()->id,
2168+ 'account_id' => $accounts->dto()->filter(fn ($account) => $account->account_type_enum === AccountTypeEnum::ACTIVE_ACCOUNTS())->first()->id,
2169+ 'tax_id' => $taxes->dto()->first()->id,
2170+ 'text' => Str::uuid(),
2171+ 'unit_price' => 100,
2172+ 'discount_in_percent' => '0',
2173+ ]),
2174+ ],
2175+ ]);
2176+
2177+ $quote = $connector->send(new CreateAQuoteRequest(quote: $newQuote))->dto();
2178+ ```
2179+
2180+ ``` php
2181+ /**
2182+ * Edit A Quote
2183+ */
2184+ $editQuote = $connector->send(new FetchAQuoteRequest(quote_id: 1))->dto();
2185+
2186+ $editQuote->title = 'Updated Quote Title';
2187+
2188+ $quote = $connector->send(new EditAQuoteRequest(quote_id: 1, quote: $editQuote));
2189+ ```
2190+
2191+ ``` php
2192+ /**
2193+ * Delete A Quote
2194+ */
2195+ $response = $connector->send(new DeleteAQuoteRequest(
2196+ quote_id: 1
2197+ ));
2198+ ```
2199+
2200+ ``` php
2201+ /**
2202+ * Issue A Quote
2203+ */
2204+ $response = $connector->send(new IssueAQuoteRequest(
2205+ quote_id: 1
2206+ ));
2207+ ```
2208+
2209+ ``` php
2210+ /**
2211+ * Revert Issue A Quote
2212+ */
2213+ $response = $connector->send(new RevertIssueAQuoteRequest(
2214+ quote_id: 1
2215+ ));
2216+ ```
2217+
2218+ ``` php
2219+ /**
2220+ * Accept A Quote
2221+ */
2222+ $response = $connector->send(new AcceptAQuoteRequest(
2223+ quote_id: 1
2224+ ));
2225+ ```
2226+
2227+ ``` php
2228+ /**
2229+ * Decline A Quote
2230+ */
2231+ $response = $connector->send(new DeclineAQuoteRequest(
2232+ quote_id: 1
2233+ ));
2234+ ```
2235+
2236+ ``` php
2237+ /**
2238+ * Reissue A Quote
2239+ */
2240+ $response = $connector->send(new ReissueAQuoteRequest(
2241+ quote_id: 1
2242+ ));
2243+ ```
2244+
2245+ ``` php
2246+ /**
2247+ * Mark Quote As Sent
2248+ */
2249+ $response = $connector->send(new MarkAsSentAQuoteRequest(
2250+ quote_id: 1
2251+ ));
2252+ ```
2253+
2254+ ``` php
2255+ /**
2256+ * Show PDF Of A Quote
2257+ */
2258+ $pdf = $connector->send(new ShowPdfAQuoteRequest(
2259+ quote_id: 1
2260+ ))->dto();
2261+
2262+ /**
2263+ * Saving PDF from response
2264+ */
2265+ Storage::disk('local')->put('your/directory/'. $pdf->name, base64_decode($pdf->content));
2266+
2267+ /**
2268+ * Download PDF from response
2269+ */
2270+ return response(base64_decode($pdf->content))
2271+ ->header('Content-Type', $pdf->mime)
2272+ ->header('Content-Disposition', 'attachment; filename="'.$pdf->name.'"')
2273+ ->header('Content-Length', $pdf->size);
2274+ ```
2275+
2276+ ``` php
2277+ /**
2278+ * Create Order From Quote
2279+ */
2280+ $response = $connector->send(new CreateOrderFromQuoteRequest(
2281+ quote_id: 1
2282+ ));
2283+ ```
2284+
2285+ ``` php
2286+ /**
2287+ * Create Invoice From Quote
2288+ */
2289+ $response = $connector->send(new CreateInvoiceFromQuoteRequest(
2290+ quote_id: 1
2291+ ));
2292+ ```
2293+
20122294### Items
20132295``` php
20142296/**
0 commit comments