|
|
@@ -5,173 +5,136 @@ namespace App\ApiResources\Dolibarr;
|
|
|
|
|
|
use ApiPlatform\Core\Annotation\ApiProperty;
|
|
|
use ApiPlatform\Core\Annotation\ApiResource;
|
|
|
+use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
|
|
/**
|
|
|
* Données de l'organization retournées par l'API Dolibarr
|
|
|
- *
|
|
|
- * @ApiResource(
|
|
|
- * compositeIdentifier=false,
|
|
|
- * itemOperations={
|
|
|
- * "get"={
|
|
|
- * "method"="GET",
|
|
|
- * "path"="/dolibarr/account/{organizationId}"
|
|
|
- * }
|
|
|
- * }
|
|
|
- * )
|
|
|
*/
|
|
|
+#[ApiResource(
|
|
|
+ itemOperations: [
|
|
|
+ 'get' => [
|
|
|
+ 'method' => 'GET',
|
|
|
+ 'path' => '/dolibarr/account/{organizationId}',
|
|
|
+ 'requirements' => ['organizationId' => '\d+'],
|
|
|
+ 'normalization_context' => [
|
|
|
+ 'groups' => ['dolibarr_get']
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ compositeIdentifier: false,
|
|
|
+)]
|
|
|
class DolibarrAccount
|
|
|
{
|
|
|
- /**
|
|
|
- * @var int
|
|
|
- * @ApiProperty(identifier=true)
|
|
|
- */
|
|
|
+ #[ApiProperty(identifier: true)]
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
private int $organizationId;
|
|
|
+
|
|
|
/**
|
|
|
* Dolibarr societies pk
|
|
|
- * @var int
|
|
|
*/
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
private int $socId;
|
|
|
+
|
|
|
/**
|
|
|
* Opentalent client ref
|
|
|
- * @var string
|
|
|
*/
|
|
|
- private string $clientNumber;
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
+ private string $clientNumber = "";
|
|
|
+
|
|
|
/**
|
|
|
* Opentalent product owned
|
|
|
- * @var string
|
|
|
*/
|
|
|
- private string $product;
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
+ private string $product = "";
|
|
|
+
|
|
|
/**
|
|
|
* Services currently actives
|
|
|
- * @var array
|
|
|
*/
|
|
|
- private array $services;
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
+ private array $services = [];
|
|
|
+
|
|
|
/**
|
|
|
* Sms credit remaining
|
|
|
- * @var string
|
|
|
*/
|
|
|
- private string $smsCredit;
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
+ private string $smsCredit = "";
|
|
|
+
|
|
|
/**
|
|
|
* Last bills
|
|
|
- * @var array
|
|
|
*/
|
|
|
- private array $bills;
|
|
|
+ #[Groups('dolibarr_get')]
|
|
|
+ private array $bills = [];
|
|
|
|
|
|
- /**
|
|
|
- * @return int
|
|
|
- */
|
|
|
public function getOrganizationId(): int
|
|
|
{
|
|
|
return $this->organizationId;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param int $organizationId
|
|
|
- */
|
|
|
public function setOrganizationId(int $organizationId): void
|
|
|
{
|
|
|
$this->organizationId = $organizationId;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return int
|
|
|
- */
|
|
|
public function getSocId(): int
|
|
|
{
|
|
|
return $this->socId;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param int $socId
|
|
|
- */
|
|
|
public function setSocId(int $socId): void
|
|
|
{
|
|
|
$this->socId = $socId;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return string
|
|
|
- */
|
|
|
public function getClientNumber(): string
|
|
|
{
|
|
|
return $this->clientNumber;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param string $clientNumber
|
|
|
- */
|
|
|
public function setClientNumber(string $clientNumber): void
|
|
|
{
|
|
|
$this->clientNumber = $clientNumber;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return string
|
|
|
- */
|
|
|
public function getProduct(): string
|
|
|
{
|
|
|
return $this->product;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param string $product
|
|
|
- */
|
|
|
public function setProduct(string $product): void
|
|
|
{
|
|
|
$this->product = $product;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return array
|
|
|
- */
|
|
|
public function getServices(): array
|
|
|
{
|
|
|
return $this->services;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param array $services
|
|
|
- */
|
|
|
public function setServices(array $services): void
|
|
|
{
|
|
|
$this->services = $services;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return string
|
|
|
- */
|
|
|
public function getSmsCredit(): string
|
|
|
{
|
|
|
return $this->smsCredit;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param string $smsCredit
|
|
|
- */
|
|
|
public function setSmsCredit(string $smsCredit): void
|
|
|
{
|
|
|
$this->smsCredit = $smsCredit;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return array
|
|
|
- */
|
|
|
public function getBills(): array
|
|
|
{
|
|
|
return $this->bills;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param array $bills
|
|
|
- */
|
|
|
public function setBills(array $bills): void
|
|
|
{
|
|
|
$this->bills = $bills;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @param DolibarrBill $bill
|
|
|
- */
|
|
|
public function addBill(DolibarrBill $bill): void
|
|
|
{
|
|
|
$this->bills[] = $bill;
|