From 9ed1bd5088042d641e4f996ced643d90049b18c7 Mon Sep 17 00:00:00 2001 From: Aaron Whittington Date: Wed, 22 Aug 2018 15:37:13 +0200 Subject: [PATCH] fix/SHPWR-328_extend-plugin-update-function-for-backend-orders update function and plugin save function still work (sw 5.4.5) --- .../Events/PluginConfigurationSubscriber.php | 175 +-------------- Bootstrapping/ShopConfigSetup.php | 203 +++--------------- Component/Service/ConfigLoader.php | 15 ++ Component/Service/RatepayConfigWriter.php | 170 +++++++++++++++ plugin.json | 2 +- 5 files changed, 228 insertions(+), 337 deletions(-) create mode 100644 Component/Service/RatepayConfigWriter.php diff --git a/Bootstrapping/Events/PluginConfigurationSubscriber.php b/Bootstrapping/Events/PluginConfigurationSubscriber.php index 00c78f72..d81e4dfb 100644 --- a/Bootstrapping/Events/PluginConfigurationSubscriber.php +++ b/Bootstrapping/Events/PluginConfigurationSubscriber.php @@ -7,6 +7,8 @@ */ namespace RpayRatePay\Bootstrapping\Events; +use RpayRatePay\Component\Service\RatepayConfigWriter; + class PluginConfigurationSubscriber implements \Enlight\Event\SubscriberInterface { protected $_countries = array('de', 'at', 'ch', 'nl', 'be'); @@ -50,9 +52,6 @@ public function beforeSavePluginConfig(\Enlight_Hook_HookArgs $arguments) $shopCredentials = array(); - // Remove old configs - $this->_truncateConfigTables(); - foreach ($parameter['elements'] as $element) { foreach ($this->_countries AS $country) { if ($element['name'] === 'RatePayProfileID' . strtoupper($country)) { @@ -78,26 +77,30 @@ public function beforeSavePluginConfig(\Enlight_Hook_HookArgs $arguments) } } + $rpayConfigWriter = new RatepayConfigWriter(Shopware()->Db()); + + $rpayConfigWriter->truncateConfigTables(); + foreach($shopCredentials as $shopId => $credentials) { foreach ($this->_countries AS $country) { if (null !== $credentials[$country]['profileID'] && null !== $credentials[$country]['securityCode']) { - if ($this->getRatepayConfig($credentials[$country]['profileID'], $credentials[$country]['securityCode'], $shopId, $country)) { + if ($rpayConfigWriter->writeRatepayConfig($credentials[$country]['profileID'], $credentials[$country]['securityCode'], $shopId, $country)) { Shopware()->PluginLogger()->addNotice('Ruleset for ' . strtoupper($country) . ' successfully updated.'); } if ($country == 'de') { - if ($this->getRatepayConfig($credentials[$country]['profileID'] . '_0RT', $credentials[$country]['securityCode'], $shopId, $country)) { + if ($rpayConfigWriter->writeRatepayConfig($credentials[$country]['profileID'] . '_0RT', $credentials[$country]['securityCode'], $shopId, $country)) { Shopware()->PluginLogger()->addNotice('Ruleset 0RT for ' . strtoupper($country) . ' successfully updated.'); } } } if (null !== $credentials[$country]['profileIDBackend'] && null !== $credentials[$country]['securityCodeBackend']) { - if ($this->getRatepayConfig($credentials[$country]['profileIDBackend'], $credentials[$country]['securityCodeBackend'], $shopId, $country, true)) { + if ($rpayConfigWriter->writeRatepayConfig($credentials[$country]['profileIDBackend'], $credentials[$country]['securityCodeBackend'], $shopId, $country, true)) { Shopware()->PluginLogger()->addNotice('Ruleset BACKEND for ' . strtoupper($country) . ' successfully updated.'); } if ($country == 'de') { - if ($this->getRatepayConfig($credentials[$country]['profileIDBackend'] . '_0RT', $credentials[$country]['securityCodeBackend'], $shopId, $country, true)) { + if ($rpayConfigWriter->writeRatepayConfig($credentials[$country]['profileIDBackend'] . '_0RT', $credentials[$country]['securityCodeBackend'], $shopId, $country, true)) { Shopware()->PluginLogger()->addNotice('Ruleset BACKEND 0RT for ' . strtoupper($country) . ' successfully updated.'); } } @@ -105,162 +108,4 @@ public function beforeSavePluginConfig(\Enlight_Hook_HookArgs $arguments) } } } - - /** - * Truncate config tables - * - * @return bool - */ - private function _truncateConfigTables() - { - $configSql = 'TRUNCATE TABLE `rpay_ratepay_config`;'; - $configPaymentSql = 'TRUNCATE TABLE `rpay_ratepay_config_payment`;'; - $configInstallmentSql = 'TRUNCATE TABLE `rpay_ratepay_config_installment`;'; - try { - Shopware()->Db()->query($configSql); - Shopware()->Db()->query($configPaymentSql); - Shopware()->Db()->query($configInstallmentSql); - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->info($exception->getMessage()); - return false; - } - return true; - } - - /** - * Sends a Profile_request and saves the data into the Database - * - * @param string $profileId - * @param string $securityCode - * @param int $shopId - * @param string $country - * @param bool $backend - * - * @return mixed - * @throws exception - */ - private function getRatepayConfig($profileId, $securityCode, $shopId, $country, $backend = false) - { - $factory = new \Shopware_Plugins_Frontend_RpayRatePay_Component_Mapper_ModelFactory(null, $backend); - $data = array( - 'profileId' => $profileId, - 'securityCode' => $securityCode - ); - - $response = $factory->callRequest('ProfileRequest', $data); - - $payments = array('invoice', 'elv', 'installment'); - - if (is_array($response) && $response !== false) { - - foreach ($payments AS $payment) { - if (strstr($profileId, '_0RT') !== false) { - if ($payment !== 'installment') { - continue; - } - } - - $dataPayment = array( - $response['result']['merchantConfig']['activation-status-' . $payment], - $response['result']['merchantConfig']['b2b-' . $payment] == 'yes' ? 1 : 0, - $response['result']['merchantConfig']['tx-limit-' . $payment . '-min'], - $response['result']['merchantConfig']['tx-limit-' . $payment . '-max'], - $response['result']['merchantConfig']['tx-limit-' . $payment . '-max-b2b'], - $response['result']['merchantConfig']['delivery-address-' . $payment] == 'yes' ? 1 : 0, - ); - - $paymentSql = 'INSERT INTO `rpay_ratepay_config_payment`' - . '(`status`, `b2b`,`limit_min`,`limit_max`,' - . '`limit_max_b2b`, `address`)' - . 'VALUES(' . substr(str_repeat('?,', 6), 0, -1) . ');'; - try { - Shopware()->Db()->query($paymentSql, $dataPayment); - $id = Shopware()->Db()->fetchOne('SELECT `rpay_id` FROM `rpay_ratepay_config_payment` ORDER BY `rpay_id` DESC'); - $type[$payment] = $id; - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->error($exception->getMessage()); - return false; - } - } - - if ($response['result']['merchantConfig']['activation-status-installment'] == 2) { - $installmentConfig = array( - $type['installment'], - $response['result']['installmentConfig']['month-allowed'], - $response['result']['installmentConfig']['valid-payment-firstdays'], - $response['result']['installmentConfig']['rate-min-normal'], - $response['result']['installmentConfig']['interestrate-default'], - ); - $paymentSql = 'INSERT INTO `rpay_ratepay_config_installment`' - . '(`rpay_id`, `month-allowed`,`payment-firstday`,`interestrate-default`,' - . '`rate-min-normal`)' - . 'VALUES(' . substr(str_repeat('?,', 5), 0, -1) . ');'; - try { - Shopware()->Db()->query($paymentSql, $installmentConfig); - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->error($exception->getMessage()); - return false; - } - - } - - if (strstr($profileId, '_0RT') !== false) { - $qry = "UPDATE rpay_ratepay_config SET installment0 = '" . $type['installment'] . "' WHERE profileId = '" . substr($profileId, 0, -4) . "'"; - Shopware()->Db()->query($qry); - } else { - $data = array( - $response['result']['merchantConfig']['profile-id'], - $type['invoice'], - $type['installment'], - $type['elv'], - 0, - 0, - $response['result']['merchantConfig']['eligibility-device-fingerprint'] ? : 'no', - $response['result']['merchantConfig']['device-fingerprint-snippet-id'], - strtoupper($response['result']['merchantConfig']['country-code-billing']), - strtoupper($response['result']['merchantConfig']['country-code-delivery']), - strtoupper($response['result']['merchantConfig']['currency']), - strtoupper($country), - $response['sandbox'], - $backend, - //shopId always needs be the last line - $shopId - ); - - $activePayments[] = '"rpayratepayinvoice"'; - $activePayments[] = '"rpayratepaydebit"'; - $activePayments[] = '"rpayratepayrate"'; - $activePayments[] = '"rpayratepayrate0"'; - - if (count($activePayments) > 0) { - $updateSqlActivePaymentMethods = 'UPDATE `s_core_paymentmeans` SET `active` = 1 WHERE `name` in(' . implode(",", $activePayments) . ') AND `active` <> 0'; - } - $configSql = 'INSERT INTO `rpay_ratepay_config`' - . '(`profileId`, `invoice`, `installment`, `debit`, `installment0`, `installmentDebit`,' - . '`device-fingerprint-status`, `device-fingerprint-snippet-id`,' - . '`country-code-billing`, `country-code-delivery`,' - . '`currency`,`country`, `sandbox`,' - . '`backend`, `shopId`)' - . 'VALUES(' . substr(str_repeat('?,', 15), 0, -1) . ');'; // In case of altering cols change 14 by amount of affected cols - try { - Shopware()->Db()->query($configSql, $data); - if (count($activePayments) > 0) { - Shopware()->Db()->query($updateSqlActivePaymentMethods); - } - - return true; - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->error($exception->getMessage()); - - return false; - } - } - } else { - Shopware()->Pluginlogger()->error('RatePAY: Profile_Request failed!'); - - if (strstr($profileId, '_0RT') == false) { - throw new Exception('RatePAY: Profile_Request failed!'); - } - } - } } \ No newline at end of file diff --git a/Bootstrapping/ShopConfigSetup.php b/Bootstrapping/ShopConfigSetup.php index 069b860d..b4c8ea8b 100644 --- a/Bootstrapping/ShopConfigSetup.php +++ b/Bootstrapping/ShopConfigSetup.php @@ -7,41 +7,41 @@ */ namespace RpayRatePay\Bootstrapping; -use RpayRatePay\Bootstrapping\Bootstrapper; +use RpayRatePay\Component\Service\ConfigLoader; +use RpayRatePay\Component\Service\RatepayConfigWriter; class ShopConfigSetup extends Bootstrapper { - protected $availableCountries = array( - 'de', - 'at', - 'ch', - 'nl', - 'be' + public static $AVAILABLE_COUNTRIES = array( + 'DE', + 'AT', + 'CH', + 'NL', + 'BE' ); - /** - * @throws Exception - */ public function install() { - // + // do nothing } /** * @return mixed|void - * @throws Exception + * @throws \Exception */ public function update() { - $credentials = $this->loadShopCredentials(); + $configLoader = new ConfigLoader(Shopware()->Db()); + $configWriter = new RatepayConfigWriter(Shopware()->Db()); - if (!empty($credentials)) { - foreach ($credentials as $country => $shop) { - foreach ($shop['id'] as $item) { - $this->getRatepayConfig($shop['profile'], $shop['security'], $item['shop_id'], $country); - if ($country == 'de') { - $this->getRatepayConfig($shop['profile'] . '_0RT', $shop['security'], $item['shop_id'], $country); - } - } - } + $configWriter->truncateConfigTables(); + Shopware()->Pluginlogger()->info('ShopConfigSetup truncated tables'); + + $repo = Shopware()->Models()->getRepository('Shopware\Models\Shop\Shop'); + $shops = $repo->findBy(['active' => true]); + + /** @var \Shopware\Models\Shop\Shop $shop */ + foreach($shops as $shop) { + $this->updateRatepayConfig($configLoader, $configWriter, $shop->getId(), false); + $this->updateRatepayConfig($configLoader, $configWriter, $shop->getId(), true); } } @@ -50,161 +50,22 @@ public function update() { */ public function uninstall() {} - /** - * @return mixed - */ - public function loadShopCredentials() - { - $shopConfig = Shopware()->Plugins()->Frontend()->RpayRatePay()->Config(); - - return array_reduce($this->availableCountries, function ($shops, $country) use ($shopConfig) { - $profile = $shopConfig->get('RatePayProfileID' . strtoupper($country)); - $security = $shopConfig->get('RatePaySecurityCode' . strtoupper($country)); - - if (!empty($profile)) { - $id = Shopware()->Db() - ->query("SELECT `shop_id` FROM `s_core_config_values` WHERE `value` LIKE '%" . $profile . "%'"); - $shops[$country] = compact('profile', 'security', 'id'); - } - - return $shops; - }, []); - } - /** - * Sends a Profile_request and saves the data into the Database - * - * @param string $profileId - * @param string $securityCode - * @param int $shopId - * @param string $country - * - * @return mixed - * @throws exception - */ - private function getRatepayConfig($profileId, $securityCode, $shopId, $country) + public function updateRatepayConfig($configLoader, $configWriter, $shopId, $backend) { - $factory = new \Shopware_Plugins_Frontend_RpayRatePay_Component_Mapper_ModelFactory(); - $data = array( - 'profileId' => $profileId, - 'securityCode' => $securityCode - ); - - $response = $factory->callRequest('ProfileRequest', $data); + foreach (self::$AVAILABLE_COUNTRIES as $iso) { + $profileId = $configLoader->getProfileId($iso, $shopId, false, $backend); + $securityCode = $configLoader->getSecurityCode($iso, $shopId, $backend); - $payments = array('invoice', 'elv', 'installment'); - - if (is_array($response) && $response !== false) { - - foreach ($payments AS $payment) { - if (strstr($profileId, '_0RT') !== false) { - if ($payment !== 'installment') { - continue; - } - } - - $dataPayment = array( - $response['result']['merchantConfig']['activation-status-' . $payment], - $response['result']['merchantConfig']['b2b-' . $payment] == 'yes' ? 1 : 0, - $response['result']['merchantConfig']['tx-limit-' . $payment . '-min'], - $response['result']['merchantConfig']['tx-limit-' . $payment . '-max'], - $response['result']['merchantConfig']['tx-limit-' . $payment . '-max-b2b'], - $response['result']['merchantConfig']['delivery-address-' . $payment] == 'yes' ? 1 : 0, - ); - - $paymentSql = 'REPLACE INTO `rpay_ratepay_config_payment`' - . '(`status`, `b2b`,`limit_min`,`limit_max`, `limit_max_b2b`, `address`)' - . 'VALUES(' . substr(str_repeat('?,', 6), 0, -1) . ');'; - try { - Shopware()->Db()->query($paymentSql, $dataPayment); - $id = Shopware()->Db()->fetchOne('SELECT `rpay_id` FROM `rpay_ratepay_config_payment` ORDER BY `rpay_id` DESC'); - $type[$payment] = $id; - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->error($exception->getMessage()); - return false; - } - } - - if ($response['result']['merchantConfig']['activation-status-installment'] == 2) { - $installmentConfig = array( - $type['installment'], - $response['result']['installmentConfig']['month-allowed'], - $response['result']['installmentConfig']['valid-payment-firstdays'], - $response['result']['installmentConfig']['rate-min-normal'], - $response['result']['installmentConfig']['interestrate-default'], - ); - $paymentSql = 'REPLACE INTO `rpay_ratepay_config_installment`' - . '(`rpay_id`, `month-allowed`,`payment-firstday`,`interestrate-default`,' - . '`rate-min-normal`)' - . 'VALUES(' . substr(str_repeat('?,', 5), 0, -1) . ');'; - try { - Shopware()->Db()->query($paymentSql, $installmentConfig); - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->error($exception->getMessage()); - return false; - } - - } - - if (strstr($profileId, '_0RT') !== false) { - $qry = "UPDATE rpay_ratepay_config SET installment0 = '" . $type['installment'] . "' WHERE profileId = '" . substr($profileId, 0, -4) . "'"; - Shopware()->Db()->query($qry); - } else { - $data = array( - $response['result']['merchantConfig']['profile-id'], - $type['invoice'], - $type['installment'], - $type['elv'], - 0, - 0, - $response['result']['merchantConfig']['eligibility-device-fingerprint'] ? : 'no', - $response['result']['merchantConfig']['device-fingerprint-snippet-id'], - strtoupper($response['result']['merchantConfig']['country-code-billing']), - strtoupper($response['result']['merchantConfig']['country-code-delivery']), - strtoupper($response['result']['merchantConfig']['currency']), - strtoupper($country), - $response['sandbox'], - //shopId always needs be the last line - $shopId - ); - - $activePayments[] = '"rpayratepayinvoice"'; - $activePayments[] = '"rpayratepaydebit"'; - $activePayments[] = '"rpayratepayrate"'; - $activePayments[] = '"rpayratepayrate0"'; - - if (count($activePayments) > 0) { - $updateSqlActivePaymentMethods = 'UPDATE `s_core_paymentmeans` SET `active` = 1 WHERE `name` in(' . implode(",", $activePayments) . ') AND `active` <> 0'; - } - - - $configSql = 'REPLACE INTO `rpay_ratepay_config`' - . '(`profileId`, `invoice`, `installment`, `debit`, `installment0`, `installmentDebit`,' - . '`device-fingerprint-status`, `device-fingerprint-snippet-id`,' - . '`country-code-billing`, `country-code-delivery`,' - . '`currency`,`country`, `sandbox`,' - . ' `shopId`)' - . 'VALUES(' . substr(str_repeat('?,', 14), 0, -1) . ');'; // In case of altering cols change 14 by amount of affected cols - try { - Shopware()->Db()->query($configSql, $data); - if (count($activePayments) > 0) { - Shopware()->Db()->query($updateSqlActivePaymentMethods); - } - - return true; - } catch (\Exception $exception) { - Shopware()->Pluginlogger()->error($exception->getMessage()); - - return false; - } + if(empty($profileId)) { + continue; } + $configWriter->writeRatepayConfig($profileId, $securityCode, $shopId, $iso, $backend); - } else { - Shopware()->Pluginlogger()->error('RatePAY: Profile_Request failed!'); - - if (strstr($profileId, '_0RT') == false) { - throw new Exception('RatePAY: Profile_Request failed!'); + if ($iso == 'DE') { + $profileIdZeroPercent = $configLoader->getProfileId($iso, $shopId, true, $backend); + $configWriter->writeRatepayConfig($profileIdZeroPercent, $securityCode, $shopId, $iso, $backend); } } } diff --git a/Component/Service/ConfigLoader.php b/Component/Service/ConfigLoader.php index 6dc590fa..4bc7d2e6 100644 --- a/Component/Service/ConfigLoader.php +++ b/Component/Service/ConfigLoader.php @@ -96,6 +96,21 @@ public function getProfileId($countryISO, $shopId, $zeroPercent = false, $backen return $profileId; } + /** + * @param string $countryISO + * @param int $shopId + * @param bool $backend + * @return string + */ + public function getSecurityCode($countryISO, $shopId, $backend = false) + { + $key = self::getSecurityCodeKey($countryISO, $backend); + + $securityCode = $this->config->get($key, $shopId); + + return $securityCode; + } + /** * @param string $countryISO * @param bool $backend diff --git a/Component/Service/RatepayConfigWriter.php b/Component/Service/RatepayConfigWriter.php new file mode 100644 index 00000000..48b2f784 --- /dev/null +++ b/Component/Service/RatepayConfigWriter.php @@ -0,0 +1,170 @@ +db = $db; + } + + /** + * @return bool + */ + public function truncateConfigTables() + { + $configSql = 'TRUNCATE TABLE `rpay_ratepay_config`;'; + $configPaymentSql = 'TRUNCATE TABLE `rpay_ratepay_config_payment`;'; + $configInstallmentSql = 'TRUNCATE TABLE `rpay_ratepay_config_installment`;'; + try { + $this->db->query($configSql); + $this->db->query($configPaymentSql); + $this->db->query($configInstallmentSql); + } catch (\Exception $exception) { + Shopware()->Pluginlogger()->info($exception->getMessage()); + return false; + } + return true; + } + + + /** + * Sends a Profile_request and saves the data into the Database + * + * @param string $profileId + * @param string $securityCode + * @param int $shopId + * @param string $country + * @param bool $backend + * + * @return mixed + * @throws exception + */ + public function writeRatepayConfig($profileId, $securityCode, $shopId, $country, $backend = false) + { + $factory = new \Shopware_Plugins_Frontend_RpayRatePay_Component_Mapper_ModelFactory(null, $backend); + $data = array( + 'profileId' => $profileId, + 'securityCode' => $securityCode + ); + + $response = $factory->callRequest('ProfileRequest', $data); + + $payments = array('invoice', 'elv', 'installment'); + + if (is_array($response) && $response !== false) { + + foreach ($payments AS $payment) { + if (strstr($profileId, '_0RT') !== false) { + if ($payment !== 'installment') { + continue; + } + } + + $dataPayment = array( + $response['result']['merchantConfig']['activation-status-' . $payment], + $response['result']['merchantConfig']['b2b-' . $payment] == 'yes' ? 1 : 0, + $response['result']['merchantConfig']['tx-limit-' . $payment . '-min'], + $response['result']['merchantConfig']['tx-limit-' . $payment . '-max'], + $response['result']['merchantConfig']['tx-limit-' . $payment . '-max-b2b'], + $response['result']['merchantConfig']['delivery-address-' . $payment] == 'yes' ? 1 : 0, + ); + + $paymentSql = 'INSERT INTO `rpay_ratepay_config_payment`' + . '(`status`, `b2b`,`limit_min`,`limit_max`,' + . '`limit_max_b2b`, `address`)' + . 'VALUES(' . substr(str_repeat('?,', 6), 0, -1) . ');'; + try { + $this->db->query($paymentSql, $dataPayment); + $id = $this->db->fetchOne('SELECT `rpay_id` FROM `rpay_ratepay_config_payment` ORDER BY `rpay_id` DESC'); + $type[$payment] = $id; + } catch (\Exception $exception) { + Shopware()->Pluginlogger()->error($exception->getMessage()); + return false; + } + } + + if ($response['result']['merchantConfig']['activation-status-installment'] == 2) { + $installmentConfig = array( + $type['installment'], + $response['result']['installmentConfig']['month-allowed'], + $response['result']['installmentConfig']['valid-payment-firstdays'], + $response['result']['installmentConfig']['rate-min-normal'], + $response['result']['installmentConfig']['interestrate-default'], + ); + $paymentSql = 'INSERT INTO `rpay_ratepay_config_installment`' + . '(`rpay_id`, `month-allowed`,`payment-firstday`,`interestrate-default`,' + . '`rate-min-normal`)' + . 'VALUES(' . substr(str_repeat('?,', 5), 0, -1) . ');'; + try { + $this->db->query($paymentSql, $installmentConfig); + } catch (\Exception $exception) { + Shopware()->Pluginlogger()->error($exception->getMessage()); + return false; + } + + } + + if (strstr($profileId, '_0RT') !== false) { + $qry = "UPDATE rpay_ratepay_config SET installment0 = '" . $type['installment'] . "' WHERE profileId = '" . substr($profileId, 0, -4) . "'"; + $this->db->query($qry); + } else { + $data = array( + $response['result']['merchantConfig']['profile-id'], + $type['invoice'], + $type['installment'], + $type['elv'], + 0, + 0, + $response['result']['merchantConfig']['eligibility-device-fingerprint'] ?: 'no', + $response['result']['merchantConfig']['device-fingerprint-snippet-id'], + strtoupper($response['result']['merchantConfig']['country-code-billing']), + strtoupper($response['result']['merchantConfig']['country-code-delivery']), + strtoupper($response['result']['merchantConfig']['currency']), + strtoupper($country), + $response['sandbox'], + $backend, + //shopId always needs be the last line + $shopId + ); + + $activePayments[] = '"rpayratepayinvoice"'; + $activePayments[] = '"rpayratepaydebit"'; + $activePayments[] = '"rpayratepayrate"'; + $activePayments[] = '"rpayratepayrate0"'; + + if (count($activePayments) > 0) { + $updateSqlActivePaymentMethods = 'UPDATE `s_core_paymentmeans` SET `active` = 1 WHERE `name` in(' . implode(",", $activePayments) . ') AND `active` <> 0'; + } + $configSql = 'INSERT INTO `rpay_ratepay_config`' + . '(`profileId`, `invoice`, `installment`, `debit`, `installment0`, `installmentDebit`,' + . '`device-fingerprint-status`, `device-fingerprint-snippet-id`,' + . '`country-code-billing`, `country-code-delivery`,' + . '`currency`,`country`, `sandbox`,' + . '`backend`, `shopId`)' + . 'VALUES(' . substr(str_repeat('?,', 15), 0, -1) . ');'; // In case of altering cols change 14 by amount of affected cols + try { + $this->db->query($configSql, $data); + if (count($activePayments) > 0) { + $this->db->query($updateSqlActivePaymentMethods); + } + + return true; + } catch (\Exception $exception) { + Shopware()->Pluginlogger()->error($exception->getMessage()); + + return false; + } + } + } else { + Shopware()->Pluginlogger()->error('RatePAY: Profile_Request failed!'); + + if (strstr($profileId, '_0RT') == false) { + throw new Exception('RatePAY: Profile_Request failed!'); + } + } + } +} \ No newline at end of file diff --git a/plugin.json b/plugin.json index d4dc3203..e7f1688c 100644 --- a/plugin.json +++ b/plugin.json @@ -11,7 +11,7 @@ "supplier": "RatePAY GmbH", "description": "

RatePAY Payment plugin for Shopware Community Edition Version 5

", - "currentVersion": "5.2.2", + "currentVersion": "5.2.3", "payment_confirm": true, "compatibility": {