TruskService
in package
Class TruskService
Table of Contents
Constants
- IDF_DEPARTMENTS = ['75', '91', '92', '93', '94', '95']
Properties
- $container : ContainerInterface
- $entityManager : EntityManagerInterface
- $logService : LogServiceInterface
- $productService : ProductService
- $saleProductService : SaleProductService|object
- $mailerService : MailerService|object
- $saleService : SaleService|object
- $truskApi : TruskApi|object
Methods
- __construct() : mixed
- QueueService constructor.
- afterSaleProductCanceled() : mixed
- afterSaleProductCreated() : mixed
- afterSaleProductUpdatedFromSale() : void
- checkShippingDateIsValid() : bool
- checkTruskDirectory() : mixed
- check if directory exist
- connectToSftp() : SFTP|null
- Connecting to SFTP
- createTruskShipmentTracking() : void
- Create or update Trusk shipment tracking records with status priority
- findTruskLastAvailableDate() : DateTime|mixed|null
- getTruskDeliveryFrom() : mixed
- getTruskNextAvailableDate() : DateTime|mixed|null
- getTruskNextAvailblePreparationDates() : array<string|int, mixed>
- getTruskWorkDay() : DateTime
- isIleDeFranceOrder() : bool
- isTruskEligibleDate() : bool
- isTruskEligibleWorkDay() : bool
- onSaleProductChange() : mixed
- onSaleProductsQtyChange() : mixed
- When a sale product qty is changed
- onSaleProductsTruskAppointmentFixed() : mixed
- registerSaleAsTrusk() : void
- sendToTrusk() : bool
- shouldMarkSaleAsTrusk() : bool
- truskConnect() : SFTP
- createOrUpdateShipmentTrackingStatusHistory() : mixed
- Create or update shipment tracking status history for Trusk with status priority
- findOrCreateSaleProductShipment() : mixed
- Find or create SaleProductShipment for Trusk - Force SHP type
- findOrCreateSaleProductShipmentTracking() : mixed
- Find or create SaleProductShipmentTracking for Trusk
- processSaleProduct() : mixed
- updateShipmentStatusWithPriority() : mixed
- Update shipment status with priority logic
Constants
IDF_DEPARTMENTS
private
mixed
IDF_DEPARTMENTS
= ['75', '91', '92', '93', '94', '95']
Properties
$container
protected
ContainerInterface
$container
$entityManager
protected
EntityManagerInterface
$entityManager
$logService
protected
LogServiceInterface
$logService
$productService
protected
ProductService
$productService
$saleProductService
protected
SaleProductService|object
$saleProductService
$mailerService
private
MailerService|object
$mailerService
$saleService
private
SaleService|object
$saleService
$truskApi
private
TruskApi|object
$truskApi
Methods
__construct()
QueueService constructor.
public
__construct(ContainerInterface $container, EntityManagerInterface $entityManager, LogServiceInterface $logService) : mixed
Parameters
- $container : ContainerInterface
- $entityManager : EntityManagerInterface
- $logService : LogServiceInterface
afterSaleProductCanceled()
public
afterSaleProductCanceled(AfterSaleProductCanceledEvent $event) : mixed
Parameters
- $event : AfterSaleProductCanceledEvent
Tags
afterSaleProductCreated()
public
afterSaleProductCreated(AfterSaleProductCreatedFromSaleEvent $event) : mixed
Parameters
- $event : AfterSaleProductCreatedFromSaleEvent
afterSaleProductUpdatedFromSale()
public
afterSaleProductUpdatedFromSale(AfterSaleProductUpdatedFromSaleEvent $event) : void
Parameters
- $event : AfterSaleProductUpdatedFromSaleEvent
checkShippingDateIsValid()
public
checkShippingDateIsValid(DateTime $date) : bool
Parameters
- $date : DateTime
Return values
boolcheckTruskDirectory()
check if directory exist
public
checkTruskDirectory() : mixed
connectToSftp()
Connecting to SFTP
public
connectToSftp() : SFTP|null
Return values
SFTP|nullcreateTruskShipmentTracking()
Create or update Trusk shipment tracking records with status priority
public
createTruskShipmentTracking(SaleProduct $saleProduct, string $eventCode, string $comment, string $timestamp, mixed $user) : void
Parameters
- $saleProduct : SaleProduct
- $eventCode : string
- $comment : string
- $timestamp : string
- $user : mixed
findTruskLastAvailableDate()
public
findTruskLastAvailableDate(mixed $nbDays[, null $date = null ]) : DateTime|mixed|null
Parameters
- $nbDays : mixed
- $date : null = null
Return values
DateTime|mixed|nullgetTruskDeliveryFrom()
public
getTruskDeliveryFrom() : mixed
getTruskNextAvailableDate()
public
getTruskNextAvailableDate(mixed $nbDays[, null $date = null ]) : DateTime|mixed|null
Parameters
- $nbDays : mixed
- $date : null = null
Return values
DateTime|mixed|nullgetTruskNextAvailblePreparationDates()
public
getTruskNextAvailblePreparationDates(mixed $date) : array<string|int, mixed>
Parameters
- $date : mixed
Return values
array<string|int, mixed>getTruskWorkDay()
public
getTruskWorkDay(mixed $type[, mixed $now = null ]) : DateTime
Parameters
- $type : mixed
- $now : mixed = null
Return values
DateTimeisIleDeFranceOrder()
public
isIleDeFranceOrder(Sale $sale) : bool
Parameters
- $sale : Sale
Return values
boolisTruskEligibleDate()
public
isTruskEligibleDate(mixed $date, mixed $i) : bool
Parameters
- $date : mixed
- $i : mixed
Return values
boolisTruskEligibleWorkDay()
public
isTruskEligibleWorkDay(mixed $type[, mixed $now = null ]) : bool
Parameters
- $type : mixed
- $now : mixed = null
Return values
boolonSaleProductChange()
public
onSaleProductChange(SaleProductChangedEvent $event) : mixed
Parameters
- $event : SaleProductChangedEvent
onSaleProductsQtyChange()
When a sale product qty is changed
public
onSaleProductsQtyChange(SaleProductQtyChangedEvent $event) : mixed
Parameters
- $event : SaleProductQtyChangedEvent
Tags
onSaleProductsTruskAppointmentFixed()
public
onSaleProductsTruskAppointmentFixed() : mixed
registerSaleAsTrusk()
public
registerSaleAsTrusk(Sale $sale) : void
Parameters
- $sale : Sale
sendToTrusk()
public
sendToTrusk(Sale $sale[, array<string|int, mixed> $products = [] ]) : bool
Parameters
- $sale : Sale
- $products : array<string|int, mixed> = []
Return values
boolshouldMarkSaleAsTrusk()
public
shouldMarkSaleAsTrusk(Sale $sale) : bool
Parameters
- $sale : Sale
Return values
booltruskConnect()
public
truskConnect() : SFTP
Return values
SFTPcreateOrUpdateShipmentTrackingStatusHistory()
Create or update shipment tracking status history for Trusk with status priority
private
createOrUpdateShipmentTrackingStatusHistory(mixed $shipmentTracking, mixed $eventCode, mixed $comment, mixed $timestamp, mixed $now) : mixed
Parameters
- $shipmentTracking : mixed
- $eventCode : mixed
- $comment : mixed
- $timestamp : mixed
- $now : mixed
findOrCreateSaleProductShipment()
Find or create SaleProductShipment for Trusk - Force SHP type
private
findOrCreateSaleProductShipment(mixed $saleProduct, mixed $user, mixed $now) : mixed
Parameters
- $saleProduct : mixed
- $user : mixed
- $now : mixed
findOrCreateSaleProductShipmentTracking()
Find or create SaleProductShipmentTracking for Trusk
private
findOrCreateSaleProductShipmentTracking(mixed $shipment, mixed $saleProduct, mixed $now) : mixed
Parameters
- $shipment : mixed
- $saleProduct : mixed
- $now : mixed
processSaleProduct()
private
processSaleProduct(SaleProduct $saleProduct) : mixed
Parameters
- $saleProduct : SaleProduct
Tags
updateShipmentStatusWithPriority()
Update shipment status with priority logic
private
updateShipmentStatusWithPriority(mixed $shipmentTracking, mixed $newStatus) : mixed
Parameters
- $shipmentTracking : mixed
- $newStatus : mixed