Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetFilesAssocCount added GetFullyPaidDate for Invoice added #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion authorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


$options = [
'scope' => ['openid email profile offline_access assets projects accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments']
'scope' => ['openid email profile offline_access assets projects accounting.settings accounting.transactions accounting.contacts accounting.journals.read accounting.reports.read accounting.attachments files files.read']
// finance.accountingactivity.read finance.bankstatementsplus.read finance.cashvalidation.read finance.statements.read
];

Expand Down
37 changes: 33 additions & 4 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,13 @@ public function getAccountAttachmentById($xeroTenantId,$apiInstance,$returnObj=f
}
}

public function getAssociationsCount($xeroTenantId, $filesApi)
{
$objects = "0c0f2162-7f7e-4816-a5f7-1e24a6299d3c,0bdc1542-6987-42f8-97a3-eb453f5314b7";
$result = $filesApi->getAssociationsCount($xeroTenantId,$objects);
echo '<pre>'; print_r($result); echo '</pre>';
}

public function getAccounts($xeroTenantId,$apiInstance,$returnObj=false)
{
$str = '';
Expand Down Expand Up @@ -665,14 +672,18 @@ public function getContacts($xeroTenantId,$apiInstance,$returnObj=false)
//[Contacts:Read]
// read all contacts
$result = $apiInstance->getContacts($xeroTenantId);

// filter by contacts by status
$where = 'ContactStatus=="ACTIVE"';
$result2 = $apiInstance->getContacts($xeroTenantId, null, $where);
$order = "Name ASC";
$page = 0;
$includeArchived = true;
$summaryOnly = true;
$searchTerm = "";
$result2 = $apiInstance->getContacts($xeroTenantId, null, $where, $order,null,$page,$includeArchived,$summaryOnly,$searchTerm);
//[/Contacts:Read]

$str = $str . "Get Contacts Total: " . count($result->getContacts()) . "<br>";
$str = $str . "Get ACTIVE Contacts Total: " . count($result2->getContacts()) . "<br>";
$str = $str . "Get Contacts Total: " . count($result->getContacts()) . "<br>";
$str = $str . "Get ACTIVE Contacts Total: " . count($result2->getContacts()) . "<br>";

if($returnObj) {
return $result2;
Expand Down Expand Up @@ -2041,6 +2052,24 @@ public function getPayment($xeroTenantId,$apiInstance,$returnObj=false)
}
}

public function getPaymentFullyPaidDate($xeroTenantId,$apiInstance,$returnObj=false)
{
$str = '';

//[PaymentsFullyPaidDate:Read]
//$invoice = new XeroAPI\XeroPHP\Models\Accounting\Invoice;
$invoiceId = '1300d9d0-cf54-4b1b-9a75-8b338a8ca7df';
$invoice = $apiInstance->getInvoice($xeroTenantId,$invoiceId);
//$invoice->setInvoiceID($invoiceId);
var_dump( $invoice->getInvoices()[0]->getFullyPaidOnDateAsDate());
$result = $invoice->getInvoices()[0]->getFullyPaidOnDateAsDate();
$str = print_r($result,true) . "<br>";
//[/PaymentsFullyPaidDate:Read]

return $str;

}

public function createPayment($xeroTenantId,$apiInstance,$returnObj=false)
{
$str = '';
Expand Down
21 changes: 20 additions & 1 deletion get.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
$config
);

$filesApi = new XeroAPI\XeroPHP\Api\FilesApi(
new GuzzleHttp\Client(),
$config
);

if (isset($_POST["endpoint"]) ) {
$endpoint = htmlspecialchars($_POST["endpoint"]);
} else {
Expand Down Expand Up @@ -278,7 +283,7 @@ function get_string_between($string, $start, $end){
echo $ex->createContacts($xeroTenantId,$accountingApi);
break;
case "Read":
echo $ex->getContact($xeroTenantId,$accountingApi);
echo $ex->getContacts($xeroTenantId,$accountingApi);
break;
case "UpdateOrCreate":
echo $ex->updateOrCreateContacts($xeroTenantId,$accountingApi);
Expand Down Expand Up @@ -416,6 +421,9 @@ function get_string_between($string, $start, $end){
case "Void":
echo $ex->voidInvoice($xeroTenantId,$accountingApi);
break;
case "FullPaidDate":
echo $ex->getPaymentFullyPaidDate($xeroTenantId,$accountingApi);
break;
default:
echo $action . " action not supported in API";
}
Expand Down Expand Up @@ -960,6 +968,17 @@ function get_string_between($string, $start, $end){
}
break;

case "FilesAssocCount":
switch($action)
{
case "Read":
echo $ex->getAssociationsCount($xeroTenantId,$filesApi);
break;
default:
echo $action . " action not supported in API";
}
break;

case "FinancialStatementBalanceSheet":
switch($action)
{
Expand Down
4 changes: 3 additions & 1 deletion xero-sdk-ui/xero.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var endpoint = [
{name: "Currencies",action:[{name: "Create"},{name: "Read"}]},
{name: "Employees",action:[{name: "Create"},{name: "CreateMulti"},{name: "Read"},{name: "Update"}]},
{name: "ExpenseClaims",action:[{name: "Create"},{name: "Read"},{name: "Update"}]},
{name: "Invoices",action:[{name: "Create"},{name: "UpdateOrCreate"},{name: "ReadPdf"},{name: "Read"},{name: "Update"},{name: "Delete"},{name: "Void"}]},
{name: "Invoices",action:[{name: "Create"},{name: "UpdateOrCreate"},{name: "ReadPdf"},{name: "Read"},{name: "Update"},{name: "Delete"},{name: "Void"},{name: "FullPaidDate"}]},
{name: "InvoiceReminders",action:[{name: "Read"}]},
{name: "Items",action:[{name: "Create"},{name: "CreateMulti"},{name: "Read"},{name: "Update"},{name: "Delete"}]},
{name: "Journals",action:[{name: "Read all"}, {name: "Read one by number"}]},
Expand All @@ -55,6 +55,8 @@ var endpoint = [
{name: "TrackingCategories",action:[{name: "Create"},{name: "Read"},{name: "Update"},{name: "Delete"},{name: "Archive"}]},
{name: "TrackingOptions",action:[{name: "Create"},{name: "Update"},{name: "Delete"}]},
{name: "Users",action:[{name: "Read"}]},
{name: "---FILES---",action:[{name: ""}]},
{name: "FilesAssocCount",action:[{name: "Read"}]},
{name: "---FIXED ASSETS---",action:[{name: ""}]},
{name: "Asset",action:[{name: "Read"},{name: "Create"},{name: "Update"}]},
{name: "Assets",action:[{name: "Read"}]},
Expand Down