feat(Reminder process): add 4 reminder phases for membership (Retzien)
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 1m21s
All checks were successful
Deploy Roxane to Preprod / deploy (push) Successful in 1m21s
This commit is contained in:
@@ -9,9 +9,13 @@ use Illuminate\Support\Facades\Http;
|
||||
class DolibarrService
|
||||
{
|
||||
protected string $baseUrl;
|
||||
|
||||
protected string $htaccessUrl;
|
||||
|
||||
protected string $username;
|
||||
|
||||
protected string $password;
|
||||
|
||||
protected string $apiKey;
|
||||
|
||||
public function __construct()
|
||||
@@ -20,7 +24,7 @@ class DolibarrService
|
||||
$this->htaccessUrl = config('services.dolibarr.htaccess_url');
|
||||
$this->username = config('services.dolibarr.username');
|
||||
$this->password = config('services.dolibarr.password');
|
||||
$this->apiKey = config('services.dolibarr.api_key');
|
||||
$this->apiKey = config('services.dolibarr.api_key');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,21 +34,22 @@ class DolibarrService
|
||||
{
|
||||
return Http::withBasicAuth($this->username, $this->password)
|
||||
->withHeaders([
|
||||
'Accept' => 'application/json',
|
||||
'DOLAPIKEY' => $this->apiKey,
|
||||
'Accept' => 'application/json',
|
||||
'DOLAPIKEY' => $this->apiKey,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all members
|
||||
*
|
||||
* @throws ConnectionException
|
||||
*/
|
||||
public function getAllMembers(int $limit = 400, string $sortField = 't.rowid', string $sortOrder = 'ASC'): array
|
||||
{
|
||||
$response = $this->client()->get($this->baseUrl . '/members', [
|
||||
$response = $this->client()->get($this->baseUrl.'/members', [
|
||||
'sortfield' => $sortField,
|
||||
'sortorder' => $sortOrder,
|
||||
'limit' => $limit,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
||||
return $response->json();
|
||||
@@ -52,11 +57,12 @@ class DolibarrService
|
||||
|
||||
/**
|
||||
* Get member subscriptions
|
||||
*
|
||||
* @throws ConnectionException
|
||||
*/
|
||||
public function getMemberSubscriptions(int|string $id): array
|
||||
{
|
||||
$response = $this->client()->get($this->baseUrl . '/members/'. $id . '/subscriptions');
|
||||
$response = $this->client()->get($this->baseUrl.'/members/'.$id.'/subscriptions');
|
||||
|
||||
return $response->json();
|
||||
}
|
||||
@@ -64,19 +70,18 @@ class DolibarrService
|
||||
/**
|
||||
* Update a member with custom data
|
||||
*
|
||||
* @param int|string $id The Dolibarr member ID (rowid)
|
||||
* @param array $data Array of attributes to update (e.g. ['email' => 'new@email.com', 'array_options' => ['options_custom' => 'val']])
|
||||
* @param int|string $id The Dolibarr member ID (rowid)
|
||||
* @param array $data Array of attributes to update (e.g. ['email' => 'new@email.com', 'array_options' => ['options_custom' => 'val']])
|
||||
*
|
||||
* @throws ConnectionException
|
||||
*/
|
||||
public function updateMember(int|string $id, array $data): bool
|
||||
{
|
||||
$response = $this->client()->put(
|
||||
$this->baseUrl . '/members/' . $id,
|
||||
$this->baseUrl.'/members/'.$id,
|
||||
$data
|
||||
);
|
||||
|
||||
return $response->successful();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user