Skip to content

Commit

Permalink
Merge pull request #187 from bold-commerce/Q1-665
Browse files Browse the repository at this point in the history
Remove fulfilment status and financial status from bold_checkout_orde…
  • Loading branch information
victorpetryk authored Nov 24, 2023
2 parents 7b25317 + 1bcd6c6 commit c4870ca
Show file tree
Hide file tree
Showing 26 changed files with 72 additions and 853 deletions.
42 changes: 0 additions & 42 deletions Model/Order/OrderExtensionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,48 +63,6 @@ public function getPublicId(): ?string
return $this->getData(OrderExtensionDataResource::PUBLIC_ID);
}

/**
* Set order financial status.
*
* @param string|null $financialStatus
* @return void
*/
public function setFinancialStatus(?string $financialStatus): void
{
$this->setData(OrderExtensionDataResource::FINANCIAL_STATUS, $financialStatus);
}

/**
* Retrieve financial order status.
*
* @return string|null
*/
public function getFinancialStatus(): ?string
{
return $this->getData(OrderExtensionDataResource::FINANCIAL_STATUS);
}

/**
* Set order fulfillment status.
*
* @param string|null $fulfillmentStatus
* @return void
*/
public function setFulfillmentStatus(?string $fulfillmentStatus): void
{
$this->setData(OrderExtensionDataResource::FULFILLMENT_STATUS, $fulfillmentStatus);
}

/**
* Retrieve fulfillment order status.
*
* @return string|null
*/
public function getFulfillmentStatus(): ?string
{
return $this->getData(OrderExtensionDataResource::FULFILLMENT_STATUS);
}

/**
* Set is order using delayed payment capture.
*
Expand Down
2 changes: 1 addition & 1 deletion Model/Order/PlaceOrder/AddCommentsToOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function addComments(
$comments = new DataObject([]);

$this->eventManager->dispatch(
'add_comments_to_order_save_before',
'bold_checkout_add_comments_to_order_before',
[
'order' => $order,
'orderData' => $orderData,
Expand Down
9 changes: 4 additions & 5 deletions Model/Order/PlaceOrder/CreateOrderFromPayload.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,13 @@ public function createOrder(OrderDataInterface $orderPayload, CartInterface $quo
$orderExtensionData = $this->orderExtensionDataFactory->create();
$orderExtensionData->setPublicId($orderPayload->getPublicId());
$orderExtensionData->setOrderId((int)$magentoOrder->getId());
$orderExtensionData->setFulfillmentStatus($orderPayload->getFulfillmentStatus());
$orderExtensionData->setFinancialStatus($orderPayload->getFinancialStatus());

$this->eventManager->dispatch(
'create_order_from_payload_extension_data_save_before',
['orderPayload' => $orderPayload, 'orderExtensionData' => $orderExtensionData]
[
'orderPayload' => $orderPayload,
'orderExtensionData' => $orderExtensionData,
]
);

$this->orderExtensionDataResource->save($orderExtensionData);

return $magentoOrder;
Expand Down
8 changes: 1 addition & 7 deletions Model/Order/PlaceOrder/CreateOrderFromQuote.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ class CreateOrderFromQuote
{
private const BROWSER_IP = 'remote_ip';
private const ORDER_NUMBER = 'ext_order_id';
private const PUBLIC_ID = 'extension_attribute_public_id_public_id';
private const FINANCIAL_STATUS = 'extension_attribute_financial_status_financial_status';
private const FULFILLMENT_STATUS = 'extension_attribute_fulfillment_status_fulfillment_status';

/**
* @var CartManagementInterface
Expand Down Expand Up @@ -111,9 +108,6 @@ public function create(CartInterface $quote, OrderDataInterface $orderPayload):
$orderData = [
self::ORDER_NUMBER => $orderPayload->getOrderNumber(),
self::BROWSER_IP => $orderPayload->getBrowserIp(),
self::PUBLIC_ID => $orderPayload->getPublicId(),
self::FINANCIAL_STATUS => $orderPayload->getFinancialStatus(),
self::FULFILLMENT_STATUS => $orderPayload->getFulfillmentStatus(),
];
$quote->getBillingAddress()->setShouldIgnoreValidation(true);
if (!$quote->isVirtual()) {
Expand All @@ -122,7 +116,7 @@ public function create(CartInterface $quote, OrderDataInterface $orderPayload):
}
$orderData = new DataObject($orderData);
$this->eventManager->dispatch(
'create_order_from_quote_submit_before',
'bold_checkout_create_order_from_quote_submit_before',
[
'quote' => $quote,
'orderPayload' => $orderPayload,
Expand Down
3 changes: 0 additions & 3 deletions Model/Order/PlaceOrder/ProcessOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ public function process(OrderDataInterface $orderPayload): OrderInterface
$orderPayload->getTransaction()
);
$this->addCommentsToOrder->addComments($order, $orderPayload);
$orderExtensionData->setFulfillmentStatus($orderPayload->getFulfillmentStatus());
$orderExtensionData->setFinancialStatus($orderPayload->getFinancialStatus());
$this->orderExtensionDataResource->save($orderExtensionData);
return $order;
}
}
20 changes: 12 additions & 8 deletions Model/Payment/Gateway/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,20 @@ private function keepTransactionAdditionalData(OrderInterface $order): void
* Retrieve order public id.
*
* @param OrderInterface $order
* @return string|null
* @return string
* @throws LocalizedException
*/
private function getOrderPublicId(OrderInterface $order): ?string
private function getOrderPublicId(OrderInterface $order): string
{
$publicId = $order->getExtensionAttributes()->getPublicId();
if (!$publicId) {
$orderExtensionData = $this->orderExtensionDataFactory->create();
$this->orderExtensionDataResource->load($orderExtensionData, $order->getId(), OrderExtensionData::ORDER_ID);
$publicId = $orderExtensionData->getPublicId();
$orderExtensionData = $this->orderExtensionDataFactory->create();
$this->orderExtensionDataResource->load(
$orderExtensionData,
$order->getId(),
OrderExtensionData::ORDER_ID
);
if (!$orderExtensionData->getPublicId()) {
throw new LocalizedException(__('Order public id is not set.'));
}
return $publicId;
return $orderExtensionData->getPublicId();
}
}
45 changes: 0 additions & 45 deletions Model/Payment/Gateway/Validator/ModuleEnabledValidator.php

This file was deleted.

29 changes: 0 additions & 29 deletions Model/Payment/Gateway/Validator/PublicOrderIdValidator.php

This file was deleted.

2 changes: 0 additions & 2 deletions Model/ResourceModel/Order/OrderExtensionData.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class OrderExtensionData extends AbstractDb
public const ID = 'id';
public const ORDER_ID = 'order_id';
public const PUBLIC_ID = 'public_id';
public const FINANCIAL_STATUS = 'financial_status';
public const FULFILLMENT_STATUS = 'fulfillment_status';
public const IS_DELAYED_CAPTURE = 'is_delayed_capture';

/**
Expand Down
86 changes: 0 additions & 86 deletions Observer/Category/CategoryDelete.php

This file was deleted.

Loading

0 comments on commit c4870ca

Please sign in to comment.