Inuit sync of tax, product accounting, accounts and invoices

This commit is contained in:
Deon George
2023-05-12 20:09:51 +10:00
parent e2d8f8a096
commit ad2f6f3a7f
22 changed files with 707 additions and 144 deletions

View File

@@ -24,20 +24,18 @@ class AccountingController extends Controller
*/
public static function list(string $provider): Collection
{
$so = ProviderOauth::where('name',$provider)->singleOrFail();
// @todo This should be a variable
$uo = User::findOrFail(1);
if (($x=$so->tokens->where('user_id',$uo->id))->count() !== 1)
$so = ProviderOauth::where('name',$provider)->singleOrFail();
if (! ($to=$so->token($uo)))
abort(500,sprintf('Unknown Tokens for [%s]',$uo->email));
$to = $x->pop();
$api = $so->API($to,TRUE); // @todo Remove TRUE
$api = $to->API();
return $api->getItems()
->pluck('pid','FullyQualifiedName')
->transform(function($item,$value) { return ['id'=>$item,'value'=>$value]; })
->pluck('pid','Id')
->transform(function($item,$value) { return ['id'=>$value,'value'=>$item]; })
->values();
}