Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,4 @@
- BO : Fixed issue when the "Could not reach your Saferpay account" warning kept showing after payment methods had loaded successfully
- Fixed issue when files removed in this version stayed on disk after an upgrade, leaving obsolete iframe checkout controllers reachable and re-creating obsolete menu tabs on module reset
- BO : Fixed issue when a saved API password offered no visible way to enter a new one, and browser password manager icons covered the show/hide password control
- API update to V1.53: all payment and lookup calls now declare the current Saferpay API version
4 changes: 1 addition & 3 deletions src/Config/SaferPayConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class SaferPayConfig
const RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT = 'SAFERPAY_RESTRICT_REFUND_AMOUNT_TO_CAPTURED_AMOUNT';
const CONFIGURATION_NAME = 'SAFERPAY_CONFIGURATION_NAME';
const TEST_SUFFIX = '_TEST';
const API_VERSION = '1.50';
const API_VERSION = '1.53';

const HOOKS = [
'paymentOptions',
Expand Down Expand Up @@ -431,8 +431,6 @@ public static function getBaseUrl()
public static function getDefaultConfiguration()
{
return [
RequestHeader::SPEC_VERSION => SaferPayConfig::API_VERSION,
RequestHeader::SPEC_REFUND_VERSION => SaferPayConfig::API_VERSION,
RequestHeader::RETRY_INDICATOR => 0,
SaferPayConfig::PAYMENT_BEHAVIOR => 1,
SaferPayConfig::PAYMENT_BEHAVIOR_WITHOUT_3D => 0,
Expand Down
2 changes: 1 addition & 1 deletion src/DTO/Request/Refund/RefundRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function getAsArray()
{
$return = [
'RequestHeader' => [
'SpecVersion' => (string) Configuration::get(RequestHeader::SPEC_REFUND_VERSION),
'SpecVersion' => (string) $this->requestHeader->getSpecVersions(),
'CustomerId' => $this->requestHeader->getCustomerId(),
'RequestId' => $this->requestHeader->getRequestId(),
'RetryIndicator' => $this->requestHeader->getRetryIndicator(),
Expand Down
2 changes: 1 addition & 1 deletion src/Service/Request/RequestObjectCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __construct(

public function createRequestHeader(): RequestHeader
{
$specVersion = Configuration::get(RequestHeader::SPEC_VERSION);
$specVersion = SaferPayConfig::API_VERSION;
$customerId = Configuration::get(RequestHeader::CUSTOMER_ID . SaferPayConfig::getConfigSuffix());
$requestId = $this->idempotencyProvider->getIdempotencyKey();
$retryIndicator = Configuration::get(RequestHeader::RETRY_INDICATOR);
Expand Down
8 changes: 8 additions & 0 deletions upgrade/install-2.1.0.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ function saferpayofficial_2_1_0_delete_empty_directory($directory, $moduleDir)
}
}

/**
* The API spec version is no longer stored in configuration, it now comes straight from
* SaferPayConfig::API_VERSION, so the HTTP header and the request body cannot disagree.
* Upgraded shops still carry the old rows, and the refund one was never migrated past the
* version it was first written at, so both are removed here to stop them being trusted.
*/
function saferpayofficial_2_1_0_delete_removed_configuration()
{
Configuration::deleteByName('SAFERPAY_HOSTED_FIELDS_TEMPLATE');
Configuration::deleteByName('SAFERPAY_SPEC_VERSION');
Configuration::deleteByName('SAFERPAY_SPEC_REFUND_VERSION');
}
Loading