-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d41ca9b
Showing
9 changed files
with
4,017 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.idea | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
privatekey.pem | ||
public_privatekey.pfx | ||
publickey.cer |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace DrawMyAttention\XeroLaravel\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class XeroPartner extends Facade | ||
{ | ||
protected static function getFacadeAccessor() { return 'XeroPartner'; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace DrawMyAttention\XeroLaravel\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class XeroPublic extends Facade | ||
{ | ||
protected static function getFacadeAccessor() { return 'XeroPublic'; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
namespace DrawMyAttention\XeroLaravel\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class XeroPrivate extends Facade | ||
{ | ||
protected static function getFacadeAccessor() { return 'XeroPrivate'; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
namespace DrawMyAttention\XeroLaravel\Providers; | ||
|
||
use Illuminate\Contracts\Filesystem\Filesystem; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class XeroServiceProvider extends ServiceProvider | ||
{ | ||
private $config = 'xero/config.php'; | ||
|
||
public function boot() | ||
{ | ||
$this->publishes([ | ||
__DIR__.'/../config.php' => config_path($this->config), | ||
]); | ||
} | ||
|
||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
// Use the published configuration file if it exists. | ||
if(file_exists(config_path($this->config))) { | ||
$configPath = config_path($this->config); | ||
$config = include $configPath; | ||
} else { | ||
// Use the default package configuration as a fallback. | ||
$config = include __DIR__.'/../config.php'; | ||
} | ||
|
||
$this->app->bind('XeroPrivate', function () use ($config) { | ||
return new \XeroPHP\Application\PrivateApplication($config); | ||
}); | ||
|
||
$this->app->bind('XeroPublic', function () use ($config) { | ||
return new \XeroPHP\Application\PublicApplication($config); | ||
}); | ||
|
||
$this->app->bind('XeroPartner', function () use ($config) { | ||
return new \XeroPHP\Application\PartnerApplication($config); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "drawmyattention/xerolaravel", | ||
"description": "A Laravel 5 wrapper for Xero's PHP API", | ||
"require": { | ||
"calcinai/xero-php": "1.1.*" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Amo Chohan", | ||
"email": "[email protected]" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
'oauth' => [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| OAuth Callback | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Provide a callback URL, or use 'oob' if one isn't required. | ||
| | ||
*/ | ||
|
||
'callback' => 'oob', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Xero application authentication | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Before using this service, you'll need to register an applicatin via | ||
| the Xero developer website. When setting up your application, take | ||
| note of the consumer key and shared secret, as well as the | ||
| application type (private, public or partner). | ||
| | ||
*/ | ||
|
||
'consumer_key' => 'YOURCONSUMERKEY', | ||
'consumer_secret' => 'YOURSECRETKEY', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| RSA keys | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Ensure that you have generated the required private and public rsa keys | ||
| using the guide provided: http://bit.ly/1dIn55j. | ||
| | ||
| openssl genrsa -out privatekey.pem 1024 | ||
| openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825 | ||
| openssl pkcs12 -export -out public_privatekey.pfx -inkey privatekey.pem -in publickey.cer | ||
| | ||
| The path must follow the format file:// and then the absolute path of the | ||
| keys on the server. | ||
| | ||
| Note: do not omit the first '/' if using a UNIX based filesystem when | ||
| setting the absolute path (so the path should begin with 'file:///'. | ||
| | ||
*/ | ||
|
||
'rsa_private_key' => 'file:///home/absolutepath/vendor/src/drawmyattention/xerolaravel/Certificates/privatekey.pem', | ||
'rsa_public_key' => 'file:///home/absolutepath/vendor/src/drawmyattention/xerolaravel/Certificates/publickey.cer' | ||
] | ||
|
||
]; |