Skip to content

Commit

Permalink
Merge pull request #109 from vippsas/publication-2.4.18
Browse files Browse the repository at this point in the history
VIPPS-392: Fix issue: - phone number not passed from KCO, - lockName …
  • Loading branch information
voleye authored Aug 19, 2021
2 parents 99ae1ff + 1354556 commit c4bce81
Show file tree
Hide file tree
Showing 20 changed files with 132 additions and 175 deletions.
1 change: 1 addition & 0 deletions Controller/Payment/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
/**
* Class Callback
* @package Vipps\Payment\Controller\Payment
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Callback implements ActionInterface, CsrfAwareActionInterface
{
Expand Down
15 changes: 8 additions & 7 deletions Controller/Payment/Fallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public function __construct(

/**
* @return ResponseInterface|Redirect|ResultInterface
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
{
Expand All @@ -193,6 +194,7 @@ public function execute()
} finally {
$vippsQuote = $this->getVippsQuote(true);
$cartPersistence = $this->config->getValue('cancellation_cart_persistence');

$quoteCouldBeRestored = $transaction
&& ($transaction->transactionWasCancelled() || $transaction->isTransactionExpired());
$order = $this->getOrder();
Expand Down Expand Up @@ -309,13 +311,12 @@ private function prepareResponse(Redirect $resultRedirect, Transaction $transact
*/
private function storeLastOrder(OrderInterface $order)
{
$this->checkoutSession
->clearStorage()
->setLastQuoteId($order->getQuoteId())
->setLastSuccessQuoteId($order->getQuoteId())
->setLastOrderId($order->getEntityId())
->setLastRealOrderId($order->getIncrementId())
->setLastOrderStatus($order->getStatus());
$this->checkoutSession->clearStorage();
$this->checkoutSession->setLastQuoteId($order->getQuoteId());
$this->checkoutSession->setLastSuccessQuoteId($order->getQuoteId());
$this->checkoutSession->setLastOrderId($order->getEntityId());
$this->checkoutSession->setLastRealOrderId($order->getIncrementId());
$this->checkoutSession->setLastOrderStatus($order->getStatus());
}

/**
Expand Down
5 changes: 4 additions & 1 deletion Controller/Payment/InitExpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
/**
* Class InitExpress
* @package Vipps\Payment\Controller\Payment
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class InitExpress implements ActionInterface
{
Expand Down Expand Up @@ -93,7 +94,7 @@ class InitExpress implements ActionInterface
private $logger;

/**
* InitExpress1 constructor.
* InitExpress constructor.
*
* @param ResultFactory $resultFactory
* @param SessionManagerInterface $checkoutSession
Expand All @@ -105,6 +106,8 @@ class InitExpress implements ActionInterface
* @param ManagerInterface $messageManager
* @param CheckoutHelper $checkoutHelper
* @param LoggerInterface $logger
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
ResultFactory $resultFactory,
Expand Down
1 change: 1 addition & 0 deletions Controller/Payment/InitRegular.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
/**
* Class InitRegular
* @package Vipps\Payment\Controller\Payment
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class InitRegular implements ActionInterface
{
Expand Down
2 changes: 2 additions & 0 deletions Controller/Payment/Klarna/InitRegular.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ class InitRegular implements ActionInterface
* @param PaymentInformationManagementInterface $paymentInformationManagement
* @param QuoteIdToMaskedQuoteIdInterface $quoteIdToMaskedQuoteId
* @param ManagerInterface $messageManager
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
ResultFactory $resultFactory,
Expand Down
3 changes: 3 additions & 0 deletions Controller/Payment/ShippingDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
/**
* Class ShippingDetails
* @package Vipps\Payment\Controller\Payment
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ShippingDetails implements ActionInterface, CsrfAwareActionInterface
{
Expand Down Expand Up @@ -115,6 +116,8 @@ class ShippingDetails implements ActionInterface, CsrfAwareActionInterface
* @param ShippingMethodValidator $shippingMethodValidator
* @param CartRepositoryInterface $cartRepository
* @param LoggerInterface $logger
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
ResultFactory $resultFactory,
Expand Down
2 changes: 1 addition & 1 deletion Gateway/Request/Initiate/CustomerDataBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function build(array $buildSubject)
{
return [
self::$customerInfo => [
self::$mobileNumber => $this->subjectReader->readTelephone($buildSubject)
self::$mobileNumber => str_replace(' ', '', $this->subjectReader->readTelephone($buildSubject))
]
];
}
Expand Down
10 changes: 0 additions & 10 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ pipeline {
sh 'composer install --no-ansi'
}
}
stage('PHP Mess Detector') {
steps {
sh './vendor/bin/phpmd . ansi phpmd.xml'
}
}
stage('PHP CS') {
steps {
sh './vendor/bin/phpcs'
}
}
stage('PHP Unit') {
steps {
sh './vendor/bin/phpunit -c phpunit.xml'
Expand Down
1 change: 1 addition & 0 deletions Model/QuoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ public function load(int $vippsQuoteId)
* @param $reservedOrderId
*
* @return OrderInterface|null
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
*/
private function tryLocateOrder($reservedOrderId): ?OrderInterface
{
Expand Down
7 changes: 5 additions & 2 deletions Model/TransactionProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ class TransactionProcessor
* @param PaymentDetailsProvider $paymentDetailsProvider
* @param LoggerInterface $logger
* @param ResourceConnection $resourceConnection
*
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
OrderRepositoryInterface $orderRepository,
Expand Down Expand Up @@ -204,7 +206,9 @@ public function process(QuoteInterface $vippsQuote)

return $transaction;
} finally {
$this->releaseLock($lockName);
if (isset($lockName)) {
$this->releaseLock($lockName);
}
}
}

Expand All @@ -221,7 +225,6 @@ private function processCancelledTransaction(QuoteInterface $vippsQuote)
if ($order) {
$this->cancelOrder($order);
}

$vippsQuote->setStatus(QuoteStatusInterface::STATUS_CANCELED);
$this->quoteManagement->save($vippsQuote);
}
Expand Down
Loading

0 comments on commit c4bce81

Please sign in to comment.