diff --git a/src/Frontend/NetzkollektivEasyCredit/Api/QuoteBuilder.php b/src/Frontend/NetzkollektivEasyCredit/Api/QuoteBuilder.php index e6eaa7c..3499245 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Api/QuoteBuilder.php +++ b/src/Frontend/NetzkollektivEasyCredit/Api/QuoteBuilder.php @@ -1,7 +1,6 @@ $this->helper->getPaymentType($this->helper->getSelectedPayment()), + 'paymentSwitchPossible' => count($this->helper->getActivePaymentMethods()) > 1, // Switch between installment & bill payment should be possible if both methods are enabled 'financingTerm' => $this->getDuration(), 'orderDetails' => new \Teambank\RatenkaufByEasyCreditApiV3\Model\OrderDetails([ 'orderValue' => $this->getGrandTotal(), @@ -164,16 +165,22 @@ public function build(): Transaction { 'shippingAddress' => $this->isExpress() ? null : $this->getShippingAddress(), 'shoppingCartInformation' => $this->getItems(), 'withoutFlexprice' => (new \EasyCredit_FlexpriceService())->shouldDisableFlexprice() - ]), + ]), 'shopsystem' => $this->getSystem(), 'customer' => $this->getCustomer()->build(), 'customerRelationship' => new \Teambank\RatenkaufByEasyCreditApiV3\Model\CustomerRelationship([ 'customerSince' => ($this->getCustomer()->getCreatedAt() instanceof \DateTime) ? $this->getCustomer()->getCreatedAt()->format('Y-m-d') : null, 'orderDoneWithLogin' => $this->getCustomer()->isLoggedIn(), 'numberOfOrders' => $this->getCustomer()->getOrderCount(), - 'logisticsServiceProvider' => $this->getShippingMethod() + 'logisticsServiceProvider' => $this->getShippingMethod() ]), 'redirectLinks' => $this->getRedirectLinks() ]); + + $transaction = $this->helper->getContainer() + ->get('events') + ->filter('NetzkollektivEasyCredit_Api_QuoteBuilder_Transaction', $transaction, ['subject' => $this]); + + return $transaction; } } diff --git a/src/Frontend/NetzkollektivEasyCredit/Bootstrap.php b/src/Frontend/NetzkollektivEasyCredit/Bootstrap.php index 81c8443..5fd9765 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Bootstrap.php +++ b/src/Frontend/NetzkollektivEasyCredit/Bootstrap.php @@ -22,7 +22,7 @@ class Shopware_Plugins_Frontend_NetzkollektivEasyCredit_Bootstrap public function getLabel() { - return 'easyCredit-Ratenkauf'; + return 'easyCredit'; } public function getVersion() @@ -78,6 +78,7 @@ public function update($version) $this->_createMenuItem(); $this->_createAttributes(); $this->_applyBrandRelaunch(); + $this->_applyBillPaymentMigration(); return array( 'success' => true, @@ -103,8 +104,7 @@ public function afterInit() */ public function enable() { - $payment = $this->getPayment(); - if ($payment !== null) { + foreach ($this->getPaymentMethods() as $payment) { $payment->setActive(true); $this->get('models')->flush($payment); } @@ -125,12 +125,11 @@ public function updateSpecialFieldTypes($type = 'easycreditIntro') { public function disable() { - $payment = $this->getPayment(); - if ($payment !== null) { + foreach ($this->getPaymentMethods() as $payment) { $payment->setActive(false); $this->get('models')->flush($payment); - $this->updateSpecialFieldTypes('button'); } + $this->updateSpecialFieldTypes('button'); return array( 'success' => true, @@ -270,23 +269,36 @@ public function registerTemplateDir($viewDir = 'Views') { $template->addTemplateDir($this->Path() . $viewDir.'/'); } - protected $paymentsCache = null; - public function getPayment() + protected $paymentMethodsCache = null; + + public function getPaymentMethods() { - if (null === $this->paymentsCache) { - $this->paymentsCache = $this->Payments()->findOneBy( - array('name' => 'easycredit') + if (null === $this->paymentMethodsCache) { + $this->paymentMethodsCache = $this->Payments()->findBy( + ['class' => 'easycredit'] ); } - return $this->paymentsCache; + return $this->paymentMethodsCache; } protected function _createPayment() { $this->createPayment( array( - 'name' => self::PAYMENT_NAME, - 'description' => $this->getLabel(), + 'name' => self::PAYMENT_NAME.'_ratenkauf', + 'description' => 'easyCredit-Ratenkauf', + 'action' => 'payment_easycredit', + 'active' => 0, + 'position' => 0, + 'additionalDescription' => '', + 'template' => 'easycredit.tpl', + 'class' => 'easycredit', + ) + ); + $this->createPayment( + array( + 'name' => self::PAYMENT_NAME.'_rechnung', + 'description' => 'easyCredit-Rechnung', 'action' => 'payment_easycredit', 'active' => 0, 'position' => 0, @@ -306,7 +318,7 @@ protected function _createMenuItem() $this->createMenuItem( array( - 'label' => 'easyCredit-Ratenkauf', + 'label' => 'easyCredit', 'controller' => 'EasycreditMerchant', 'action' => 'Index', 'class' => 'easycredit--icon', @@ -372,6 +384,20 @@ public function _applyBrandRelaunch() { "); } + public function _applyBillPaymentMigration() + { + Shopware()->Db()->query(" + UPDATE s_core_plugins Set description = REPLACE(description, 'easyCredit-Ratenkauf','easyCredit') WHERE name = 'NetzkollektivEasyCredit'; + UPDATE s_core_config_forms Set + description = REPLACE(description, 'easyCredit-Ratenkauf','easyCredit'), + label = REPLACE(label, 'easyCredit-Ratenkauf','easyCredit') + WHERE name = 'NetzkollektivEasyCredit'; + + /* UPDATE menu item in backend */ + + "); + } + public function getCheckout() { return $this->get('easyCreditCheckout'); } @@ -421,11 +447,15 @@ public function isResponsive() { public function isSelected($paymentId = null) { if ($paymentId == null) { - $helper = new \EasyCredit_Helper(); - $user = $helper->getUser(); - $paymentId = $user['additional']['payment']['id']; + $paymentId = (new \EasyCredit_Helper())->getSelectedPayment(); + } + + foreach ($this->getPaymentMethods() as $payment) { + if ($payment->getId() === (int)$paymentId) { + return true; + } } - return $paymentId == $this->getPayment()->getId(); + return false; } public function addInterest($refresh = true) { diff --git a/src/Frontend/NetzkollektivEasyCredit/Components/BackendFormBuilder.php b/src/Frontend/NetzkollektivEasyCredit/Components/BackendFormBuilder.php index 9009307..30d712c 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Components/BackendFormBuilder.php +++ b/src/Frontend/NetzkollektivEasyCredit/Components/BackendFormBuilder.php @@ -67,7 +67,7 @@ public function build ($form) { 'required' => false, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, 'stripCharsRe' => ' ', - 'description' => 'Die API Signatur sichert die Datenübertragung gegen Datenmanipulation von Dritten ab. Sie können die API-Signatur im easyCredit-Ratenkauf Partnerportal aktivieren.', + 'description' => 'Die API Signatur sichert die Datenübertragung gegen Datenmanipulation von Dritten ab. Sie können die API-Signatur im easyCredit Partnerportal aktivieren.', 'position' => $position++ ) ); @@ -168,7 +168,7 @@ public function build ($form) { 'label' => '„Lieferung melden“ automatisch durchführen?', 'value' => false, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Bei Aktivierung dieser Option wird die Lieferung bei dem in der folgenden Option eingestellten Bestellstatus automatisch an easyCredit-Ratenkauf übermittelt.', + 'description' => 'Bei Aktivierung dieser Option wird die Lieferung bei dem in der folgenden Option eingestellten Bestellstatus automatisch an easyCredit übermittelt.', 'position' => $position++ ) ); @@ -194,7 +194,7 @@ public function build ($form) { 'label' => 'Rückabwicklung automatisch durchführen?', 'value' => false, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Bei Aktivierung dieser Option wird die Rückabwicklung bei dem in der folgenden Option eingestellten Bestellstatus automatisch an easyCredit-Ratenkauf übermittelt.', + 'description' => 'Bei Aktivierung dieser Option wird die Rückabwicklung bei dem in der folgenden Option eingestellten Bestellstatus automatisch an easyCredit übermittelt.', 'position' => $position++ ) ); @@ -243,7 +243,7 @@ public function build ($form) { 'label' => 'Zeige Express-Button auf Detailseite', 'value' => true, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Steigern Sie ihre Conversion, indem Sie Kunden ermöglichen mit dem easyCredit-Ratenkauf direkt von der Produktseite aus zu bezahlen.', + 'description' => 'Steigern Sie ihre Conversion, indem Sie Kunden ermöglichen mit easyCredit direkt von der Produktseite aus zu bezahlen.', 'position' => $position++ ) ); @@ -255,7 +255,7 @@ public function build ($form) { 'label' => 'Zeige Express-Button im Warenkorb', 'value' => true, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Steigern Sie ihre Conversion, indem Sie Kunden ermöglichen mit dem easyCredit-Ratenkauf direkt aus dem Warenkorb zu bezahlen.', + 'description' => 'Steigern Sie ihre Conversion, indem Sie Kunden ermöglichen mit easyCredit direkt aus dem Warenkorb heraus zu bezahlen.', 'position' => $position++ ) ); @@ -267,7 +267,7 @@ public function build ($form) { 'label' => 'Zeige Express-Button im Off-Canvas Warenkorb', 'value' => true, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Steigern Sie ihre Conversion, indem Sie Kunden ermöglichen mit dem easyCredit-Ratenkauf direkt aus dem Off-Canvas Warenkorb zu bezahlen.', + 'description' => 'Steigern Sie ihre Conversion, indem Sie Kunden ermöglichen mit easyCredit direkt aus dem Off-Canvas Warenkorb zu bezahlen.', 'position' => $position++ ) ); @@ -290,7 +290,7 @@ public function build ($form) { 'label' => 'Zeige Ratenrechner-Widget neben Produktpreis', 'value' => true, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Für den größten Erfolg mit dem easyCredit-Ratenkauf empfehlen wir, das Widget zu aktivieren.', + 'description' => 'Für den größten Erfolg mit easyCredit empfehlen wir, das Widget zu aktivieren.', 'position' => $position++ ) ); @@ -302,7 +302,7 @@ public function build ($form) { 'label' => 'Zeige Ratenrechner-Widget im Warenkorb', 'value' => true, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Für den größten Erfolg mit dem easyCredit-Ratenkauf empfehlen wir, das Widget zu aktivieren.', + 'description' => 'Für den größten Erfolg mit easyCredit empfehlen wir, das Widget zu aktivieren.', 'position' => $position++ ) ); @@ -314,7 +314,7 @@ public function build ($form) { 'label' => 'Zeige Ratenrechner-Widget im Off-Canvas Warenkorb', 'value' => true, 'scope' => \Shopware\Models\Config\Element::SCOPE_SHOP, - 'description' => 'Für den größten Erfolg mit dem easyCredit-Ratenkauf empfehlen wir, das Widget zu aktivieren.', + 'description' => 'Für den größten Erfolg mit easyCredit empfehlen wir, das Widget zu aktivieren.', 'position' => $position++ ) ); diff --git a/src/Frontend/NetzkollektivEasyCredit/Components/CustomerService.php b/src/Frontend/NetzkollektivEasyCredit/Components/CustomerService.php index fc5a610..9524c32 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Components/CustomerService.php +++ b/src/Frontend/NetzkollektivEasyCredit/Components/CustomerService.php @@ -55,20 +55,22 @@ public function createCustomer(TransactionInformation $transaction) 'country' => $countryId, 'state' => null, 'phone' => $contact->getMobilePhoneNumber(), - ]); + ], $transaction); return $customerModel; } /** * @return Customer */ - private function registerCustomer(array $customerData) + private function registerCustomer(array $customerData, TransactionInformation $transaction) { $customer = new Customer(); $personalForm = $this->formFactory->create(PersonalFormType::class, $customer); $personalForm->submit($customerData); - $customer->setPaymentId($this->helper->getPayment()->getId()); + $customer->setPaymentId($this->helper->getMethodByPaymentType( + $transaction->getTransaction()->getPaymentType() + )->getId()); $address = new Address(); $addressForm = $this->formFactory->create(AddressFormType::class, $address); diff --git a/src/Frontend/NetzkollektivEasyCredit/Components/Helper.php b/src/Frontend/NetzkollektivEasyCredit/Components/Helper.php index 6aaee94..9f22639 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Components/Helper.php +++ b/src/Frontend/NetzkollektivEasyCredit/Components/Helper.php @@ -31,8 +31,21 @@ public function getEntityManager() { return $this->container->get('models'); } - public function getPayment () { - return $this->getPlugin()->getPayment(); + public function getPaymentMethods () { + return $this->getPlugin()->getPaymentMethods(); + } + + public function getPaymentMethodIds () { + return array_map(function ($payment) { + return $payment->getId(); + }, $this->getPaymentMethods()); + } + + public function getActivePaymentMethods() + { + return array_filter($this->getPaymentMethods(), function ($payment) { + return $payment->getActive(); + }); } protected function getVariable($var, $module) { @@ -56,4 +69,42 @@ public function getUser() { public function getSelectedDispatch() { return Shopware()->Front()->Plugins()->ViewRenderer()->Action()->View()->getAssign('sDispatch'); } + + public function getSelectedPayment() + { + if ($paymentId = $this->getSession()->offsetGet('sPaymentID')) { + return $paymentId; + } + if ($paymentId = $this->getUser()['additional']['payment']['id']) { + return $paymentId; + } + } + + public function getPaymentType($paymentId) { + $methods = $this->getPaymentMethods(); + foreach ($methods as $method) { + if ($method->getId() !== (int) $paymentId) { + continue; + } + + if ($method->getName() == 'easycredit_ratenkauf') { + return 'INSTALLMENT_PAYMENT'; + } + if ($method->getName() == 'easycredit_rechnung') { + return 'BILL_PAYMENT'; + } + } + } + + public function getMethodByPaymentType($paymentType) { + return current(array_filter($this->getPaymentMethods(), function ($payment) use ($paymentType) { + $type = $this->getPaymentType($payment->getId()); + if ($paymentType === $type || + $paymentType === str_replace('_PAYMENT', '', $type) + ) { + return true; + } + return false; + })); + } } diff --git a/src/Frontend/NetzkollektivEasyCredit/Controllers/Backend/EasycreditMerchant.php b/src/Frontend/NetzkollektivEasyCredit/Controllers/Backend/EasycreditMerchant.php index a57cb5e..2d31cd2 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Controllers/Backend/EasycreditMerchant.php +++ b/src/Frontend/NetzkollektivEasyCredit/Controllers/Backend/EasycreditMerchant.php @@ -1,5 +1,6 @@ getPayment()->getId(); $builder->innerJoin( 'sOrder.payment', 'payment', Join::WITH, - 'payment.id = :paymentId' - )->setParameter('paymentId', $paymentId, \PDO::PARAM_INT); + $builder->expr()->in('payment.id', ':paymentIds') + ); + $builder->setParameter('paymentIds', $helper->getPaymentMethodIds(), Connection::PARAM_INT_ARRAY); $builder->leftJoin('sOrder.languageSubShop', 'languageSubShop') ->leftJoin('sOrder.customer', 'customer') @@ -205,4 +206,3 @@ class Shopware_Controllers_Backend_EasycreditMerchant extends Shopware_Controlle } } - diff --git a/src/Frontend/NetzkollektivEasyCredit/Controllers/Frontend/PaymentEasycredit.php b/src/Frontend/NetzkollektivEasyCredit/Controllers/Frontend/PaymentEasycredit.php index 98944a3..84d7796 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Controllers/Frontend/PaymentEasycredit.php +++ b/src/Frontend/NetzkollektivEasyCredit/Controllers/Frontend/PaymentEasycredit.php @@ -1,11 +1,6 @@ helper->getPluginSession()["transaction_id"]; - $paymentUniqueId = $this->createPaymentUniqueId(); + try { + $transactionId = $this->helper->getPluginSession()["transaction_id"]; + $paymentUniqueId = $this->createPaymentUniqueId(); - $orderNumber = $this->saveOrder($transactionId, $paymentUniqueId, null, false); - $orderId = $this->getOrderId($transactionId, $paymentUniqueId); + $orderNumber = $this->saveOrder($transactionId, $paymentUniqueId, null, false); + $orderId = $this->getOrderId($transactionId, $paymentUniqueId); - $this->saveOrderAttributes($orderId); + $this->saveOrderAttributes($orderId); - try { $checkout = $this->container->get('easyCreditCheckout'); if (!$checkout->authorize($orderNumber)) { throw new \Exception('The transaction could not be authorized.'); @@ -103,7 +98,7 @@ public function indexAction() $this->order->setOrderStatus($orderId, $orderStatusId, true, $e->getMessage()); $this->container->get('pluginlogger')->error($e->getMessage()); - $this->helper->getPlugin()->getStorage()->set('apiError', 'Die Zahlung mit easyCredit-Ratenkauf konnte auf Grund eines Fehlers nicht abgeschlossen werden. Bitte probieren Sie es erneut oder kontaktieren Sie den Händler.'); + $this->helper->getPlugin()->getStorage()->set('apiError', 'Die Zahlung mit easyCredit konnte auf Grund eines Fehlers nicht abgeschlossen werden. Bitte probieren Sie es erneut oder kontaktieren Sie den Händler.'); $this->helper->getPlugin()->getStorage()->set('apiErrorSkipSuffix', true); $this->redirect(array( 'controller' => 'checkout', @@ -115,10 +110,25 @@ public function indexAction() public function returnAction() { - $checkout = $this->container->get('easyCreditCheckout'); try { + $checkout = $this->container->get('easyCreditCheckout'); $transaction = $checkout->loadTransaction(); $approved = $checkout->isApproved(); + + if (!$approved) { + throw new \Exception('easyCredit-Ratenkauf wurde nicht genehmigt.'); + } + + if ($this->helper->getPlugin()->getStorage()->get('express')) { + $customerService = new EasyCredit_CustomerService(); + $customer = $customerService->createCustomer($transaction); + $customerService->loginCustomer($customer); + } + + $this->updatePaymentMethod($transaction->getTransaction()->getPaymentType()); + + $this->helper->getPlugin()->addInterest(); + $this->redirectCheckoutConfirm(); } catch (Exception $e) { $this->helper->getPlugin()->getStorage()->set('apiError', $e->getMessage()); $this->_redirToPaymentSelection(); @@ -150,6 +160,19 @@ public function createOrder($transaction) $customerService->createCustomer($transaction); } + protected function updatePaymentMethod($paymentType) + { + $paymentMethod = $this->helper->getMethodByPaymentType( + $paymentType + ); + if (!$paymentMethod->getActive()) { + throw new \Exception($paymentMethod->getDescription(). ' ist derzeit nicht verfügbar. Bitte wählen Sie eine andere Zahlungsart.'); + } + file_put_contents('/tmp/bla', 'setting paymentId '. $paymentMethod->getId().PHP_EOL,FILE_APPEND); + $this->session->offsetSet('sPaymentID', $paymentMethod->getId()); + $this->getModule('admin')->sUpdatePayment($paymentMethod->getId()); + } + public function cancelAction() { $this->_redirToPaymentSelection(); @@ -165,24 +188,23 @@ public function expressAction() $this->Front()->Plugins()->ViewRenderer()->setNoRender(); $basket = $this->getModule('basket'); - if ($productNumber = $this->Request()->getParam('sAdd')) { $basket->sDeleteBasket(); $basket->sAddArticle($productNumber, (int) $this->Request()->getParam('sQuantity', 1)); } - /** @var sAdmin $admin */ - $admin = $this->getModule('admin'); - - $this->session->offsetSet('sPaymentID', $this->helper->getPayment()->getId()); - $admin->sUpdatePayment($this->helper->getPayment()->getId()); + $this->updatePaymentMethod( + $this->Request()->getParam('easycredit')['paymentType'] + ); $checkoutController = $this->getCheckoutController(); $checkoutController->getSelectedCountry(); $checkoutController->getSelectedDispatch(); + /** @var sAdmin $admin */ + $admin = $this->getModule('admin'); $countries = $admin->sGetCountryList(); - $shipping = $admin->sGetPremiumShippingcosts(\reset($countries)); + $admin->sGetPremiumShippingcosts(\reset($countries)); $basket->sGetBasket(); diff --git a/src/Frontend/NetzkollektivEasyCredit/Snippets/backend/easycredit_merchant/view/main/window.ini b/src/Frontend/NetzkollektivEasyCredit/Snippets/backend/easycredit_merchant/view/main/window.ini index 6438142..9ebd126 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Snippets/backend/easycredit_merchant/view/main/window.ini +++ b/src/Frontend/NetzkollektivEasyCredit/Snippets/backend/easycredit_merchant/view/main/window.ini @@ -1,5 +1,5 @@ [en_GB] -window/title = "easyCredit-Ratenkauf" +window/title = "easyCredit" [de_DE] -window/title = "easyCredit-Ratenkauf" +window/title = "easyCredit" diff --git a/src/Frontend/NetzkollektivEasyCredit/Subscriber/Backend.php b/src/Frontend/NetzkollektivEasyCredit/Subscriber/Backend.php index c881a14..d05f5ee 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Subscriber/Backend.php +++ b/src/Frontend/NetzkollektivEasyCredit/Subscriber/Backend.php @@ -52,8 +52,8 @@ public function handleMerchantStatusChangedError(\Enlight_Event_EventArgs $args) public function preventShippingAddressChange(\Enlight_Event_EventArgs $args) { $_this = $args->get('subject'); - $postData = $_this->Request()->getParams(); + if (isset($postData['payment'][0]['name']) && $postData['payment'][0]['name'] != 'easycredit') { return; } @@ -84,7 +84,7 @@ public function preventShippingAddressChange(\Enlight_Event_EventArgs $args) { $_this->View()->assign(array( 'success' => false, 'data' => $orderData[0], - 'message' => 'Die Lieferadresse kann bei mit easyCredit-Ratenkauf bezahlten Bestellungen nicht im Nachhinein geändert werden. Bitte stornieren Sie die Bestellung und Zahlung hierfür und legen Sie eine neue Bestellung an.' + 'message' => 'Die Lieferadresse kann bei mit easyCredit bezahlten Bestellungen nicht im Nachhinein geändert werden. Bitte stornieren Sie die Bestellung und Zahlung hierfür und legen Sie eine neue Bestellung an.' )); return true; diff --git a/src/Frontend/NetzkollektivEasyCredit/Subscriber/Frontend.php b/src/Frontend/NetzkollektivEasyCredit/Subscriber/Frontend.php index 17062a2..36f1de6 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Subscriber/Frontend.php +++ b/src/Frontend/NetzkollektivEasyCredit/Subscriber/Frontend.php @@ -14,7 +14,7 @@ class Frontend implements SubscriberInterface { - const INTEREST_REMOVED_ERROR = 'Raten müssen neu berechnet werden'; + const INTEREST_REMOVED_ERROR = 'Der Bestellwert hat sich geändert.'; const INTEREST_ORDERNUM = 'sw-payment-ec-interest'; protected $bootstrap; @@ -69,8 +69,8 @@ public function interceptRiskRuleLess(\Enlight_Event_EventArgs $args) { } public function interceptRiskRule(\Enlight_Event_EventArgs $args, $operator) { - if ($args->get('paymentID') != $this->helper->getPayment()->getId()) { // explicitely not !==, paymentId can be string - return null; + if (!in_array((int) $args->get('paymentID'), $this->helper->getPaymentMethodIds())) { + return null; } $order = $args->get('basket'); @@ -195,16 +195,17 @@ public function addEasyCreditModelWidget(\Enlight_Event_EventArgs $arguments) { $sAdmin = $this->helper->getModule('Admin'); - $paymentId = $this->helper->getPayment()->getId(); - $apiKey = $this->config->get('easycreditApiKey'); if ($apiKey) { $view->assign('EasyCreditApiKey', $apiKey); } - $isEasyCreditAllowed = !$sAdmin->sManageRisks($paymentId, $this->helper->getBasket(), $this->helper->getUser() ?: []); + $isEasyCreditForbidden = true; + foreach ($this->helper->getPaymentMethodIds() as $paymentId) { + $isEasyCreditForbidden = $isEasyCreditForbidden && $sAdmin->sManageRisks($paymentId, $this->helper->getBasket(), $this->helper->getUser() ?: []); + } - if ($apiKey && $isEasyCreditAllowed) { + if ($apiKey && !$isEasyCreditForbidden) { $modalIsOpen = 'true'; if ( $this->config->get('easyCreditMarketingModalSettingsDelay') ) { if ( $this->config->get('easyCreditMarketingModalSettingsDelay') > 0 ) { @@ -212,6 +213,10 @@ public function addEasyCreditModelWidget(\Enlight_Event_EventArgs $arguments) { } } + $view->assign('EasyCreditActiveMethods', array_map(function($paymentMethod) { + return $this->helper->getPaymentType($paymentMethod->getId()); + }, $this->helper->getActivePaymentMethods())); + // Express Checkout $view->assign('EasyCreditExpressProduct', $this->config->get('easyCreditExpressProduct')); $view->assign('EasyCreditExpressCart', $this->config->get('easyCreditExpressCart')); @@ -409,7 +414,7 @@ protected function getRedirectUrl() { } catch (ConnectException $e) { $this->container->get('pluginlogger')->error($e->getMessage()); $this->helper->getPlugin()->getStorage() - ->set('apiError', 'easyCredit-Ratenkauf ist im Moment nicht verfügbar. Bitte probieren Sie es erneut oder wählen Sie eine andere Zahlungsart.') + ->set('apiError', 'easyCredit ist im Moment nicht verfügbar. Bitte probieren Sie es erneut oder wählen Sie eine andere Zahlungsart.') ->set('apiErrorSkipSuffix', true); return false; @@ -467,11 +472,12 @@ protected function _extendPaymentTemplate($action, $view) { $view->assign('EasyCreditError', $error); $view->assign('EasyCreditAmount', $this->helper->getPlugin()->getQuote()->getOrderDetails()->getOrderValue()); - $isSelected = $this->helper->getPlugin()->isSelected($view->sUserData['additional']['user']['paymentID']); - $view->assign('EasyCreditIsSelected', ($isSelected) ? 'true' : 'false'); + $view->assign('EasyCreditSelectedPaymentId', $view->sUserData['additional']['user']['paymentID']); $view->assign('EasyCreditPaymentPlan', $this->getPaymentPlan()); $view->assign('EasyCreditDisableFlexprice', (new \EasyCredit_FlexpriceService())->shouldDisableFlexprice()); + $isSelected = $this->helper->getPlugin()->isSelected($view->sUserData['additional']['user']['paymentID']); + if (!$error && $isSelected) { if (isset($this->helper->getPluginSession()["addressError"]) && $this->helper->getPluginSession()["addressError"] diff --git a/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderRefunded.php b/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderRefunded.php index b8daac0..87c0051 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderRefunded.php +++ b/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderRefunded.php @@ -23,7 +23,7 @@ public function _onOrderStatusChanged(PreUpdateEventArgs $eventArgs) { $order = $eventArgs->getEntity(); $transactionId = $order->getTransactionId(); if (empty($transactionId)) { - throw new \Exception('Die zugehörige easyCredit-Ratenkauf Transaktion-ID dieser Bestellung ist nicht vorhanden.'); + throw new \Exception('Die zugehörige easyCredit Transaktion-ID dieser Bestellung ist nicht vorhanden.'); } $merchantClient = Shopware()->Container()->get('easyCreditMerchant'); diff --git a/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderShipped.php b/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderShipped.php index e67b88c..8369024 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderShipped.php +++ b/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderShipped.php @@ -22,7 +22,7 @@ public function _onOrderStatusChanged(PreUpdateEventArgs $eventArgs) { $order = $eventArgs->getEntity(); $txId = $order->getTransactionId(); if (empty($txId)) { - throw new \Exception('Die zugehörige easyCredit-Ratenkauf Transaktion-ID dieser Bestellung ist nicht vorhanden.'); + throw new \Exception('Die zugehörige easyCredit Transaktion-ID dieser Bestellung ist nicht vorhanden.'); } $merchantClient = Shopware()->Container()->get('easyCreditMerchant'); @@ -33,7 +33,7 @@ public function _onOrderStatusChanged(PreUpdateEventArgs $eventArgs) { ); } catch (ApiException $e) { if ($e->getResponseObject() instanceof ConstraintViolation) { - $error = 'easyCredit-Ratenkauf: '; + $error = 'easyCredit: '; foreach ($e->getResponseObject()->getViolations() as $violation) { $error .= $violation->getMessage(); } diff --git a/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderStatusChanged.php b/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderStatusChanged.php index f75a798..f4448fb 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderStatusChanged.php +++ b/src/Frontend/NetzkollektivEasyCredit/Subscriber/OrderStatusChanged.php @@ -25,16 +25,17 @@ protected function handleError ($error) { public function preUpdate(PreUpdateEventArgs $eventArgs) { + $helper = new \EasyCredit_Helper(); + $order = $eventArgs->getEntity(); if (!($order instanceof Order) || !$eventArgs->hasChangedField('orderStatus') || $order->getPayment()->getId() == null - || !$this->get('plugins')->Frontend()->NetzkollektivEasyCredit()->isSelected($order->getPayment()->getId()) + || !$helper->getPlugin()->isSelected($order->getPayment()->getId()) ) { return; } - $orderStatus = $eventArgs->getNewValue('orderStatus')->getId(); if ($this->config($this->getConfigKey()) && $this->config($this->getConfigKey().'Status') == $eventArgs->getNewValue('orderStatus')->getId() ) { diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/images/card-easycredit-rechnung-image.png b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/images/card-easycredit-rechnung-image.png new file mode 100644 index 0000000..dfc18e1 Binary files /dev/null and b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/images/card-easycredit-rechnung-image.png differ diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/images/card-intro-image.png b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/images/card-intro-image.png new file mode 100644 index 0000000..b1bc0c4 Binary files /dev/null and b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/images/card-intro-image.png differ diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css index b164ed1..fc29047 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css @@ -1,11 +1,18 @@ /* Colors - Base */ /* Colors - eC */ +/* Colors - SW5 */ /* Colors - Typo (SW5) */ .base-element-easycreditintro { + --grid-column-gap: 48px; + --grid-column-gap-m: 36px; + --grid-template-columns: 3fr 2fr; + --grid-template-columns-50-50: 1fr 1fr; /* Headings */ /* Typo */ /* Links */ /* Buttons */ + /* Badges */ + /* Intro 2024 */ /* Intro */ /* Click & Collect */ /* Marketing */ @@ -18,7 +25,7 @@ /* - Bar */ } .base-element-easycreditintro .x-panel-body { - padding: 0 25px 0 0; + padding: 2px 25px 2px 2px; border: 0; } .base-element-easycreditintro.x-panel.has-tabs { @@ -28,11 +35,11 @@ height: auto !important; } .base-element-easycreditintro h2, .base-element-easycreditintro h3 { - margin-top: 30px; + margin-top: 36px; margin-bottom: 10px; color: #475c6a; font-size: calc(13px * 1.2); - line-height: 1.2; + line-height: 1.3; } .base-element-easycreditintro h2 { scroll-margin-top: 30px; @@ -60,7 +67,7 @@ .base-element-easycreditintro a { color: #0e6bbb; } -.base-element-easycreditintro a[target=_blank]:not(.easycredit-intro__image):after { +.base-element-easycreditintro a[target=_blank]:not(.easycredit-intro__image):not(.btn.btn-primary):not(.btn.btn-secondary):after { content: ""; display: inline-block; margin-left: 0.285em; @@ -76,6 +83,8 @@ } .base-element-easycreditintro .btn { display: inline-block; + margin-bottom: 5px; + margin-right: 10px; padding: 10px 20px; background-color: #0066B3; border: 0; @@ -90,31 +99,56 @@ .base-element-easycreditintro .btn.btn-primary { background-color: #F37122; } -.base-element-easycreditintro .btn:hover, .base-element-easycreditintro .btn:active, .base-element-easycreditintro .btn:focus, .base-element-easycreditintro .btn:visited { - background-color: #0066B3 !important; - color: #fff !important; +.base-element-easycreditintro .btn.btn-link { + background-color: transparent; + padding-left: 0; + padding-right: 0; + color: #0066B3 !important; } -.base-element-easycreditintro .btn:hover.btn-primary, .base-element-easycreditintro .btn:active.btn-primary, .base-element-easycreditintro .btn:focus.btn-primary, .base-element-easycreditintro .btn:visited.btn-primary { - background-color: #F37122 !important; +.base-element-easycreditintro .btn:not(.btn-link):hover, .base-element-easycreditintro .btn:not(.btn-link):active, .base-element-easycreditintro .btn:not(.btn-link):focus, .base-element-easycreditintro .btn:not(.btn-link):visited { + background-color: #00579a !important; + color: #fff !important; } -.base-element-easycreditintro .btn:hover.btn-primary { +.base-element-easycreditintro .btn:not(.btn-link):hover.btn-primary, .base-element-easycreditintro .btn:not(.btn-link):active.btn-primary, .base-element-easycreditintro .btn:not(.btn-link):focus.btn-primary, .base-element-easycreditintro .btn:not(.btn-link):visited.btn-primary { background-color: #ef620d !important; } -.base-element-easycreditintro .btn:active, .base-element-easycreditintro .btn:focus { +.base-element-easycreditintro .btn:not(.btn-link):active, .base-element-easycreditintro .btn:not(.btn-link):focus { + box-shadow: 0 0 0 0.2rem rgba(0, 102, 179, 0.4) !important; +} +.base-element-easycreditintro .btn:not(.btn-link):active.btn-primary, .base-element-easycreditintro .btn:not(.btn-link):focus.btn-primary { box-shadow: 0 0 0 0.2rem rgba(243, 113, 34, 0.4) !important; } -.base-element-easycreditintro .btn:disabled, .base-element-easycreditintro .btn.disabled { +.base-element-easycreditintro .btn:not(.btn-link):disabled, .base-element-easycreditintro .btn:not(.btn-link).disabled { cursor: default; pointer-events: none; + background-color: rgba(0, 102, 179, 0.5) !important; + color: #fff; +} +.base-element-easycreditintro .btn:not(.btn-link):disabled.btn-primary, .base-element-easycreditintro .btn:not(.btn-link).disabled.btn-primary { background-color: rgba(243, 113, 34, 0.5) !important; +} +.base-element-easycreditintro .btn + .btn:last-child { + margin-right: 0; +} +.base-element-easycreditintro .badge { + margin-right: 7.5px; + padding: 2px 5px 2px; + background-color: #002C5A; + border-radius: 10px; + font-size: 11.05px; + font-weight: 600; color: #fff; } +.base-element-easycreditintro .badge + h2 { + margin-top: 5px !important; +} .base-element-easycreditintro .easycredit-intro { - margin-top: 30px; - margin-bottom: 30px; + margin-top: 36px; + margin-bottom: 36px; padding: 35px 30px; background-color: #fff; - border-radius: 15px; + border-radius: 8px; + box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 2px 1px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1); } .base-element-easycreditintro .easycredit-intro h2, .base-element-easycreditintro .easycredit-intro h3, .base-element-easycreditintro .easycredit-intro p, .base-element-easycreditintro .easycredit-intro ul { @@ -175,8 +209,22 @@ } .base-element-easycreditintro .easycredit-intro__grid { display: grid; - grid-template-columns: 3fr 2fr; - grid-column-gap: 48px; + grid-template-columns: var(--grid-template-columns); + grid-column-gap: var(--grid-column-gap); +} +.base-element-easycreditintro .easycredit-intro__grid:has(.intro-2024) { + grid-column-gap: 24px; +} +@media (max-width: 991px) { + .base-element-easycreditintro .easycredit-intro__grid:has(.intro-2024) { + display: block; + } +} +.base-element-easycreditintro .easycredit-intro__grid.grid-50-50 { + grid-template-columns: var(--grid-template-columns-50-50); +} +.base-element-easycreditintro .easycredit-intro__grid:has(.easycredit-intro__image + .easycredit-intro__content) { + grid-column-gap: var(--grid-column-gap-m); } .base-element-easycreditintro .easycredit-intro__tab-content .easycredit-intro__grid { padding-top: 24px; @@ -210,6 +258,58 @@ width: 100%; padding-bottom: 75%; } +.base-element-easycreditintro .easycredit-intro__image.fill { + position: relative; + background-color: #D9DFE6; + background-position: center; + background-repeat: no-repeat; + background-size: cover; + border-radius: 15px; +} +.base-element-easycreditintro .easycredit-intro__image.aspect-2-3:after { + content: ""; + display: block; + width: 100%; + padding-bottom: 150%; +} +.base-element-easycreditintro .easycredit-intro__image.aspect-36-2:after { + content: ""; + display: block; + width: 100%; + padding-bottom: 55.56%; +} +.base-element-easycreditintro .easycredit-intro.dimmed { + background-color: #F5F7F8; +} +.base-element-easycreditintro .intro-2024 { + --grid-column-gap: 24px; +} +.base-element-easycreditintro .intro-2024 h2 { + margin-bottom: 15px; + font-size: 22.425px; + line-height: 1.3; + font-weight: 600; + color: #002C5A; +} +.base-element-easycreditintro .intro-2024 p { + margin-bottom: 25px; +} +.base-element-easycreditintro .intro-2024 ul li { + margin-bottom: 8px; +} +.base-element-easycreditintro .intro-2024 ul li a { + font-weight: 600; + text-decoration: none; +} +.base-element-easycreditintro .intro-2024 .easycredit-intro__image { + background-image: url("../../images/card-intro-image.png"); +} +.base-element-easycreditintro .bill { + margin-top: 0; +} +.base-element-easycreditintro .bill .easycredit-intro__image { + background-image: url("../../images/card-easycredit-rechnung-image.png"); +} .base-element-easycreditintro .intro { margin-top: 10px; margin-bottom: 0; @@ -271,8 +371,5 @@ } /* Plugin Manager */ -.store-plugin-detail-configuration-container .easycredit-intro { - background-color: rgba(0, 44, 90, 0.05) !important; -} /*# sourceMappingURL=easycredit-config.css.map */ diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css.map b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css.map index 0412641..8f821de 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css.map +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/css/easycredit-config.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../sass/easycredit-config.scss"],"names":[],"mappings":"AAAA;AAGA;AAUA;AAoBA;AAcI;AAeA;AAoBA;AAuBA;AAgLA;AAgBA;AAgBA;AAKA;AAeA;AAYA;AASA;AAUA;AAUA;AAWA;;AA/VA;EACI;EACA;;AAGJ;EACI;;AAEA;EACI;;AAKR;EACI,YAzBA;EA0BA;EACA,OApCQ;EAqCR;EACA,aAjCc;;AAmClB;EACI;;AAEJ;EACI;;AAIJ;AAAA;EAEI;EACA,WAhDI;EAiDJ,aAhDM;EAiDN,OAtDK;;AAwDL;AAAA;EACI;;AAGR;EACI;;AAEA;EACI;;AAKR;EACI,OApEK;;AAuED;EACI;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,kBApFH;;AA0FT;EACI;EACA;EACA,kBAxGa;EAyGb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI,kBApHO;;AAuHX;EAII;EACA;;AAEA;EACI;;AAIR;EACI;;AAGJ;EAEI;;AAGJ;EACI;EACA;EACA;EACA,OAnJE;;AAuJV;EACI,YAjIA;EAkIA,eAlIA;EAmIA;EAEA,kBA5JM;EA6JN,eAjIW;;AAmIX;AAAA;EAEI,OA5JQ;;AA+JZ;EACI;EACA;EACA;;AAEJ;EACI;;AAGJ;EACI,OA1KS;;AA6Kb;EACI;EACA;EACA;EAEA;;AAEJ;EACI;EAEA;EACA;EAEA;EACA,WA9KA;EA+KA;;AAEA;EACI;;AAGJ;EACI;EACA,OAnMI;;AAsMR;EACI;EACA,OAxMI;;AA0MJ;EACI;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EAEA;;AAMR;EACI;;AAGJ;EACI;;AAIR;EACI;EACA;EACA,iBAxNM;;AA2NN;EACI;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAIR;EACI,kBAhQM;EAiQN;EACA;EACA;EACA,eAhPG;;AAkPH;EACI;EACA;EACA;EACA;;AAOhB;EACI;EACA;;AAGI;EACI;EACA;EACA;EACA;EACA;;AAMZ;EACI;;AAGI;EACI,kBAzSI;EA0SJ;;AAEA;EACI;;AAOhB;EACI;;AAMI;EACI;EACA;EACA,YA1SH;;AA4SG;EACI;;AAUR;AAAA;EACI;EACA;EACA;;AAQJ;EACI;;AAQJ;EACI;EACA;;AAQJ;EACI;EACA;;AAQJ;EACI;EACA;EACA;;AAQJ;EACI;EACA;EACA;;;AAMhB;AAEI;EACI","file":"easycredit-config.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../sass/easycredit-config.scss"],"names":[],"mappings":"AAAA;AAGA;AAUA;AAIA;AAsBA;EACI;EACA;EACA;EACA;AAeA;AAeA;AAoBA;AAuBA;AAkEA;AA8LA;AA0CA;AAgBA;AAgBA;AAKA;AAeA;AAYA;AASA;AAUA;AAUA;AAWA;;AAzdA;EACI;EACA;;AAGJ;EACI;;AAEA;EACI;;AAKR;EACI,YAhCA;EAiCA;EACA,OA3CQ;EA4CR;EACA,aAtCc;;AAwClB;EACI;;AAEJ;EACI;;AAIJ;AAAA;EAEI;EACA,WAvDI;EAwDJ,aArDM;EAsDN,OA7DK;;AA+DL;AAAA;EACI;;AAGR;EACI;;AAEA;EACI;;AAKR;EACI,OA3EK;;AA8ED;EACI;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA,kBA3FH;;AAiGT;EACI;EACA;EACA;EACA;EACA,kBArHa;EAsHb;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACI,kBAjIO;;AAmIX;EACI;EACA;EACA;EACA;;AAIA;EAII;EACA;;AAEA;EACI;;AAGR;EAEI;;AAEA;EACI;;AAIR;EAEI;EACA;EACA;EACA,OAvKF;;AAyKE;EACI;;AAMZ;EACI;;AAKR;EACI;EACA;EACA,kBApLY;EAqLZ;EACA,WArKO;EAsKP;EACA;;AAEJ;EACI;;AAGJ;EACI,YAzKA;EA0KA,eA1KA;EA2KA;EAEA,kBAxMM;EAyMN,eAvKW;EAwKX,YA5KU;;AA8KV;AAAA;EAEI,OAzMQ;;AA4MZ;EACI;EACA;EACA;;AAEJ;EACI;;AAGJ;EACI,OAvNS;;AA0Nb;EACI;EACA;EACA;EAEA;;AAEJ;EACI;EAEA;EACA;EAEA;EACA,WAvNA;EAwNA;;AAEA;EACI;;AAGJ;EACI;EACA,OAhPI;;AAmPR;EACI;EACA,OArPI;;AAuPJ;EACI;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EAEA;;AAMR;EACI;;AAGJ;EACI;;AAIR;EACI;EACA;EACA;;AAEA;EACI;;AAEA;EAHJ;IAIQ;;;AAIR;EACI;;AAGJ;EACI;;AAIJ;EACI;;AAIR;EACI;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAEA;EACI;EACA;EACA;EACA;;AAIR;EACI,kBA7TM;EA8TN;EACA;EACA;EACA,eAxSG;;AA0SH;EACI;EACA;EACA;EACA;;AAIR;EACI;EACA,kBA7UM;EA8UN;EACA;EACA;EACA,eAxTG;;AA4TH;EACI;EACA;EACA;EACA;;AAIJ;EACI;EACA;EACA;EACA;;AAKZ;EACI,kBAjWW;;AAsWnB;EACI;;AAEA;EACI;EAEA,WAnWG;EAoWH,aAlWU;EAmWV;EACA,OAxXQ;;AA2XZ;EACI;;AAIA;EACI;;AAEA;EACI;EACA;;AAKZ;EACI;;AAKR;EACI;;AAEA;EACI;;AAKR;EACI;EACA;;AAGI;EACI;EACA;EACA;EACA;EACA;;AAMZ;EACI;;AAGI;EACI,kBA9aI;EA+aJ;;AAEA;EACI;;AAOhB;EACI;;AAMI;EACI;EACA;EACA,YA3aH;;AA6aG;EACI;;AAUR;AAAA;EACI;EACA;EACA;;AAQJ;EACI;;AAQJ;EACI;EACA;;AAQJ;EACI;EACA;;AAQJ;EACI;EACA;EACA;;AAQJ;EACI;EACA;EACA;;;AAMhB","file":"easycredit-config.css"} \ No newline at end of file diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/sass/easycredit-config.scss b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/sass/easycredit-config.scss index 02a4ec4..8bb21ca 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/sass/easycredit-config.scss +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/_resources/resources/sass/easycredit-config.scss @@ -11,29 +11,40 @@ $color-ec-darkblue15: #D9DFE6; $color-ec-darkblue20: #CCD5DE; $color-ec-darkblue50: #8095AC; +/* Colors - SW5 */ +$color-sw5-bg-grey: #f2f4f6; +$color-sw5-bg-grey-75: #F5F7F8; + /* Colors - Typo (SW5) */ $color-font: #010101; $color-heading: #475c6a; $color-link: #0e6bbb; $font-size: 13px; +$font-size-sm: $font-size * 0.85; +$font-size-h2: $font-size * 1.725; $line-height: 1.4; -$line-height-heading: 1.2; - -$grid-column-gap: 48px; +$line-height-heading: 1.3; -$space: 30px; +$space: 36px; $box-shadow: 0 4px 20px 0 rgba(0,0,0,.25); +$box-shadow-card: 0 1px 1px rgba(0, 0, 0, 0.08), 0 2px 1px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1); $border-radius: 30px; $border-radius-sm: 15px; +$border-radius-xs: 8px; $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); .base-element-easycreditintro { + --grid-column-gap: 48px; + --grid-column-gap-m: 36px; + --grid-template-columns: 3fr 2fr; + --grid-template-columns-50-50: 1fr 1fr; + .x-panel-body { - padding: 0 25px 0 0; + padding: 2px 25px 2px 2px; border: 0; } @@ -84,7 +95,7 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); a { color: $color-link; - &[target="_blank"]:not(.easycredit-intro__image) { + &[target="_blank"]:not(.easycredit-intro__image):not(.btn.btn-primary):not(.btn.btn-secondary) { &:after { content: ''; display: inline-block; @@ -106,6 +117,8 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); /* Buttons */ .btn { display: inline-block; + margin-bottom: 5px; + margin-right: 10px; padding: 10px 20px; background-color: $color-ec-secondary; border: 0; @@ -120,34 +133,65 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); &.btn-primary { background-color: $color-ec-primary; } + &.btn-link { + background-color: transparent; + padding-left: 0; + padding-right: 0; + color: $color-ec-secondary !important; + } - &:hover, - &:active, - &:focus, - &:visited { - background-color: $color-ec-secondary !important; - color: $color-white !important; + &:not(.btn-link) { + &:hover, + &:active, + &:focus, + &:visited { + background-color: darken($color-ec-secondary, 5%) !important; + color: $color-white !important; - &.btn-primary { - background-color: $color-ec-primary !important; + &.btn-primary { + background-color: darken($color-ec-primary, 5%) !important; + } + } + &:active, + &:focus { + box-shadow: 0 0 0 0.2rem rgba($color-ec-secondary, .4) !important; + + &.btn-primary { + box-shadow: 0 0 0 0.2rem rgba($color-ec-primary, .4) !important; + } + } + + &:disabled, + &.disabled { + cursor: default; + pointer-events: none; + background-color: rgba($color-ec-secondary, .5) !important; + color: $color-white; + + &.btn-primary { + background-color: rgba($color-ec-primary, .5) !important; + } } } - &:hover { - &.btn-primary { - background-color: darken($color-ec-primary,5%) !important; - } - } - &:active, - &:focus { - box-shadow: 0 0 0 0.2rem rgba($color-ec-primary, .4) !important; + } + .btn + .btn { + &:last-child { + margin-right: 0; } + } - &:disabled, &.disabled { - cursor: default; - pointer-events: none; - background-color: rgba($color-ec-primary, .5) !important; - color: $color-white; - } + /* Badges */ + .badge { + margin-right: 7.5px; + padding: 2px 5px 2px; + background-color: $color-ec-darkblue; + border-radius: 10px; + font-size: $font-size-sm; + font-weight: 600; + color: #fff; + } + .badge + h2 { + margin-top: 5px !important; } .easycredit-intro { @@ -156,7 +200,8 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); padding: 35px 30px; background-color: $color-white; - border-radius: $border-radius-sm; + border-radius: $border-radius-xs; + box-shadow: $box-shadow-card; h2, h3, p, ul { @@ -235,8 +280,24 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); &__grid { display: grid; - grid-template-columns: 3fr 2fr; - grid-column-gap: $grid-column-gap; + grid-template-columns: var(--grid-template-columns); + grid-column-gap: var(--grid-column-gap); + + &:has(.intro-2024) { + grid-column-gap: 24px; + + @media (max-width: 991px) { + display: block; + } + } + + &.grid-50-50 { + grid-template-columns: var(--grid-template-columns-50-50); + } + + &:has(.easycredit-intro__image + .easycredit-intro__content) { + grid-column-gap: var(--grid-column-gap-m); + } } &__tab-content { .easycredit-intro__grid { @@ -276,6 +337,78 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); padding-bottom: 75%; } } + + &.fill { + position: relative; + background-color: $color-ec-darkblue15; + background-position: center; + background-repeat: no-repeat; + background-size: cover; + border-radius: $border-radius-sm; + } + + &.aspect-2-3 { + &:after { + content: ''; + display: block; + width: 100%; + padding-bottom: 150%; + } + } + &.aspect-36-2 { + &:after { + content: ''; + display: block; + width: 100%; + padding-bottom: 55.56%; + } + } + } + + &.dimmed { + background-color: $color-sw5-bg-grey-75; + } + } + + /* Intro 2024 */ + .intro-2024 { + --grid-column-gap: 24px; + + h2 { + margin-bottom: 15px; + + font-size: $font-size-h2; + line-height: $line-height-heading; + font-weight: 600; + color: $color-ec-darkblue; + } + + p { + margin-bottom: 25px; + } + + ul { + li { + margin-bottom: 8px; + + a { + font-weight: 600; + text-decoration: none; + } + } + } + + .easycredit-intro__image { + background-image: url('../../images/card-intro-image.png'); + } + } + .faq { + } + .bill { + margin-top: 0; + + .easycredit-intro__image { + background-image: url('../../images/card-easycredit-rechnung-image.png'); } } @@ -398,7 +531,7 @@ $transition-timing: cubic-bezier(0.73, 0.32, 0.14, 0.99); /* Plugin Manager */ .store-plugin-detail-configuration-container { .easycredit-intro { - background-color: $color-ec-darkblue5 !important; + // background-color: $color-ec-darkblue5 !important; // box-shadow: $box-shadow; } } diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/intro.html b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/intro.html index c99abb5..395438b 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/intro.html +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/intro.html @@ -1,3 +1,68 @@ +
+
+
+
+

