Skip to content

Commit

Permalink
Add WebhookDataPickOrderPacked
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jun 17, 2024
1 parent eb4397d commit 50e6943
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Consumer/WebhookConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use CuyZ\Valinor\MapperBuilder;
use Setono\PeakWMS\DataTransferObject\Webhook\Name;
use Setono\PeakWMS\DataTransferObject\Webhook\WebhookDataPickOrderPacked;
use Setono\PeakWMS\DataTransferObject\Webhook\WebhookDataStockAdjust;

final class WebhookConsumer implements WebhookConsumerInterface
Expand Down Expand Up @@ -50,6 +51,7 @@ public static function convertNameToDataClass(Name|int $name): string

return match ($name) {

Check warning on line 52 in src/Consumer/WebhookConsumer.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ } return match ($name) { Name::StockAdjust => WebhookDataStockAdjust::class, - Name::PickOrderPacked => WebhookDataPickOrderPacked::class, default => throw new \InvalidArgumentException(sprintf('The name "%d" is not supported', $name->value)), }; } }

Check warning on line 52 in src/Consumer/WebhookConsumer.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.3, highest)

Escaped Mutant for Mutator "MatchArmRemoval": --- Original +++ New @@ @@ return match ($name) { Name::StockAdjust => WebhookDataStockAdjust::class, Name::PickOrderPacked => WebhookDataPickOrderPacked::class, - default => throw new \InvalidArgumentException(sprintf('The name "%d" is not supported', $name->value)), }; } }
Name::StockAdjust => WebhookDataStockAdjust::class,
Name::PickOrderPacked => WebhookDataPickOrderPacked::class,
default => throw new \InvalidArgumentException(sprintf('The name "%d" is not supported', $name->value)),
};
}
Expand Down
62 changes: 61 additions & 1 deletion src/DataTransferObject/Webhook/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,75 @@

enum Name: int
{
/**
* Event is triggered on a stock adjustment, and data will include information about the product and new quantity.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataStockAdjust is returned in the webhook data.
*/
case StockAdjust = 100;

/**
* Event is triggered on change on product EAN, and will include information about the product and new EAN.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataUpdateEan is returned in the webhook data.
*/
case EanUpdates = 101;

/**
* Event is triggered when a pick order is packed, and will include information about the sales order (orderId), tracking info, and the packed lines.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataPickOrderPacked is returned in the webhook data.
*/
case PickOrderPacked = 102;

/**
* Event is triggered when an inbound order with a set warehouse is closed and will update all warehouse host locations separately.
* A Domain.DataTransferObjects.OpenApi.PurchaseOrder is returned in the webhook data.
*/
case InboundOrderClosed = 103;

/**
* Event is triggered when a refund is performed and will include information about the refunded sales order.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataOrderRefunded is returned in the webhook data.
*/
case OrderRefunded = 104;

/**
* Event is triggered when a product is created or updated.
* A Domain.DataTransferObjects.OpenApi.Product is returned in the webhook data.
*/
case ProductCreateUpdate = 105;

/**
* Event is triggered when fulfillment is not possible of a product that should be produced.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataFulfillmentNotPossible is returned in the webhook data.
*/
case FulfillmentNotPossible = 106;

/**
* Event is triggered when an inbound delivery is closed.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataInboundDeliveryClosed is returned in the webhook data.
*/
case InboundDeliveryClosed = 107;

/**
* Event is triggered when order is sent again.
* A Domain.DataTransferObjects.OpenApi.SalesOrder is returned in the webhook data.
*/
case OrderSendAgain = 108;

/**
* Event is triggered when order state is changed as part of the order release.
* A Domain.DataTransferObjects.OpenApi.SalesOrder is returned in the webhook data.
*/
case OrderStateChanged = 109;
case PickOrderFullyPacked = 110;

/**
* Event is triggered when a pick orders is fully picked, and will include information about the sales order (orderId) and tracking info (if available).
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataPickOrderPicked is returned in the webhook data.
*/
case PickOrderPicked = 110;

/**
* Event is triggered when the delivery date change on a purchase order affects a sales order.
* A Domain.DataTransferObjects.OpenApi.WebhookData.WebhookDataExpectedDeliveryChanged is returned in the webhook data.
*/
case ExpectedDeliveryChanged = 111;
}
19 changes: 19 additions & 0 deletions src/DataTransferObject/Webhook/WebhookDataPickOrderLine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Setono\PeakWMS\DataTransferObject\Webhook;

final class WebhookDataPickOrderLine
{
public function __construct(
/** The host id of the sales order line */
public string $orderLineId,
/**
* The quantity that was picked/packed on the line. If PickOrderPacked webhook then this is the packed quantity.
* If PickOrderPicked webhook then this is the picked quantity
*/
public int $quantity,
) {
}
}
21 changes: 21 additions & 0 deletions src/DataTransferObject/Webhook/WebhookDataPickOrderPacked.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Setono\PeakWMS\DataTransferObject\Webhook;

final class WebhookDataPickOrderPacked
{
public function __construct(
/** The host id of the sales order */
public string $orderId,
/** The PeakWMS internal id of the pick order */
public int $pickOrderId,
public bool $paymentCaptured,
/** @var list<WebhookDataPickOrderLine> $orderLines */
public array $orderLines,
public ?string $trackingNumber = null,
public ?string $trackingUrl = null,
) {
}
}

0 comments on commit 50e6943

Please sign in to comment.