From 6facc5bb8389e76561ef68a34581f6fa1b91ff69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 20 Jan 2023 17:19:39 +0100 Subject: [PATCH 01/21] Fixed a problem with loading the Ratepay device fingerprint javascript --- Block/RatepayDeviceFingerprint.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Block/RatepayDeviceFingerprint.php b/Block/RatepayDeviceFingerprint.php index a5132181..821434c1 100644 --- a/Block/RatepayDeviceFingerprint.php +++ b/Block/RatepayDeviceFingerprint.php @@ -87,9 +87,9 @@ public function getDevicefingerprintToken() */ protected function isRatepayMethodActive() { - if ($this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INVOICE) === false || - $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_DEBIT) === false || - $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INSTALLMENT) === false + if ($this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INVOICE) === true || + $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_DEBIT) === true || + $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INSTALLMENT) === true ) { return true; } From f00cb2015b7f60d0525af9a3b1547a55dc5c44c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 26 Jan 2023 15:23:02 +0100 Subject: [PATCH 02/21] MAG2-275 - Added interpretation of some Ratepay profile config options --- .../Form/Field/RefreshRatepayProfiles.php | 16 ++- Block/RatepayDeviceFingerprint.php | 6 +- Helper/Ratepay.php | 96 +++++++++++++++++- Model/ConfigProvider.php | 57 +++++++++-- Model/Methods/Ratepay/Installment.php | 7 +- Model/Methods/Ratepay/RatepayBase.php | 29 ++---- Model/PayoneConfig.php | 6 ++ Model/ResourceModel/RatepayProfileConfig.php | 98 +++++++++---------- .../Model/Methods/Ratepay/InstallmentTest.php | 6 +- .../Model/Methods/Ratepay/InvoiceTest.php | 3 +- etc/csp_whitelist.xml | 1 + i18n/de_DE.csv | 2 +- .../form/field/refresh_ratepay_profiles.phtml | 8 +- .../payment/method-renderer/ratepay_base.js | 32 +++++- .../method-renderer/ratepay_debit-method.js | 6 +- .../ratepay_installment-method.js | 15 ++- .../method-renderer/ratepay_invoice-method.js | 6 +- .../web/template/payment/bnpl_debit.html | 2 +- .../template/payment/bnpl_installment.html | 2 +- .../web/template/payment/bnpl_invoice.html | 2 +- .../web/template/payment/ratepay_debit.html | 24 ++++- .../template/payment/ratepay_installment.html | 24 ++++- .../web/template/payment/ratepay_invoice.html | 24 ++++- 23 files changed, 353 insertions(+), 119 deletions(-) diff --git a/Block/Adminhtml/Config/Form/Field/RefreshRatepayProfiles.php b/Block/Adminhtml/Config/Form/Field/RefreshRatepayProfiles.php index b0b07710..64ab6561 100644 --- a/Block/Adminhtml/Config/Form/Field/RefreshRatepayProfiles.php +++ b/Block/Adminhtml/Config/Form/Field/RefreshRatepayProfiles.php @@ -45,6 +45,19 @@ protected function _prepareLayout() return $this; } + /** + * Generates unique javascript function name for each payment method + * + * @param string $sPaymentMethod + * @return string + */ + protected function getJSFunctionName($sPaymentMethod) + { + $sPaymentMethod = ucwords($sPaymentMethod, "_"); + $sPaymentMethod = str_replace("_", "", $sPaymentMethod); + return "updateProfileConfigs".$sPaymentMethod; + } + /** * Unset some non-related element parameters * @@ -69,7 +82,8 @@ protected function _getElementHtml(\Magento\Framework\Data\Form\Element\Abstract $sPaymentMethod = str_replace('payone_payment/', '', $originalData['path']); $this->addData([ - 'ajax_url' => $this->_urlBuilder->getUrl('payone/config_ratepay/refresh', ['method' => $sPaymentMethod]) + 'ajax_url' => $this->_urlBuilder->getUrl('payone/config_ratepay/refresh', ['method' => $sPaymentMethod]), + 'javascript_function_name' => $this->getJSFunctionName($sPaymentMethod), ]); return $this->_toHtml(); diff --git a/Block/RatepayDeviceFingerprint.php b/Block/RatepayDeviceFingerprint.php index a5132181..821434c1 100644 --- a/Block/RatepayDeviceFingerprint.php +++ b/Block/RatepayDeviceFingerprint.php @@ -87,9 +87,9 @@ public function getDevicefingerprintToken() */ protected function isRatepayMethodActive() { - if ($this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INVOICE) === false || - $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_DEBIT) === false || - $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INSTALLMENT) === false + if ($this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INVOICE) === true || + $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_DEBIT) === true || + $this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INSTALLMENT) === true ) { return true; } diff --git a/Helper/Ratepay.php b/Helper/Ratepay.php index 47c7f5e8..977db4f5 100644 --- a/Helper/Ratepay.php +++ b/Helper/Ratepay.php @@ -26,11 +26,24 @@ namespace Payone\Core\Helper; +use Payone\Core\Model\PayoneConfig; + /** * Helper class for ratepay payment */ class Ratepay extends \Payone\Core\Helper\Base { + /** + * Map for methodCode to short payment method identifier for database columns + * + * @var array + */ + protected $aMethodIdentifierMap = [ + PayoneConfig::METHOD_RATEPAY_INVOICE => 'invoice', + PayoneConfig::METHOD_RATEPAY_DEBIT => 'elv', + PayoneConfig::METHOD_RATEPAY_INSTALLMENT => 'installment', + ]; + /** * Object of profile request * @@ -221,6 +234,20 @@ public function getRatepayDeviceFingerprintToken() return $sTokenFromSession; } + /** + * Returns ratepay method identifier + * + * @param string $sMethodCode + * @return string|false + */ + protected function getRatepayMethodIdentifierByMethodCode($sMethodCode) + { + if (isset($this->aMethodIdentifierMap[$sMethodCode])) { + return $this->aMethodIdentifierMap[$sMethodCode]; + } + return false; + } + /** * Get matching Ratepay shop id for current transaction * @@ -228,14 +255,75 @@ public function getRatepayDeviceFingerprintToken() * @param string $sCountryCode * @param string $sCurrency * @param double $dGrandTotal - * @return string + * @param bool $blGetConfigWithoutTotals + * @return string|false */ - public function getRatepayShopId($sMethodCode, $sCountryCode, $sCurrency, $dGrandTotal) + public function getRatepayShopId($sMethodCode, $sCountryCode, $sCurrency, $dGrandTotal, $blGetConfigWithoutTotals = false) { + $sRatepayMethodIdentifier = $this->getRatepayMethodIdentifierByMethodCode($sMethodCode); + $aShopIds = $this->getRatepayShopConfigIdsByPaymentMethod($sMethodCode); - $sShopId = $this->profileResource->getMatchingShopId($sMethodCode, $aShopIds, $sCountryCode, $sCurrency, $dGrandTotal); + return $this->profileResource->getMatchingShopId($sRatepayMethodIdentifier, $aShopIds, $sCountryCode, $sCurrency, $dGrandTotal, $blGetConfigWithoutTotals); + } + + /** + * Returns matching Ratepay shop id by given quote + * + * @param string $sMethodCode + * @param \Magento\Quote\Api\Data\CartInterface $quote + * @param bool $blGetConfigWithoutTotals + * @return string + * @throws \Magento\Framework\Exception\LocalizedException + */ + public function getShopIdByQuote($sMethodCode, \Magento\Quote\Api\Data\CartInterface $quote, $blGetConfigWithoutTotals = false) + { + $sCountryCode = $quote->getShippingAddress()->getCountryId(); + if (empty($sCountryCode)) { + $sCountryCode = $quote->getBillingAddress()->getCountryId(); + } + $sCurrency = $this->apiHelper->getCurrencyFromQuote($quote); + $dGrandTotal = $this->apiHelper->getQuoteAmount($quote); + + return $this->getRatepayShopId($sMethodCode, $sCountryCode, $sCurrency, $dGrandTotal, $blGetConfigWithoutTotals); + } + + /** + * Returns matching Ratepay shop config by quote + * + * @param string $sMethodCode + * @param \Magento\Quote\Api\Data\CartInterface|null $quote + * @param bool $blGetConfigWithoutTotals + * @return array + */ + public function getShopConfigByQuote($sMethodCode, \Magento\Quote\Api\Data\CartInterface $quote = null, $blGetConfigWithoutTotals = false) + { + if ($quote === null) { + $quote = $this->checkoutSession->getQuote(); + } - return $sShopId; + $sShopId = $this->getShopIdByQuote($sMethodCode, $quote, $blGetConfigWithoutTotals); + if (empty($sShopId)) { + return []; + } + return $this->getRatepayShopConfigById($sShopId); + } + + /** + * Returns a certain property from the given shop config array + * + * @param array $aShopConfig + * @param string $sMethodCode + * @param string $sProperty + * @return string|false + */ + public function getShopConfigProperty($aShopConfig, $sMethodCode, $sProperty) + { + $sRatepayMethodIdentifier = $this->getRatepayMethodIdentifierByMethodCode($sMethodCode); + + if (isset($aShopConfig[$sProperty.'_'.$sRatepayMethodIdentifier])) { + return $aShopConfig[$sProperty.'_'.$sRatepayMethodIdentifier]; + } + return false; } /** diff --git a/Model/ConfigProvider.php b/Model/ConfigProvider.php index 26ddaabc..1ee38a43 100644 --- a/Model/ConfigProvider.php +++ b/Model/ConfigProvider.php @@ -140,6 +140,13 @@ class ConfigProvider extends \Magento\Payment\Model\CcGenericConfigProvider */ protected $toolkitHelper; + /** + * PAYONE ratepay helper + * + * @var \Payone\Core\Helper\Ratepay + */ + protected $ratepayHelper; + /** * Constructor * @@ -159,6 +166,7 @@ class ConfigProvider extends \Magento\Payment\Model\CcGenericConfigProvider * @param \Payone\Core\Model\ResourceModel\SavedPaymentData $savedPaymentData * @param \Payone\Core\Model\Methods\Ratepay\Installment\Proxy $ratepayInstallment * @param \Payone\Core\Helper\Toolkit $toolkitHelper + * @param \Payone\Core\Helper\Ratepay $ratepayHelper */ public function __construct( \Magento\Payment\Model\CcConfig $ccConfig, @@ -176,7 +184,8 @@ public function __construct( \Payone\Core\Helper\Shop $shopHelper, \Payone\Core\Model\ResourceModel\SavedPaymentData $savedPaymentData, \Payone\Core\Model\Methods\Ratepay\Installment\Proxy $ratepayInstallment, - \Payone\Core\Helper\Toolkit $toolkitHelper + \Payone\Core\Helper\Toolkit $toolkitHelper, + \Payone\Core\Helper\Ratepay $ratepayHelper ) { parent::__construct($ccConfig, $dataHelper); $this->dataHelper = $dataHelper; @@ -194,6 +203,7 @@ public function __construct( $this->savedPaymentData = $savedPaymentData; $this->ratepayInstallment = $ratepayInstallment; $this->toolkitHelper = $toolkitHelper; + $this->ratepayHelper = $ratepayHelper; } /** @@ -278,7 +288,7 @@ protected function getPayoneConfig() 'currency' => $this->requestHelper->getConfigParam('currency'), 'klarnaTitles' => $this->paymentHelper->getKlarnaMethodTitles(), 'storeName' => $this->shopHelper->getStoreName(), - 'ratepayAllowedMonths' => $this->getRatepayAllowedMonths(), + 'ratepay' => $this->getRatepayConfig(), 'bnpl' => $this->getBNPLConfig(), ]; } @@ -330,12 +340,47 @@ protected function isPaydirektOneKlickDisplayable() return false; } - protected function getRatepayAllowedMonths() + /** + * Return Ratepay configuration for given method code + * + * @param string $sRatepayMethodCode + * @return array|bool[] + */ + protected function getRatepaySingleConfig($sRatepayMethodCode) { - if ($this->paymentHelper->isPaymentMethodActive(PayoneConfig::METHOD_RATEPAY_INSTALLMENT) === true) { - return $this->ratepayInstallment->getAllowedMonths(); + $aShopConfig = $this->ratepayHelper->getShopConfigByQuote($sRatepayMethodCode); + if (empty($aShopConfig)) { + $aShopConfig = $this->ratepayHelper->getShopConfigByQuote($sRatepayMethodCode, null, true); + if (empty($aShopConfig)) { + return []; + } + } + + return [ + 'b2bAllowed' => (bool)$this->ratepayHelper->getShopConfigProperty($aShopConfig, $sRatepayMethodCode, 'b2b'), + 'differentAddressAllowed' => (bool)$this->ratepayHelper->getShopConfigProperty($aShopConfig, $sRatepayMethodCode, 'delivery_address'), + ]; + } + + /** + * Return ratepay config for all ratepay payment methods + * + * @return array + */ + protected function getRatepayConfig() + { + $aReturn = []; + + foreach (PayoneConfig::METHODS_RATEPAY as $sRatepayMethod) { + if ($this->paymentHelper->isPaymentMethodActive($sRatepayMethod) === true) { + $aReturn[$sRatepayMethod] = $this->getRatepaySingleConfig($sRatepayMethod); + } + } + + if (isset($aReturn[PayoneConfig::METHOD_RATEPAY_INSTALLMENT])) { + $aReturn[PayoneConfig::METHOD_RATEPAY_INSTALLMENT]['allowedMonths'] = $this->ratepayInstallment->getAllowedMonths(); } - return []; + return $aReturn; } /** diff --git a/Model/Methods/Ratepay/Installment.php b/Model/Methods/Ratepay/Installment.php index b2c13715..3c5f48bd 100644 --- a/Model/Methods/Ratepay/Installment.php +++ b/Model/Methods/Ratepay/Installment.php @@ -144,12 +144,7 @@ public function getAllowedMonths(\Magento\Quote\Api\Data\CartInterface $quote = $quote = $this->checkoutSession->getQuote(); } - $sShopId = $this->getShopIdByQuote($quote); - if (empty($sShopId)) { - return []; - } - - $aConfig = $this->ratepayHelper->getRatepayShopConfigById($sShopId); + $aConfig = $this->ratepayHelper->getShopConfigByQuote($this->getCode(), $quote); if (!$aConfig) { return []; } diff --git a/Model/Methods/Ratepay/RatepayBase.php b/Model/Methods/Ratepay/RatepayBase.php index 09ee3605..71977caf 100644 --- a/Model/Methods/Ratepay/RatepayBase.php +++ b/Model/Methods/Ratepay/RatepayBase.php @@ -93,7 +93,8 @@ class RatepayBase extends PayoneMethod 'telephone', 'dateofbirth', 'iban', - 'bic' + 'bic', + 'company_uid', ]; /** @@ -195,6 +196,11 @@ public function getPaymentSpecificParameters(Order $oOrder) 'add_paydata[shop_id]' => $this->getShopIdByOrder($oOrder), ]; + $sCompanyUid = $this->getInfoInstance()->getAdditionalInformation('company_uid'); + if (!empty($sCompanyUid)) { + $aBaseParams['add_paydata[vat_id]'] = $sCompanyUid; + } + $sBirthday = $this->getInfoInstance()->getAdditionalInformation('dateofbirth'); if ($sBirthday) { $aBaseParams['birthday'] = $sBirthday; @@ -210,25 +216,6 @@ public function getPaymentSpecificParameters(Order $oOrder) return $aParams; } - /** - * Returns matching Ratepay shop id by given quote - * - * @param \Magento\Quote\Api\Data\CartInterface $quote - * @return string - * @throws \Magento\Framework\Exception\LocalizedException - */ - protected function getShopIdByQuote(\Magento\Quote\Api\Data\CartInterface $quote) - { - $sCountryCode = $quote->getShippingAddress()->getCountryId(); - if (empty($sCountryCode)) { - $sCountryCode = $quote->getBillingAddress()->getCountryId(); - } - $sCurrency = $this->apiHelper->getCurrencyFromQuote($quote); - $dGrandTotal = $this->apiHelper->getQuoteAmount($quote); - - return $this->ratepayHelper->getRatepayShopId($this->getCode(), $sCountryCode, $sCurrency, $dGrandTotal); - } - /** * Returns matching Ratepay shop id by given quote * @@ -262,7 +249,7 @@ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) $quote = $this->checkoutSession->getQuote(); } - if ($this->getShopIdByQuote($quote) === false) { + if ($this->ratepayHelper->getShopIdByQuote($this->getCode(), $quote) === false) { return false; } diff --git a/Model/PayoneConfig.php b/Model/PayoneConfig.php index 7b635426..becd3aa5 100644 --- a/Model/PayoneConfig.php +++ b/Model/PayoneConfig.php @@ -105,4 +105,10 @@ abstract class PayoneConfig const METHOD_GROUP_KLARNA = 'payone_klarna'; const METHOD_GROUP_RATEPAY = 'payone_ratepay'; const METHOD_GROUP_BNPL = 'payone_bnpl'; + + const METHODS_RATEPAY = [ + self::METHOD_RATEPAY_INVOICE, + self::METHOD_RATEPAY_DEBIT, + self::METHOD_RATEPAY_INSTALLMENT, + ]; } diff --git a/Model/ResourceModel/RatepayProfileConfig.php b/Model/ResourceModel/RatepayProfileConfig.php index d4487fb3..e982b703 100644 --- a/Model/ResourceModel/RatepayProfileConfig.php +++ b/Model/ResourceModel/RatepayProfileConfig.php @@ -33,17 +33,6 @@ */ class RatepayProfileConfig extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { - /** - * Map for methodCode to short payment method identifier for database columns - * - * @var array - */ - protected $aMethodIdentifierMap = [ - PayoneConfig::METHOD_RATEPAY_INVOICE => 'invoice', - PayoneConfig::METHOD_RATEPAY_DEBIT => 'elv', - PayoneConfig::METHOD_RATEPAY_INSTALLMENT => 'installment', - ]; - /** * Initialize connection and table * @@ -99,6 +88,24 @@ public function profileExists($sShopId) return false; } + /** + * Convert strange Ratepay yes/no values to int-style bool values for the database + * + * @param string $sValue + * @return int + */ + protected function convertYesNoToBool($sValue) + { + if (strtolower($sValue) == "yes") { + return 1; + } + + if (strtolower($sValue) == "no") { + return 0; + } + return $sValue; + } + /** * Fills data array for insert and update queries * @@ -120,28 +127,28 @@ protected function getDataArray($aProfileResponse) 'activation_status_invoice' => $aProfileResponse['add_paydata[activation-status-invoice]'], 'activation_status_prepayment' => $aProfileResponse['add_paydata[activation-status-prepayment]'], 'amount_min_longrun' => $aProfileResponse['add_paydata[amount-min-longrun]'], - 'b2b_pq_full' => $aProfileResponse['add_paydata[b2b-PQ-full]'], - 'b2b_pq_light' => isset($aProfileResponse['add_paydata[b2b-PQ-light]']) ? $aProfileResponse['add_paydata[b2b-PQ-light]'] : '', - 'b2b_elv' => $aProfileResponse['add_paydata[b2b-elv]'], - 'b2b_installment' => $aProfileResponse['add_paydata[b2b-installment]'], - 'b2b_invoice' => $aProfileResponse['add_paydata[b2b-invoice]'], - 'b2b_prepayment' => $aProfileResponse['add_paydata[b2b-prepayment]'], + 'b2b_pq_full' => $this->convertYesNoToBool($aProfileResponse['add_paydata[b2b-PQ-full]']), + 'b2b_pq_light' => isset($aProfileResponse['add_paydata[b2b-PQ-light]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[b2b-PQ-light]']) : 0, + 'b2b_elv' => $this->convertYesNoToBool($aProfileResponse['add_paydata[b2b-elv]']), + 'b2b_installment' => $this->convertYesNoToBool($aProfileResponse['add_paydata[b2b-installment]']), + 'b2b_invoice' => $this->convertYesNoToBool($aProfileResponse['add_paydata[b2b-invoice]']), + 'b2b_prepayment' => $this->convertYesNoToBool($aProfileResponse['add_paydata[b2b-prepayment]']), 'country_code_billing' => $aProfileResponse['add_paydata[country-code-billing]'], 'country_code_delivery' => $aProfileResponse['add_paydata[country-code-delivery]'], - 'delivery_address_pq_full' => $aProfileResponse['add_paydata[delivery-address-PQ-full]'], - 'delivery_address_pq_light' => isset($aProfileResponse['add_paydata[delivery-address-PQ-light]']) ? $aProfileResponse['add_paydata[delivery-address-PQ-light]'] : '', - 'delivery_address_elv' => $aProfileResponse['add_paydata[delivery-address-elv]'], - 'delivery_address_installment' => $aProfileResponse['add_paydata[delivery-address-installment]'], - 'delivery_address_invoice' => $aProfileResponse['add_paydata[delivery-address-invoice]'], - 'delivery_address_prepayment' => $aProfileResponse['add_paydata[delivery-address-prepayment]'], + 'delivery_address_pq_full' => $this->convertYesNoToBool($aProfileResponse['add_paydata[delivery-address-PQ-full]']), + 'delivery_address_pq_light' => isset($aProfileResponse['add_paydata[delivery-address-PQ-light]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[delivery-address-PQ-light]']) : 0, + 'delivery_address_elv' => $this->convertYesNoToBool($aProfileResponse['add_paydata[delivery-address-elv]']), + 'delivery_address_installment' => $this->convertYesNoToBool($aProfileResponse['add_paydata[delivery-address-installment]']), + 'delivery_address_invoice' => $this->convertYesNoToBool($aProfileResponse['add_paydata[delivery-address-invoice]']), + 'delivery_address_prepayment' => $this->convertYesNoToBool($aProfileResponse['add_paydata[delivery-address-prepayment]']), 'device_fingerprint_snippet_id' => isset($aProfileResponse['add_paydata[device-fingerprint-snippet-id]']) ? $aProfileResponse['add_paydata[device-fingerprint-snippet-id]'] : NULL, 'eligibility_device_fingerprint' => isset($aProfileResponse['add_paydata[eligibility-device-fingerprint]']) ? $aProfileResponse['add_paydata[eligibility-device-fingerprint]'] : NULL, - 'eligibility_ratepay_elv' => isset($aProfileResponse['add_paydata[eligibility-ratepay-elv]']) ? $aProfileResponse['add_paydata[eligibility-ratepay-elv]'] : 'no', - 'eligibility_ratepay_installment' => isset($aProfileResponse['add_paydata[eligibility-ratepay-installment]']) ? $aProfileResponse['add_paydata[eligibility-ratepay-installment]'] : 'no', - 'eligibility_ratepay_invoice' => isset($aProfileResponse['add_paydata[eligibility-ratepay-invoice]']) ? $aProfileResponse['add_paydata[eligibility-ratepay-invoice]'] : 'no', - 'eligibility_ratepay_pq_full' => isset($aProfileResponse['add_paydata[eligibility-ratepay-pq-full]']) ? $aProfileResponse['add_paydata[eligibility-ratepay-pq-full]'] : 'no', - 'eligibility_ratepay_pq_light' => isset($aProfileResponse['add_paydata[eligibility-ratepay-pq-light]']) ? $aProfileResponse['add_paydata[eligibility-ratepay-pq-light]'] : 'no', - 'eligibility_ratepay_prepayment' => $aProfileResponse['add_paydata[eligibility-ratepay-prepayment]'], + 'eligibility_ratepay_elv' => isset($aProfileResponse['add_paydata[eligibility-ratepay-elv]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[eligibility-ratepay-elv]']) : 0, + 'eligibility_ratepay_installment' => isset($aProfileResponse['add_paydata[eligibility-ratepay-installment]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[eligibility-ratepay-installment]']) : 0, + 'eligibility_ratepay_invoice' => isset($aProfileResponse['add_paydata[eligibility-ratepay-invoice]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[eligibility-ratepay-invoice]']) : 0, + 'eligibility_ratepay_pq_full' => isset($aProfileResponse['add_paydata[eligibility-ratepay-pq-full]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[eligibility-ratepay-pq-full]']) : 0, + 'eligibility_ratepay_pq_light' => isset($aProfileResponse['add_paydata[eligibility-ratepay-pq-light]']) ? $this->convertYesNoToBool($aProfileResponse['add_paydata[eligibility-ratepay-pq-light]']) : 0, + 'eligibility_ratepay_prepayment' => $this->convertYesNoToBool($aProfileResponse['add_paydata[eligibility-ratepay-prepayment]']), 'interest_rate_merchant_towards_bank' => $aProfileResponse['add_paydata[interest-rate-merchant-towards-bank]'], 'interestrate_default' => $aProfileResponse['add_paydata[interestrate-default]'], 'interestrate_max' => $aProfileResponse['add_paydata[interestrate-max]'], @@ -198,20 +205,6 @@ public function insertProfileConfig($sShopId, $aProfileResponse) $this->getConnection()->insert($this->getMainTable(), $data); } - /** - * Returns ratepay method identifier - * - * @param string $sMethodCode - * @return string|false - */ - protected function getRatepayMethodIdentifierByMethodCode($sMethodCode) - { - if (isset($this->aMethodIdentifierMap[$sMethodCode])) { - return $this->aMethodIdentifierMap[$sMethodCode]; - } - return false; - } - /** * Get matching shop id for current quote parameters * @@ -220,28 +213,33 @@ protected function getRatepayMethodIdentifierByMethodCode($sMethodCode) * @param string $sCountryCode * @param string $sCurrency * @param double $dGrandTotal - * @return string|bool + * @param bool $blGetConfigWithoutTotals + * @return string|false */ - public function getMatchingShopId($sMethodCode, $aShopIds, $sCountryCode, $sCurrency, $dGrandTotal) + public function getMatchingShopId($sRatepayMethodIdentifier, $aShopIds, $sCountryCode, $sCurrency, $dGrandTotal, $blGetConfigWithoutTotals = false) { - $sRatepayMethodIdentifier = $this->getRatepayMethodIdentifierByMethodCode($sMethodCode); - $oSelect = $this->getConnection()->select() ->from($this->getMainTable(), ['shop_id']) ->where("shop_id IN ('".implode("','", $aShopIds)."')") - ->where("tx_limit_".$sRatepayMethodIdentifier."_min <= :grandTotal") - ->where("tx_limit_".$sRatepayMethodIdentifier."_max >= :grandTotal") ->where("country_code_billing = :countryCode") ->where("currency = :currency") ->order('shop_id ASC') ->limit(1); $aParams = [ - 'grandTotal' => $dGrandTotal, 'countryCode' => $sCountryCode, 'currency' => $sCurrency, ]; + // $blGetConfigWithoutTotals = true mode is used to get a configuration without the totals being concidered. + // This is needed in checkout when basket total is a little unter the min_limit but with shipping costs it's over the limit + // CheckoutConfig javascript array is generated before shipping costs are added, but available payment methods are determined after shipping costs were added + if ($blGetConfigWithoutTotals === false) { + $oSelect = $oSelect->where("tx_limit_".$sRatepayMethodIdentifier."_min <= :grandTotal") + ->where("tx_limit_".$sRatepayMethodIdentifier."_max >= :grandTotal"); + $aParams['grandTotal'] = $dGrandTotal; + } + $sShopId = $this->getConnection()->fetchOne($oSelect, $aParams); if (empty($sShopId)) { return false; diff --git a/Test/Unit/Model/Methods/Ratepay/InstallmentTest.php b/Test/Unit/Model/Methods/Ratepay/InstallmentTest.php index 23d7a48d..01b63693 100644 --- a/Test/Unit/Model/Methods/Ratepay/InstallmentTest.php +++ b/Test/Unit/Model/Methods/Ratepay/InstallmentTest.php @@ -106,8 +106,7 @@ public function testGetAllowedMonths() 'interestrate_default' => '9', ]; - $this->ratepayHelper->method('getRatepayShopId')->willReturn("test"); - $this->ratepayHelper->method('getRatepayShopConfigById')->willReturn($config); + $this->ratepayHelper->method('getShopConfigByQuote')->willReturn($config); $result = $this->classToTest->getAllowedMonths(); $this->assertCount(3, $result); @@ -121,8 +120,7 @@ public function testGetAllowedMonthsZero() 'interestrate_default' => '0', ]; - $this->ratepayHelper->method('getRatepayShopId')->willReturn("test"); - $this->ratepayHelper->method('getRatepayShopConfigById')->willReturn($config); + $this->ratepayHelper->method('getShopConfigByQuote')->willReturn($config); $result = $this->classToTest->getAllowedMonths(); $this->assertCount(3, $result); diff --git a/Test/Unit/Model/Methods/Ratepay/InvoiceTest.php b/Test/Unit/Model/Methods/Ratepay/InvoiceTest.php index d665afa1..f421ec02 100644 --- a/Test/Unit/Model/Methods/Ratepay/InvoiceTest.php +++ b/Test/Unit/Model/Methods/Ratepay/InvoiceTest.php @@ -171,6 +171,7 @@ public function testGetPaymentSpecificParameters() 'add_paydata[device_token]' => '12345', 'add_paydata[merchant_consumer_id]' => '123', 'add_paydata[shop_id]' => '54321', + 'add_paydata[vat_id]' => '1', 'birthday' => '1', 'telephonenumber' => '1', ]; @@ -264,7 +265,7 @@ public function testIsAvailableFalse() { $this->scopeConfig->method('getValue')->willReturn(1); - $this->ratepayHelper->method('getRatepayShopId')->willReturn(false); + $this->ratepayHelper->method('getShopIdByQuote')->willReturn(false); $result = $this->classToTest->isAvailable(); $this->assertFalse($result); diff --git a/etc/csp_whitelist.xml b/etc/csp_whitelist.xml index 4fe96246..03b36e6c 100644 --- a/etc/csp_whitelist.xml +++ b/etc/csp_whitelist.xml @@ -33,6 +33,7 @@ secure.pay1.de payments.amazon.de jsctool.com + www.jsctool.com diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 9f06ca1f..0ac3ddd9 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -1175,5 +1175,5 @@ "PAYONE Credit Card", "PAYONE Kreditkarte" "Safe installment is not available for your current basket. Please choose another payment method.","Gesicherter Ratenkauf wird für Ihren aktuellen Warenkorb nicht unterstützt. Bitte wählen Sie eine andere Zahlart." -"Ratepay payment with differing billing- and shipping-address is not supported","Die Zahlung mit Ratepay bei abweichender Rechnungs- und Lieferadressen wird nicht unterstützt" +"Payment with differing billing- and shipping-address is not supported for this payment type","Die Zahlung bei abweichender Rechnungs- und Lieferadressen wird für diese Zahlart nicht unterstützt" "Place Order","Jetzt kaufen" diff --git a/view/adminhtml/templates/system/config/form/field/refresh_ratepay_profiles.phtml b/view/adminhtml/templates/system/config/form/field/refresh_ratepay_profiles.phtml index b4e22040..3734d70d 100644 --- a/view/adminhtml/templates/system/config/form/field/refresh_ratepay_profiles.phtml +++ b/view/adminhtml/templates/system/config/form/field/refresh_ratepay_profiles.phtml @@ -25,14 +25,14 @@ */ /** - * @see \Payone\Core\Block\Adminhtml\Config\Form\Field\AmazonConfiguration + * @see \Payone\Core\Block\Adminhtml\Config\Form\Field\RefreshRatepayProfiles */ ?>
-
diff --git a/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js b/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js index 19499007..39303a19 100644 --- a/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js +++ b/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js @@ -32,7 +32,31 @@ define( 'use strict'; return Component.extend({ isPlaceOrderActionAllowedRatePay: function () { - return (quote.billingAddress() != null && quote.billingAddress().getCacheKey() == quote.shippingAddress().getCacheKey()); + return this.isDifferentAddressNotAllowed() === false && this.isB2BNotAllowed() === false; + }, + isDifferentAddressNotAllowed: function () { + if (window.checkoutConfig.payment.payone.ratepay[this.getCode()].differentAddressAllowed !== undefined && window.checkoutConfig.payment.payone.ratepay[this.getCode()].differentAddressAllowed === true) { + return false; + } + return (quote.billingAddress() === null || quote.billingAddress().getCacheKey() !== quote.shippingAddress().getCacheKey()); + }, + isB2BNotAllowed: function () { + if (window.checkoutConfig.payment.payone.ratepay[this.getCode()].b2bAllowed !== undefined && window.checkoutConfig.payment.payone.ratepay[this.getCode()].b2bAllowed === true) { + return false; + } + return (quote.billingAddress() !== null && typeof quote.billingAddress().company !== undefined && quote.billingAddress().company !== null && quote.billingAddress().company != ""); + }, + isB2bMode: function () { + if (quote.billingAddress() != null && + typeof quote.billingAddress().company !== undefined && + quote.billingAddress().company !== null && + quote.billingAddress().company != "" && + window.checkoutConfig.payment.payone.ratepay[this.getCode()].b2bAllowed !== undefined && + window.checkoutConfig.payment.payone.ratepay[this.getCode()].b2bAllowed === true + ) { + return true; + } + return false; }, getData: function () { var parentReturn = this._super(); @@ -45,6 +69,9 @@ define( if (this.requestTelephone()) { parentReturn.additional_data.telephone = this.telephone(); } + if (this.isB2bMode()) { + parentReturn.additional_data.company_uid = this.companyUid(); + } return parentReturn; }, @@ -53,6 +80,9 @@ define( return window.checkoutConfig.payment.instructions[this.item.method]; }, requestBirthday: function () { + if (quote.billingAddress() == null || this.isB2bMode() === true) { + return false; + } if (customer.customerData.dob == undefined || customer.customerData.dob === null) { return true; } diff --git a/view/frontend/web/js/view/payment/method-renderer/ratepay_debit-method.js b/view/frontend/web/js/view/payment/method-renderer/ratepay_debit-method.js index 96722bba..02a9007e 100644 --- a/view/frontend/web/js/view/payment/method-renderer/ratepay_debit-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/ratepay_debit-method.js @@ -37,7 +37,8 @@ define( birthyear: '', telephone: '', iban: '', - bic: '' + bic: '', + companyUid: '' }, initObservable: function () { this._super() @@ -47,7 +48,8 @@ define( 'birthyear', 'telephone', 'iban', - 'bic' + 'bic', + 'companyUid' ]); return this; }, diff --git a/view/frontend/web/js/view/payment/method-renderer/ratepay_installment-method.js b/view/frontend/web/js/view/payment/method-renderer/ratepay_installment-method.js index ca47f13c..763f5e3c 100644 --- a/view/frontend/web/js/view/payment/method-renderer/ratepay_installment-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/ratepay_installment-method.js @@ -49,8 +49,9 @@ define( installmentTotalAmount: null, interestRate: null, useDirectDebit: true, - allowedMonths: window.checkoutConfig.payment.payone.ratepayAllowedMonths, - allowedMonthsReloaded: false + allowedMonths: [], + allowedMonthsReloaded: false, + companyUid: '' }, initObservable: function () { this._super() @@ -69,10 +70,16 @@ define( 'interestRate', 'useDirectDebit', 'allowedMonths', - 'allowedMonthsReloaded' + 'allowedMonthsReloaded', + 'companyUid' ]); return this; }, + initialize: function () { + let parentReturn = this._super(); + this.allowedMonths(window.checkoutConfig.payment.payone.ratepay[this.getCode()].allowedMonths); + return parentReturn; + }, getData: function () { var parentReturn = this._super(); @@ -154,7 +161,7 @@ define( this.useDirectDebit(!this.useDirectDebit()); }, getAllowedMonths: function () { - if ((window.checkoutConfig.payment.payone.ratepayAllowedMonths === undefined || window.checkoutConfig.payment.payone.ratepayAllowedMonths.length == 0) && this.allowedMonthsReloaded() === false) { + if ((window.checkoutConfig.payment.payone.ratepay[this.getCode()].allowedMonths === undefined || window.checkoutConfig.payment.payone.ratepay[this.getCode()].allowedMonths.length == 0) && this.allowedMonthsReloaded() === false) { updateAllowedMonths(this); this.allowedMonthsReloaded(true); } diff --git a/view/frontend/web/js/view/payment/method-renderer/ratepay_invoice-method.js b/view/frontend/web/js/view/payment/method-renderer/ratepay_invoice-method.js index 16f49e2e..fe7e819f 100644 --- a/view/frontend/web/js/view/payment/method-renderer/ratepay_invoice-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/ratepay_invoice-method.js @@ -35,7 +35,8 @@ define( birthday: '', birthmonth: '', birthyear: '', - telephone: '' + telephone: '', + companyUid: '', }, initObservable: function () { this._super() @@ -43,7 +44,8 @@ define( 'birthday', 'birthmonth', 'birthyear', - 'telephone' + 'telephone', + 'companyUid' ]); return this; } diff --git a/view/frontend/web/template/payment/bnpl_debit.html b/view/frontend/web/template/payment/bnpl_debit.html index 9f2ff30e..7c41a31d 100644 --- a/view/frontend/web/template/payment/bnpl_debit.html +++ b/view/frontend/web/template/payment/bnpl_debit.html @@ -180,7 +180,7 @@

- +

diff --git a/view/frontend/web/template/payment/bnpl_installment.html b/view/frontend/web/template/payment/bnpl_installment.html index ca87d1da..2845e2d2 100644 --- a/view/frontend/web/template/payment/bnpl_installment.html +++ b/view/frontend/web/template/payment/bnpl_installment.html @@ -191,7 +191,7 @@

- +

diff --git a/view/frontend/web/template/payment/bnpl_invoice.html b/view/frontend/web/template/payment/bnpl_invoice.html index c5d2e556..d65db400 100644 --- a/view/frontend/web/template/payment/bnpl_invoice.html +++ b/view/frontend/web/template/payment/bnpl_invoice.html @@ -154,7 +154,7 @@

- +

diff --git a/view/frontend/web/template/payment/ratepay_debit.html b/view/frontend/web/template/payment/ratepay_debit.html index 3b87547c..49e3d4ef 100644 --- a/view/frontend/web/template/payment/ratepay_debit.html +++ b/view/frontend/web/template/payment/ratepay_debit.html @@ -43,6 +43,23 @@
+ +
+ +
+ +
+
+
-

- +

+ +
+

+
diff --git a/view/frontend/web/template/payment/ratepay_installment.html b/view/frontend/web/template/payment/ratepay_installment.html index 689d4081..ce9bb6d2 100644 --- a/view/frontend/web/template/payment/ratepay_installment.html +++ b/view/frontend/web/template/payment/ratepay_installment.html @@ -139,6 +139,23 @@

+ +
+ +
+ +
+
+
-

- +

+ +
+

+

diff --git a/view/frontend/web/template/payment/ratepay_invoice.html b/view/frontend/web/template/payment/ratepay_invoice.html index 80a23d94..966815a2 100644 --- a/view/frontend/web/template/payment/ratepay_invoice.html +++ b/view/frontend/web/template/payment/ratepay_invoice.html @@ -43,6 +43,23 @@
+ +
+ +
+ +
+
+
-

- +

+ +
+

+
From 688511365c85f2c3813e7811d497d9295ed159e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 31 Jan 2023 11:49:05 +0100 Subject: [PATCH 03/21] MAG2-275 - Added ratepay config refresh after address entry for guest checkout --- Api/Data/RatepayConfigResponseInterface.php | 44 +++++++++ Api/RatepayConfigInterface.php | 40 +++++++++ Helper/Ratepay.php | 51 ++++++++++- Helper/Toolkit.php | 2 +- Model/ConfigProvider.php | 31 +------ Service/V1/Data/RatepayConfigResponse.php | 55 ++++++++++++ Service/V1/RatepayConfig.php | 89 +++++++++++++++++++ etc/di.xml | 2 + etc/webapi.xml | 17 ++++ view/frontend/web/js/action/ratepayconfig.js | 72 +++++++++++++++ .../payment/method-renderer/ratepay_base.js | 27 +++++- 11 files changed, 396 insertions(+), 34 deletions(-) create mode 100644 Api/Data/RatepayConfigResponseInterface.php create mode 100644 Api/RatepayConfigInterface.php create mode 100644 Service/V1/Data/RatepayConfigResponse.php create mode 100644 Service/V1/RatepayConfig.php create mode 100644 view/frontend/web/js/action/ratepayconfig.js diff --git a/Api/Data/RatepayConfigResponseInterface.php b/Api/Data/RatepayConfigResponseInterface.php new file mode 100644 index 00000000..39988b2f --- /dev/null +++ b/Api/Data/RatepayConfigResponseInterface.php @@ -0,0 +1,44 @@ +. + * + * PHP version 8 + * + * @category Payone + * @package Payone_Magento2_Plugin + * @author FATCHIP GmbH + * @copyright 2003 - 2023 Payone GmbH + * @license GNU Lesser General Public License + * @link http://www.payone.de + */ + +namespace Payone\Core\Api\Data; + +interface RatepayConfigResponseInterface +{ + /** + * Returns if editing the address was a success + * + * @return bool + */ + public function getSuccess(); + + /** + * Returns config json array + * + * @return string + */ + public function getConfig(); +} diff --git a/Api/RatepayConfigInterface.php b/Api/RatepayConfigInterface.php new file mode 100644 index 00000000..a2036d8a --- /dev/null +++ b/Api/RatepayConfigInterface.php @@ -0,0 +1,40 @@ +. + * + * PHP version 8 + * + * @category Payone + * @package Payone_Magento2_Plugin + * @author FATCHIP GmbH + * @copyright 2003 - 2023 Payone GmbH + * @license GNU Lesser General Public License + * @link http://www.payone.de + */ + +namespace Payone\Core\Api; + +interface RatepayConfigInterface +{ + /** + * PAYONE editAddress script + * The full class-paths must be given here otherwise the Magento 2 WebApi + * cant handle this with its fake type system! + * + * @param string $cartId + * @return \Payone\Core\Service\V1\Data\RatepayConfigResponse + */ + public function getConfig($cartId); +} diff --git a/Helper/Ratepay.php b/Helper/Ratepay.php index 977db4f5..53fc6f4d 100644 --- a/Helper/Ratepay.php +++ b/Helper/Ratepay.php @@ -72,6 +72,13 @@ class Ratepay extends \Payone\Core\Helper\Base */ protected $apiHelper; + /** + * Payone Payment helper + * + * @var \Payone\Core\Helper\Payment + */ + protected $paymentHelper; + /** * Constructor * @@ -83,6 +90,7 @@ class Ratepay extends \Payone\Core\Helper\Base * @param \Payone\Core\Model\ResourceModel\RatepayProfileConfig $profileResource * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Payone\Core\Helper\Api $apiHelper + * @param \Payone\Core\Helper\Payment $paymentHelper */ public function __construct( \Magento\Framework\App\Helper\Context $context, @@ -92,13 +100,15 @@ public function __construct( \Payone\Core\Model\Api\Request\Genericpayment\Profile $profile, \Payone\Core\Model\ResourceModel\RatepayProfileConfig $profileResource, \Magento\Checkout\Model\Session $checkoutSession, - \Payone\Core\Helper\Api $apiHelper + \Payone\Core\Helper\Api $apiHelper, + \Payone\Core\Helper\Payment $paymentHelper ) { parent::__construct($context, $storeManager, $shopHelper, $state); $this->profile = $profile; $this->profileResource = $profileResource; $this->checkoutSession = $checkoutSession; $this->apiHelper = $apiHelper; + $this->paymentHelper = $paymentHelper; } /** @@ -340,4 +350,43 @@ public function getRatepayShopConfigById($sShopId) } return false; } + + /** + * Return Ratepay config for config provider + * + * @return array + */ + public function getRatepayConfig() + { + $aReturn = []; + + foreach (PayoneConfig::METHODS_RATEPAY as $sRatepayMethod) { + if ($this->paymentHelper->isPaymentMethodActive($sRatepayMethod) === true) { + $aReturn[$sRatepayMethod] = $this->getRatepaySingleConfig($sRatepayMethod); + } + } + return $aReturn; + } + + /** + * Return Ratepay configuration for given method code + * + * @param string $sRatepayMethodCode + * @return array|bool[] + */ + protected function getRatepaySingleConfig($sRatepayMethodCode) + { + $aShopConfig = $this->getShopConfigByQuote($sRatepayMethodCode); + if (empty($aShopConfig)) { + $aShopConfig = $this->getShopConfigByQuote($sRatepayMethodCode, null, true); + if (empty($aShopConfig)) { + return []; + } + } + + return [ + 'b2bAllowed' => (bool)$this->getShopConfigProperty($aShopConfig, $sRatepayMethodCode, 'b2b'), + 'differentAddressAllowed' => (bool)$this->getShopConfigProperty($aShopConfig, $sRatepayMethodCode, 'delivery_address'), + ]; + } } diff --git a/Helper/Toolkit.php b/Helper/Toolkit.php index 16c00fcd..f44963c5 100644 --- a/Helper/Toolkit.php +++ b/Helper/Toolkit.php @@ -213,7 +213,7 @@ public function maskIban($sUnmasked) */ public function isUTF8($sString) { - return $sString === mb_convert_encoding(mb_convert_encoding($sString, "UTF-32", "UTF-8"), "UTF-8", "UTF-32"); + return $sString === mb_convert_encoding(mb_convert_encoding($sString ?? '', "UTF-32", "UTF-8"), "UTF-8", "UTF-32"); } /** diff --git a/Model/ConfigProvider.php b/Model/ConfigProvider.php index 1ee38a43..3f7f3577 100644 --- a/Model/ConfigProvider.php +++ b/Model/ConfigProvider.php @@ -289,6 +289,7 @@ protected function getPayoneConfig() 'klarnaTitles' => $this->paymentHelper->getKlarnaMethodTitles(), 'storeName' => $this->shopHelper->getStoreName(), 'ratepay' => $this->getRatepayConfig(), + 'ratepayRefreshed' => false, 'bnpl' => $this->getBNPLConfig(), ]; } @@ -340,28 +341,6 @@ protected function isPaydirektOneKlickDisplayable() return false; } - /** - * Return Ratepay configuration for given method code - * - * @param string $sRatepayMethodCode - * @return array|bool[] - */ - protected function getRatepaySingleConfig($sRatepayMethodCode) - { - $aShopConfig = $this->ratepayHelper->getShopConfigByQuote($sRatepayMethodCode); - if (empty($aShopConfig)) { - $aShopConfig = $this->ratepayHelper->getShopConfigByQuote($sRatepayMethodCode, null, true); - if (empty($aShopConfig)) { - return []; - } - } - - return [ - 'b2bAllowed' => (bool)$this->ratepayHelper->getShopConfigProperty($aShopConfig, $sRatepayMethodCode, 'b2b'), - 'differentAddressAllowed' => (bool)$this->ratepayHelper->getShopConfigProperty($aShopConfig, $sRatepayMethodCode, 'delivery_address'), - ]; - } - /** * Return ratepay config for all ratepay payment methods * @@ -369,13 +348,7 @@ protected function getRatepaySingleConfig($sRatepayMethodCode) */ protected function getRatepayConfig() { - $aReturn = []; - - foreach (PayoneConfig::METHODS_RATEPAY as $sRatepayMethod) { - if ($this->paymentHelper->isPaymentMethodActive($sRatepayMethod) === true) { - $aReturn[$sRatepayMethod] = $this->getRatepaySingleConfig($sRatepayMethod); - } - } + $aReturn = $this->ratepayHelper->getRatepayConfig(); if (isset($aReturn[PayoneConfig::METHOD_RATEPAY_INSTALLMENT])) { $aReturn[PayoneConfig::METHOD_RATEPAY_INSTALLMENT]['allowedMonths'] = $this->ratepayInstallment->getAllowedMonths(); diff --git a/Service/V1/Data/RatepayConfigResponse.php b/Service/V1/Data/RatepayConfigResponse.php new file mode 100644 index 00000000..8e62130e --- /dev/null +++ b/Service/V1/Data/RatepayConfigResponse.php @@ -0,0 +1,55 @@ +. + * + * PHP version 8 + * + * @category Payone + * @package Payone_Magento2_Plugin + * @author FATCHIP GmbH + * @copyright 2003 - 2023 Payone GmbH + * @license GNU Lesser General Public License + * @link http://www.payone.de + */ + +namespace Payone\Core\Service\V1\Data; + +use Payone\Core\Api\Data\RatepayConfigResponseInterface; + +/** + * Object for addresscheck WebApi response + */ +class RatepayConfigResponse extends \Magento\Framework\Api\AbstractExtensibleObject implements RatepayConfigResponseInterface +{ + /** + * Returns if editing the address was a success + * + * @return bool + */ + public function getSuccess() + { + return $this->_get('success'); + } + + /** + * Returns config json array + * + * @return string + */ + public function getConfig() + { + return $this->_get('config'); + } +} diff --git a/Service/V1/RatepayConfig.php b/Service/V1/RatepayConfig.php new file mode 100644 index 00000000..bc7a0083 --- /dev/null +++ b/Service/V1/RatepayConfig.php @@ -0,0 +1,89 @@ +. + * + * PHP version 5 + * + * @category Payone + * @package Payone_Magento2_Plugin + * @author FATCHIP GmbH + * @copyright 2003 - 2018 Payone GmbH + * @license GNU Lesser General Public License + * @link http://www.payone.de + */ + +namespace Payone\Core\Service\V1; + +use Payone\Core\Api\RatepayConfigInterface; + +/** + * Web API model for the PAYONE RatepayConfig + */ +class RatepayConfig implements RatepayConfigInterface +{ + /** + * Factory for the response object + * + * @var \Payone\Core\Service\V1\Data\RatepayConfigResponseFactory + */ + protected $responseFactory; + + /** + * Address repository + * + * @var \Magento\Checkout\Model\Session + */ + protected $checkoutSession; + + /** + * PAYONE ratepay helper + * + * @var \Payone\Core\Helper\Ratepay + */ + protected $ratepayHelper; + + /** + * Constructor + * + * @param \Payone\Core\Service\V1\Data\RatepayConfigResponseFactory $responseFactory + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Payone\Core\Helper\Ratepay $ratepayHelper + */ + public function __construct( + \Payone\Core\Service\V1\Data\RatepayConfigResponseFactory $responseFactory, + \Magento\Checkout\Model\Session $checkoutSession, + \Payone\Core\Helper\Ratepay $ratepayHelper + ) { + $this->responseFactory = $responseFactory; + $this->checkoutSession = $checkoutSession; + $this->ratepayHelper = $ratepayHelper; + } + + /** + * PAYONE editAddress script + * The full class-paths must be given here otherwise the Magento 2 WebApi + * cant handle this with its fake type system! + * + * @param string $cartId + * @return \Payone\Core\Service\V1\Data\RatepayConfigResponse + */ + public function getConfig($cartId) + { + $oResponse = $this->responseFactory->create(); + $oResponse->setData('config', json_encode($this->ratepayHelper->getRatepayConfig())); + $oResponse->setData('success', true); + return $oResponse; + } +} diff --git a/etc/di.xml b/etc/di.xml index 8bc39b27..0f2c60b3 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -31,6 +31,8 @@ + + diff --git a/etc/webapi.xml b/etc/webapi.xml index 06499a16..0d315958 100644 --- a/etc/webapi.xml +++ b/etc/webapi.xml @@ -160,4 +160,21 @@ %cart_id% + + + + + + + + + + + + + + + %cart_id% + + diff --git a/view/frontend/web/js/action/ratepayconfig.js b/view/frontend/web/js/action/ratepayconfig.js new file mode 100644 index 00000000..c1e73a28 --- /dev/null +++ b/view/frontend/web/js/action/ratepayconfig.js @@ -0,0 +1,72 @@ +/** + * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PAYONE Magento 2 Connector is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with PAYONE Magento 2 Connector. If not, see . + * + * PHP version 8 + * + * @category Payone + * @package Payone_Magento2_Plugin + * @author FATCHIP GmbH + * @copyright 2003 - 2023 Payone GmbH + * @license GNU Lesser General Public License + * @link http://www.payone.de + */ +/*jshint browser:true jquery:true*/ +/*global alert*/ +define([ + 'jquery', + 'Magento_Checkout/js/model/url-builder', + 'mage/storage', + 'Magento_Checkout/js/model/full-screen-loader', + 'Magento_Checkout/js/model/quote', + 'Magento_Customer/js/model/customer' +], function ($, urlBuilder, storage, fullScreenLoader, quote, customer) { + 'use strict'; + + /** Override default place order action and add agreement_ids to request */ + return function () { + var serviceUrl; + + var request = { + cartId: quote.getQuoteId() + }; + if (!customer.isLoggedIn()) { + serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payone-ratepayGetConfig', { + quoteId: quote.getQuoteId() + }); + } else { + serviceUrl = urlBuilder.createUrl('/carts/mine/payone-ratepayGetConfig', {}); + } + + fullScreenLoader.startLoader(); + + return storage.post( + serviceUrl, + JSON.stringify(request) + ).done( + function (response) { + if (response.success === true && response.config !== undefined) { + window.checkoutConfig.payment.payone.ratepayReloaded = JSON.parse(response.config); + window.checkoutConfig.payment.payone.ratepayRefreshed = true; + } + fullScreenLoader.stopLoader(); + } + ).fail( + function (response) { + //errorProcessor.process(response, messageContainer); + alert('An error occured.'); + fullScreenLoader.stopLoader(); + } + ); + }; +}); diff --git a/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js b/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js index 39303a19..a81e8427 100644 --- a/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js +++ b/view/frontend/web/js/view/payment/method-renderer/ratepay_base.js @@ -26,26 +26,47 @@ define( 'Payone_Core/js/view/payment/method-renderer/base', 'Magento_Checkout/js/model/quote', 'Magento_Customer/js/model/customer', + 'Payone_Core/js/action/ratepayconfig', 'mage/translate' ], - function (Component, quote, customer, $t) { + function (Component, quote, customer, ratepayconfig, $t) { 'use strict'; return Component.extend({ + initialize: function () { + let parentReturn = this._super(); + if (!customer.isLoggedIn() && window.checkoutConfig.payment.payone.ratepayRefreshed === false) { + ratepayconfig(); + window.checkoutConfig.payment.payone.ratepayRefreshed = true; + } + return parentReturn; + }, isPlaceOrderActionAllowedRatePay: function () { return this.isDifferentAddressNotAllowed() === false && this.isB2BNotAllowed() === false; }, isDifferentAddressNotAllowed: function () { - if (window.checkoutConfig.payment.payone.ratepay[this.getCode()].differentAddressAllowed !== undefined && window.checkoutConfig.payment.payone.ratepay[this.getCode()].differentAddressAllowed === true) { + if (this.getConfigValue('differentAddressAllowed') === true) { return false; } return (quote.billingAddress() === null || quote.billingAddress().getCacheKey() !== quote.shippingAddress().getCacheKey()); }, isB2BNotAllowed: function () { - if (window.checkoutConfig.payment.payone.ratepay[this.getCode()].b2bAllowed !== undefined && window.checkoutConfig.payment.payone.ratepay[this.getCode()].b2bAllowed === true) { + if (this.getConfigValue('b2bAllowed') === true) { return false; } return (quote.billingAddress() !== null && typeof quote.billingAddress().company !== undefined && quote.billingAddress().company !== null && quote.billingAddress().company != ""); }, + getConfigValue: function (sConfigKey) { + if (!customer.isLoggedIn() && window.checkoutConfig.payment.payone.ratepayRefreshed === true && window.checkoutConfig.payment.payone.ratepayReloaded !== undefined) { + let config = window.checkoutConfig.payment.payone.ratepayReloaded; + if (config[this.getCode()] !== undefined && config[this.getCode()][sConfigKey] !== undefined) { + return config[this.getCode()][sConfigKey]; + } + } + if (window.checkoutConfig.payment.payone.ratepay[this.getCode()][sConfigKey] !== undefined && window.checkoutConfig.payment.payone.ratepay[this.getCode()][sConfigKey] === true) { + return window.checkoutConfig.payment.payone.ratepay[this.getCode()][sConfigKey]; + } + return null; + }, isB2bMode: function () { if (quote.billingAddress() != null && typeof quote.billingAddress().company !== undefined && From 3b66115e30a56a8836f2828c6525c6c90df08b9f Mon Sep 17 00:00:00 2001 From: janteuber <88656469+janteuber@users.noreply.github.com> Date: Tue, 31 Jan 2023 14:21:28 +0100 Subject: [PATCH 04/21] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2a8866a8..d7a6a70b 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,6 @@ magento@payone.com
## License See our License Agreement at: https://www.payone.de/fileadmin/downloads/sonstiges/PAYONE_Haftungs_und_Lizenzvereinbarung_Extensions.pdf -## About BS PAYONE -Since the end of August 2017, the two payment specialist companies PAYONE and B+S Card Service merged to become BS PAYONE GmbH. All current partnerships will be maintained the way they are. APIs, interfaces, and other technical parameters will stay the same. Your current contact persons will continue to gladly be at your service.
-BS PAYONE GmbH is headquartered in Frankfurt am Main and is one of the leading omnichannel payment providers in Europe. In addition to providing customer support to numerous Sparkasse banks, the full-service payment service provider also provides cashless payment transactions services to more than 255,000 customers from various branches – whether that be in stationary retail or when completing e-commerce and mobile payment transactions. +## About PAYONE +Since the end of August 2017, the two payment specialist companies PAYONE and B+S Card Service merged to become PAYONE GmbH. All current partnerships will be maintained the way they are. APIs, interfaces, and other technical parameters will stay the same. Your current contact persons will continue to gladly be at your service.
+PAYONE GmbH is headquartered in Frankfurt am Main and is one of the leading omnichannel payment providers in Europe. In addition to providing customer support to numerous Sparkasse banks, the full-service payment service provider also provides cashless payment transactions services to more than 255,000 customers from various branches – whether that be in stationary retail or when completing e-commerce and mobile payment transactions. From faa0f5153a6a4e0f46df1a687bf3184a6ef35375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Wed, 1 Feb 2023 10:35:44 +0100 Subject: [PATCH 05/21] MAG2-275 - Fixed an api log problem --- Model/Entities/ApiLog.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Entities/ApiLog.php b/Model/Entities/ApiLog.php index 7ecc03e8..d4123ad1 100644 --- a/Model/Entities/ApiLog.php +++ b/Model/Entities/ApiLog.php @@ -83,7 +83,7 @@ protected function formatArray($aArray) { foreach ($aArray as $sKey => $mValue) { if (!$this->toolkitHelper->isUTF8($mValue)) { - $aArray[$sKey] = utf8_encode($mValue); + $aArray[$sKey] = utf8_encode($mValue ?? ''); } } return $aArray; @@ -105,7 +105,7 @@ protected function getUnserializedArray($sKey, $blSort = false) $aRequest = unserialize($sRequest); } catch(\Exception $exc) { if ($this->toolkitHelper->isUTF8($sRequest)) { - $aRequest = unserialize(utf8_decode($sRequest)); + $aRequest = unserialize(utf8_decode($sRequest ?? '')); } } if (is_array($aRequest)) { From d9dd9261a8026ad7c81001c5221e89fab7878fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 23 Feb 2023 18:31:27 +0100 Subject: [PATCH 06/21] MAG2-277 - Added BNPL Secured Direct Debit --- Helper/Payment.php | 2 +- etc/adminhtml/system.xml | 6 ++--- etc/config.xml | 6 +++-- etc/payment.xml | 4 ++-- i18n/de_DE.csv | 12 +++++----- i18n/en_US.csv | 4 ++-- view/frontend/layout/checkout_index_index.xml | 4 ++-- .../method-renderer/bnpl_debit-method.js | 23 ++++++++++++++++++- .../web/js/view/payment/payone-payments.js | 4 ++-- 9 files changed, 44 insertions(+), 21 deletions(-) diff --git a/Helper/Payment.php b/Helper/Payment.php index fbb5c8df..f47e5a5d 100644 --- a/Helper/Payment.php +++ b/Helper/Payment.php @@ -73,7 +73,7 @@ class Payment extends \Payone\Core\Helper\Base PayoneConfig::METHOD_BANCONTACT, PayoneConfig::METHOD_BNPL_INVOICE, PayoneConfig::METHOD_BNPL_INSTALLMENT, - //BNPL_DEBIT_DEACTIVATED PayoneConfig::METHOD_BNPL_DEBIT, + PayoneConfig::METHOD_BNPL_DEBIT, ]; /** diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index ce96a8a3..9b6e986c 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -267,11 +267,11 @@ Payone\Core\Block\Adminhtml\Config\Form\Field\StatusMapping Payone\Core\Model\Config\Backend\SerializedOrJson - + Payone\Core\Block\Adminhtml\Config\Form\Field\StatusMapping @@ -332,7 +332,7 @@ - +
diff --git a/etc/config.xml b/etc/config.xml index 5b3859f9..81521eb5 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -330,16 +330,18 @@ 0 payone - + 1 Authorization diff --git a/etc/payment.xml b/etc/payment.xml index 22c21773..aa2916d7 100644 --- a/etc/payment.xml +++ b/etc/payment.xml @@ -130,9 +130,9 @@ 0 - + 0 diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 0ac3ddd9..35a49006 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -553,12 +553,12 @@ "Enable this if differing billing address and shipping address are allowed. This is disabled by default because this has to be enabled by Payone for your merchant account.","Aktivierbar um abweichende Rechnungs- und Lieferadresse zu erlauben. Dies ist standardmäßig deaktiviert, da dies erst von Payone in ihrem Merchant Account aktiviert werden muss." "B2B orders are not supported for this payment method","B2B Bestellungen sind nicht verfügbar für diese Zahlart" -"bnpl_legal_text_snippet_1","Mit dieser Bestellung erkläre ich mich mit den" -"bnpl_legal_text_snippet_2","zusätzlichen Zahlungsbedingungen" -"bnpl_legal_text_snippet_3","und der Risikobewertung für die gewählte Zahlungsart einverstanden." -"bnpl_legal_text_snippet_4","Ich habe den" -"bnpl_legal_text_snippet_5","zusätzlichen Datenschutzhinweis" -"bnpl_legal_text_snippet_6","zur Kenntnis genommen." +"bnpl_legal_text_snippet_1","Mit Abschluss dieser Bestellung erkläre ich mich mit den" +"bnpl_legal_text_snippet_2","ergänzenden Zahlungsbedingungen" +"bnpl_legal_text_snippet_3","und der Durchführung einer Risikoprüfung für die ausgewählte Zahlungsart einverstanden." +"bnpl_legal_text_snippet_4","Den" +"bnpl_legal_text_snippet_5","ergänzenden Datenschutzhinweis" +"bnpl_legal_text_snippet_6","habe ich zur Kenntnis genommen." "bnpl_payment_terms_url","https://legal.paylater.payone.com/de/terms-of-payment.html" "bnpl_data_protection_url","https://legal.paylater.payone.com/de/data-protection-payments.html" diff --git a/i18n/en_US.csv b/i18n/en_US.csv index 7555f53b..9adf92c6 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -42,9 +42,9 @@ "bnpl_legal_text_snippet_1","By placing this order, I agree to the" "bnpl_legal_text_snippet_2","supplementary payment terms" -"bnpl_legal_text_snippet_3","and the risk assessment for the selected payment method." +"bnpl_legal_text_snippet_3","and the performance of a risk assessment for the selected payment method." "bnpl_legal_text_snippet_4","I am aware of the" -"bnpl_legal_text_snippet_5","additional data protection notice" +"bnpl_legal_text_snippet_5","supplementary data protection notice" "bnpl_legal_text_snippet_6","." "bnpl_payment_terms_url","https://legal.paylater.payone.com/en/terms-of-payment.html" "bnpl_data_protection_url","https://legal.paylater.payone.com/en/data-protection-payments.html" diff --git a/view/frontend/layout/checkout_index_index.xml b/view/frontend/layout/checkout_index_index.xml index 10a2b506..fa56efdb 100644 --- a/view/frontend/layout/checkout_index_index.xml +++ b/view/frontend/layout/checkout_index_index.xml @@ -151,9 +151,9 @@ true - + true diff --git a/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js b/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js index c618ba61..9e617bee 100644 --- a/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js @@ -50,7 +50,28 @@ define( 'iban' ]); return this; - } + }, + getData: function () { + var parentReturn = this._super(); + parentReturn.additional_data.bankaccountholder = this.bankaccountholder(); + parentReturn.additional_data.iban = this.getCleanedNumber(this.iban()); + return parentReturn; + }, + validate: function () { + var parentReturn = this._super(); + if (parentReturn === false) { + return parentReturn; + } + if (this.bankaccountholder() == '') { + this.messageContainer.addErrorMessage({'message': $t('Please enter your bank account holder information.')}); + return false; + } + if (this.iban() == '') { + this.messageContainer.addErrorMessage({'message': $t('Please enter a valid IBAN.')}); + return false; + } + return parentReturn; + }, }); } ); diff --git a/view/frontend/web/js/view/payment/payone-payments.js b/view/frontend/web/js/view/payment/payone-payments.js index cb140283..ee500b09 100644 --- a/view/frontend/web/js/view/payment/payone-payments.js +++ b/view/frontend/web/js/view/payment/payone-payments.js @@ -164,10 +164,10 @@ define( type: 'payone_bnpl_invoice', component: 'Payone_Core/js/view/payment/method-renderer/bnpl_invoice-method' }, - /*BNPL_DEBIT_DEACTIVATED{ + { type: 'payone_bnpl_debit', component: 'Payone_Core/js/view/payment/method-renderer/bnpl_debit-method' - },*/ + }, { type: 'payone_bnpl_installment', component: 'Payone_Core/js/view/payment/method-renderer/bnpl_installment-method' From aa4646f1c7c8b2a62d79841b8962a11ce45ffbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Wed, 1 Mar 2023 11:45:44 +0100 Subject: [PATCH 07/21] MAG2-279 - Updated iDeal issuer list --- Model/Methods/OnlineBankTransfer/Ideal.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Model/Methods/OnlineBankTransfer/Ideal.php b/Model/Methods/OnlineBankTransfer/Ideal.php index 84a8362f..d4eb1552 100644 --- a/Model/Methods/OnlineBankTransfer/Ideal.php +++ b/Model/Methods/OnlineBankTransfer/Ideal.php @@ -63,18 +63,17 @@ class Ideal extends OnlineBankTransferBase */ protected static $aBankGroups = [ 'ABN_AMRO_BANK' => 'ABN Amro', + 'ASN_BANK' => 'ASN Bank', 'BUNQ_BANK' => 'Bunq', + 'ING_BANK' => 'ING Bank', + 'KNAB_BANK' => 'Knab', 'RABOBANK' => 'Rabobank', - 'ASN_BANK' => 'ASN Bank', + 'REVOLUT' => 'Revolut', 'SNS_BANK' => 'SNS Bank', - 'TRIODOS_BANK' => 'Triodos Bank', 'SNS_REGIO_BANK' => 'Regio Bank', - 'ING_BANK' => 'ING Bank', - 'KNAB_BANK' => 'Knab', + 'TRIODOS_BANK' => 'Triodos Bank', 'VAN_LANSCHOT_BANKIERS' => 'van Lanschot', - 'HANDELSBANKEN' => 'Handelsbanken', - 'FRIESLAND_BANK' => 'Friesland Bank', - 'REVOLUT' => 'Revolut', + 'YOURSAFE' => 'Yoursafe B.V', ]; /** From a599042a9ba638b4ed5cd7be52b724fc31cfacb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Fri, 3 Mar 2023 12:16:56 +0100 Subject: [PATCH 08/21] MAG2-281 - Removed _isScopePrivate usage --- Block/Onepage/Totals.php | 1 - view/frontend/layout/payone_amazon_loadreview.xml | 2 +- view/frontend/layout/payone_onepage_review.xml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Block/Onepage/Totals.php b/Block/Onepage/Totals.php index 5430bd5d..05b7f846 100644 --- a/Block/Onepage/Totals.php +++ b/Block/Onepage/Totals.php @@ -61,7 +61,6 @@ public function __construct( ) { $this->_salesConfig = $salesConfig; parent::__construct($context, $customerSession, $checkoutSession, $salesConfig, $layoutProcessors, $data); - $this->_isScopePrivate = true; $this->layoutProcessors = $layoutProcessors; $this->baseHelper = $baseHelper; } diff --git a/view/frontend/layout/payone_amazon_loadreview.xml b/view/frontend/layout/payone_amazon_loadreview.xml index a8e8384a..ec678a05 100644 --- a/view/frontend/layout/payone_amazon_loadreview.xml +++ b/view/frontend/layout/payone_amazon_loadreview.xml @@ -41,7 +41,7 @@ - + diff --git a/view/frontend/layout/payone_onepage_review.xml b/view/frontend/layout/payone_onepage_review.xml index 53431978..d97e1b4b 100644 --- a/view/frontend/layout/payone_onepage_review.xml +++ b/view/frontend/layout/payone_onepage_review.xml @@ -42,6 +42,6 @@ - + From 038cf2863abc68cfe6d57dacb8231f8350afdcfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 6 Mar 2023 13:01:32 +0100 Subject: [PATCH 09/21] MAG2-281 - Try updating to Github actions v3 --- .github/workflows/build.yml | 2 +- .github/workflows/build_magento23.yml | 2 +- .github/workflows/build_magento244php81.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9303fa46..d256b3b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: - 3306:3306 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install PHP uses: shivammathur/setup-php@master with: diff --git a/.github/workflows/build_magento23.yml b/.github/workflows/build_magento23.yml index 45e3ca74..a5c8d1e8 100644 --- a/.github/workflows/build_magento23.yml +++ b/.github/workflows/build_magento23.yml @@ -23,7 +23,7 @@ jobs: - 3306:3306 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install PHP uses: shivammathur/setup-php@master with: diff --git a/.github/workflows/build_magento244php81.yml b/.github/workflows/build_magento244php81.yml index fe09ac6c..f1158a73 100644 --- a/.github/workflows/build_magento244php81.yml +++ b/.github/workflows/build_magento244php81.yml @@ -23,7 +23,7 @@ jobs: - 3306:3306 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install PHP uses: shivammathur/setup-php@master with: From 222b413ea1f8a09df8562141c91852d4f816d8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 6 Mar 2023 13:14:56 +0100 Subject: [PATCH 10/21] MAG2-281 - Update Composer to v2 and Gitleaks to Actions v3 --- .github/workflows/build.yml | 2 +- .github/workflows/build_magento23.yml | 2 +- .github/workflows/build_magento244php81.yml | 2 +- .github/workflows/gitleaks.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d256b3b7..49c2e9be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip - tools: composer:v1 + tools: composer:v2 - name: Validate composer.json and composer.lock run: composer validate diff --git a/.github/workflows/build_magento23.yml b/.github/workflows/build_magento23.yml index a5c8d1e8..47c43b44 100644 --- a/.github/workflows/build_magento23.yml +++ b/.github/workflows/build_magento23.yml @@ -29,7 +29,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip - tools: composer:v1 + tools: composer:v2 - name: Validate composer.json and composer.lock run: composer validate diff --git a/.github/workflows/build_magento244php81.yml b/.github/workflows/build_magento244php81.yml index f1158a73..3510e3b6 100644 --- a/.github/workflows/build_magento244php81.yml +++ b/.github/workflows/build_magento244php81.yml @@ -29,7 +29,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip - tools: composer:v1 + tools: composer:v2 - name: Validate composer.json and composer.lock run: composer validate diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index a297598f..bae484dc 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -6,6 +6,6 @@ jobs: gitleaks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: gitleaks-action uses: gitleaks/gitleaks-action@v1.6.0 From fbc6d7024ac58820ab88b7189e357eec631e8e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Mon, 6 Mar 2023 13:22:14 +0100 Subject: [PATCH 11/21] MAG2-281 - Try using composer v2.1 --- .github/workflows/build.yml | 2 +- .github/workflows/build_magento23.yml | 2 +- .github/workflows/build_magento244php81.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49c2e9be..cf2e0888 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip - tools: composer:v2 + tools: composer:v2.1 - name: Validate composer.json and composer.lock run: composer validate diff --git a/.github/workflows/build_magento23.yml b/.github/workflows/build_magento23.yml index 47c43b44..ac4e8077 100644 --- a/.github/workflows/build_magento23.yml +++ b/.github/workflows/build_magento23.yml @@ -29,7 +29,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip - tools: composer:v2 + tools: composer:v2.1 - name: Validate composer.json and composer.lock run: composer validate diff --git a/.github/workflows/build_magento244php81.yml b/.github/workflows/build_magento244php81.yml index 3510e3b6..a8cf7d78 100644 --- a/.github/workflows/build_magento244php81.yml +++ b/.github/workflows/build_magento244php81.yml @@ -29,7 +29,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, gd, bcmath, ctype, curl, dom, hash, iconv, intl, openssl, simplexml, soap, xsl, zip - tools: composer:v2 + tools: composer:v2.1 - name: Validate composer.json and composer.lock run: composer validate From 08c9f57488edff564035e4bef9087a73fc87dff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 7 Mar 2023 16:43:47 +0100 Subject: [PATCH 12/21] MAG2-282 - Added finishing touches to BNPL integration --- Block/BNPL/InstallmentPlan.php | 10 +++---- Model/ConfigProvider.php | 3 +++ Model/Methods/BNPL/BNPLBase.php | 26 ++++++++++++++++++- Model/Methods/BNPL/Debit.php | 3 ++- Model/Methods/BNPL/Installment.php | 3 ++- Model/Plugins/MethodList.php | 16 ++++++------ Test/Unit/Block/BNPL/InstallmentPlanTest.php | 2 +- Test/Unit/Model/Methods/BNPL/DebitTest.php | 5 ++++ .../Model/Methods/BNPL/InstallmentTest.php | 5 ++++ Test/Unit/Model/Plugins/MethodListTest.php | 9 ++++--- i18n/de_DE.csv | 7 ++++- view/frontend/web/css/payone.css | 4 +++ .../web/js/model/error-processor-mixin.js | 8 +++++- .../method-renderer/bnpl_debit-method.js | 7 ----- .../bnpl_installment-method.js | 7 ----- .../web/template/payment/bnpl_debit.html | 17 +----------- .../template/payment/bnpl_installment.html | 18 +------------ .../web/template/payment/bnpl_invoice.html | 2 +- .../templates/bnpl/installment_plan.phtml | 6 ++--- 19 files changed, 85 insertions(+), 73 deletions(-) diff --git a/Block/BNPL/InstallmentPlan.php b/Block/BNPL/InstallmentPlan.php index 961286fd..12e32e72 100644 --- a/Block/BNPL/InstallmentPlan.php +++ b/Block/BNPL/InstallmentPlan.php @@ -64,11 +64,11 @@ public function formatPrice($dPrice) */ public function getSelectLinkText($aInstallment) { - $sText = $this->formatPrice($aInstallment['monthly_amount_value']).' '; - $sText .= $aInstallment['monthly_amount_currency'].' '; - $sText .= __('per month').' - '; - $sText .= $aInstallment['number_of_payments'].' '; - $sText .= __('installments'); + $sText = __('Payment in'); + $sText .= ' '.$aInstallment['number_of_payments'].' '; + $sText .= __('installments of').' '; + $sText .= $this->formatPrice($aInstallment['monthly_amount_value']).' '; + $sText .= $aInstallment['monthly_amount_currency']; return $sText; } } diff --git a/Model/ConfigProvider.php b/Model/ConfigProvider.php index 3f7f3577..6d92ef73 100644 --- a/Model/ConfigProvider.php +++ b/Model/ConfigProvider.php @@ -401,14 +401,17 @@ protected function getBNPLConfig() 'environment' => [ // "t" for TEST, "p" for PROD PayoneConfig::METHOD_BNPL_INVOICE => $this->requestHelper->getConfigParam('mode', PayoneConfig::METHOD_BNPL_INVOICE, 'payone_payment') == 'live' ? 'p' : 't', PayoneConfig::METHOD_BNPL_INSTALLMENT => $this->requestHelper->getConfigParam('mode', PayoneConfig::METHOD_BNPL_INSTALLMENT, 'payone_payment') == 'live' ? 'p' : 't', + PayoneConfig::METHOD_BNPL_DEBIT => $this->requestHelper->getConfigParam('mode', PayoneConfig::METHOD_BNPL_DEBIT, 'payone_payment') == 'live' ? 'p' : 't', ], 'mid' => [ PayoneConfig::METHOD_BNPL_INVOICE => $this->paymentHelper->getCustomConfigParam('mid', PayoneConfig::METHOD_BNPL_INVOICE), PayoneConfig::METHOD_BNPL_INSTALLMENT => $this->paymentHelper->getCustomConfigParam('mid', PayoneConfig::METHOD_BNPL_INSTALLMENT), + PayoneConfig::METHOD_BNPL_DEBIT => $this->paymentHelper->getCustomConfigParam('mid', PayoneConfig::METHOD_BNPL_DEBIT), ], 'differentAddressAllowed' => [ PayoneConfig::METHOD_BNPL_INVOICE => (bool)$this->requestHelper->getConfigParam('different_address_allowed', PayoneConfig::METHOD_BNPL_INVOICE, 'payment'), PayoneConfig::METHOD_BNPL_INSTALLMENT => (bool)$this->requestHelper->getConfigParam('different_address_allowed', PayoneConfig::METHOD_BNPL_INSTALLMENT, 'payment'), + PayoneConfig::METHOD_BNPL_DEBIT => (bool)$this->requestHelper->getConfigParam('different_address_allowed', PayoneConfig::METHOD_BNPL_DEBIT, 'payment'), ], 'payla_partner_id' => BNPLBase::BNPL_PARTNER_ID, 'uuid' => $this->getUUID(), diff --git a/Model/Methods/BNPL/BNPLBase.php b/Model/Methods/BNPL/BNPLBase.php index 5ce8ac8c..f99da182 100644 --- a/Model/Methods/BNPL/BNPLBase.php +++ b/Model/Methods/BNPL/BNPLBase.php @@ -83,7 +83,6 @@ class BNPLBase extends PayoneMethod 'dateofbirth', 'telephone', 'iban', - 'bankaccountholder', 'installmentOption', 'optionid', ]; @@ -254,4 +253,29 @@ public function assignData(DataObject $data) return $this; } + + /** + * Perform certain actions with the response + * + * @param array $aResponse + * @param Order $oOrder + * @param float $amount + * @return array + */ + protected function handleResponse($aResponse, Order $oOrder, $amount) + { + if (isset($aResponse['status']) && $aResponse['status'] == 'ERROR' && isset($aResponse['errorcode']) && $aResponse['errorcode'] == '307') { + $aBans = $this->checkoutSession->getPayonePaymentBans(); + if (empty($aBans)) { + $aBans = []; + } + + $sBannedUntil = date('Y-m-d H:i:s', (time() + (60 * 60 * 8))); + $aBans[PayoneConfig::METHOD_BNPL_DEBIT] = $sBannedUntil; + $aBans[PayoneConfig::METHOD_BNPL_INSTALLMENT] = $sBannedUntil; + $aBans[PayoneConfig::METHOD_BNPL_INVOICE] = $sBannedUntil; + $this->checkoutSession->setPayonePaymentBans($aBans); + } + return $aResponse; + } } diff --git a/Model/Methods/BNPL/Debit.php b/Model/Methods/BNPL/Debit.php index 5ef338ee..d661b6d6 100644 --- a/Model/Methods/BNPL/Debit.php +++ b/Model/Methods/BNPL/Debit.php @@ -55,9 +55,10 @@ class Debit extends BNPLBase public function getSubTypeSpecificParameters(Order $oOrder) { $oInfoInstance = $this->getInfoInstance(); + $oBilling = $oOrder->getBillingAddress(); $aParams = [ - 'bankaccountholder' => $oInfoInstance->getAdditionalInformation('bankaccountholder'), + 'bankaccountholder' => $oBilling->getFirstname().' '.$oBilling->getLastname(), 'iban' => $oInfoInstance->getAdditionalInformation('iban'), ]; diff --git a/Model/Methods/BNPL/Installment.php b/Model/Methods/BNPL/Installment.php index e8799c22..dc665d5a 100644 --- a/Model/Methods/BNPL/Installment.php +++ b/Model/Methods/BNPL/Installment.php @@ -55,9 +55,10 @@ class Installment extends BNPLBase public function getSubTypeSpecificParameters(Order $oOrder) { $oInfoInstance = $this->getInfoInstance(); + $oBilling = $oOrder->getBillingAddress(); $aParams = [ - 'bankaccountholder' => $oInfoInstance->getAdditionalInformation('bankaccountholder'), + 'bankaccountholder' => $oBilling->getFirstname().' '.$oBilling->getLastname(), 'iban' => $oInfoInstance->getAdditionalInformation('iban'), 'add_paydata[installment_option_id]' => $oInfoInstance->getAdditionalInformation('optionid'), 'workorderid' => $this->checkoutSession->getInstallmentWorkorderId(), diff --git a/Model/Plugins/MethodList.php b/Model/Plugins/MethodList.php index 6d1862bd..01f9a8dc 100644 --- a/Model/Plugins/MethodList.php +++ b/Model/Plugins/MethodList.php @@ -196,11 +196,11 @@ protected function getBannedPaymentMethods(Quote $oQuote) $aBans = []; if (!empty($oQuote->getCustomerId())) { $aBans = $this->paymentBan->getPaymentBans($oQuote->getCustomerId()); - } else { // guest checkout - $aSessionBans = $this->checkoutSession->getPayonePaymentBans(); - if (!empty($aSessionBans)) { - $aBans = $aSessionBans; - } + } + + $aSessionBans = $this->checkoutSession->getPayonePaymentBans(); + if (!empty($aSessionBans)) { + $aBans = array_merge($aBans, $aSessionBans); } return $aBans; } @@ -214,11 +214,11 @@ protected function getBannedPaymentMethods(Quote $oQuote) */ protected function removeBannedPaymentMethods($aPaymentMethods, Quote $oQuote) { - $aBannedMethos = $this->getBannedPaymentMethods($oQuote); + $aBannedMethods = $this->getBannedPaymentMethods($oQuote); foreach ($aPaymentMethods as $key => $aPaymentMethod) { $sCode = $aPaymentMethod->getCode(); - if (array_key_exists($sCode, $aBannedMethos) !== false) { - $iBannedUntil = strtotime($aBannedMethos[$sCode]); + if (array_key_exists($sCode, $aBannedMethods) !== false) { + $iBannedUntil = strtotime($aBannedMethods[$sCode]); if ($iBannedUntil > time()) { unset($aPaymentMethods[$key]); } diff --git a/Test/Unit/Block/BNPL/InstallmentPlanTest.php b/Test/Unit/Block/BNPL/InstallmentPlanTest.php index a93b6f68..b557d7b0 100644 --- a/Test/Unit/Block/BNPL/InstallmentPlanTest.php +++ b/Test/Unit/Block/BNPL/InstallmentPlanTest.php @@ -86,7 +86,7 @@ public function testGetSelectLinkText() 'number_of_payments' => '12', 'monthly_amount_value' => '500', ]; - $expected = '5,00 EUR per month - 12 installments'; + $expected = 'Payment in 12 installments of 5,00 EUR'; $result = $this->classToTest->getSelectLinkText($aInstallment); $this->assertEquals($expected, $result); } diff --git a/Test/Unit/Model/Methods/BNPL/DebitTest.php b/Test/Unit/Model/Methods/BNPL/DebitTest.php index 42766932..d7dbe5c4 100644 --- a/Test/Unit/Model/Methods/BNPL/DebitTest.php +++ b/Test/Unit/Model/Methods/BNPL/DebitTest.php @@ -62,7 +62,12 @@ protected function setUp(): void public function testGetSubTypeSpecificParameters() { + $address = $this->getMockBuilder(Address::class)->disableOriginalConstructor()->getMock(); + $address->method('getFirstname')->willReturn('Max'); + $address->method('getLastname')->willReturn('Mustermann'); + $order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); + $order->method('getBillingAddress')->willReturn($address); $result = $this->classToTest->getSubTypeSpecificParameters($order); $this->assertCount(2, $result); diff --git a/Test/Unit/Model/Methods/BNPL/InstallmentTest.php b/Test/Unit/Model/Methods/BNPL/InstallmentTest.php index e900885b..68b66f16 100644 --- a/Test/Unit/Model/Methods/BNPL/InstallmentTest.php +++ b/Test/Unit/Model/Methods/BNPL/InstallmentTest.php @@ -63,8 +63,13 @@ protected function setUp(): void $store = $this->getMockBuilder(Store::class)->disableOriginalConstructor()->getMock(); $store->method('getCode')->willReturn('test'); + $address = $this->getMockBuilder(Address::class)->disableOriginalConstructor()->getMock(); + $address->method('getFirstname')->willReturn('Max'); + $address->method('getLastname')->willReturn('Mustermann'); + $this->order = $this->getMockBuilder(Order::class)->disableOriginalConstructor()->getMock(); $this->order->method('getStore')->willReturn($store); + $this->order->method('getBillingAddress')->willReturn($address); $toolkitHelper = $this->getMockBuilder(Toolkit::class)->disableOriginalConstructor()->getMock(); $toolkitHelper->method('getAdditionalDataEntry')->willReturn("value"); diff --git a/Test/Unit/Model/Plugins/MethodListTest.php b/Test/Unit/Model/Plugins/MethodListTest.php index f193c270..53297179 100644 --- a/Test/Unit/Model/Plugins/MethodListTest.php +++ b/Test/Unit/Model/Plugins/MethodListTest.php @@ -134,15 +134,18 @@ public function testAfterGetAvailableMethodsPreviousCheck() $subject = $this->getMockBuilder(MethodList::class)->disableOriginalConstructor()->getMock(); + $paymentBanned = $this->getMockBuilder(MethodInterface::class)->disableOriginalConstructor()->getMock(); + $paymentBanned->method('getCode')->willReturn(PayoneConfig::METHOD_DEBIT); + $payment = $this->getMockBuilder(MethodInterface::class)->disableOriginalConstructor()->getMock(); - $payment->method('getCode')->willReturn(PayoneConfig::METHOD_DEBIT); - $paymentMethods = [$payment]; + $payment->method('getCode')->willReturn(PayoneConfig::METHOD_CASH_ON_DELIVERY); + $paymentMethods = [$paymentBanned, $payment]; $this->quote->method('getCustomerId')->willReturn('5'); $this->paymentBan->method('getPaymentBans')->willReturn([]); $result = $this->classToTest->afterGetAvailableMethods($subject, $paymentMethods, $this->quote); - $this->assertInstanceOf(MethodInterface::class, $result[0]); + $this->assertInstanceOf(MethodInterface::class, array_shift($result)); } public function testAfterGetAvailableMethods() diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 35a49006..7a4ff3d2 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -1084,19 +1084,24 @@ "Accountholder","Kontoinhaber" "Check installment availability","Ratenkauf Verfügbarkeit prüfen" "Please select your desired number of installments","Bitte wählen Sie Ihre gewünschte Anzahl von Raten" +"Select the number of installments","Wählen Sie die Anzahl der Raten" "Overview","Übersicht" -"No. of installments:","Anzahl von Raten:" +"No. of installments:","Ratenanzahl:" "Financingamount:","Finanzierungsbetrag:" "Total:","Gesamt:" "Interest rate:","Zinssatz:" "Effective interest rate:","Effektivzinssatz:" "Monthly installment:","Monatliche Rate:" "Download Installment-Contract-Draft","Ratenkauf Mustervertrag herunterladen" +"Download installment information","Ratenkauf Informationen herunterladen" "per month","pro Monat" "installments","Raten" "Installment","Rate" "due","fällig" +"Payment in","Bezahlung in" +"installments of","Raten je" + "Use Klarna","Klarna verwenden" "Installment Draft Username","Ratenkauf Muster Benutzername" diff --git a/view/frontend/web/css/payone.css b/view/frontend/web/css/payone.css index 319396b9..68681141 100644 --- a/view/frontend/web/css/payone.css +++ b/view/frontend/web/css/payone.css @@ -36,3 +36,7 @@ .payoneClear { clear:both; } + +.payoneBNPLselector { + margin-bottom:0.7em; +} diff --git a/view/frontend/web/js/model/error-processor-mixin.js b/view/frontend/web/js/model/error-processor-mixin.js index b0af607b..ee0da8bf 100644 --- a/view/frontend/web/js/model/error-processor-mixin.js +++ b/view/frontend/web/js/model/error-processor-mixin.js @@ -41,7 +41,7 @@ define( ], function(methodList, quote) { targetModule.disablePaymentType = function (sPaymentType) { $('INPUT#' + sPaymentType).parents('.payment-method').find('.action.checkout').prop( "disabled", true ); - $('INPUT#' + sPaymentType).parents('.payment-method').delay(5000).fadeOut(2000, function() { + $('INPUT#' + sPaymentType).parents('.payment-method').delay(3000).fadeOut(2000, function() { $('INPUT#' + sPaymentType).parents('.payment-method').remove(); }); }; @@ -60,6 +60,12 @@ define( if(response.responseJSON.message.indexOf('307 -') !== -1 && quote.paymentMethod().method.indexOf('payone_ratepay') !== -1) { targetModule.disablePaymentType(quote.paymentMethod().method); } + if(response.responseJSON.message.indexOf('307 -') !== -1 && quote.paymentMethod().method.indexOf('payone_bnpl_') !== -1) { + // Hide all BNPL methods + targetModule.disablePaymentType('payone_bnpl_invoice'); + targetModule.disablePaymentType('payone_bnpl_installment'); + targetModule.disablePaymentType('payone_bnpl_debit'); + } } return origReturn; }); diff --git a/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js b/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js index 9e617bee..ee951b32 100644 --- a/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/bnpl_debit-method.js @@ -36,7 +36,6 @@ define( birthmonth: '', birthyear: '', telephone: '', - bankaccountholder: '', iban: '' }, initObservable: function () { @@ -46,14 +45,12 @@ define( 'birthmonth', 'birthyear', 'telephone', - 'bankaccountholder', 'iban' ]); return this; }, getData: function () { var parentReturn = this._super(); - parentReturn.additional_data.bankaccountholder = this.bankaccountholder(); parentReturn.additional_data.iban = this.getCleanedNumber(this.iban()); return parentReturn; }, @@ -62,10 +59,6 @@ define( if (parentReturn === false) { return parentReturn; } - if (this.bankaccountholder() == '') { - this.messageContainer.addErrorMessage({'message': $t('Please enter your bank account holder information.')}); - return false; - } if (this.iban() == '') { this.messageContainer.addErrorMessage({'message': $t('Please enter a valid IBAN.')}); return false; diff --git a/view/frontend/web/js/view/payment/method-renderer/bnpl_installment-method.js b/view/frontend/web/js/view/payment/method-renderer/bnpl_installment-method.js index c6008bf8..3ed5bb40 100644 --- a/view/frontend/web/js/view/payment/method-renderer/bnpl_installment-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/bnpl_installment-method.js @@ -39,7 +39,6 @@ define( birthmonth: '', birthyear: '', telephone: '', - bankaccountholder: '', iban: '', optionid: '' }, @@ -51,7 +50,6 @@ define( 'birthyear', 'telephone', 'telephone', - 'bankaccountholder', 'iban', 'optionid' ]); @@ -87,7 +85,6 @@ define( getData: function () { var parentReturn = this._super(); parentReturn.additional_data.optionid = this.optionid(); - parentReturn.additional_data.bankaccountholder = this.bankaccountholder(); parentReturn.additional_data.iban = this.getCleanedNumber(this.iban()); return parentReturn; }, @@ -96,10 +93,6 @@ define( if (parentReturn === false) { return parentReturn; } - if (this.bankaccountholder() == '') { - this.messageContainer.addErrorMessage({'message': $t('Please enter your bank account holder information.')}); - return false; - } if (this.iban() == '') { this.messageContainer.addErrorMessage({'message': $t('Please enter a valid IBAN.')}); return false; diff --git a/view/frontend/web/template/payment/bnpl_debit.html b/view/frontend/web/template/payment/bnpl_debit.html index 7c41a31d..991bdd7f 100644 --- a/view/frontend/web/template/payment/bnpl_debit.html +++ b/view/frontend/web/template/payment/bnpl_debit.html @@ -99,21 +99,6 @@ -
- -
- -
-
- -
- -
- -
-