Der einfachste Rechnungs- und Ratenkauf Deutschlands.

+

Wir freuen uns, dass Sie sich für easyCredit entschieden haben, die perfekte Zahlungsmethode für den Handel in Onlineshops.

+ + Dokumentation + + + Demoshop + +
+ +
+
+
+ +
+
+

Sie haben Fragen? Wir helfen gerne.

+

Wir sind von Montag bis Freitag von 8:00 bis 18:00 Uhr für Sie erreichbar.

+ +
+
+
+ +
+
+
+ +
+ Neu +

easyCredit-Rechnung - die ideale Ergänzung zum Ratenkauf

+

Sie können Ihren Kunden mit easyCredit neben dem klassischen Ratenkauf nun auch den Kauf auf Rechnung anbieten. Das Zahlungsziel liegt dabei 30 Tage in der Zukunft.

+ + Jetzt aktivieren + + + Mehr erfahren + +
+
+
+ + diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/marketing-intro.html b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/marketing-intro.html index 07f6670..4c6d8ae 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/marketing-intro.html +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_config/marketing-intro.html @@ -43,7 +43,7 @@

Hilfreiche Links

Er ermöglicht Kunden das Produkt oder den Warenkorb ohne Umwege über den Bestellprozess zu kaufen.

- Express-Button konfigurieren + Express-Button konfigurieren
@@ -62,7 +62,7 @@

