Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Administrator
ZohoBooksApi
Commits
2f7cd0d2
Commit
2f7cd0d2
authored
5 years ago
by
Daniele Rosario
Browse files
Options
Download
Plain Diff
Merge branch 'release/3.1.1'
parents
165a040c
5c6de8c3
develop
master
pr/39
5.0.1
5.0.0
4.5.1
4.5.0
4.4.2
4.4.1
4.4.0
4.3.1
4.3.0
4.2.0
4.1.0
4.0.0
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.1.1
No related merge requests found
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
README.md
+3
-0
README.md
src/Client.php
+6
-5
src/Client.php
src/Modules/Claimants.php
+0
-12
src/Modules/Claimants.php
src/Modules/CustomerPayments.php
+2
-2
src/Modules/CustomerPayments.php
src/Modules/Module.php
+12
-1
src/Modules/Module.php
src/Modules/RecurringExpenses.php
+14
-1
src/Modules/RecurringExpenses.php
src/Modules/RecurringInvoices.php
+14
-1
src/Modules/RecurringInvoices.php
src/Modules/Settings/Currencies/ExchangeRates.php
+2
-2
src/Modules/Settings/Currencies/ExchangeRates.php
src/Modules/Settings/OpeningBalances.php
+2
-2
src/Modules/Settings/OpeningBalances.php
src/Modules/Settings/TaxAuthorities.php
+26
-1
src/Modules/Settings/TaxAuthorities.php
src/Modules/Settings/TaxGroups.php
+13
-1
src/Modules/Settings/TaxGroups.php
src/Modules/Units.php
+0
-12
src/Modules/Units.php
src/Modules/VendorCredits.php
+14
-1
src/Modules/VendorCredits.php
src/ZohoBooks.php
+5
-4
src/ZohoBooks.php
with
113 additions
and
45 deletions
+113
-45
README.md
View file @
2f7cd0d2
[

](https://packagist.org/packages/webleit/zohobooksapi)
[

](https://packagist.org/packages/webleit/zohobooksapi)
# Zoho Books API v3 - PHP SDK
This Library is a SDK in PHP that simplifies the usage of the Zoho Books Api version 3 (https://www.zoho.com/books/api/v3/)
...
...
This diff is collapsed.
Click to expand it.
src/Client.php
View file @
2f7cd0d2
...
...
@@ -102,7 +102,7 @@ class Client
/**
* @return string
*/
public
function
getOrganizationId
()
public
function
getOrganizationId
()
{
return
$this
->
organizationId
;
}
...
...
@@ -110,7 +110,7 @@ class Client
/**
* @return string
*/
public
function
getRegion
()
public
function
getRegion
()
{
return
$this
->
region
;
}
...
...
@@ -191,7 +191,7 @@ class Client
$url
,
$this
->
getOptions
([
'query'
=>
$this
->
getParams
(
$organizationId
)
+
$params
,
'form_params'
=>
[
'JSONString'
=>
json_encode
(
$data
)
]
'form_params'
=>
[
'JSONString'
=>
json_encode
(
$data
)]
])
));
}
...
...
@@ -214,7 +214,8 @@ class Client
return
$this
->
processResult
(
$this
->
httpClient
->
put
(
$url
,
$this
->
getOptions
([
'query'
=>
$this
->
getParams
(
$organizationId
,
$data
)
+
$params
,
'query'
=>
$this
->
getParams
(
$organizationId
)
+
$params
,
'form_params'
=>
[
'JSONString'
=>
json_encode
(
$data
)]
])
));
}
...
...
@@ -270,7 +271,7 @@ class Client
{
return
array_merge
([
'headers'
=>
[
'Authorization'
=>
'Zoho-oauthtoken '
.
$this
->
oAuthClient
->
getAccessToken
()
'Authorization'
=>
'Zoho-oauthtoken '
.
$this
->
oAuthClient
->
getAccessToken
()
]
],
$params
);
}
...
...
This diff is collapsed.
Click to expand it.
src/Modules/Claimants.php
deleted
100644 β 0
View file @
165a040c
<?php
namespace
Webleit\ZohoBooksApi\Modules
;
/**
* Class Claimants
* @package Webleit\ZohoBooksApi\Modules
*/
class
Claimants
extends
Module
{
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Modules/CustomerPayments.php
View file @
2f7cd0d2
...
...
@@ -36,7 +36,7 @@ class CustomerPayments extends Module
/**
* @return string
*/
p
rotected
function
getResourceKey
()
p
ublic
function
getResourceKey
()
{
return
'customerpayments'
;
}
...
...
@@ -50,4 +50,4 @@ class CustomerPayments extends Module
$className
=
$this
->
getModelClassName
()
.
'\\Refund'
;
return
$this
->
getPropertyList
(
'refunds'
,
$id
,
$className
,
'payment_refunds'
,
$this
->
refunds
);
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
src/Modules/Module.php
View file @
2f7cd0d2
...
...
@@ -187,6 +187,13 @@ abstract class Module implements \Webleit\ZohoBooksApi\Contracts\Module
}
/**
* Mark something with a status
*
* Note that as of 2019-11-27, Zoho Books API errors if you don't
* provide a JSONString param. It can't be empty.
*
* See https://github.com/Weble/ZohoBooksApi/issues/33
*
* @param $id
* @param $status
* @param string $key
...
...
@@ -194,7 +201,11 @@ abstract class Module implements \Webleit\ZohoBooksApi\Contracts\Module
*/
public
function
markAs
(
$id
,
$status
,
$key
=
'status'
)
{
$this
->
client
->
post
(
$this
->
getUrl
()
.
'/'
.
$id
.
'/'
.
$key
.
'/'
.
$status
);
$this
->
client
->
post
(
$this
->
getUrl
()
.
'/'
.
$id
.
'/'
.
$key
.
'/'
.
$status
,
null
,
[
"random"
=>
"data"
]
);
// If we arrive here without exceptions, everything went well
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
src/Modules/RecurringExpenses.php
View file @
2f7cd0d2
...
...
@@ -36,4 +36,17 @@ class RecurringExpenses extends Documents
{
return
$this
->
getPropertyList
(
'expenses'
,
$id
);
}
}
\ No newline at end of file
/**
* Override returned key
*
* This overrides the key that is returned from zoho, as they
* send back 'recurring_expenses' instead of 'recurringexpenses'
*
* @return string
*/
public
function
getResourceKey
()
{
return
'recurring_expenses'
;
}
}
This diff is collapsed.
Click to expand it.
src/Modules/RecurringInvoices.php
View file @
2f7cd0d2
...
...
@@ -25,4 +25,17 @@ class RecurringInvoices extends Documents
{
return
$this
->
markAs
(
$id
,
'resume'
);
}
}
\ No newline at end of file
/**
* Override returned key
*
* This overrides the key that is returned from zoho, as they
* send back 'recurring_invoices' instead of 'recurringinvoices'
*
* @return string
*/
public
function
getResourceKey
()
{
return
'recurring_invoices'
;
}
}
This diff is collapsed.
Click to expand it.
src/Modules/Settings/Currencies/ExchangeRates.php
View file @
2f7cd0d2
...
...
@@ -24,8 +24,8 @@ class ExchangeRates extends SubModule
/**
* @return string
*/
p
rotected
function
getResourceKey
()
p
ublic
function
getResourceKey
()
{
return
'exchange_rates'
;
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
src/Modules/Settings/OpeningBalances.php
View file @
2f7cd0d2
...
...
@@ -32,7 +32,7 @@ class OpeningBalances extends Module
/**
* @return string
*/
p
rotected
function
getResourceKey
()
p
ublic
function
getResourceKey
()
{
return
'opening_balance'
;
}
...
...
@@ -56,4 +56,4 @@ class OpeningBalances extends Module
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
src/Modules/Settings/TaxAuthorities.php
View file @
2f7cd0d2
...
...
@@ -26,4 +26,29 @@ class TaxAuthorities extends Module
{
return
TaxAuthority
::
class
;
}
}
\ No newline at end of file
/**
* Return Zoho API name
*
* This overrides getResourceKey in Module, which normally
* returns strtolower of name. However, Zoho returns "tax_authorities"
* instead of the expected 'taxauthorities' key.
*/
public
function
getResourceKey
()
{
return
"tax_authorities"
;
}
/**
* Return Zoho API Key Name
*
* This is the unique key used to return data. With the taxauthorities
* module, it returns the data as an array in 'tax_authorities' but the
* actual key is 'tax_authority_id', without the trailing s.
*/
public
function
getApiKeyName
()
{
return
"tax_authoritiy_id"
;
}
}
This diff is collapsed.
Click to expand it.
src/Modules/Settings/TaxGroups.php
View file @
2f7cd0d2
...
...
@@ -2,6 +2,8 @@
namespace
Webleit\ZohoBooksApi\Modules\Settings
;
use
Weble\ZohoClient\Exception\ApiError
;
use
Webleit\ZohoBooksApi\Models\Settings\TaxGroup
;
use
Webleit\ZohoBooksApi\Modules\Module
;
/**
...
...
@@ -10,6 +12,16 @@ use Webleit\ZohoBooksApi\Modules\Module;
*/
class
TaxGroups
extends
Module
{
/**
* @param array $params
* @return \Illuminate\Support\Collection|void
* @throws ApiError
*/
public
function
getList
(
$params
=
[])
{
throw
new
ApiError
(
'The getList() api for TaxGroups is not implemented in Zoho APIs'
);
}
/**
* @return string
*/
...
...
@@ -23,6 +35,6 @@ class TaxGroups extends Module
*/
public
function
getModelClassName
()
{
return
'\\Webleit\\ZohoBooksApi\\Models\\Settings\\
TaxGroup
'
;
return
TaxGroup
::
class
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Modules/Units.php
deleted
100644 β 0
View file @
165a040c
<?php
namespace
Webleit\ZohoBooksApi\Modules
;
/**
* Class Units
* @package Webleit\ZohoBooksApi\Modules
*/
class
Units
extends
Module
{
protected
$urlPath
=
'settings/units'
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Modules/VendorCredits.php
View file @
2f7cd0d2
...
...
@@ -70,4 +70,17 @@ class VendorCredits extends Module
{
return
$this
->
markAs
(
$id
,
'void'
);
}
}
\ No newline at end of file
/**
* Override returned key
*
* This overrides the key that is returned from zoho, as they
* send back 'vendor_credits' instead of 'vendorcredits'
*
* @return string
*/
public
function
getResourceKey
()
{
return
'vendor_credits'
;
}
}
This diff is collapsed.
Click to expand it.
src/ZohoBooks.php
View file @
2f7cd0d2
...
...
@@ -31,7 +31,8 @@ use Webleit\ZohoBooksApi\Modules;
* @property-read Modules\Projects $projects
* @property-read Modules\Settings $settings
* @property-read Modules\Organizations $organizations
* @property-read Modules\Items $items;
* @property-read Modules\Items $items
* @property-read Modules\Users $users
*/
class
ZohoBooks
implements
\
Webleit\ZohoBooksApi\Contracts\ProvidesModules
{
...
...
@@ -93,7 +94,8 @@ class ZohoBooks implements \Webleit\ZohoBooksApi\Contracts\ProvidesModules
'projects'
=>
Modules\Projects
::
class
,
'settings'
=>
Modules\Settings
::
class
,
'organizations'
=>
Modules\Organizations
::
class
,
'items'
=>
Modules\Items
::
class
'items'
=>
Modules\Items
::
class
,
'users'
=>
Modules\Users
::
class
,
];
/**
...
...
@@ -131,5 +133,4 @@ class ZohoBooks implements \Webleit\ZohoBooksApi\Contracts\ProvidesModules
$this
->
client
->
setOrganizationId
(
$id
);
return
$this
;
}
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help