mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Updates for piste
This commit is contained in:
parent
da0117bfa9
commit
f85ed1131c
@ -26,7 +26,7 @@ class Piste
|
|||||||
|
|
||||||
private bool $test_mode = false;
|
private bool $test_mode = false;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct(private string $username, private string $password)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ class Piste
|
|||||||
'grant_type' => 'client_credentials',
|
'grant_type' => 'client_credentials',
|
||||||
'client_id' => config('services.chorus.client_id'),
|
'client_id' => config('services.chorus.client_id'),
|
||||||
'client_secret' => config('services.chorus.secret'),
|
'client_secret' => config('services.chorus.secret'),
|
||||||
'scope' => 'openid'
|
'scope' => 'openid profile'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,21 +68,29 @@ class Piste
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startOauthFlow()
|
public function execute(string $uri, array $data = [])
|
||||||
{
|
{
|
||||||
$access_token = $this->getOauthAccessToken();
|
$access_token = $this->getOauthAccessToken();
|
||||||
|
|
||||||
Http::withToken($access_token)->post($this->apiUrl() . '/cpro/factures/v1/deposer/flux', [
|
nlog($access_token);
|
||||||
|
nlog($this->username);
|
||||||
|
nlog($this->password);
|
||||||
|
nlog(base64_encode($this->username . ':' . $this->password));
|
||||||
|
|
||||||
'base_uri' => $this->apiUrl(),
|
$r = Http::withToken($access_token)
|
||||||
'allow_redirects' => true,
|
->withHeaders([
|
||||||
'headers' => [
|
'cpro-account' => base64_encode($this->username . ':' . $this->password),
|
||||||
'cpro-account' => base64_encode($username . ':' . $password),
|
|
||||||
'Content-Type' => 'application/json;charset=utf-8',
|
'Content-Type' => 'application/json;charset=utf-8',
|
||||||
'Accept' => 'application/json;charset=utf-8'
|
'Accept' => 'application/json;charset=utf-8'
|
||||||
]
|
])
|
||||||
]);
|
->post($this->apiUrl() . '/cpro/factures/'. $uri, $data);
|
||||||
|
|
||||||
|
nlog($r);
|
||||||
|
nlog($r->json());
|
||||||
|
nlog($r->successful());
|
||||||
|
nlog($r->body());
|
||||||
|
nlog($r->collect());
|
||||||
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user