Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove buyer data from order data #850

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Model/Order/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
use Nosto\Model\Order\OrderStatus;
use Nosto\NostoException;
use Nosto\Tagging\Logger\Logger as NostoLogger;
use Nosto\Tagging\Model\Order\Buyer\Builder as NostoBuyerBuilder;
use Nosto\Tagging\Model\Order\Item\Builder as NostoOrderItemBuilder;

class Builder
Expand All @@ -63,27 +62,23 @@ class Builder
private SalesRuleFactory $salesRuleFactory;
private NostoOrderItemBuilder $nostoOrderItemBuilder;
private ManagerInterface $eventManager;
private NostoBuyerBuilder $buyerBuilder;

/**
* @param NostoLogger $logger
* @param SalesRuleFactory $salesRuleFactory
* @param NostoOrderItemBuilder $nostoOrderItemBuilder
* @param ManagerInterface $eventManager
* @param NostoBuyerBuilder $buyerBuilder
*/
public function __construct(
NostoLogger $logger,
SalesRuleFactory $salesRuleFactory,
NostoOrderItemBuilder $nostoOrderItemBuilder,
ManagerInterface $eventManager,
NostoBuyerBuilder $buyerBuilder
ManagerInterface $eventManager
) {
$this->logger = $logger;
$this->salesRuleFactory = $salesRuleFactory;
$this->nostoOrderItemBuilder = $nostoOrderItemBuilder;
$this->eventManager = $eventManager;
$this->buyerBuilder = $buyerBuilder;
}

/**
Expand Down Expand Up @@ -120,10 +115,7 @@ public function build(Order $order)
}
$nostoOrder->setOrderStatus($nostoStatus);
}
$nostoBuyer = $this->buyerBuilder->fromOrder($order);
if ($nostoBuyer instanceof Buyer) {
$nostoOrder->setCustomer($nostoBuyer);
}
$nostoOrder->setCustomer(new Buyer());
supercid marked this conversation as resolved.
Show resolved Hide resolved

// Add each ordered item as a line item
/** @var Item $item */
Expand Down
107 changes: 0 additions & 107 deletions Model/Order/Buyer/Builder.php

This file was deleted.

2 changes: 0 additions & 2 deletions Observer/Order/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
use Magento\Framework\Module\Manager as ModuleManager;
use Magento\Sales\Model\Order;
use Magento\Store\Model\Store;
use Nosto\Model\Order\Buyer;
use Nosto\Model\Order\Order as NostoOrder;
use Nosto\Operation\Order\OrderCreate as NostoOrderCreate;
use Nosto\Operation\Order\OrderStatus as NostoOrderUpdate;
Expand Down Expand Up @@ -256,7 +255,6 @@ private function sendNewOrder(Order $order, AccountInterface $nostoAccount, Stor
$nostoCustomerIdentifier = NostoOrderCreate::IDENTIFIER_BY_REF;
}
$nostoOrder = $this->nostoOrderBuilder->build($order);
$nostoOrder->setCustomer(new Buyer()); // Remove customer data from order API calls
if ($nostoCustomerId !== null) {
try {
$orderService = new NostoOrderCreate(
Expand Down
Loading