diff --git a/Api/Config/RepositoryInterface.php b/Api/Config/RepositoryInterface.php index 0f3475e1..073c31c7 100755 --- a/Api/Config/RepositoryInterface.php +++ b/Api/Config/RepositoryInterface.php @@ -111,9 +111,9 @@ public function getFulfillTrigger(?int $storeId = null): string; * * @param int|null $storeId * - * @return string + * @return array */ - public function getFulfillOrderStatus(?int $storeId = null): string; + public function getFulfillOrderStatusList(?int $storeId = null): array; /** * Check if international telephone is enabled diff --git a/Model/Config/Repository.php b/Model/Config/Repository.php index 5e5e0504..56d52507 100755 --- a/Model/Config/Repository.php +++ b/Model/Config/Repository.php @@ -143,9 +143,9 @@ public function getFulfillTrigger(?int $storeId = null): string /** * @inheritDoc */ - public function getFulfillOrderStatus(?int $storeId = null): string + public function getFulfillOrderStatusList(?int $storeId = null): array { - return (string)$this->getConfig(self::XML_PATH_FULFILL_ORDER_STATUS, $storeId); + return explode(',', (string)$this->getConfig(self::XML_PATH_FULFILL_ORDER_STATUS, $storeId)); } /** diff --git a/Observer/SalesOrderSaveAfter.php b/Observer/SalesOrderSaveAfter.php index cdb7b73b..b3d40706 100755 --- a/Observer/SalesOrderSaveAfter.php +++ b/Observer/SalesOrderSaveAfter.php @@ -78,7 +78,7 @@ public function execute(Observer $observer) && $order->getTwoOrderId() ) { if (($this->configRepository->getFulfillTrigger() == 'complete') - && ($this->configRepository->getFulfillOrderStatus() == $order->getStatus()) + && in_array($order->getStatus(), $this->configRepository->getFulfillOrderStatusList()) ) { if (!$this->isWholeOrderShipped($order)) { $error = __("Two requires whole order to be shipped before it can be fulfilled."); diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index c82a6b59..ea4cfbe1 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -115,10 +115,10 @@ payment/two_payment/fulfill_trigger - - If fulfilment trigger is On Completion, select the order status which triggers fulfilment. + If fulfilment trigger is On Completion, select one of more order statuses which can trigger fulfilment. Two\Gateway\Model\Config\Source\FulfillOrderStatus 1