Skip to content

Commit

Permalink
UNZER-497 Add customerType to every transaction regardless of payment…
Browse files Browse the repository at this point in the history
…Type
  • Loading branch information
Daniil Tkachev committed Oct 15, 2024
1 parent 8331bad commit c594260
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Admin/AdminOrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ protected function addAuthorizationViewData(Authorization $authorization): void
protected function getCustomerTypeAndCurrencyFromTransaction(): array
{
$transactionService = $this->getServiceFromContainer(TransactionService::class);
return $transactionService->getCustomerTypeAndCurrencyByOrderId($this->getEditObjectId());
return $transactionService->getCustomerTypeAndCurrencyFromTransactionByOrderId($this->getEditObjectId());
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/PaymentExtensions/UnzerPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ public function execute(
$companyType
);

// first try to fetch customer, secondly create anew if not found in unzer
try {
$customer = $this->unzerSDK->fetchCustomer($customer);
// for comparison and update, the original object must be recreated
$originalCustomer = $this->unzerService->getUnzerCustomer(
$userModel,
null,
Expand Down
13 changes: 3 additions & 10 deletions src/Service/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function executeUnzerPayment(PaymentModel $paymentModel): bool
{
$paymentExtension = null;
/** @var string $customerType */
$customerType = Registry::getRequest()->getRequestParameter('unzer_customer_type', '');
$customerType = Registry::getRequest()->getRequestParameter('unzer_customer_type', 'B2C');
$user = $this->session->getUser();
$basket = $this->session->getBasket();
$currency = $basket->getBasketCurrency()->name;
Expand All @@ -121,14 +121,6 @@ public function executeUnzerPayment(PaymentModel $paymentModel): bool
$basket
);

// MAYBE WE DONT NEED IT HERE /** @var string $sess_challenge */
// $sess_challenge = $this->session->getVariable('sess_challenge');
// $this->transactionService->writeTransactionToDB(
// $sess_challenge,
// $this->session->getUser()->getId(),
// $this->getSessionUnzerPayment(true)
// );

$paymentStatus = $this->getUnzerPaymentStatus() !== self::STATUS_ERROR;

if ($this->redirectUrl) {
Expand Down Expand Up @@ -496,7 +488,8 @@ public function sendShipmentNotification($oOrder, $sPaymentId = null)
}

$sPaymentId = $sPaymentId ?? $this->transactionService->getPaymentIdByOrderId($oOrder->getId());
$transactionDetails = $this->transactionService->getCustomerTypeAndCurrencyByOrderId($oOrder->getId());
$transactionDetails = $this->transactionService
->getCustomerTypeAndCurrencyFromTransactionByOrderId($oOrder->getId());

$blSuccess = false;

Expand Down

0 comments on commit c594260

Please sign in to comment.