Commit 9adf37d8 authored by Jakub Piasecki's avatar Jakub Piasecki
Browse files

Issue #3266980 by zaporylie: Add support for payment methods that are not using authorization flow

parent d8df69b1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -309,6 +309,14 @@ class EasyHostedPaymentPage extends OffsitePaymentGatewayBase implements Support
    $this->apiHelper->setEnvironment($this->configuration['mode']);
    $this->apiHelper->setSecretKey($this->configuration['secret_key']);
    $easy_payment = $this->apiHelper->getPayment($remoteId);

    // To give justice to payment methods that do not even support authorization
    // flow (ekhm... Swish) we unify the way the following code is
    // handled by creating the fallback reservedAmount entry.
    if (isset($easy_payment['payment']['summary']['chargedAmount']) && !isset($easy_payment['payment']['summary']['reservedAmount'])) {
      $easy_payment['payment']['summary']['reservedAmount'] = $easy_payment['payment']['summary']['chargedAmount'];
    }

    if (!isset($easy_payment['payment']['summary']['reservedAmount'])) {
      $this->lock->release($lockId);
      $this->logger->error('Reserved amount property is missing', ['@context' => $easy_payment]);