Skip to content

Commit

Permalink
Publication 2.4.2 (#75)
Browse files Browse the repository at this point in the history
- fixed issue with di:compile
- changed config section
  • Loading branch information
ed007m authored Oct 19, 2020
1 parent 5037e52 commit d7c5d77
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 343 deletions.
10 changes: 5 additions & 5 deletions Controller/Payment/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use Vipps\Payment\Gateway\Command\PaymentDetailsProvider;
use Vipps\Payment\Model\Gdpr\Compliance;
use Vipps\Payment\Model\TransactionProcessor;
use Zend\Http\Response as ZendResponse;
use Laminas\Http\Response as Response;

/**
* Class Callback
Expand Down Expand Up @@ -122,15 +122,15 @@ public function execute()
$this->transactionProcessor->process($this->getVippsQuote($requestData), $transaction);

/** @var Json $result */
$result->setHttpResponseCode(ZendResponse::STATUS_CODE_200);
$result->setData(['status' => ZendResponse::STATUS_CODE_200, 'message' => 'success']);
$result->setHttpResponseCode(Response::STATUS_CODE_200);
$result->setData(['status' => Response::STATUS_CODE_200, 'message' => 'success']);
} catch (\Exception $e) {
$orderId = $requestData['orderId'] ?? 'Missing';
$message = 'OrderID: ' . $orderId . ' . Exception message: ' . $e->getMessage();
$this->logger->critical($message);
$result->setHttpResponseCode(ZendResponse::STATUS_CODE_500);
$result->setHttpResponseCode(Response::STATUS_CODE_500);
$result->setData([
'status' => ZendResponse::STATUS_CODE_500,
'status' => Response::STATUS_CODE_500,
'message' => $message
]);
} finally {
Expand Down
4 changes: 2 additions & 2 deletions Controller/Payment/ConsentRemoval.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use Magento\Framework\Controller\Result\Json;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;
use Zend\Http\Response as ZendResponse;
use Laminas\Http\Response;

/**
* Class ConsentRemoval
Expand All @@ -38,7 +38,7 @@ public function execute()
{
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
/** @var Json $result */
$result->setHttpResponseCode(ZendResponse::STATUS_CODE_200);
$result->setHttpResponseCode(Response::STATUS_CODE_200);

return $result;
}
Expand Down
14 changes: 7 additions & 7 deletions Controller/Payment/ShippingDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
use Vipps\Payment\Model\Quote\AddressUpdater;
use Vipps\Payment\Model\QuoteLocator;
use Vipps\Payment\Model\Quote\ShippingMethodValidator;
use Zend\Http\Response as ZendResponse;
use Laminas\Http\Response;

/**
* Class ShippingDetails
Expand Down Expand Up @@ -177,20 +177,20 @@ public function execute()
'shippingMethodId' => $methodFullCode,
];
}
$result->setHttpResponseCode(ZendResponse::STATUS_CODE_200);
$result->setHttpResponseCode(Response::STATUS_CODE_200);
$result->setData($responseData);
} catch (LocalizedException $e) {
$this->logger->critical($this->enlargeMessage($e));
$result->setHttpResponseCode(ZendResponse::STATUS_CODE_500);
$result->setHttpResponseCode(Response::STATUS_CODE_500);
$result->setData([
'status' => ZendResponse::STATUS_CODE_500,
'status' => Response::STATUS_CODE_500,
'message' => $e->getMessage()
]);
} catch (\Exception $e) {
$this->logger->critical($this->enlargeMessage($e));
$result->setHttpResponseCode(ZendResponse::STATUS_CODE_500);
$result->setHttpResponseCode(Response::STATUS_CODE_500);
$result->setData([
'status' => ZendResponse::STATUS_CODE_500,
'status' => Response::STATUS_CODE_500,
'message' => __('An error occurred during Shipping Details processing.')
]);
} finally {
Expand Down Expand Up @@ -265,4 +265,4 @@ public function validateForCsrf(RequestInterface $request): ?bool //@codingStand
{
return true;
}
}
}
2 changes: 1 addition & 1 deletion DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Vipps Payments configuration is divided by sections. It helps to quickly find an

![Screenshot of Vipps Settings](docs/images/vipps_method.png)

Please ensure you check all configuration settings prior to using Vipps Payment. Pay attention to the Vipps Basic Settings section, namely `Saleunit Serial Number`, `Client ID`, `Client Secret`, `Subscription Key 1`, `Subscription Key 2`.
Please ensure you check all configuration settings prior to using Vipps Payment. Pay attention to the Vipps Basic Settings section, namely `Saleunit Serial Number`, `Client ID`, `Client Secret`, `Subscription Key`.

For information about how to find the above values, see the [Vipps Developer Portal documentation](https://github.com/vippsas/vipps-developers/blob/master/vipps-developer-portal-getting-started.md).

Expand Down
4 changes: 2 additions & 2 deletions Gateway/Command/GatewayCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
use Vipps\Payment\Gateway\Exception\ExceptionFactory;
use Vipps\Payment\Gateway\Exception\VippsException;
use Vipps\Payment\Model\Profiling\ProfilerInterface;
use Zend\Http\Response as ZendResponse;
use Laminas\Http\Response;
use Psr\Log\LoggerInterface;

/**
Expand Down Expand Up @@ -143,7 +143,7 @@ public function execute(array $commandSubject)

$result = $this->client->placeRequest($transfer);

/** @var ZendResponse $response */
/** @var Response $response */
$response = $result['response'];
$responseBody = $this->jsonDecoder->decode($response->getContent());