Hilfreiche Links

weist das Widget auf Wunsch auf den minimal oder maximal möglichen Finanzierungsbetrag hin.

- Widget konfigurieren + Widget konfigurieren
@@ -79,7 +79,7 @@

Hilfreiche Links

merkt die Komponente sich dies und verhindert ein weiteres Anzeigen.

- Modal konfigurieren + Modal konfigurieren
@@ -97,7 +97,7 @@

Hilfreiche Links

So können Sie ein zu ihrem Produktangebot passendes Bild verwenden.

- Card konfigurieren + Card konfigurieren
@@ -115,7 +115,7 @@

Hilfreiche Links

So können Sie ein zu ihrem Produktangebot passendes Bild verwenden.

- Flashbox konfigurieren + Flashbox konfigurieren
@@ -132,7 +132,7 @@

Hilfreiche Links

Die Slogans sind vorgegeben und können nicht angepasst werden.

- Bar konfigurieren + Bar konfigurieren
diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/grid.js b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/grid.js index 4b822d9..b8ac092 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/grid.js +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/grid.js @@ -70,6 +70,11 @@ Ext.define('Shopware.apps.EasycreditMerchant.view.main.Grid', { renderer: me.paymentStatusColumnRenderer, draggable: false }, + paymentId: { + header: '{s name="column/paymentMethod"}Payment method{/s}', + renderer: me.paymentMethodColumnRenderer, + draggable: false + }, merchantStatus: { header: '{s name="column/merchantStatus"}Merchant Status{/s}', draggable: false, @@ -188,16 +193,20 @@ Ext.define('Shopware.apps.EasycreditMerchant.view.main.Grid', { * @param { Ext.data.Model } record * @returns { String } */ - paymentStatusColumnRenderer: function (value, metaData, record) { - var status = record.getPaymentStatus().first(); + paymentMethodColumnRenderer: function (value, metaData, record) { + return record.raw.payment.description; + /* + var status = record.getOrderStatus().first(); if (status instanceof Ext.data.Model) { return status.get('description'); } return value; + */ }, + /** * @param { String } value * @returns { String } diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/window.js b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/window.js index a15a958..b7c95fb 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/window.js +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/easycredit_merchant/view/main/window.js @@ -14,7 +14,7 @@ Ext.define('Shopware.apps.EasycreditMerchant.view.main.Window', { */ configure: function () { var me = this; - me.title = '{s name="window/title"}easyCredit-Ratenkauf: Payments{/s}'; + me.title = '{s name="window/title"}easyCredit: Payments{/s}'; return { listingGrid: 'Shopware.apps.EasycreditMerchant.view.main.Grid', diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/index/backend-easycredit.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/backend/index/backend-easycredit.tpl index 299d9fb..3b1468b 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/index/backend-easycredit.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/index/backend-easycredit.tpl @@ -18,6 +18,5 @@ window.ratenkaufbyeasycreditOrderManagementConfig = {$easyCreditConfig}; {literal}{/literal} - - + {/block} diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/backend/plugins/easycredit/test.js b/src/Frontend/NetzkollektivEasyCredit/Views/backend/plugins/easycredit/test.js index ad1fe70..54bb68b 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/backend/plugins/easycredit/test.js +++ b/src/Frontend/NetzkollektivEasyCredit/Views/backend/plugins/easycredit/test.js @@ -17,7 +17,7 @@ Ext.Ajax.request({ jsonData: true, success: function (response) { var data = Ext.decode(response.responseText), - title = 'easyCredit-Ratenkauf', + title = 'easyCredit', text; if (!data.status) { @@ -26,7 +26,7 @@ Ext.Ajax.request({ if (data.valid) { text = 'Zugangsdaten korrekt. Plugin ist einsatzbereit!'; } else { - text = 'Die Zugangsdaten sind inkorrekt oder Ihr Webshop ist noch nicht aktiviert.

Bitte überprüfen Sie Ihre Eingaben oder wenden Sie sich an Ihren Ansprechpartner von easyCredit-Ratenkauf.'; + text = 'Die Zugangsdaten sind inkorrekt oder Ihr Webshop ist noch nicht aktiviert.

Bitte überprüfen Sie Ihre Eingaben oder wenden Sie sich an Ihren Ansprechpartner von easyCredit.'; } } diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/_public/src/js/easycredit-express-button.js b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/_public/src/js/easycredit-express-button.js index e69d8f5..468f615 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/_public/src/js/easycredit-express-button.js +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/_public/src/js/easycredit-express-button.js @@ -21,28 +21,40 @@ me.applyDataAttributes(); - var expressButton = me.$el.find('easycredit-express-button').get(0); - onHydrated(expressButton, function() { - me._on(expressButton, 'submit', function(event) { - event.preventDefault(); + const addFormField = (form, key, value) => { + form.append($('').attr('name', key).attr('value', value)); + } + + const handleExpressButton = function(event) { + event.preventDefault(); + + var form = $('
') + .attr('action', me.opts.url) + .hide(); - var form = $('') - .attr('action', me.opts.url) - .hide(); + if (event.detail) { + for (const [key, value] of Object.entries(event.detail)) { + addFormField(form, `easycredit[${key}]`, value) + } + } - var addToBasketForm = $(this).closest('form[name=sAddToBasket]'); - if (addToBasketForm.length > 0) { - form.attr('method','post'); - var formData = new FormData(addToBasketForm.get(0)); + var addToBasketForm = $(this).closest('form[name=sAddToBasket]'); + if (addToBasketForm.length > 0) { + form.attr('method','post'); + var formData = new FormData(addToBasketForm.get(0)); - for (var key of formData.keys()) { - form.append($('').attr('name',key).attr('value', formData.get(key))); - } + for (var key of formData.keys()) { + addFormField(form, key, formData.get(key)); } + } + + $('body').append(form); + form.submit(); + } - $('body').append(form); - form.submit(); - }); + var expressButton = me.$el.find('easycredit-express-button').get(0); + onHydrated(expressButton, function() { + me._on(expressButton, 'submit', handleExpressButton); }); }, }) diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/change_payment.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/change_payment.tpl index 7ec8c9d..ac6e21a 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/change_payment.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/change_payment.tpl @@ -1,7 +1,7 @@ {extends file="parent:frontend/checkout/change_payment.tpl"} {block name="frontend_checkout_payment_fieldset_input_label"} - {if $payment_mean.name == 'easycredit'} + {if $payment_mean.name|strpos:"easycredit" !== false} {include file="frontend/plugins/payment/easycredit/label.tpl"} {else} {$smarty.block.parent} diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/confirm.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/confirm.tpl index 14621ed..67b81f4 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/confirm.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/checkout/confirm.tpl @@ -5,7 +5,14 @@ {if $EasyCreditPaymentPlan}

- +

{/if} {/block} diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/index/index.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/index/index.tpl index 8829f49..05b2b52 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/index/index.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/index/index.tpl @@ -14,8 +14,7 @@ {/if} - - + {/block} diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit.tpl index df0c4b4..ce13f63 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit.tpl @@ -2,12 +2,19 @@ {if $EasyCreditAddressError}
{/if} + {if $EasyCreditSelectedPaymentId == $payment_mean.id} + {/if} {/if} diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/express-button.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/express-button.tpl index 8e98efc..0aa2e6c 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/express-button.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/express-button.tpl @@ -1,5 +1,9 @@ {block name='easycredit_express_button_container'}
- +
{/block} \ No newline at end of file diff --git a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/label.tpl b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/label.tpl index 399866a..eab300e 100644 --- a/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/label.tpl +++ b/src/Frontend/NetzkollektivEasyCredit/Views/frontend/plugins/payment/easycredit/label.tpl @@ -1,5 +1,12 @@