@@ -185,45 +185,16 @@ class XeroWebhookController extends Controller
185185
186186}
187187```
188- #Create an invoice - example controller:
189188
190- ``` php
191- use XeroAPI\XeroPHP\Models\Accounting\Invoice;
192- use XeroAPI\XeroPHP\Models\Accounting\Invoices;
193- use XeroAPI\XeroPHP\Models\Accounting\TaxType;
194- use XeroAPI\XeroPHP\Models\Accounting\LineItem;
195- use XeroAPI\XeroPHP\Models\Accounting\AccountType;
196- use XeroAPI\XeroPHP\Models\Accounting\CurrencyCode;
197-
198- $invoices = [];
199-
200- for($i = 0; $i < 10; $i++) {
201-
202- $lineItems = [];
203- for($j = 1; $j < 6; $j++) {
204- $lineItem = new LineItem();
205- $lineItem->setQuantity(1);
206- $lineItem->setUnitAmount(100 * $j);
207- $lineItem->setDescription("Line {$j}");
208- $lineItem->setTaxType(TaxType::OUTPUT2);
209- $lineItem->setAccountCode(AccountType::SALES);
210- $lineItems[] = $lineItem;
211- }
189+ ## Example calls
212190
213- $xeroInvoice = new Invoice();
214- $xeroInvoice->setType(Invoice::TYPE_ACCREC);
215- $xeroInvoice->setContact(/* XERO_CONTACT_UUID */);
216- $xeroInvoice->setReference(/* AN INTERNAL REFERENCE */);
217- $xeroInvoice->setLineItems($lineItems);
218- $xeroInvoice->setCurrencyCode(CurrencyCode::NZD);
219- $xeroInvoice->setDueDate(now()->addDays(14));
220- $invoices[] = $xeroInvoice;
221- }
191+ This package is simply a bridge so you don't have to deal with the Oauth2 gymnastics in Laravel.
222192
223- $xero = resolve(\XeroAPI\XeroPHP\Api\AccountingApi::class);
224- $xero->updateOrCreateInvoices(new Invoices(['invoices' => $invoices]));
193+ Once you've have an instance of \XeroAPI\XeroPHP\Api\AccountingApi::class you're dealing directly with Xero's api library.
225194
226- ```
195+ The XeroAPI PHP Oauth2 App repository has this list of examples of implementing calls to the API: e.g. invoice creation etc.
196+
197+ https://github.com/XeroAPI/xero-php-oauth2-app/blob/master/example.php
227198
228199## License
229200
0 commit comments