Skip to content

Commit

Permalink
Merge pull request #17 from iranl/extend-all-testing
Browse files Browse the repository at this point in the history
Extend all testing
  • Loading branch information
iranl authored Jul 9, 2019
2 parents 9c61dae + a366c77 commit 03ac86d
Show file tree
Hide file tree
Showing 44 changed files with 821 additions and 49 deletions.
4 changes: 3 additions & 1 deletion examples/Activity.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Activity
* Twinfield UI: https://accounting.twinfield.com/UI/#/Projects/Manage
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Activities
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Article.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Article
* Twinfield UI: https://accounting.twinfield.com/UI/#/Sales/ClassicItems
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Articles
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/AssetMethod.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* AssetMethod
* Twinfield UI: https://accounting.twinfield.com/UI/#/FixedAssets/ClassicAssetClasses
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/AssetMethods
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
3 changes: 3 additions & 0 deletions examples/Authorization.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

/* To use OAuth 2 for logging in it is necessary that a user with access rights to Twinfield grants authorization.
* On loading a page containing the following code the user will be redirected to the Twinfield Login page.
Expand Down
344 changes: 344 additions & 0 deletions examples/BankTransaction.php

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion examples/BrowseData.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

/* BrowseData
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Request/BrowseData
*/

//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/CashBankBook.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

//CashBankBook

//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
344 changes: 344 additions & 0 deletions examples/CashTransaction.php

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions examples/Connection.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

