Skip to content

Commit 466567a

Browse files
authored
Merge pull request #1406 from PrestaShopCorp/fix/PAYSHIP-3684
[PAYSHIP-3684] Fix payment method name on save order
2 parents ca5917b + 2c8a0a6 commit 466567a

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

core/src/Order/Action/CreateOrderPaymentAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function execute(PayPalOrderResponse $payPalOrderResponse)
121121

122122
$paymentAdded = $order->addOrderPayment(
123123
$capture['amount']['value'],
124-
$this->fundingSourceTranslationProvider->getFundingSourceName($payPalOrderResponse->getFundingSource()),
124+
$this->fundingSourceTranslationProvider->getFundingSourceName($payPalOrder->getFundingSource()),
125125
$capture['id'],
126126
$currency,
127127
$date->format('Y-m-d H:i:s'),

core/src/Order/Action/CreateValidateOrderDataAction.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use PsCheckout\Core\OrderState\Configuration\OrderStateConfiguration;
2828
use PsCheckout\Core\OrderState\OrderStateException;
2929
use PsCheckout\Core\OrderState\Service\OrderStateMapperInterface;
30+
use PsCheckout\Core\PayPal\Order\Repository\PayPalOrderRepositoryInterface;
3031
use PsCheckout\Infrastructure\Adapter\ContextInterface;
3132
use PsCheckout\Infrastructure\Repository\CurrencyRepositoryInterface;
3233

@@ -52,24 +53,32 @@ class CreateValidateOrderDataAction implements CreateValidateOrderDataActionInte
5253
*/
5354
private $orderAmountValidator;
5455

56+
/**
57+
* @var PayPalOrderRepositoryInterface
58+
*/
59+
private $payPalOrderRepository;
60+
5561
public function __construct(
5662
ContextInterface $context,
5763
OrderStateMapperInterface $orderStateMapper,
5864
CurrencyRepositoryInterface $currencyRepository,
59-
OrderAmountValidatorInterface $orderAmountValidator
65+
OrderAmountValidatorInterface $orderAmountValidator,
66+
PayPalOrderRepositoryInterface $payPalOrderRepository
6067
) {
6168
$this->context = $context;
6269
$this->orderStateMapper = $orderStateMapper;
6370
$this->currencyRepository = $currencyRepository;
6471
$this->orderAmountValidator = $orderAmountValidator;
72+
$this->payPalOrderRepository = $payPalOrderRepository;
6573
}
6674

6775
/**
6876
* {@inheritDoc}
6977
*/
70-
public function execute(PayPalOrderResponse $paypalOrder): ValidateOrderData
78+
public function execute(PayPalOrderResponse $payPalOrderResponse): ValidateOrderData
7179
{
72-
$fundingSource = $paypalOrder->getFundingSource();
80+
$payPalOrder = $this->payPalOrderRepository->getOneBy(['id' => $payPalOrderResponse->getId()]);
81+
$fundingSource = $payPalOrder->getFundingSource();
7382
$cart = $this->context->getCart();
7483

7584
$paidAmount = '';
@@ -78,7 +87,7 @@ public function execute(PayPalOrderResponse $paypalOrder): ValidateOrderData
7887

7988
$currencyId = (int) $this->context->getCart()->id_currency;
8089

81-
$capture = $paypalOrder->getCapture();
90+
$capture = $payPalOrderResponse->getCapture();
8291

8392
if ($capture) {
8493
$transactionId = $capture['id'];

core/src/Order/Action/CreateValidateOrderDataActionInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
interface CreateValidateOrderDataActionInterface
2727
{
2828
/**
29-
* @param PayPalOrderResponse $paypalOrder
29+
* @param PayPalOrderResponse $payPalOrderResponse
3030
*
3131
* @return ValidateOrderData
3232
*/
33-
public function execute(PayPalOrderResponse $paypalOrder): ValidateOrderData;
33+
public function execute(PayPalOrderResponse $payPalOrderResponse): ValidateOrderData;
3434
}

ps17/config/front/process.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ services:
4040
- '@PsCheckout\Core\OrderState\Service\OrderStateMapper'
4141
- '@PsCheckout\Infrastructure\Repository\CurrencyRepository'
4242
- '@PsCheckout\Core\Order\Validator\OrderAmountValidator'
43+
- '@PsCheckout\Infrastructure\Repository\PayPalOrderRepository'
4344

4445
PsCheckout\Core\Order\Action\ValidateOrderAction:
4546
class: PsCheckout\Core\Order\Action\ValidateOrderAction

ps8/config/front/process.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ services:
4040
- '@PsCheckout\Core\OrderState\Service\OrderStateMapper'
4141
- '@PsCheckout\Infrastructure\Repository\CurrencyRepository'
4242
- '@PsCheckout\Core\Order\Validator\OrderAmountValidator'
43+
- '@PsCheckout\Infrastructure\Repository\PayPalOrderRepository'
4344

4445
PsCheckout\Core\Order\Action\ValidateOrderAction:
4546
class: PsCheckout\Core\Order\Action\ValidateOrderAction

ps9/config/front/process.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ services:
4040
- '@PsCheckout\Core\OrderState\Service\OrderStateMapper'
4141
- '@PsCheckout\Infrastructure\Repository\CurrencyRepository'
4242
- '@PsCheckout\Core\Order\Validator\OrderAmountValidator'
43+
- '@PsCheckout\Infrastructure\Repository\PayPalOrderRepository'
4344

4445
PsCheckout\Core\Order\Action\ValidateOrderAction:
4546
class: PsCheckout\Core\Order\Action\ValidateOrderAction

0 commit comments

Comments
 (0)