-
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.
- Loading branch information
Showing
8 changed files
with
195 additions
and
4 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
29 changes: 29 additions & 0 deletions
29
src/Modules/SalesOrder/DataTransferObjects/SalesOrderAddressDto.php
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 | ||
|
||
namespace DREID\LaravelJtlApi\Modules\SalesOrder\DataTransferObjects; | ||
|
||
readonly class SalesOrderAddressDto | ||
{ | ||
public function __construct( | ||
public ?string $company, | ||
public ?string $firstName, | ||
public ?string $lastName, | ||
public string $street, | ||
public ?string $postalCode, | ||
public ?string $city, | ||
public string $countryIso, | ||
) {} | ||
|
||
public static function fromResponse(array $data): static | ||
{ | ||
return new self( | ||
$data['Company'] ?? null, | ||
$data['FirstName'] ?? null, | ||
$data['LastName'] ?? null, | ||
$data['Street'], | ||
$data['PostalCode'] ?? null, | ||
$data['City'] ?? null, | ||
$data['CountryIso'], | ||
); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Modules/SalesOrder/DataTransferObjects/SalesOrderDepartureCountryDto.php
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,21 @@ | ||
<?php | ||
|
||
namespace DREID\LaravelJtlApi\Modules\SalesOrder\DataTransferObjects; | ||
|
||
readonly class SalesOrderDepartureCountryDto | ||
{ | ||
public function __construct( | ||
public string $countryIso, | ||
public string $currencyIso, | ||
public float $currencyFactor, | ||
) {} | ||
|
||
public static function fromResponse(array $data): static | ||
{ | ||
return new self( | ||
$data['CountryISO'], | ||
$data['CurrencyIso'], | ||
$data['CurrencyFactor'], | ||
); | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
src/Modules/SalesOrder/DataTransferObjects/SalesOrderShippingDetailDto.php
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,31 @@ | ||
<?php | ||
|
||
namespace DREID\LaravelJtlApi\Modules\SalesOrder\DataTransferObjects; | ||
|
||
readonly class SalesOrderShippingDetailDto | ||
{ | ||
public function __construct( | ||
public ?int $shippingMethodId, | ||
public ?int $deliveryCompleteStatus, | ||
public ?int $shippingPriority, | ||
public ?string $shippingDate, | ||
public ?string $estimatedDeliveryDate, | ||
public ?string $deliveredDate, | ||
public ?int $onHoldReasonId, | ||
public ?float $extraWeight, | ||
) {} | ||
|
||
public static function fromResponse(array $data): static | ||
{ | ||
return new self( | ||
$data['ShippingMethodId'] ?? null, | ||
$data['DeliveryCompleteStatus'] ?? null, | ||
$data['ShippingPriority'] ?? null, | ||
$data['ShippingDate'] ?? null, | ||
$data['EstimatedDeliveryDate'] ?? null, | ||
$data['DeliveredDate'] ?? null, | ||
$data['OnHoldReasonId'] ?? null, | ||
$data['ExtraWeight'] ?? null, | ||
); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Modules/SalesOrder/Requests/QuerySalesOrdersRequest.php
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,31 @@ | ||
<?php | ||
|
||
namespace DREID\LaravelJtlApi\Modules\SalesOrder\Requests; | ||
|
||
readonly class QuerySalesOrdersRequest | ||
{ | ||
public function __construct( | ||
public ?string $salesOrderNumber = null, | ||
public ?string $externalOrderNumber = null, | ||
public ?string $billingNumber = null, | ||
public ?int $itemId = null, | ||
public ?int $customerId = null, | ||
public ?int $paymentStatus = null, | ||
public ?int $paymentMethodId = null, | ||
public ?int $deliveryCompleteStatus = null, | ||
public ?int $createdUserId = null, | ||
public ?int $companyId = null, | ||
public ?string $salesChannelId = null, | ||
public ?string $createdSince = null, | ||
public ?string $createdUntil = null, | ||
public ?int $colorId = null, | ||
public ?string $ebayUsername = null, | ||
public ?int $shippingMethodId = null, | ||
public ?string $deliveredDate = null, | ||
public ?bool $isCancelled = null, | ||
public ?int $onHoldReasonId = null, | ||
public ?bool $isExternalInvoice = null, | ||
public ?int $pageNumber = null, | ||
public ?int $pageSize = null, | ||
) {} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/Modules/SalesOrder/Responses/QuerySalesOrdersResponse.php
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,17 @@ | ||
<?php | ||
|
||
namespace DREID\LaravelJtlApi\Modules\SalesOrder\Responses; | ||
|
||
use DREID\LaravelJtlApi\ApiResponse; | ||
use DREID\LaravelJtlApi\Modules\SalesOrder\DataTransferObjects\SalesOrderDto; | ||
use DREID\LaravelJtlApi\PaginatedResponse; | ||
|
||
readonly class QuerySalesOrdersResponse extends PaginatedResponse | ||
{ | ||
public function __construct(ApiResponse $response) | ||
{ | ||
parent::__construct($response, array_map(static function ($item) { | ||
return SalesOrderDto::fromResponse($item); | ||
}, $response->json['Items'])); | ||
} | ||
} |
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