Expand Down
85 changes: 0 additions & 85 deletions Gateway/Config/CanVoidHandler.php

This file was deleted.

14 changes: 6 additions & 8 deletions Gateway/Http/Client/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
use Magento\Payment\Gateway\Http\TransferInterface;
use Vipps\Payment\Gateway\Exception\AuthenticationException;
use Vipps\Payment\Model\TokenProviderInterface;
use Zend\Http\Request;
use Zend\Http\Response as ZendResponse;
use Laminas\Http\Request;
use Laminas\Http\Response;
use Psr\Log\LoggerInterface;
use Vipps\Payment\Model\ModuleMetadataInterface;

Expand Down Expand Up @@ -101,7 +101,7 @@ public function placeRequest(TransferInterface $transfer)
{
try {
$response = $this->place($transfer);
if ($response->getStatusCode() == ZendResponse::STATUS_CODE_401) {
if ($response->getStatusCode() == Response::STATUS_CODE_401) {
$this->tokenProvider->regenerate();
$response = $this->place($transfer);
}
Expand All @@ -116,7 +116,7 @@ public function placeRequest(TransferInterface $transfer)
/**
* @param TransferInterface $transfer
*
* @return ZendResponse
* @return Response
* @throws AuthenticationException
*/
private function place(TransferInterface $transfer)
Expand Down Expand Up @@ -146,10 +146,8 @@ private function place(TransferInterface $transfer)
$requestHeaders,
$this->jsonEncoder->encode($transfer->getBody())
);
$responseSting = $adapter->read();
$response = ZendResponse::fromString($responseSting);

return $response;
return Response::fromString($adapter->read());
} finally {
$adapter ? $adapter->close() : null;
}
Expand All @@ -170,7 +168,7 @@ private function getHeaders($headers)
self::HEADER_PARAM_X_REQUEST_ID => '',
self::HEADER_PARAM_X_SOURCE_ADDRESS => '',
self::HEADER_PARAM_X_TIMESTAMP => '',
self::HEADER_PARAM_SUBSCRIPTION_KEY => $this->config->getValue('subscription_key2'),
self::HEADER_PARAM_SUBSCRIPTION_KEY => $this->config->getValue('subscription_key1'),
],
$headers
);
Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Vipps Payments configuration is divided by sections. It helps to quickly find an

![Screenshot of Vipps Settings](docs/images/vipps_method.png)

Please ensure you check all configuration settings prior to using Vipps Payment. Pay attention to the Vipps Basic Settings section, namely `Saleunit Serial Number`, `Client ID`, `Client Secret`, `Subscription Key 1`, `Subscription Key 2`.
Please ensure you check all configuration settings prior to using Vipps Payment. Pay attention to the Vipps Basic Settings section, namely `Saleunit Serial Number`, `Client ID`, `Client Secret`, `Subscription Key`.

For information about how to find the above values, see the [Vipps Developer Portal documentation](https://github.com/vippsas/vipps-developers/blob/master/vipps-developer-portal-getting-started.md).

Expand Down
2 changes: 1 addition & 1 deletion Model/Profiling/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Vipps\Payment\Api\Profiling\Data\ItemInterfaceFactory;
use Vipps\Payment\Api\Profiling\ItemRepositoryInterface;

use Zend\Http\Response;
use Laminas\Http\Response;
use Magento\Framework\Json\DecoderInterface;
use Vipps\Payment\Model\Gdpr\Compliance;

Expand Down
2 changes: 1 addition & 1 deletion Model/Profiling/ProfilerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

use Magento\Payment\Gateway\Http\TransferInterface;
use Vipps\Payment\Api\Profiling\Data\ItemInterface;
use Zend\Http\Response;
use Laminas\Http\Response;

interface ProfilerInterface
{
Expand Down
1 change: 1 addition & 0 deletions Model/TokenProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ private function readJwt()
$this->logger->critical($e->getMessage());
throw new AuthenticationException(__('Can\'t retrieve access token from Vipps.'));
}

return $jwt;
}

Expand Down
5 changes: 3 additions & 2 deletions Observer/AvailabilityByShippingMethod.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright Vipps
* Copyright 2020 Vipps
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
Expand All @@ -15,7 +15,8 @@
*/
namespace Vipps\Payment\Observer;

use Magento\Framework\Event\{Observer, ObserverInterface};
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Quote\Model\Quote;
use Vipps\Payment\Model\Quote\ShippingMethodValidator;
Expand Down
2 changes: 1 addition & 1 deletion Plugin/Config/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Config
* @var array
*/
private static $encryptedFields = [
'client_id', 'merchant_serial_number', 'client_secret', 'subscription_key1', 'subscription_key2'
'client_id', 'merchant_serial_number', 'client_secret', 'subscription_key1'
];

/**
Expand Down
66 changes: 0 additions & 66 deletions Plugin/Klarna/Kco/Model/Api/Builder/KasperPlugin.php

This file was deleted.

Loading

0 comments on commit d7c5d77

Please sign in to comment.