/* In order to use OAuth2 to authenticate with Twinfield, one should use the \PhpTwinfield\Secure\Provider\OAuthProvider
* to retrieve an \League\OAuth2\Client\Token\AccessToken object, and extract the refresh and access token from this object.
* Furthermore, it is required to set up a default \PhpTwinfield\Office, that will be used during requests to Twinfield.
Expand Down
4 changes: 3 additions & 1 deletion examples/CostCenter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* CostCenter
* Twinfield UI: https://accounting.twinfield.com/UI/#/Dimensions/CostCenters
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/CostCenters
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Country.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

//Country

//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Currency.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Currency
* Twinfield UI: https://accounting.twinfield.com/UI/#/Settings/Company/Currencies
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Currencies
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Customer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Customer
* Twinfield UI: https://accounting.twinfield.com/UI/#/Sales/ClassicCustomers
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Customers
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/DimensionGroup.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* DimensionGroup
* Twinfield UI: https://accounting.twinfield.com/UI/#/Settings/Company/DimensionGroups
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/DimensionGroups
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/DimensionType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* DimensionType
* Twinfield UI: https://accounting.twinfield.com/UI/#/Settings/Company/DimensionTypes
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/DimensionTypes
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/FixedAsset.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* FixedAsset
* Twinfield UI: https://accounting.twinfield.com/UI/#/FixedAssets/ClassicFixedAssets
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/FixedAssets
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/GeneralLedger.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* GeneralLedger
* Twinfield UI: https://accounting.twinfield.com/UI/#/Dimensions/BalanceSheet and https://accounting.twinfield.com/UI/#/Dimensions/ProfitAndLoss
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/BalanceSheets
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
10 changes: 6 additions & 4 deletions examples/Invoice.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Invoice
* Twinfield UI: https://accounting.twinfield.com/UI/#/Sales/ClassicInvoices
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/SalesInvoices
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down Expand Up @@ -173,12 +175,12 @@
echo "Messages: " . print_r($invoice->getMessages(), true) . "<br />"; // Array|null (Error) messages.
}

echo "Office (\\PhpTwinfield\\Office): <pre>" . print_r($invoice->getOffice(), true) . "</pre><br />"; // Office|null Office code.
echo "Office (string): " . Util::objectToStr($invoice->getOffice()) . "<br />"; // string|null
echo "PaymentMethod: {$invoice->getPaymentMethod()}<br />"; // PaymentMethod|null The payment method.
echo "PerformanceDate (\\DateTimeInterface): <pre>" . print_r($invoice->getPerformanceDate(), true) . "</pre><br />"; // DateTimeInterface|null Performance date, when set-up on the invoice header.
echo "PerformanceDate (string): " . Util::formatDate($invoice->getPerformanceDate()) . "<br />"; // string|null
echo "Period: {$invoice->getPeriod()}<br />"; // string|null Period in YYYY/PP format.
echo "Office (\\PhpTwinfield\\Office): <pre>" . print_r($invoice->getOffice(), true) . "</pre><br />"; // Office|null Office code.
echo "Office (string): " . Util::objectToStr($invoice->getOffice()) . "<br />"; // string|null
echo "Result: {$invoice->getResult()}<br />"; // int|null Result (0 = error, 1 or empty = success).
echo "Status: {$invoice->getStatus()}<br />"; // Status|null Status of the invoice.

Expand Down Expand Up @@ -368,7 +370,7 @@
//$invoiceLine->setUnitsPriceInc(\Money\Money::EUR(1210)); // Money|null Only valid for invoice types with VAT inclusive units prices. Only add this tag to an XML request if the setting Prices can be changed on an item is set to true. Otherwise, the price will be determined by the system. (Equals 12.10 EUR)
$vatCode = new \PhpTwinfield\VatCode;
$vatCode->setCode('VH');
//$invoiceLine->getVatCode($vatCode); // VatCode|null VAT code.
//$invoiceLine->setVatCode($vatCode); // VatCode|null VAT code.
//$invoiceLine->setVatCode(\PhpTwinfield\VatCode::fromCode('VH')); // string|null

$invoice->addLine($invoiceLine); // InvoiceLine Add an InvoiceLine object to the Invoice object
Expand Down
4 changes: 3 additions & 1 deletion examples/InvoiceType.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

//InvoiceType

//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Office.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Office
* Twinfield UI: https://accounting.twinfield.com/UI/#/Companies/All
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Offices
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/PayCode.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

//PayCode

//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Project.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Project
* Twinfield UI: https://accounting.twinfield.com/UI/#/Projects/Manage
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Projects
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/Rate.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Rate
* Twinfield UI: https://accounting.twinfield.com/UI/#/Projects/TimeAndExpenses/Rates
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Rates
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
3 changes: 3 additions & 0 deletions examples/RenewAccessToken.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

/* Store a valid access token and cluster through a scheduled task/cron job running in the background.
* Running the following code every 60 minutes (or a bit less as Access Tokens are valid for exactly 60 minutes)
* will reduce connection time when working with the API (by about 2 seconds).
Expand Down
3 changes: 3 additions & 0 deletions examples/RenewAuthorization.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);

/* A user with login access to Twinfield needs to grant authorization to the API at least every 550 days.
* Consider running this script through a task schedular/Cron once every week to check if the authorization needs to be imminently renewed.
* Email the user the request for renewal of the authorization at that time and keep resending the request every week until authorization is granted.
Expand Down
4 changes: 3 additions & 1 deletion examples/Supplier.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* Supplier
* Twinfield UI: https://accounting.twinfield.com/UI/#/Purchase/ClassicSuppliers
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Suppliers
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
4 changes: 3 additions & 1 deletion examples/User.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/* User
* Twinfield UI: https://accounting.twinfield.com/UI/#/Settings/Access/Users/UserSettings
* API Documentation: https://c3.twinfield.com/webservices/documentation/#/ApiReference/Masters/Users
Expand All @@ -8,6 +7,9 @@
//Optionally declare the namespace PhpTwinfield so u can call classes without prepending \PhpTwinfield\
namespace PhpTwinfield;

error_reporting(E_ALL);
ini_set("display_errors", 1);

// Use the ResponseException class to handle errors when listing, getting and sending objects to/from Twinfield
use PhpTwinfield\Response\ResponseException;

Expand Down
Loading

0 comments on commit 03ac86d

Please sign in to comment.