GlsService
in package
Table of Contents
Properties
- $container : ContainerInterface
- $entityManager : EntityManagerInterface
- $logService : LogServiceInterface
- $productService : ProductService
- $saleProductService : SaleProductService|object
- $apiGls : SaleService|object
- $eventDispatcher : EventDispatcherInterface
- $saleLogService : SaleLogService
- $saleService : SaleService|object
- $shipmentTrackingSynchronizer : ShipmentTrackingSynchronizer
- $userService : UserService
Methods
- __construct() : mixed
- GLS Service constructor.
- createSaleProductShipment() : true
- determineShipmentStatus() : string|null
- determineShipmentStatusDetails() : DateTimeImmutable}|null
- extractStatusDetailsFromParcelInfo() : DateTimeImmutable}
- extractStatusFromParcelInfo() : string|null
- fetchStatusHistoryEvents() : array<int, DateTimeImmutable, timestamp: int}>
- fetchStatusHistoryMap() : array<string, DateTimeImmutable>
- generatBodyForEtiquetGls() : array<string|int, mixed>
- generate Body for etiqueete Gls
- getParcelInfoByTrackingId() : mixed
- Send Expedition to Gls
- isGlsable() : bool
- Check if a package should be handled by GLS based on dimensions and weight
- isWithinGlsWeightLimit() : bool
- Check if weight is within GLS limits
- saveGlsEtiquette() : string
- sendExpeditionToGls() : mixed
- Send Expedition to Gls
- collectHistoryEvents() : array<int, DateTimeImmutable, timestamp: int}>
- dispatchSaleProductsAfterTicketPrintedEvent() : void
- dispatchSaleProductsShippedEvent() : void
- extractStatusDateFromParcelInfo() : DateTimeImmutable|null
- extractTrackingIds() : array<int, string>
- finalizeSale() : void
- isOversizedPackage() : bool
- Calculate if package dimensions qualify as oversized
- logShipment() : void
- normalizeHistoryItems() : array<int, DateTimeImmutable, timestamp: int}>
- normalizeToArray() : array<string|int, mixed>
- parseGlsDate() : DateTimeImmutable|null
- processShipment() : void
- updateSaleProductStatus() : void
Properties
$container
protected
ContainerInterface
$container
$entityManager
protected
EntityManagerInterface
$entityManager
$logService
protected
LogServiceInterface
$logService
$productService
protected
ProductService
$productService
$saleProductService
protected
SaleProductService|object
$saleProductService
$apiGls
private
SaleService|object
$apiGls
$eventDispatcher
private
EventDispatcherInterface
$eventDispatcher
$saleLogService
private
SaleLogService
$saleLogService
$saleService
private
SaleService|object
$saleService
$shipmentTrackingSynchronizer
private
ShipmentTrackingSynchronizer
$shipmentTrackingSynchronizer
$userService
private
UserService
$userService
Methods
__construct()
GLS Service constructor.
public
__construct(ContainerInterface $container, GlsApi $glsApi, EntityManagerInterface $entityManager, LogServiceInterface $logService, EventDispatcherInterface $eventDispatcher) : mixed
Parameters
- $container : ContainerInterface
- $glsApi : GlsApi
- $entityManager : EntityManagerInterface
- $logService : LogServiceInterface
- $eventDispatcher : EventDispatcherInterface
createSaleProductShipment()
public
createSaleProductShipment(array<string|int, int> $saleProductIds[, int|string|null $userId = null ][, bool $logChanges = false ][, bool $notify = true ]) : true
Parameters
- $saleProductIds : array<string|int, int>
- $userId : int|string|null = null
- $logChanges : bool = false
- $notify : bool = true
Tags
Return values
truedetermineShipmentStatus()
public
determineShipmentStatus(array<int, string> $trackingIds) : string|null
Parameters
- $trackingIds : array<int, string>
Return values
string|nulldetermineShipmentStatusDetails()
public
determineShipmentStatusDetails(array<int, string> $trackingIds) : DateTimeImmutable}|null
Parameters
- $trackingIds : array<int, string>
Return values
DateTimeImmutable}|nullextractStatusDetailsFromParcelInfo()
public
extractStatusDetailsFromParcelInfo(array<string|int, mixed> $parcelData) : DateTimeImmutable}
Parameters
- $parcelData : array<string|int, mixed>
Return values
DateTimeImmutable}extractStatusFromParcelInfo()
public
extractStatusFromParcelInfo(array<string|int, mixed> $parcelData) : string|null
Parameters
- $parcelData : array<string|int, mixed>
Return values
string|nullfetchStatusHistoryEvents()
public
fetchStatusHistoryEvents(array<int, string> $trackingIds) : array<int, DateTimeImmutable, timestamp: int}>
Parameters
- $trackingIds : array<int, string>
Return values
array<int, DateTimeImmutable, timestamp: int}>fetchStatusHistoryMap()
public
fetchStatusHistoryMap(array<int, string> $trackingIds) : array<string, DateTimeImmutable>
Parameters
- $trackingIds : array<int, string>
Return values
array<string, DateTimeImmutable>generatBodyForEtiquetGls()
generate Body for etiqueete Gls
public
generatBodyForEtiquetGls(Sale $sale, SaleProduct $item, mixed $generateBareCode) : array<string|int, mixed>
Parameters
- $sale : Sale
- $item : SaleProduct
- $generateBareCode : mixed
Return values
array<string|int, mixed>getParcelInfoByTrackingId()
Send Expedition to Gls
public
getParcelInfoByTrackingId(mixed $trackingId) : mixed
Parameters
- $trackingId : mixed
isGlsable()
Check if a package should be handled by GLS based on dimensions and weight
public
static isGlsable(float $length, float $width, float $height, float $weight) : bool
Parameters
- $length : float
-
Length in cm
- $width : float
-
Width in cm
- $height : float
-
Height in cm
- $weight : float
-
Weight in kg
Return values
bool —True if GLS should handle the package
isWithinGlsWeightLimit()
Check if weight is within GLS limits
public
static isWithinGlsWeightLimit(float $weight) : bool
Parameters
- $weight : float
-
Weight in kg
Return values
boolsaveGlsEtiquette()
public
saveGlsEtiquette(mixed $data, mixed $sp) : string
Parameters
- $data : mixed
- $sp : mixed
Return values
stringsendExpeditionToGls()
Send Expedition to Gls
public
sendExpeditionToGls(mixed $data) : mixed
Parameters
- $data : mixed
collectHistoryEvents()
private
collectHistoryEvents(array<string|int, mixed> $parcelData) : array<int, DateTimeImmutable, timestamp: int}>
Parameters
- $parcelData : array<string|int, mixed>
Return values
array<int, DateTimeImmutable, timestamp: int}>dispatchSaleProductsAfterTicketPrintedEvent()
private
dispatchSaleProductsAfterTicketPrintedEvent(SaleProductShipment $saleProductShipment) : void
Parameters
- $saleProductShipment : SaleProductShipment
dispatchSaleProductsShippedEvent()
private
dispatchSaleProductsShippedEvent(array<string|int, mixed> $saleProductIds) : void
Parameters
- $saleProductIds : array<string|int, mixed>
extractStatusDateFromParcelInfo()
private
extractStatusDateFromParcelInfo(array<string|int, mixed> $parcelData, string|null $status) : DateTimeImmutable|null
Parameters
- $parcelData : array<string|int, mixed>
- $status : string|null
Return values
DateTimeImmutable|nullextractTrackingIds()
private
extractTrackingIds(mixed $trackingId) : array<int, string>
Parameters
- $trackingId : mixed
Return values
array<int, string>finalizeSale()
private
finalizeSale(Sale $sale, DateTime $now, bool $logChanges, mixed $user) : void
Parameters
- $sale : Sale
- $now : DateTime
- $logChanges : bool
- $user : mixed
Tags
isOversizedPackage()
Calculate if package dimensions qualify as oversized
private
static isOversizedPackage(float $length, float $width, float $height) : bool
Parameters
- $length : float
-
Length in cm
- $width : float
-
Width in cm
- $height : float
-
Height in cm
Return values
boollogShipment()
private
logShipment(Sale $sale, bool $shipmentId, SaleProduct $sp, mixed $user) : void
Parameters
- $sale : Sale
- $shipmentId : bool
- $sp : SaleProduct
- $user : mixed
Tags
normalizeHistoryItems()
private
normalizeHistoryItems(array<int|string, mixed> $historyItems) : array<int, DateTimeImmutable, timestamp: int}>
Parameters
- $historyItems : array<int|string, mixed>
Return values
array<int, DateTimeImmutable, timestamp: int}>normalizeToArray()
private
normalizeToArray(mixed $value) : array<string|int, mixed>
Parameters
- $value : mixed
Return values
array<string|int, mixed>parseGlsDate()
private
parseGlsDate(mixed $value) : DateTimeImmutable|null
Parameters
- $value : mixed
Return values
DateTimeImmutable|nullprocessShipment()
private
processShipment(SaleProduct $sp, Sale $sale, mixed $user, bool $notify) : void
Parameters
- $sp : SaleProduct
- $sale : Sale
- $user : mixed
- $notify : bool
Tags
updateSaleProductStatus()
private
updateSaleProductStatus(SaleProduct $sp, DateTime $now) : void
Parameters
- $sp : SaleProduct
- $now : DateTime