Skip to content

Commit

Permalink
Fix the issue with failed Klarna payment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamara committed Dec 23, 2024
1 parent 93a8a7a commit 967ef21
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Handlers/AbstractPaymentMethodHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,16 @@ public function pay(
*/
$stateData = $requestStateData ?? $storedStateData ?? [];

$billieData = [];
$companyName = $dataBag->get('companyName');
$registrationNumber = $dataBag->get('registrationNumber');

$billieData = [
'companyName' => $companyName,
'registrationNumber' => $registrationNumber,
];
if ($companyName && $registrationNumber) {
$billieData = [
'companyName' => $companyName,
'registrationNumber' => $registrationNumber,
];
}

/*
* If there are more than one stateData and /payments calls have been completed,
Expand Down Expand Up @@ -773,7 +776,10 @@ private function getPaymentRequest(
$billieData = []
) {
$transactionId = $transaction->getOrderTransaction()->getId();
$stateData['billieData'] = $billieData;
if ($billieData !== []) {
$stateData['billieData'] = $billieData;
}

try {
$request = $this->preparePaymentsRequest(
$salesChannelContext,
Expand Down

0 comments on commit 967ef21

Please sign in to comment.