Skip to content

Commit

Permalink
remove double code
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinverschoor committed Aug 25, 2021
1 parent 104ac0d commit 7c2f0d6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Controller/Checkout/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ private function processPaidOrder(Transaction $transaction, Order $order)
$order->addStatusHistoryComment(__('New order email sent'))->setIsCustomerNotified(true)->save();
}

$newStatus = ($transaction->isAuthorized()) ? $this->config->getAuthorizedStatus($paymentMethod) : $this->config->getPaidStatus($paymentMethod);

# Skip creation of invoice for B2B if enabled
if ($this->config->ignoreB2BInvoice($paymentMethod)) {
$orderCompany = $order->getBillingAddress()->getCompany();
Expand All @@ -342,8 +344,6 @@ private function processPaidOrder(Transaction $transaction, Order $order)
# Change amount paid manually
$order->setTotalPaid($order->getGrandTotal());
$order->setBaseTotalPaid($order->getBaseGrandTotal());

$newStatus = ($transaction->isAuthorized()) ? $this->config->getAuthorizedStatus($paymentMethod) : $this->config->getPaidStatus($paymentMethod);
$order->setStatus(!empty($newStatus) ? $newStatus : Order::STATE_PROCESSING);
$order->addStatusHistoryComment(__('B2B Setting: Skipped creating invoice'));
$this->orderRepository->save($order);
Expand All @@ -358,7 +358,6 @@ private function processPaidOrder(Transaction $transaction, Order $order)
$payment->registerCaptureNotification($paidAmount, $this->config->isSkipFraudDetection());
}

$newStatus = ($transaction->isAuthorized()) ? $this->config->getAuthorizedStatus($paymentMethod) : $this->config->getPaidStatus($paymentMethod);
$order->setStatus(!empty($newStatus) ? $newStatus : Order::STATE_PROCESSING);

$this->orderRepository->save($order);
Expand Down

0 comments on commit 7c2f0d6

Please sign in to comment.