diff --git a/saferpayofficial.php b/saferpayofficial.php index b0acd4630..350760752 100755 --- a/saferpayofficial.php +++ b/saferpayofficial.php @@ -1,4 +1,5 @@ name = 'saferpayofficial'; $this->author = 'Invertus'; - $this->version = '2.0.2'; + $this->version = '2.1.0'; $this->module_key = '3d3506c3e184a1fe63b936b82bda1bdf'; $this->displayName = 'SaferpayOfficial'; $this->description = 'Saferpay Payment module'; @@ -257,8 +258,10 @@ public function hookPaymentOptions($params) $paymentMethod['currencies'] = $currencyProvider->getAllCurrenciesInArray(); } - if (!in_array($this->context->currency->iso_code, $paymentMethod['currencies']) - && !in_array($paymentMethod['paymentMethod'], \Invertus\SaferPay\Config\SaferPayConfig::WALLET_PAYMENT_METHODS)) { + if ( + !in_array($this->context->currency->iso_code, $paymentMethod['currencies']) + && !in_array($paymentMethod['paymentMethod'], \Invertus\SaferPay\Config\SaferPayConfig::WALLET_PAYMENT_METHODS) + ) { continue; } @@ -424,7 +427,8 @@ public function hookActionEmailSendBefore($params) public function hookActionAdminControllerSetMedia() { - if ('AdminOrders' === Tools::getValue('controller') + if ( + 'AdminOrders' === Tools::getValue('controller') && (Tools::isSubmit('vieworder') || Tools::getValue('action') === 'vieworder') ) { $this->context->controller->addCSS( @@ -518,8 +522,10 @@ private function displayInAdminOrderPage(array $params) // Note: This condition check or Payment method supports 3DS. // If payment method does not supports 3DS , when we change 'liability_shift' // to true , to hide 'failed security check ' message. - if ($assertData['liability_shift'] === "0" - && !in_array($assertData['paymentMethod'], $supported3DsPaymentMethods)) { + if ( + $assertData['liability_shift'] === "0" + && !in_array($assertData['paymentMethod'], $supported3DsPaymentMethods) + ) { $assertData['liability_shift'] = true; } @@ -543,7 +549,8 @@ private function displayInAdminOrderPage(array $params) public function addFlash($msg, $type) { - if (VersionUtility::isPsVersionGreaterOrEqualTo('1.7.7.0') + if ( + VersionUtility::isPsVersionGreaterOrEqualTo('1.7.7.0') && VersionUtility::isPsVersionLessThan('9.0.0') ) { return $this->get('session')->getFlashBag()->add($type, $msg); diff --git a/src/Config/SaferPayConfig.php b/src/Config/SaferPayConfig.php index ae7879997..ad70eae0f 100755 --- a/src/Config/SaferPayConfig.php +++ b/src/Config/SaferPayConfig.php @@ -1,4 +1,5 @@ self::PAYMENT_MAESTRO, 'Mastercard' => self::PAYMENT_MASTERCARD, 'myOne' => self::PAYMENT_MYONE, - 'paydirekt' => self::PAYMENT_PAYDIREKT, 'PayPal' => self::PAYMENT_PAYPAL, 'Twint' => self::PAYMENT_TWINT, 'Visa' => self::PAYMENT_VISA, 'Postcard' => self::PAYMENT_POSTCARD, 'BonusCard' => self::PAYMENT_BONUS, 'Lastschrift' => self::PAYMENT_LASTSCHRIFT, - 'SOFORTUEBERWEISUNG' => self::PAYMENT_SOFORT, 'AccountToAccount' => self::PAYMENT_ACCOUNTTOACCOUNT, 'Payconiq' => self::PAYMENT_PAYCONIQ, 'Cards' => self::PAYMENT_CARDS, @@ -163,6 +163,8 @@ class SaferPayConfig 'WeChatPay' => self::PAYMENT_WECHATPAY, 'Blik' => self::PAYMENT_BLIK, 'Reka' => self::PAYMENT_REKA, + 'Wero' => self::PAYMENT_WERO, + 'Giftcard' => self::PAYMENT_GIFTCARD, ]; const FIELD_SUPPORTED_PAYMENT_METHODS = [ @@ -321,6 +323,7 @@ public static function supportsOrderCapture($paymentMethod) $unsupportedCapturePayments = [ self::PAYMENT_WECHATPAY, self::PAYMENT_ACCOUNTTOACCOUNT, + self::PAYMENT_GIFTCARD, ]; return !in_array($paymentMethod, $unsupportedCapturePayments); @@ -332,6 +335,7 @@ public static function supportsOrderCancel($paymentMethod) $unsupportedCancelPayments = [ self::PAYMENT_WECHATPAY, self::PAYMENT_ACCOUNTTOACCOUNT, + self::PAYMENT_GIFTCARD, ]; return !in_array($paymentMethod, $unsupportedCancelPayments); @@ -347,11 +351,12 @@ public static function isRedirectPayment($paymentMethod) self::PAYMENT_TWINT, self::PAYMENT_POSTFINANCE_PAY, self::PAYMENT_DIRECTDEBIT, - self::PAYMENT_SOFORT, self::PAYMENT_PAYPAL, self::PAYMENT_CLICKTOPAY, self::PAYMENT_BLIK, self::PAYMENT_REKA, + self::PAYMENT_WERO, + self::PAYMENT_GIFTCARD, ]; return in_array($paymentMethod, $paymentsAlwaysRedirect); @@ -376,7 +381,7 @@ public static function getFieldAccessToken() { return Configuration::get( \Invertus\SaferPay\Config\SaferPayConfig::FIELDS_ACCESS_TOKEN . - \Invertus\SaferPay\Config\SaferPayConfig::getConfigSuffix() + \Invertus\SaferPay\Config\SaferPayConfig::getConfigSuffix() ); } @@ -393,7 +398,7 @@ public static function getFieldUrl() \Invertus\SaferPay\Config\SaferPayConfig::getBaseUrl(), Configuration::get( \Invertus\SaferPay\Config\SaferPayConfig::CUSTOMER_ID . - \Invertus\SaferPay\Config\SaferPayConfig::getConfigSuffix() + \Invertus\SaferPay\Config\SaferPayConfig::getConfigSuffix() ) ); } diff --git a/src/Service/LegacyTranslator.php b/src/Service/LegacyTranslator.php index 82bc605a2..772d90411 100755 --- a/src/Service/LegacyTranslator.php +++ b/src/Service/LegacyTranslator.php @@ -60,17 +60,14 @@ private function getTranslations() SaferPayConfig::PAYMENT_DIRECTDEBIT => $this->module->l('Directdebit', self::FILE_NAME), SaferPayConfig::PAYMENT_EPRZELEWY => $this->module->l('Eprzelewy', self::FILE_NAME), SaferPayConfig::PAYMENT_EPS => $this->module->l('Eps', self::FILE_NAME), - SaferPayConfig::PAYMENT_GIROPAY => $this->module->l('Giropay', self::FILE_NAME), SaferPayConfig::PAYMENT_IDEAL => $this->module->l('Ideal', self::FILE_NAME), SaferPayConfig::PAYMENT_INVOICE => $this->module->l('Invoice', self::FILE_NAME), SaferPayConfig::PAYMENT_JCB => $this->module->l('Jcb', self::FILE_NAME), SaferPayConfig::PAYMENT_MAESTRO => $this->module->l('Maestro', self::FILE_NAME), SaferPayConfig::PAYMENT_MASTERCARD => $this->module->l('Mastercard', self::FILE_NAME), SaferPayConfig::PAYMENT_MYONE => $this->module->l('Myone', self::FILE_NAME), - SaferPayConfig::PAYMENT_PAYDIREKT => $this->module->l('Paydirect', self::FILE_NAME), SaferPayConfig::PAYMENT_POSTCARD => $this->module->l('Postcard', self::FILE_NAME), SaferPayConfig::PAYMENT_POSTFINANCE => $this->module->l('Postfinance', self::FILE_NAME), - SaferPayConfig::PAYMENT_SOFORT => $this->module->l('Sofort', self::FILE_NAME), SaferPayConfig::PAYMENT_TWINT => $this->module->l('Twint', self::FILE_NAME), SaferPayConfig::PAYMENT_VISA => $this->module->l('Visa', self::FILE_NAME), SaferPayConfig::PAYMENT_VPAY => $this->module->l('Vpay', self::FILE_NAME), @@ -85,6 +82,8 @@ private function getTranslations() SaferPayConfig::PAYMENT_GOOGLEPAY => $this->module->l('Googlepay'), SaferPayConfig::PAYMENT_CLICKTOPAY => $this->module->l('Clicktopay', self::FILE_NAME), SaferPayConfig::PAYMENT_REKA => $this->module->l('Reka', self::FILE_NAME), + SaferPayConfig::PAYMENT_WERO => $this->module->l('Wero', self::FILE_NAME), + SaferPayConfig::PAYMENT_GIFTCARD => $this->module->l('Giftcard', self::FILE_NAME), ]; } } diff --git a/src/Service/Response/ResponseObjectCreator.php b/src/Service/Response/ResponseObjectCreator.php index 38c4b8824..e552888dd 100755 --- a/src/Service/Response/ResponseObjectCreator.php +++ b/src/Service/Response/ResponseObjectCreator.php @@ -77,8 +77,12 @@ protected function createPaymentMeans($paymentMeans) $card = $paymentMeans->Card; $cardObj = new Card(); $cardObj->setMaskedNumber($card->MaskedNumber); - $cardObj->setExpYear($card->ExpYear); - $cardObj->setExpMonth($card->ExpMonth); + if (isset($card->ExpYear)) { + $cardObj->setExpYear($card->ExpYear); + } + if (isset($card->ExpMonth)) { + $cardObj->setExpMonth($card->ExpMonth); + } if (isset($card->HolderName)) { $cardObj->setHolderName($card->HolderName); } diff --git a/src/Service/SaferPayOrderStatusService.php b/src/Service/SaferPayOrderStatusService.php index 2bf3e2ae8..7e92cfc48 100755 --- a/src/Service/SaferPayOrderStatusService.php +++ b/src/Service/SaferPayOrderStatusService.php @@ -266,21 +266,6 @@ public function refund(Order $order, $refundedAmount) $cart = new Cart($order->id_cart); $pendingNotification = null; - if ($saferPayAssert->payment_method === SaferPayConfig::PAYMENT_PAYDIREKT) { - $pendingNotify = $this->context->getLink()->getModuleLink( - $this->module->name, - ControllerName::PENDING_NOTIFY, - [ - 'success' => 1, - 'cartId' => $cart->id, - 'orderId' => Order::getOrderByCartId($cart->id), - 'secureKey' => $cart->secure_key, - ], - true - ); - $customer = new Customer($order->id_customer); - $pendingNotification = new PendingNotification($pendingNotify, [$customer->email]); - } $refundRequest = $this->refundRequestObjectCreator->create( $cart, $saferPayOrder->transaction_id,