Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
e8b049a2e8 | |||
6741d95073 | |||
9d81824b52 |
10
src/API.php
10
src/API.php
@ -305,7 +305,7 @@ final class API
|
||||
$key = 'Item';
|
||||
$parameters['query'] = 'select * from Item';
|
||||
|
||||
return new ListList($this->execute('query',$parameters),$key);
|
||||
return new ListList($this->execute('query',$parameters,$key),$key);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -428,7 +428,9 @@ final class API
|
||||
{
|
||||
Log::debug(sprintf('%s:Update invoice',static::LOGKEY),['params'=>$parameters]);
|
||||
|
||||
return new Invoice($this->execute('invoice',array_merge($parameters,['method'=>'POST'])));
|
||||
$result = $this->execute('invoice',array_merge($parameters,['method'=>'POST']));
|
||||
|
||||
return new Invoice($result->Invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,6 +444,8 @@ final class API
|
||||
{
|
||||
Log::debug(sprintf('%s:Update customer',static::LOGKEY),['params'=>$parameters]);
|
||||
|
||||
return new Customer($this->execute('customer',array_merge($parameters,['method'=>'POST'])));
|
||||
$result = $this->execute('customer',array_merge($parameters,['method'=>'POST']));
|
||||
|
||||
return new Customer($result->Customer);
|
||||
}
|
||||
}
|
54
src/Commands/TokenRefresh.php
Normal file
54
src/Commands/TokenRefresh.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Intuit\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Intuit\Traits\ProviderTokenTrait;
|
||||
|
||||
/**
|
||||
* Refresh the Intuit tokens
|
||||
*/
|
||||
class TokenRefresh extends Command
|
||||
{
|
||||
use ProviderTokenTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'intuit:token:refresh'
|
||||
.' {user? : User Email}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Refresh an access token';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @throws \Intuit\Exceptions\NotTokenException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$to = $this->providerToken($this->argument('user'));
|
||||
|
||||
$old = $to->refresh_token;
|
||||
|
||||
$x = $to->refreshToken();
|
||||
|
||||
dump([
|
||||
'access'=>$to->access_token,
|
||||
'old'=>$old,
|
||||
'refresh'=>$to->refresh_token,
|
||||
'expires'=>(string)$to->refresh_token_expires_at,
|
||||
'x'=>$x,
|
||||
]);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ namespace Intuit\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Intuit\Commands\{AccountGet,InvoiceGet,PaymentGet,TaxCodeGet};
|
||||
use Intuit\Commands\{AccountGet,InvoiceGet,PaymentGet,TaxCodeGet,TokenRefresh};
|
||||
|
||||
/**
|
||||
* Class IntuitServiceProvider.
|
||||
@ -27,6 +27,7 @@ class IntuitServiceProvider extends ServiceProvider
|
||||
InvoiceGet::class,
|
||||
PaymentGet::class,
|
||||
TaxCodeGet::class,
|
||||
TokenRefresh::class,
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -144,9 +144,7 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
|
||||
*/
|
||||
private function data(object $response,string $type): Collection
|
||||
{
|
||||
if (! ($x=object_get($response->QueryResponse,$type)))
|
||||
return collect();
|
||||
|
||||
$x = $response->{$type};
|
||||
switch (Arr::get(self::TYPES,$type)) {
|
||||
case Category::class:
|
||||
$data = collect(Category::hydrate($x));
|
||||
@ -177,8 +175,8 @@ class ListList extends Base implements \Countable, \ArrayAccess, \Iterator
|
||||
throw new \Exception(sprintf('%s:Unknown object type: %s',self::LOGKEY,$type));
|
||||
}
|
||||
|
||||
$this->startPosition = $response->QueryResponse->startPosition;
|
||||
$this->maxResults = $response->QueryResponse->maxResults;
|
||||
$this->startPosition = $response->startPosition;
|
||||
$this->maxResults = $response->maxResults;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user