-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated client, model and unit tests
- Loading branch information
1 parent
a8b0f98
commit 5ab65be
Showing
18 changed files
with
413 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"id": 603409, | ||
"country": { | ||
"id": null, | ||
"code2": "LU", | ||
"code3": "LUX", | ||
"name": "Люксембург", | ||
"nameEn": "Luxembourg", | ||
"isEU": true | ||
}, | ||
"postCode": "0", | ||
"name": "Alscheid", | ||
"nameEn": "Alscheid", | ||
"regionName": "", | ||
"regionNameEn": "", | ||
"phoneCode": "0", | ||
"location": null, | ||
"expressCityDeliveries": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VasilDakov\Econt; | ||
|
||
use VasilDakov\Econt\Request; | ||
|
||
/** | ||
* EcontInterface | ||
* | ||
* @author Vasil Dakov <[email protected]> | ||
*/ | ||
interface EcontInterface | ||
{ | ||
public function getClientProfiles(): string; | ||
|
@@ -12,9 +19,9 @@ public function getCountries(): string; | |
|
||
public function getCities(Request\GetCitiesRequest $object): string; | ||
|
||
public function getOffices(array $data): string; | ||
public function getOffices(Request\GetOfficesRequest $object): string; | ||
|
||
public function getStreets(array $data): string; | ||
public function getStreets(Request\GetStreetsRequest $object): string; | ||
|
||
public function getQuarters(array $data): string; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VasilDakov\Econt\Model; | ||
|
||
use JMS\Serializer\Annotation as Serializer; | ||
|
||
final readonly class Address | ||
{ | ||
public function __construct( | ||
#[Serializer\Type('int')] | ||
public ?int $id = null, | ||
|
||
#[Serializer\Type(City::class)] | ||
public ?City $city = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $fullAddress = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $fullAddressEn = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $quarter = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $street = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $num = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $other = null, | ||
|
||
#[Serializer\Type(GeoLocation::class)] | ||
public ?GeoLocation $location = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $zip = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $hezid = null, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace VasilDakov\Econt\Model; | ||
|
||
use JMS\Serializer\Annotation as Serializer; | ||
|
||
readonly class GeoLocation | ||
{ | ||
public function __construct( | ||
#[Serializer\Type('float')] | ||
public ?float $latitude = null, | ||
|
||
#[Serializer\Type('float')] | ||
public ?float $longitude = null, | ||
|
||
#[Serializer\Type('int')] | ||
public ?int $confidence = null, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VasilDakov\Econt\Model; | ||
|
||
class Office | ||
use JMS\Serializer\Annotation as Serializer; | ||
|
||
readonly class Office | ||
{ | ||
public function __construct( | ||
#[Serializer\Type('int')] | ||
public ?int $id = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $code = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $name = null, | ||
|
||
#[Serializer\Type('string')] | ||
public ?string $nameEn = null, | ||
|
||
#[Serializer\Type('bool')] | ||
public ?bool $isMPS = null, | ||
|
||
#[Serializer\Type('bool')] | ||
public ?bool $isAPS = null, | ||
|
||
#[Serializer\Type('array')] | ||
public ?array $phones = null, | ||
|
||
#[Serializer\Type('array')] | ||
public ?array $emails = null, | ||
|
||
} | ||
#[Serializer\Type(Address::class)] | ||
public ?Address $address = null, | ||
){ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace VasilDakov\Econt\Request; | ||
|
||
use VasilDakov\Econt\Constants; | ||
|
||
/** | ||
* EcontInterface | ||
* | ||
* @author Vasil Dakov <[email protected]> | ||
*/ | ||
final readonly class GetOfficesRequest | ||
{ | ||
public function __construct( | ||
public string $countryCode, | ||
public string $cityId | ||
) { | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
Constants::COUNTRY_CODE => $this->countryCode, | ||
Constants::CITY_ID => $this->cityId, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace VasilDakov\Econt\Request; | ||
|
||
use VasilDakov\Econt\Constants; | ||
|
||
final readonly class GetStreetsRequest | ||
{ | ||
public function __construct(public string $cityId) | ||
{ | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
Constants::CITY_ID => $this->cityId | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace VasilDakov\Econt\Response; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use JMS\Serializer\Annotation as Serializer; | ||
use VasilDakov\Econt\Model; | ||
|
||
final class GetOfficesResponse | ||
{ | ||
#[Serializer\Type("ArrayCollection<VasilDakov\Econt\Model\Office>")] | ||
public ArrayCollection $offices; | ||
|
||
public function __construct() | ||
{ | ||
$this->offices = new ArrayCollection(); | ||
} | ||
} |
Oops, something went wrong.