From ffc69fce0c98ae5144c05721e2c55c0531db66e8 Mon Sep 17 00:00:00 2001 From: Pascal Kleindienst Date: Tue, 28 Apr 2026 08:37:01 +0200 Subject: [PATCH] push new 2.0.3 --- Bootstrap.php | 8 ++ CHANGELOG.md | 12 ++ Migrations/Migration20260303100000.php | 35 ++++++ README.md | 4 +- adminmenu/template/settings.tpl | 26 ++++ checksums.csv | 82 ++++++------ frontend/js/unzer-ui-components.js | 117 ++++++++++++----- frontend/js/unzer-ui-components.js.map | 4 +- frontend/js/unzer-ui-components.min.js | 2 +- frontend/js/unzer-ui-components.min.js.map | 2 +- frontend/src/js/components/base.js | 116 ++++++++++++----- .../partials/saved_payment_methods.tpl | 62 +++++++++ info.xml | 118 +++++++++++++++++- locale/de-DE/base.mo | Bin 20058 -> 20612 bytes locale/de-DE/base.po | 20 ++- locale/en-GB/base.mo | Bin 21807 -> 22742 bytes locale/en-GB/base.po | 21 ++++ paymentmethod/HeidelpayAlipay.php | 15 ++- paymentmethod/HeidelpayCreditCard.php | 18 ++- paymentmethod/HeidelpayEPS.php | 15 ++- paymentmethod/HeidelpayPayPal.php | 8 +- paymentmethod/HeidelpayPrepayment.php | 15 ++- paymentmethod/HeidelpayPrzelewy24.php | 15 ++- paymentmethod/HeidelpaySEPADirectDebit.php | 24 +++- paymentmethod/HeidelpayWeChatPay.php | 15 ++- paymentmethod/HeidelpayiDEAL.php | 15 ++- paymentmethod/UnzerBancontact.php | 15 ++- paymentmethod/UnzerPaylaterDirectDebit.php | 3 + paymentmethod/UnzerPaylaterInvoice.php | 3 + paymentmethod/template/_components_v2.tpl | 25 ++++ paymentmethod/template/credit_card_form.tpl | 32 ++++- paymentmethod/template/paypal_form.tpl | 31 ++++- paymentmethod/template/sepa_form.tpl | 31 ++++- src/Controllers/FrontendOutputController.php | 15 +++ src/Payments/HeidelpayPaymentMethod.php | 5 + src/Payments/PaymentHandler.php | 15 +++ src/Payments/Traits/HasAuthorization.php | 6 +- src/Payments/Traits/HasBasket.php | 14 ++- src/Payments/Traits/HasCustomer.php | 13 +- src/Payments/Traits/HasDirectCharge.php | 6 +- src/Payments/Traits/HasSavedPaymentData.php | 45 +++++++ src/Services/SavedPaymentDataService.php | 68 ++++++++++ src/Utils/Config.php | 3 + src/Utils/SessionHelper.php | 1 + 44 files changed, 958 insertions(+), 142 deletions(-) create mode 100644 Migrations/Migration20260303100000.php create mode 100644 frontend/template/partials/saved_payment_methods.tpl create mode 100644 src/Payments/Traits/HasSavedPaymentData.php create mode 100644 src/Services/SavedPaymentDataService.php diff --git a/Bootstrap.php b/Bootstrap.php index 73b9675..64c96da 100644 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -7,6 +7,7 @@ use JTL\Checkout\Bestellung; use JTL\Events\Dispatcher; use JTL\Helpers\Request; +use JTL\IO\IOResponse; use JTL\Plugin\Bootstrapper; use JTL\Plugin\BootstrapperInterface; use JTL\Plugin\Payment\Method; @@ -36,6 +37,7 @@ use Plugin\s360_unzer_shop5\src\KeyPairs\KeyPairModel; use Plugin\s360_unzer_shop5\src\Orders\OrderMappingModel; use Plugin\s360_unzer_shop5\src\Payments\Interfaces\NotificationInterface; +use Plugin\s360_unzer_shop5\src\Services\SavedPaymentDataService; use Plugin\s360_unzer_shop5\src\Utils\Config; use Plugin\s360_unzer_shop5\src\Utils\JtlLinkHelper; use Plugin\s360_unzer_shop5\src\Utils\Logger; @@ -159,6 +161,12 @@ public function boot(Dispatcher $dispatcher): void $args['io'] ); $controller->handle(); + + // Delete saved payment data for user + $args['io']->register('s360_unzer_shop5::deletePaymentMethod', function (string $id) { + return (new IOResponse()) + ->assignVar('success', (new SavedPaymentDataService())->deleteUserPaymentData($id)); + }); } catch (Throwable $th) { Logger::error( 'Error ' . $th->getCode() . ':' . $th->getMessage() . ', Exception in Hook ' diff --git a/CHANGELOG.md b/CHANGELOG.md index e6e84eb..c32ed6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.0.3] (April 2026) +### Changed +- basket metadata is now set for all payment methods +- german names for installment and and invoice + +### Added +- support for COF (Credential on File) payments for *Credit Card*, *PayPal*, and *SEPA Direct Debit* + +### Fixed +- issue with *WERO* not working when setting a discount for the payment method +- issue with billing address not being set correctly for UPL payment methods (*Installment*, *Direct Debit*, and *Invoice*) resulting in the customer not being able to use the payment method + ## [2.0.2] (February 2026) ### Changed - changed *iDeal* logo and name to *iDeal - Wero* diff --git a/Migrations/Migration20260303100000.php b/Migrations/Migration20260303100000.php new file mode 100644 index 0000000..e9cc3a8 --- /dev/null +++ b/Migrations/Migration20260303100000.php @@ -0,0 +1,35 @@ +execute( + 'CREATE TABLE IF NOT EXISTS xplugin_s360_unzer_shop5_saved_payment_data ( + `id` INT(10) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `kKunde` INT(10) UNSIGNED NOT NULL, + `payment_method` VARCHAR(36) NOT NULL, + `payment_type_id` VARCHAR(32) NOT NULL, + `data` TEXT NOT NULL, + `created_at` DATETIME(3) NOT NULL, + `updated_at` DATETIME(3) NULL, + FOREIGN KEY (`kKunde`) REFERENCES `tkunde`(`kKunde`) ON DELETE CASCADE + ) ENGINE=InnoDB CHARSET=utf8 COLLATE utf8_unicode_ci;' + ); + } + + public function down() + { + if ($this->doDeleteData()) { + $this->execute('DROP TABLE IF EXISTS `xplugin_s360_unzer_shop5_saved_payment_data`'); + } + } + +} diff --git a/README.md b/README.md index ec7bde2..4dbaf6e 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ Dieses Plugin integriert die folgenden Unzer-Zahlungsarten im JTL Shop: - Direktüberweisung - SEPA Lastschrift - Lastschrift -- Ratenkauf -- Rechnungskauf +- Ratenzahlung +- Rechnung - Vorkasse - WeChat Pay - Wero diff --git a/adminmenu/template/settings.tpl b/adminmenu/template/settings.tpl index b18172b..1e3a6f7 100644 --- a/adminmenu/template/settings.tpl +++ b/adminmenu/template/settings.tpl @@ -371,6 +371,32 @@ {__('hpSettingsPqSelectorPlaceOrderButtonHelp')} + + {* PQ Selector Bestellabschluss Form *} +
+
+ +
+
+ + {__('hpSettingspqSelectorSavedPaymentDataHelp')} +
+
+
+
+ +
+
+ + {__('hpSettingspqMethodSavedPaymentDataHelp')} +
+
diff --git a/checksums.csv b/checksums.csv index 6eeaa73..1e7396e 100644 --- a/checksums.csv +++ b/checksums.csv @@ -855,15 +855,15 @@ d74ee339a9008b6c184705dcf20536ee;vendor/paragonie/constant_time_encoding/src/Hex a761dc4a6a7338866116567ae11c4368;composer.lock 0a7ea3bc84eaecb910b6cb1b6f474db5;apple-developer-merchantid-domain-association c466bfceae7a1c850f00a4bd2c8400db;composer.json -28c2a67cf953f30927161c19c676d686;frontend/js/unzer-ui-components.js -b567a57e25a1c34331e0d0df4f6d0102;frontend/js/unzer-ui-components.min.js.map -24031a46f8a2ee9aaf19337961ad735a;frontend/js/unzer-ui-components.js.map -2445a0eb171fe7593516fea5ed9ec428;frontend/js/unzer-ui-components.min.js +23ada647e7af4c86e7388b6b74efca32;frontend/js/unzer-ui-components.js +35aa90abd4f87d672b078fe554d61349;frontend/js/unzer-ui-components.min.js.map +86efdfbb532c2954668d7cfa59d645f2;frontend/js/unzer-ui-components.js.map +c22cf5ae527666d4c6e1840db7317d17;frontend/js/unzer-ui-components.min.js 13c1593de90ae1a978dff1f3f40fc272;frontend/src/js/components/applepay.js f7d1244b78a5567f379329b383f76ffb;frontend/src/js/components/googlepay.js d1e7bb32208035988d5734be00b5df38;frontend/src/js/components/klarna.js d5de3c2637eb45440c212d9a0824ee18;frontend/src/js/components/index.js -10020844bd04af57fffb4cbd6c198ad9;frontend/src/js/components/base.js +2292f0faa91e69e2fbcfcb332e7e9bce;frontend/src/js/components/base.js 15112aab51c1133c80096c05759e4008;frontend/src/js/utils/errors.js cf44e5fa2ae44e1a9756651963bfe755;frontend/src/js/utils/debugging.js 280b9703c8fd488aebf961bd9a721cd0;frontend/sync-workflow.php @@ -871,6 +871,7 @@ cf44e5fa2ae44e1a9756651963bfe755;frontend/src/js/utils/debugging.js 824c7c0e6cf814a4e52b7a45d26a657e;frontend/template/google_pay_button.tpl 3e34c443a1d94d22322bdd82673d0dd6;frontend/template/hire_purchase_direct_debit.tpl ca79740c158847ad33410b9f2d9746c0;frontend/template/partials/_threatMetrix.tpl +4dbfe3c00162c00d2b3092fc70f424bc;frontend/template/partials/saved_payment_methods.tpl b5cfea6ee2dd9b9572e3b7d07ec7b574;frontend/template/partials/change_payment.tpl 911c39040a1e67886cc82c515a47c939;frontend/template/partials/payment_info.tpl d41d8cd98f00b204e9800998ecf8427e;frontend/template/webhook.tpl @@ -886,7 +887,7 @@ c2405627e35992f208ba7281a6490256;adminmenu/scss/admin.scss 746bd73bf157393d5d55f4b559a8c6e5;adminmenu/css/admin.css.map ea5a5b2dc793ab305fe96a7822ba667d;adminmenu/template/applepay.tpl bd1dee2d300e99d194c69dfb1693075e;adminmenu/template/keypairs.tpl -0d2524e782110921f643c386fc5098f2;adminmenu/template/settings.tpl +910a55e93d804f4f24251c5b197893e9;adminmenu/template/settings.tpl 34e0beaa04e4bef9d55c15dc6b4a1f0d;adminmenu/template/partials/_order_item.tpl c973e777d822dfcc69c48771aee4ab72;adminmenu/template/partials/_order_detail.tpl 94692a0334d6eeefe4b4806fc5832914;adminmenu/template/partials/_includes.tpl @@ -896,7 +897,7 @@ e0b9e6894421345360862d2571283a23;adminmenu/template/partials/_header.tpl dad4062692dbd99b16ae3233b36ec1ec;adminmenu/template/orders.tpl 30e621c301583a4e13928bd8b9a09a9d;.jshintrc 2c62fe5947e6614a783d78e29f531d00;phpmd-ruleset.xml -8726dfdb4e0f5f56720fd5891eb78604;README.md +6a4b7de12703b622853d4aa40dac6a7a;README.md 767ba442de91503e5b6245c2d114a5c7;src/ApplePay/CertificatesResource.php 6703c52f0190cd22bfa1f72d7930fce1;src/ApplePay/CertificationService.php 4ad80bac1bc3c0c244426c6dd6279a96;src/ApplePay/CertificateException.php @@ -904,18 +905,19 @@ dad4062692dbd99b16ae3233b36ec1ec;adminmenu/template/orders.tpl a3255fc904b7509e171553ea009c9c82;src/ApplePay/ActivateCertificateResource.php 4ba10c90d08b3f639e188c332647e1c5;src/Payments/PaymentMethodModuleFactory.php b7d6a5dab057b0bb5bb42c02456aedf7;src/Payments/HeidelpayApiAdapter.php -b84d538275b94512897bcfa43fbfb27e;src/Payments/HeidelpayPaymentMethod.php +d7d9c9455ae5943a40596d3d170c3c39;src/Payments/HeidelpayPaymentMethod.php 85dadc4e055384cf11546247308921f5;src/Payments/Traits/PriceCurrencyConverter.php 54f0fff5386a4145ce981a2c4e24d576;src/Payments/Traits/SupportsB2B.php +ad359a50ddb9c76117d5941d75617fc8;src/Payments/Traits/HasSavedPaymentData.php d78c74c0918be9b079a8cf4655446589;src/Payments/Traits/HasState.php -c8a85612f77eb4552e34989d0d184b9a;src/Payments/Traits/HasAuthorization.php -5aefd466eee6fd9307f5a4226fc9a4ec;src/Payments/Traits/HasBasket.php +63177285223e501f9dc916d62e1754c1;src/Payments/Traits/HasAuthorization.php +3324fa5c40887fa065d5357432fd1e52;src/Payments/Traits/HasBasket.php aa1212a34a1c3b4f1475e6b439603404;src/Payments/Traits/HasMetadata.php 9f5c6070edc5f2c82560e28fd47a66ac;src/Payments/Traits/CancelPaymentTransaction.php -1388c6134e473e38b7c76983d21be94b;src/Payments/Traits/HasCustomer.php +c2632abd856021c7b0cdef9f8f6f0fca;src/Payments/Traits/HasCustomer.php eafbb3fd550ede774e80f963759e71ea;src/Payments/Traits/HasPayStatus.php -3edfe6c9da5790a2164bf4d22d775cab;src/Payments/Traits/HasDirectCharge.php -d5e45aaa6141dfe97e0d2e0efb8715ee;src/Payments/PaymentHandler.php +8922f3e4843d3879c6c01d6da80166d1;src/Payments/Traits/HasDirectCharge.php +f64f8fbc30450ccafaa26deee7e4fb9e;src/Payments/PaymentHandler.php 36e5aa72d873a51ef1c3bd79a32acade;src/Payments/Interfaces/HandleStepAdditionalInterface.php ac4adca913172393fba84fda8c388a10;src/Payments/Interfaces/PaymentStatusInterface.php b40a39212fa05718f866b4326766043c;src/Payments/Interfaces/RedirectPaymentInterface.php @@ -929,7 +931,7 @@ ab1b1e5c0f257e793786fd8f49b3a9b7;src/Payments/Interfaces/NotificationInterface.p cc1c780662e1a85826bafc4dbfef25fc;src/Controllers/Controller.php 6b557d2f5af216698fad3cbb233f211e;src/Controllers/AjaxResponse.php f510097b40df90505b40042b0e9b0c07;src/Controllers/HasAjaxResponse.php -6a4f5378cbdae8a8b90a56a9db41aef9;src/Controllers/FrontendOutputController.php +13bbb0219ed291bed9ff4e822fef7ae0;src/Controllers/FrontendOutputController.php dd581e104187683d8fec2efa4ecd770b;src/Controllers/WebhookController.php 23ef8c7578da322e16a14f6fd67f825b;src/Controllers/SyncController.php fa5a691923e7f21ba2ddcd5b5822706b;src/Controllers/ApplePayController.php @@ -943,10 +945,11 @@ e990705d5e8da7895d4460e98f516ec3;src/Controllers/Admin/AdminController.php 8296f8b464c72e7441c7dedec8159728;src/Orders/OrderMappingModel.php 3da45aa29a08f869b95627a6e46e5f9a;src/Orders/OrderViewStruct.php c1f8da0ce57d62d455c5e259c24685d0;src/Orders/OrderMappingEntity.php +f8bcecf005718c0af3412829d40aa63b;src/Services/SavedPaymentDataService.php 521e61755ca1485bfe834b40a50ac426;src/Utils/Logger.php ff2e8ea1952f33020fe432ab359624d6;src/Utils/JtlLinkHelper.php -4e1879d90f1a57b9c526919337e0de85;src/Utils/SessionHelper.php -dcdeac17d651b1ec66d15b927d9a797b;src/Utils/Config.php +3f168e1ffb14560bed4eb5d301c8f748;src/Utils/SessionHelper.php +d8659e8d6c1850a787285eb36967e3f1;src/Utils/Config.php d5d5d79ab6d86b5a965cf17240ff601e;src/Utils/JtlLoggerTrait.php 45d77592d5be177698832b19d2f84b78;src/Utils/Compatibility.php 48830baed39f5710178337ad6d6f8444;src/Utils/TranslatorTrait.php @@ -963,28 +966,28 @@ fda45f203428056c6676cf83a15b4387;src/Foundation/Seeder.php a09b4b6da00f1cd498ddbac5b8c4d051;src/Foundation/Entity.php 97287cd9117f7b341aefb53cfe00ac64;src/Foundation/Model.php ea7aa4025fd765d650d31bf1c60e768f;LICENSE -eb925bcc8e525c0151338006a2c34ac7;paymentmethod/UnzerPaylaterDirectDebit.php -1ef765d0ee365680c13dc50356da8aa4;paymentmethod/HeidelpayPrepayment.php +38a3fc22572cdee9a3885683bf3b007c;paymentmethod/UnzerPaylaterDirectDebit.php +3ca7967b1966f2fda5a4732d0779aeb8;paymentmethod/HeidelpayPrepayment.php ec0675d513fe14aa3766347ab3fe45ba;paymentmethod/UnzerDirectBankTransfer.php cdf083b85ad47dd962fb7223301609c3;paymentmethod/UnzerWero.php 4704fb5d3c5b2581977682c705979bf0;paymentmethod/HeidelpayInvoiceGuaranteed.php 9e34f11f989a7ec68c9e4cc9c8a380d2;paymentmethod/UnzerKlarna.php -96b585ddc78e8c6441df7b160a012680;paymentmethod/UnzerBancontact.php -c0cb90d1ae3f9488c4f1900cb4cbd052;paymentmethod/HeidelpayPayPal.php +7101d4748dff19c48223d84a112339db;paymentmethod/UnzerBancontact.php +936e2ea3fec93fc4498132b81ec8f4f1;paymentmethod/HeidelpayPayPal.php c33ab12c2ff6b0a4be832b1fd5ccc258;paymentmethod/UnzerTwint.php bc6a8299df4b8de3e0b2743ed860d61f;paymentmethod/UnzerApplePay.php -953a8f0ea57476b1a419e92e65685f05;paymentmethod/HeidelpayWeChatPay.php +75d281c904425534046164df12e3d1f5;paymentmethod/HeidelpayWeChatPay.php 2cde4fb87f7ba1ccd21abbac226d75eb;paymentmethod/UnzerApplePayV2.php -b350dcebcc08fd00d7e98673d378b11a;paymentmethod/HeidelpayEPS.php -d3c122c6611b3fac25a782e1b348c2d3;paymentmethod/HeidelpaySEPADirectDebit.php +d6e6fa5c751565b83ebc6c2c3676cc94;paymentmethod/HeidelpayEPS.php +321b61e4a93e0d0860f9dd8404ebf377;paymentmethod/HeidelpaySEPADirectDebit.php 04f239d9194556e5a43ef6c6b6168f43;paymentmethod/HeidelpayGiropay.php 3aea69ee54494a9981058e8f84be502e;paymentmethod/HeidelpayFlexiPayDirect.php b80ab88d008319b39cba524bf2bd1b11;paymentmethod/HeidelpayInvoiceFactoring.php 58dae7c0526e2464e276aba8f326a7e0;paymentmethod/HeidelpaySEPADirectDebitGuaranteed.php -6e2fc01e330f5f5755e277cf59e274e2;paymentmethod/HeidelpayiDEAL.php +524d91a283d4adcd7b18466d25fe9ae1;paymentmethod/HeidelpayiDEAL.php 91aff68f9cc80451feb3b05f9f435d20;paymentmethod/UnzerPaylaterInstallment.php 76aac63ba26683b03f88e06311db677e;paymentmethod/HeidelpayInvoice.php -c20ff94ea7e43b658b7b0c7fbd5e9186;paymentmethod/UnzerPaylaterInvoice.php +4bc389fe7847acb688edcd86bf0b9b81;paymentmethod/UnzerPaylaterInvoice.php b2b5981cdb3060854934a7a4ddd86352;paymentmethod/HeidelpaySofort.php 405ab8956305746a8bfe2f10955d367a;paymentmethod/images/Default.svg e9b9822db699305c6f9210f7a3296d99;paymentmethod/images/Bancontact.svg @@ -1025,12 +1028,12 @@ d2198616c50a0ffd907e94a2f42c5f8b;paymentmethod/images/iDeal_WERO.svg a25d1f684f60c0372468352a886400d5;paymentmethod/images/DirectDebitSecuredWL.svg 36dc54e9a212afc559462b482399025c;paymentmethod/images/Ideal.svg 97301dfb7f296851b5c3d01f5f1459ce;paymentmethod/images/Discover.svg -3ed99e2491c35c9bd10085fbbf563db1;paymentmethod/HeidelpayPrzelewy24.php +96277ca6f92c342d9667542213dd903f;paymentmethod/HeidelpayPrzelewy24.php 4c63e15cb4148ac8d76fead03e93f5e1;paymentmethod/HeidelpayHirePurchaseDirectDebit.php -b67477cee042851e2e5797c69653f459;paymentmethod/HeidelpayAlipay.php +4c97bb9c40d73235c899b707e60c4a0c;paymentmethod/HeidelpayAlipay.php 608e304f236b8f85fca13d8cf4069077;paymentmethod/UnzerGooglePay.php 43aa1ac4c28b351cdb5c54656b0586b5;paymentmethod/template/hire_purchase_direct_debit_form.tpl -2b159d6ce8467ebf9681650448686803;paymentmethod/template/sepa_form.tpl +e8405d784f1b577d8332cfd9f2702587;paymentmethod/template/sepa_form.tpl 43aa1ac4c28b351cdb5c54656b0586b5;paymentmethod/template/sepa_guaranteed_form.tpl b9d6e186e710ffdb6ea598a13479db43;paymentmethod/template/bancontact_form.tpl 65f91fe9b9c5a02b7c577418adf9885d;paymentmethod/template/klarna.tpl @@ -1049,30 +1052,31 @@ d41d8cd98f00b204e9800998ecf8427e;paymentmethod/template/google_pay.tpl 37a525c363261a7be5c758cfd53b5c7c;paymentmethod/template/eps_form.tpl b95106f7bffc7555d8f14ab20d2280d8;paymentmethod/template/_includes.tpl 684dd20ae3d25753df30f267ca1e8c9e;paymentmethod/template/_footer.tpl -fb2098163ee1ea4b71832307f9782cb2;paymentmethod/template/_components_v2.tpl +1488460b7ebfcb5fa2e5c52cf773d276;paymentmethod/template/_components_v2.tpl a60e1531064c14507ae0429e123a1112;paymentmethod/template/ideal_form.tpl 3fa929316c2b3961c4ca5e32fc52cc20;paymentmethod/template/direct_bank_transfer.tpl -b0da8f398cc756806aeb2863b64b7904;paymentmethod/template/paypal_form.tpl -bf65191e3e917f6b2cb611fb7c132684;paymentmethod/template/credit_card_form.tpl +1390733025f2713b335eeb881c3a5f3c;paymentmethod/template/paypal_form.tpl +418e56b835216f9ad94bd0cfb35acfbf;paymentmethod/template/credit_card_form.tpl 43aa1ac4c28b351cdb5c54656b0586b5;paymentmethod/template/invoice_factoring_form.tpl 2cf802a644ae51b1d780f7032f37d463;paymentmethod/template/wero.tpl 3541e3aafa172d7fcb1574a64d8930f5;paymentmethod/template/dummy.tpl ddaaceadd4366b7aa7aaa82ae405c821;paymentmethod/template/alipay_form.tpl 43aa1ac4c28b351cdb5c54656b0586b5;paymentmethod/template/invoice_guaranteed_form.tpl 54fd30a2872c9c7223da7c93d746029b;paymentmethod/template/prepayment_form.tpl -c9fbc71d1dfb968bf8980b0e8475130e;paymentmethod/HeidelpayCreditCard.php -c88298d6edeb669318ab38896cc367a5;info.xml +c6212be984396ea5ae48880b371e2c61;paymentmethod/HeidelpayCreditCard.php +ee72586bef75c15d1d06a437e4354ec8;info.xml c237fcf06c9da2f07028932e8eb8aa36;Migrations/Migration20230925100000.php +686b3eec05aa867a757aa916dd50b50a;Migrations/Migration20260303100000.php 55ccfd103771065e96f3e482ee49499e;Migrations/Migration20220511114913.php cd6d409b4fbd95d76bfe82ab4805a17b;Migrations/Migration20230919100000.php 166d9346b496a3a2a2332586e8dcfa44;Migrations/Migration20221006103000.php 3faed6c0507c6f399d352282db7c777b;Migrations/Migration20201027083900.php -1149e01925063e361c6f6b2cbdc0b0dd;Bootstrap.php +3457b9fdf3d1762d3fdc8a2d2a10cacf;Bootstrap.php c9f6e33220cf462393c7070cffcfff1a;NOTICE 4db0ef5803b943bc62cf9a6e0f7b40b5;Seeders/Shop4PluginMigrationSeeder.php -07d0989807114abdbcfc1277066d9c42;locale/de-DE/base.po -cd72ab3d0e95f351a71904b62ddaa7e8;locale/de-DE/base.mo -1b37dc38c1a66c0ae96ac95652205eb6;locale/en-GB/base.po -35912e0e8c142ec7fbe5047751f970dd;locale/en-GB/base.mo +24c7b7d22435a4e5efc810d505d146cb;locale/de-DE/base.po +72ebb8c85ec797a90faf8be19ecf1383;locale/de-DE/base.mo +778e8c29f694bc2c9902c04ed686ac0b;locale/en-GB/base.po +a1f17490d317c9c3c41322d96a75daa4;locale/en-GB/base.mo e73740baa8bcab9ac6d47b2a95daa826;jsconfig.json -f4e8cfce61e17d18d5f03489956dddae;CHANGELOG.md +835d1c9f49afcc380506604e594054fb;CHANGELOG.md diff --git a/frontend/js/unzer-ui-components.js b/frontend/js/unzer-ui-components.js index e48187d..630badf 100644 --- a/frontend/js/unzer-ui-components.js +++ b/frontend/js/unzer-ui-components.js @@ -76,14 +76,15 @@ var _errors = _interopRequireDefault(require("../utils/errors")); var _default = /*#__PURE__*/function () { /** *@param {HTMLElement} el - * @param {{component: string, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings + * @param {{component: string, hasSavedInfo: boolean, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings */ function _default(el, settings) { (0, _classCallCheck2["default"])(this, _default); (0, _defineProperty2["default"])(this, "inputNames", { 'resourceId': 'paymentData[resourceId]', 'customerId': 'paymentData[customerId]', - 'threatMetrixId': 'paymentData[threatMetrixId]' + 'threatMetrixId': 'paymentData[threatMetrixId]', + 'saveInfo': 'paymentData[saveInfo]' }); (0, _defineProperty2["default"])(this, "unzerCheckout", null); (0, _defineProperty2["default"])(this, "unzerPayment", null); @@ -99,19 +100,7 @@ var _default = /*#__PURE__*/function () { (0, _createClass2["default"])(_default, [{ key: "boot", value: function boot() { - var wrapper = document.createElement('unzer-checkout'); - - if (this.submitButton) { - // Wrap Submit Button with for - // "automatic handling for enabling/disabling the submit button depending on the current status, - // and showing/hiding of brand icons." - wrapper.id = "unzer-checkout-wrapper"; - this.submitButton.parentNode.insertBefore(wrapper, this.submitButton); - wrapper.appendChild(this.submitButton); - this.submitButton.id = 'unzerUiComponentCheckoutBtn'; - } else { - this.el.appendChild(wrapper); - } + this.initUnzerCheckoutButton(); } }, { key: "register", @@ -121,27 +110,43 @@ var _default = /*#__PURE__*/function () { // form (_this$submitButton = this.submitButton) === null || _this$submitButton === void 0 ? void 0 : _this$submitButton.addEventListener('click', function (e) { - e.preventDefault(); // this.el.closest('form').submit(); - }); // this.#el.closest('form').addEventListener('submit', (e) => { - // console.log('on submit'); - // e.preventDefault(); - // document.querySelector('unzer-checkout > button[type="submit"]').click(); - // }) - // Wait for ui components to be loaded + e.preventDefault(); // Submit the form when we use a saved payment instead of the UI component - Promise.all([customElements.whenDefined("unzer-payment"), customElements.whenDefined("unzer-checkout"), customElements.whenDefined(this.customElement)]).then(function () { - _this.unzerPayment = document.querySelector('unzer-payment'); - _this.unzerCheckout = document.querySelector('unzer-checkout'); + if (_this.settings.hasSavedInfo && document.querySelector("input[name='" + _this.inputNames.resourceId + "']:checked").value !== 'new') { + _this.el.closest('form').submit(); + } + }); // Radio Group for saved payment data - _this.mounted(); - })["catch"](function (err) { - return _this.logError(err); - }); + if (this.settings.hasSavedInfo) { + var radioButtons = this.el.querySelectorAll("input[name='" + this.inputNames.resourceId + "']"); + + for (var i = 0; i < radioButtons.length; i++) { + radioButtons[i].addEventListener('change', function (event) { + var targetElement = event.target; + + var unzerElementWrapper = _this.el.querySelector('unzer-payment'); + + unzerElementWrapper.hidden = targetElement.value !== 'new'; + + if (targetElement.value !== 'new') { + _this.destroyUnzerCheckoutButton(); + } else { + _this.initUnzerCheckoutButton(); + } + }); + } + + document.querySelector("input[name='" + this.inputNames.resourceId + "']:checked").dispatchEvent(new Event('change')); + } } }, { key: "mounted", value: function mounted() { - // this.unzerCheckout.autoDisable = true; + if (!this.unzerCheckout) { + return; + } // this.unzerCheckout.autoDisable = true; + + this.unzerCheckout.onPaymentSubmit = this.onPaymentSubmit.bind(this); // Small style fix if needed if (this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout')) { @@ -217,6 +222,15 @@ var _default = /*#__PURE__*/function () { threatmetrixIdInput.setAttribute('name', this.inputNames.threatMetrixId); threatmetrixIdInput.setAttribute('value', response.threatMetrixId); this.el.appendChild(threatmetrixIdInput); + } // COF payments + + + if (response.saveInfoValue) { + var saveInfoValueInput = document.createElement('input'); + saveInfoValueInput.setAttribute('type', 'hidden'); + saveInfoValueInput.setAttribute('name', this.inputNames.saveInfo); + saveInfoValueInput.setAttribute('value', JSON.stringify(response.submitResponse.data)); + this.el.appendChild(saveInfoValueInput); } // submit ids to server side intergration to perform payment transaction @@ -233,6 +247,49 @@ var _default = /*#__PURE__*/function () { err: err }); } + }, { + key: "initUnzerCheckoutButton", + value: function initUnzerCheckoutButton() { + var _this2 = this; + + var wrapper = document.createElement('unzer-checkout'); + + if (this.submitButton) { + // Wrap Submit Button with for + // "automatic handling for enabling/disabling the submit button depending on the current status, + // and showing/hiding of brand icons." + wrapper.id = "unzer-checkout-wrapper"; + this.submitButton.parentNode.insertBefore(wrapper, this.submitButton); + wrapper.appendChild(this.submitButton); + this.submitButton.id = 'unzerUiComponentCheckoutBtn'; + } else { + this.el.appendChild(wrapper); + } // Wait for ui components to be loaded + + + Promise.all([customElements.whenDefined("unzer-payment"), customElements.whenDefined("unzer-checkout"), customElements.whenDefined(this.customElement)]).then(function () { + _this2.unzerPayment = document.querySelector('unzer-payment'); + _this2.unzerCheckout = document.querySelector('unzer-checkout'); + + _this2.mounted(); + })["catch"](function (err) { + return _this2.logError(err); + }); + } + }, { + key: "destroyUnzerCheckoutButton", + value: function destroyUnzerCheckoutButton() { + var unzerCheckoutWrapper = document.querySelector('unzer-checkout'); + this.submitButton.disabled = false; + + if (unzerCheckoutWrapper) { + while (unzerCheckoutWrapper.firstChild) { + unzerCheckoutWrapper.parentNode.insertBefore(unzerCheckoutWrapper.firstChild, unzerCheckoutWrapper); + } + + unzerCheckoutWrapper.remove(); + } + } }]); return _default; }(); diff --git a/frontend/js/unzer-ui-components.js.map b/frontend/js/unzer-ui-components.js.map index 0a55bcf..bd2ab91 100644 --- a/frontend/js/unzer-ui-components.js.map +++ b/frontend/js/unzer-ui-components.js.map @@ -22,13 +22,13 @@ "node_modules/@babel/runtime/helpers/typeof.js" ], "names": [], - "mappings": "AAAA;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;WAGI,mBAAU;MACN;MACA,KAAK,UAAL,CAAgB,UAAhB,GAA6B,uBAA7B;MAEA,IAAM,YAAY,GAAG,IAAI,CAAC,KAAL,CAAW,KAAK,EAAL,CAAQ,OAAR,CAAgB,kBAA3B,KAAkD,EAAvE,CAJM,CAKN;MACA;MACA;MACA;MACA;;MAEA,KAAK,YAAL,CAAkB,eAAlB,CAAkC,YAAlC;IACH;;;E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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": "AAAA;;;;;;;;;;;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;WAGI,mBAAU;MACN;MACA,KAAK,UAAL,CAAgB,UAAhB,GAA6B,uBAA7B;MAEA,IAAM,YAAY,GAAG,IAAI,CAAC,KAAL,CAAW,KAAK,EAAL,CAAQ,OAAR,CAAgB,kBAA3B,KAAkD,EAAvE,CAJM,CAKN;MACA;MACA;MACA;MACA;;MAEA,KAAK,YAAL,CAAkB,eAAlB,CAAkC,YAAlC;IACH;;;EAbwB,gB;;;;;;;;;;;;;;;;;;;;ACF7B;;;EAcI;AACJ;AACA;AACA;EACI,kBAAY,EAAZ,EAAgB,QAAhB,EAA0B;IAAA;IAAA,qDAdb;MACT,cAAc,yBADL;MAET,cAAc,yBAFL;MAGT,kBAAkB,6BAHT;MAIT,YAAY;IAJH,CAca;IAAA,wDAPV,IAOU;IAAA,uDANX,IAMW;IACtB,KAAK,EAAL,GAAU,EAAV;IACA,KAAK,QAAL,GAAgB,QAAhB;IACA,KAAK,aAAL,GAAqB,WAAW,QAAQ,CAAC,SAAzC;IACA,KAAK,YAAL,GAAoB,QAAQ,CAAC,aAAT,CAAuB,QAAQ,CAAC,YAAhC,CAApB;IACA,KAAK,YA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "unzer-ui-components.js", "sourceRoot": "", "sourcesContent": [ "(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n // return await this.unzerPayment?.submit()\n // .then(response => this.onPaymentSubmit(response))\n // .catch(err => this.logError(err));\n // };\n\n this.unzerPayment.setApplePayData(applePayData);\n }\n}", - "import ErrorHandler from \"../utils/errors\";\n\nexport default class\n{\n inputNames = {\n 'resourceId': 'paymentData[resourceId]',\n 'customerId': 'paymentData[customerId]',\n 'threatMetrixId': 'paymentData[threatMetrixId]'\n };\n\n unzerCheckout = null;\n unzerPayment = null;\n\n /**\n *@param {HTMLElement} el\n * @param {{component: string, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings\n */\n constructor(el, settings) {\n this.el = el;\n this.settings = settings;\n this.customElement = \"unzer-\" + settings.component;\n this.submitButton = document.querySelector(settings.submitButton);\n this.errorHandler = new ErrorHandler();\n\n this.boot();\n this.register();\n }\n\n boot() {\n const wrapper = document.createElement('unzer-checkout');\n\n if (this.submitButton) {\n // Wrap Submit Button with for\n // \"automatic handling for enabling/disabling the submit button depending on the current status,\n // and showing/hiding of brand icons.\"\n wrapper.id = \"unzer-checkout-wrapper\"\n this.submitButton.parentNode.insertBefore(wrapper, this.submitButton);\n wrapper.appendChild(this.submitButton);\n this.submitButton.id = 'unzerUiComponentCheckoutBtn';\n } else {\n this.el.appendChild(wrapper);\n }\n }\n\n register() {\n // form\n this.submitButton?.addEventListener('click', e => {\n e.preventDefault();\n // this.el.closest('form').submit();\n });\n\n // this.#el.closest('form').addEventListener('submit', (e) => {\n // console.log('on submit');\n // e.preventDefault();\n // document.querySelector('unzer-checkout > button[type=\"submit\"]').click();\n // })\n\n // Wait for ui components to be loaded\n Promise.all([\n customElements.whenDefined(\"unzer-payment\"),\n customElements.whenDefined(\"unzer-checkout\"),\n customElements.whenDefined(this.customElement)\n ]).then(() => {\n this.unzerPayment = document.querySelector('unzer-payment');\n this.unzerCheckout = document.querySelector('unzer-checkout');\n this.mounted();\n })\n .catch((err) => this.logError(err));\n }\n\n mounted() {\n // this.unzerCheckout.autoDisable = true;\n this.unzerCheckout.onPaymentSubmit = this.onPaymentSubmit.bind(this);\n\n // Small style fix if needed\n if (this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout')) {\n this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout').style.width = '100%';\n }\n\n // Set customer data if available\n if (this.settings.customer) {\n if (this.settings.isB2B) {\n this.settings.customer.customerSettings = {'type': 'B2B'};\n }\n\n this.unzerPayment.setCustomerData(this.settings.customer);\n }\n\n // Set basket data if available\n if (this.settings.basket) {\n this.unzerPayment.setBasketData(this.settings.basket);\n }\n\n // Autosubmit form\n if (this.settings.autoSubmit) {\n // document.querySelector('unzer-checkout > button[type=\"submit\"]').click();\n this.submitButton?.click();\n }\n }\n\n onPaymentSubmit(response) {\n try {\n if (this.settings.component === 'card' && response.submitResponse?.success !== true) {\n if (!response.submitResponse || response.submitResponse.status !== 'SUCCESS') {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n } else {\n if (!response.submitResponse || !response.submitResponse.success) {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n }\n\n console.log({ response });\n\n // Append payment resource id\n const resourceIdInput = document.createElement('input');\n resourceIdInput.setAttribute('type', 'hidden');\n resourceIdInput.setAttribute('name', this.inputNames.resourceId);\n resourceIdInput.setAttribute('value', response.submitResponse.data.id);\n this.el.appendChild(resourceIdInput);\n\n // append customer id\n if (response.customerResponse && response.customerResponse.success) {\n const customerIdInput = document.createElement('input');\n customerIdInput.setAttribute('type', 'hidden');\n customerIdInput.setAttribute('name', this.inputNames.customerId);\n customerIdInput.setAttribute('value', response.customerResponse.data.id);\n this.el.appendChild(customerIdInput);\n }\n\n // append threatmetrix id\n if (response.threatMetrixId) {\n const threatmetrixIdInput = document.createElement('input');\n threatmetrixIdInput.setAttribute('type', 'hidden');\n threatmetrixIdInput.setAttribute('name', this.inputNames.threatMetrixId);\n threatmetrixIdInput.setAttribute('value', response.threatMetrixId);\n this.el.appendChild(threatmetrixIdInput);\n }\n\n // submit ids to server side intergration to perform payment transaction\n this.el.closest('form').submit();\n } catch(err) {\n this.logError(err);\n }\n }\n\n logError(err) {\n this.errorHandler.show(err);\n console.error('Unzer UI Component Error', {err})\n }\n}", + "import ErrorHandler from \"../utils/errors\";\n\nexport default class\n{\n inputNames = {\n 'resourceId': 'paymentData[resourceId]',\n 'customerId': 'paymentData[customerId]',\n 'threatMetrixId': 'paymentData[threatMetrixId]',\n 'saveInfo': 'paymentData[saveInfo]'\n };\n\n unzerCheckout = null;\n unzerPayment = null;\n\n /**\n *@param {HTMLElement} el\n * @param {{component: string, hasSavedInfo: boolean, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings\n */\n constructor(el, settings) {\n this.el = el;\n this.settings = settings;\n this.customElement = \"unzer-\" + settings.component;\n this.submitButton = document.querySelector(settings.submitButton);\n this.errorHandler = new ErrorHandler();\n\n this.boot();\n this.register();\n }\n\n boot() {\n this.initUnzerCheckoutButton();\n }\n\n register() {\n // form\n this.submitButton?.addEventListener('click', e => {\n e.preventDefault();\n\n // Submit the form when we use a saved payment instead of the UI component\n if (this.settings.hasSavedInfo && document.querySelector(\"input[name='\" + this.inputNames.resourceId + \"']:checked\").value !== 'new') {\n this.el.closest('form').submit();\n }\n });\n\n // Radio Group for saved payment data\n if (this.settings.hasSavedInfo) {\n const radioButtons = this.el.querySelectorAll(\"input[name='\" + this.inputNames.resourceId + \"']\");\n\n for (let i = 0; i < radioButtons.length; i++) {\n radioButtons[i].addEventListener('change', (event) => {\n const targetElement = event.target;\n const unzerElementWrapper = this.el.querySelector('unzer-payment');\n unzerElementWrapper.hidden = targetElement.value !== 'new';\n\n if (targetElement.value !== 'new') {\n this.destroyUnzerCheckoutButton();\n } else {\n this.initUnzerCheckoutButton();\n }\n });\n\n }\n\n document\n .querySelector(\"input[name='\" + this.inputNames.resourceId + \"']:checked\")\n .dispatchEvent(new Event('change'));\n }\n }\n\n mounted() {\n if (! this.unzerCheckout) {\n return;\n }\n\n // this.unzerCheckout.autoDisable = true;\n this.unzerCheckout.onPaymentSubmit = this.onPaymentSubmit.bind(this);\n\n // Small style fix if needed\n if (this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout')) {\n this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout').style.width = '100%';\n }\n\n // Set customer data if available\n if (this.settings.customer) {\n if (this.settings.isB2B) {\n this.settings.customer.customerSettings = {'type': 'B2B'};\n }\n\n this.unzerPayment.setCustomerData(this.settings.customer);\n }\n\n // Set basket data if available\n if (this.settings.basket) {\n this.unzerPayment.setBasketData(this.settings.basket);\n }\n\n // Autosubmit form\n if (this.settings.autoSubmit) {\n // document.querySelector('unzer-checkout > button[type=\"submit\"]').click();\n this.submitButton?.click();\n }\n }\n\n onPaymentSubmit(response) {\n try {\n if (this.settings.component === 'card' && response.submitResponse?.success !== true) {\n if (!response.submitResponse || response.submitResponse.status !== 'SUCCESS') {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n } else {\n if (!response.submitResponse || !response.submitResponse.success) {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n }\n\n console.log({ response });\n\n // Append payment resource id\n const resourceIdInput = document.createElement('input');\n resourceIdInput.setAttribute('type', 'hidden');\n resourceIdInput.setAttribute('name', this.inputNames.resourceId);\n resourceIdInput.setAttribute('value', response.submitResponse.data.id);\n this.el.appendChild(resourceIdInput);\n\n // append customer id\n if (response.customerResponse && response.customerResponse.success) {\n const customerIdInput = document.createElement('input');\n customerIdInput.setAttribute('type', 'hidden');\n customerIdInput.setAttribute('name', this.inputNames.customerId);\n customerIdInput.setAttribute('value', response.customerResponse.data.id);\n this.el.appendChild(customerIdInput);\n }\n\n // append threatmetrix id\n if (response.threatMetrixId) {\n const threatmetrixIdInput = document.createElement('input');\n threatmetrixIdInput.setAttribute('type', 'hidden');\n threatmetrixIdInput.setAttribute('name', this.inputNames.threatMetrixId);\n threatmetrixIdInput.setAttribute('value', response.threatMetrixId);\n this.el.appendChild(threatmetrixIdInput);\n }\n\n // COF payments\n if (response.saveInfoValue) {\n const saveInfoValueInput = document.createElement('input');\n saveInfoValueInput.setAttribute('type', 'hidden');\n saveInfoValueInput.setAttribute('name', this.inputNames.saveInfo);\n saveInfoValueInput.setAttribute('value', JSON.stringify(response.submitResponse.data));\n this.el.appendChild(saveInfoValueInput);\n }\n\n // submit ids to server side intergration to perform payment transaction\n this.el.closest('form').submit();\n } catch(err) {\n this.logError(err);\n }\n }\n\n logError(err) {\n this.errorHandler.show(err);\n console.error('Unzer UI Component Error', {err})\n }\n\n initUnzerCheckoutButton() {\n const wrapper = document.createElement('unzer-checkout');\n\n if (this.submitButton) {\n // Wrap Submit Button with for\n // \"automatic handling for enabling/disabling the submit button depending on the current status,\n // and showing/hiding of brand icons.\"\n wrapper.id = \"unzer-checkout-wrapper\"\n this.submitButton.parentNode.insertBefore(wrapper, this.submitButton);\n wrapper.appendChild(this.submitButton);\n this.submitButton.id = 'unzerUiComponentCheckoutBtn';\n } else {\n this.el.appendChild(wrapper);\n }\n\n // Wait for ui components to be loaded\n Promise.all([\n customElements.whenDefined(\"unzer-payment\"),\n customElements.whenDefined(\"unzer-checkout\"),\n customElements.whenDefined(this.customElement)\n ]).then(() => {\n this.unzerPayment = document.querySelector('unzer-payment');\n this.unzerCheckout = document.querySelector('unzer-checkout');\n this.mounted();\n })\n .catch((err) => this.logError(err));\n }\n\n destroyUnzerCheckoutButton() {\n const unzerCheckoutWrapper = document.querySelector('unzer-checkout');\n this.submitButton.disabled = false;\n\n if (unzerCheckoutWrapper) {\n while (unzerCheckoutWrapper.firstChild) {\n unzerCheckoutWrapper.parentNode.insertBefore(unzerCheckoutWrapper.firstChild, unzerCheckoutWrapper);\n }\n unzerCheckoutWrapper.remove();\n }\n }\n}", "import BaseComponent from './base';\n\nexport default class extends BaseComponent {\n mounted() {\n super.mounted();\n\n this.inputNames.resourceId = 'unzer-payment-type-id';\n\n const settings = JSON.parse(this.el.dataset.paymentDataRequest) || {};\n const googlePayData = {\n gatewayMerchantId: settings.gatewayMerchantId,\n merchantInfo: settings.merchantInfo,\n transactionInfo: settings.transactionInfo,\n allowedCardNetworks: settings.allowedCardNetworks,\n allowCreditCards: settings.allowCreditCards,\n allowPrepaidCards: settings.allowPrepaidCards,\n buttonOptions: {\n buttonColor: settings.buttonOptions.buttonColor,\n buttonSizeMode: settings.buttonOptions.buttonSize,\n },\n // onPaymentAuthorizedCallback: async (paymentData) => {\n // return await this.unzerPayment?.submit()\n // .then(response => this.onPaymentSubmit(response))\n // .catch(err => this.logError(err));\n // }\n };\n\n this.unzerPayment.setGooglePayData(googlePayData);\n }\n}", "/**\n * Unzer UI Components V2\n * @see https://docs.unzer.com/online-payments/ui-component-v2/\n */\nimport BaseComponent from \"./base\";\nimport ErrorHandler from \"../utils/errors\";\nimport GooglePayComponent from \"./googlepay\";\nimport ApplePayComponent from \"./applepay\";\nimport KlarnaComponent from \"./klarna\";\n\n// Init component\ndocument.addEventListener('DOMContentLoaded', function() {\n /** @type {NodeListOf} */\n const components = document.querySelectorAll('[data-unzer-ui-component]');\n\n if (!components || components.length === 0) {\n return;\n }\n\n components.forEach(el => {\n try {\n const settings = JSON.parse(el.dataset.unzerUiComponent) || {};\n\n if (settings.component === 'google-pay') {\n new GooglePayComponent(el, settings);\n } else if (settings.component === 'apple-pay') {\n new ApplePayComponent(el, settings);\n } else if (settings.component === 'klarna') {\n new KlarnaComponent(el, settings);\n } else {\n new BaseComponent(el, settings);\n }\n } catch(err) {\n (new ErrorHandler).show(err);\n console.error(err);\n }\n });\n});\n", "import BaseComponent from './base';\n\nexport default class extends BaseComponent {\n mounted() {\n super.mounted();\n\n const locale = new Intl.Locale(navigator.language || navigator.userLanguage || 'en-GB');\n\n this.unzerPayment.updateCustomerData({\n \"language\": locale.language\n });\n }\n}", diff --git a/frontend/js/unzer-ui-components.min.js b/frontend/js/unzer-ui-components.min.js index b8b73f5..062e7e7 100644 --- a/frontend/js/unzer-ui-components.min.js +++ b/frontend/js/unzer-ui-components.min.js @@ -1,2 +1,2 @@ -!function(){function e(t,r,n){function o(s,a){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(u)return u(s,!0);var i=new Error("Cannot find module '"+s+"'");throw i.code="MODULE_NOT_FOUND",i}var p=r[s]={exports:{}};t[s][0].call(p.exports,function(e){return o(t[s][1][e]||e)},p,p.exports,e,t,r,n)}return r[s].exports}for(var u="function"==typeof require&&require,s=0;s {\n // return await this.unzerPayment?.submit()\n // .then(response => this.onPaymentSubmit(response))\n // .catch(err => this.logError(err));\n // };\n\n this.unzerPayment.setApplePayData(applePayData);\n }\n}","import ErrorHandler from \"../utils/errors\";\n\nexport default class\n{\n inputNames = {\n 'resourceId': 'paymentData[resourceId]',\n 'customerId': 'paymentData[customerId]',\n 'threatMetrixId': 'paymentData[threatMetrixId]'\n };\n\n unzerCheckout = null;\n unzerPayment = null;\n\n /**\n *@param {HTMLElement} el\n * @param {{component: string, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings\n */\n constructor(el, settings) {\n this.el = el;\n this.settings = settings;\n this.customElement = \"unzer-\" + settings.component;\n this.submitButton = document.querySelector(settings.submitButton);\n this.errorHandler = new ErrorHandler();\n\n this.boot();\n this.register();\n }\n\n boot() {\n const wrapper = document.createElement('unzer-checkout');\n\n if (this.submitButton) {\n // Wrap Submit Button with for\n // \"automatic handling for enabling/disabling the submit button depending on the current status,\n // and showing/hiding of brand icons.\"\n wrapper.id = \"unzer-checkout-wrapper\"\n this.submitButton.parentNode.insertBefore(wrapper, this.submitButton);\n wrapper.appendChild(this.submitButton);\n this.submitButton.id = 'unzerUiComponentCheckoutBtn';\n } else {\n this.el.appendChild(wrapper);\n }\n }\n\n register() {\n // form\n this.submitButton?.addEventListener('click', e => {\n e.preventDefault();\n // this.el.closest('form').submit();\n });\n\n // this.#el.closest('form').addEventListener('submit', (e) => {\n // console.log('on submit');\n // e.preventDefault();\n // document.querySelector('unzer-checkout > button[type=\"submit\"]').click();\n // })\n\n // Wait for ui components to be loaded\n Promise.all([\n customElements.whenDefined(\"unzer-payment\"),\n customElements.whenDefined(\"unzer-checkout\"),\n customElements.whenDefined(this.customElement)\n ]).then(() => {\n this.unzerPayment = document.querySelector('unzer-payment');\n this.unzerCheckout = document.querySelector('unzer-checkout');\n this.mounted();\n })\n .catch((err) => this.logError(err));\n }\n\n mounted() {\n // this.unzerCheckout.autoDisable = true;\n this.unzerCheckout.onPaymentSubmit = this.onPaymentSubmit.bind(this);\n\n // Small style fix if needed\n if (this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout')) {\n this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout').style.width = '100%';\n }\n\n // Set customer data if available\n if (this.settings.customer) {\n if (this.settings.isB2B) {\n this.settings.customer.customerSettings = {'type': 'B2B'};\n }\n\n this.unzerPayment.setCustomerData(this.settings.customer);\n }\n\n // Set basket data if available\n if (this.settings.basket) {\n this.unzerPayment.setBasketData(this.settings.basket);\n }\n\n // Autosubmit form\n if (this.settings.autoSubmit) {\n // document.querySelector('unzer-checkout > button[type=\"submit\"]').click();\n this.submitButton?.click();\n }\n }\n\n onPaymentSubmit(response) {\n try {\n if (this.settings.component === 'card' && response.submitResponse?.success !== true) {\n if (!response.submitResponse || response.submitResponse.status !== 'SUCCESS') {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n } else {\n if (!response.submitResponse || !response.submitResponse.success) {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n }\n\n console.log({ response });\n\n // Append payment resource id\n const resourceIdInput = document.createElement('input');\n resourceIdInput.setAttribute('type', 'hidden');\n resourceIdInput.setAttribute('name', this.inputNames.resourceId);\n resourceIdInput.setAttribute('value', response.submitResponse.data.id);\n this.el.appendChild(resourceIdInput);\n\n // append customer id\n if (response.customerResponse && response.customerResponse.success) {\n const customerIdInput = document.createElement('input');\n customerIdInput.setAttribute('type', 'hidden');\n customerIdInput.setAttribute('name', this.inputNames.customerId);\n customerIdInput.setAttribute('value', response.customerResponse.data.id);\n this.el.appendChild(customerIdInput);\n }\n\n // append threatmetrix id\n if (response.threatMetrixId) {\n const threatmetrixIdInput = document.createElement('input');\n threatmetrixIdInput.setAttribute('type', 'hidden');\n threatmetrixIdInput.setAttribute('name', this.inputNames.threatMetrixId);\n threatmetrixIdInput.setAttribute('value', response.threatMetrixId);\n this.el.appendChild(threatmetrixIdInput);\n }\n\n // submit ids to server side intergration to perform payment transaction\n this.el.closest('form').submit();\n } catch(err) {\n this.logError(err);\n }\n }\n\n logError(err) {\n this.errorHandler.show(err);\n console.error('Unzer UI Component Error', {err})\n }\n}","import BaseComponent from './base';\n\nexport default class extends BaseComponent {\n mounted() {\n super.mounted();\n\n this.inputNames.resourceId = 'unzer-payment-type-id';\n\n const settings = JSON.parse(this.el.dataset.paymentDataRequest) || {};\n const googlePayData = {\n gatewayMerchantId: settings.gatewayMerchantId,\n merchantInfo: settings.merchantInfo,\n transactionInfo: settings.transactionInfo,\n allowedCardNetworks: settings.allowedCardNetworks,\n allowCreditCards: settings.allowCreditCards,\n allowPrepaidCards: settings.allowPrepaidCards,\n buttonOptions: {\n buttonColor: settings.buttonOptions.buttonColor,\n buttonSizeMode: settings.buttonOptions.buttonSize,\n },\n // onPaymentAuthorizedCallback: async (paymentData) => {\n // return await this.unzerPayment?.submit()\n // .then(response => this.onPaymentSubmit(response))\n // .catch(err => this.logError(err));\n // }\n };\n\n this.unzerPayment.setGooglePayData(googlePayData);\n }\n}","/**\n * Unzer UI Components V2\n * @see https://docs.unzer.com/online-payments/ui-component-v2/\n */\nimport BaseComponent from \"./base\";\nimport ErrorHandler from \"../utils/errors\";\nimport GooglePayComponent from \"./googlepay\";\nimport ApplePayComponent from \"./applepay\";\nimport KlarnaComponent from \"./klarna\";\n\n// Init component\ndocument.addEventListener('DOMContentLoaded', function() {\n /** @type {NodeListOf} */\n const components = document.querySelectorAll('[data-unzer-ui-component]');\n\n if (!components || components.length === 0) {\n return;\n }\n\n components.forEach(el => {\n try {\n const settings = JSON.parse(el.dataset.unzerUiComponent) || {};\n\n if (settings.component === 'google-pay') {\n new GooglePayComponent(el, settings);\n } else if (settings.component === 'apple-pay') {\n new ApplePayComponent(el, settings);\n } else if (settings.component === 'klarna') {\n new KlarnaComponent(el, settings);\n } else {\n new BaseComponent(el, settings);\n }\n } catch(err) {\n (new ErrorHandler).show(err);\n console.error(err);\n }\n });\n});\n","import BaseComponent from './base';\n\nexport default class extends BaseComponent {\n mounted() {\n super.mounted();\n\n const locale = new Intl.Locale(navigator.language || navigator.userLanguage || 'en-GB');\n\n this.unzerPayment.updateCustomerData({\n \"language\": locale.language\n });\n }\n}","export default class ErrorHandler {\n /**\n * @param {JQuery|null} $wrapper Wrapper for Container to display error messages in\n * @param {JQuery|null} $holder Container to display error messages in\n */\n constructor($wrapper, $holder) {\n this.$wrapper = $wrapper || $('#error-container');\n this.$holder = $holder || this.$wrapper.find('.alert');\n }\n\n /**\n * Show Error message\n * @param {String} message\n */\n show(message) {\n this.$wrapper.show();\n this.$holder.html(message);\n }\n\n /**\n * Hide error message\n */\n hide() {\n this.$wrapper.hide();\n this.$holder.html();\n }\n}\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nmodule.exports = _createClass, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var superPropBase = require(\"./superPropBase.js\");\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get.bind(), module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n }\n\n return _get.apply(this, arguments);\n}\n\nmodule.exports = _get, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\n\nvar assertThisInitialized = require(\"./assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var getPrototypeOf = require(\"./getPrototypeOf.js\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\n\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;"]} \ No newline at end of file +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","frontend/src/js/components/applepay.js","frontend/src/js/components/base.js","frontend/src/js/components/googlepay.js","frontend/src/js/components/index.js","frontend/src/js/components/klarna.js","frontend/src/js/utils/errors.js","node_modules/@babel/runtime/helpers/assertThisInitialized.js","node_modules/@babel/runtime/helpers/classCallCheck.js","node_modules/@babel/runtime/helpers/createClass.js","node_modules/@babel/runtime/helpers/defineProperty.js","node_modules/@babel/runtime/helpers/get.js","node_modules/@babel/runtime/helpers/getPrototypeOf.js","node_modules/@babel/runtime/helpers/inherits.js","node_modules/@babel/runtime/helpers/interopRequireDefault.js","node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","node_modules/@babel/runtime/helpers/setPrototypeOf.js","node_modules/@babel/runtime/helpers/superPropBase.js","node_modules/@babel/runtime/helpers/typeof.js"],"names":["r","e","n","t","o","i","f","c","require","u","a","Error","code","p","exports","call","length","1","module","_get2","_getPrototypeOf2","_default","prototype","this","inputNames","resourceId","applePayData","JSON","parse","el","dataset","paymentDataRequest","unzerPayment","setApplePayData","_interopRequireDefault","_errors","settings","_classCallCheck2","_defineProperty2","customerId","threatMetrixId","saveInfo","customElement","component","submitButton","document","querySelector","errorHandler","boot","register","initUnzerCheckoutButton","_this$submitButton","_this","addEventListener","preventDefault","hasSavedInfo","value","closest","submit","radioButtons","querySelectorAll","event","targetElement","target","hidden","destroyUnzerCheckoutButton","dispatchEvent","Event","unzerCheckout","onPaymentSubmit","bind","shadowRoot","style","width","customer","isB2B","customerSettings","type","setCustomerData","basket","setBasketData","autoSubmit","_this$submitButton2","click","response","_response$submitRespo","submitResponse","success","status","_response$submitRespo2","message","stringify","_response$submitRespo3","console","log","resourceIdInput","createElement","setAttribute","data","id","appendChild","customerResponse","customerIdInput","threatmetrixIdInput","saveInfoValue","saveInfoValueInput","err","logError","show","error","_this2","wrapper","parentNode","insertBefore","Promise","all","customElements","whenDefined","then","mounted","unzerCheckoutWrapper","disabled","firstChild","remove","googlePayData","gatewayMerchantId","merchantInfo","transactionInfo","allowedCardNetworks","allowCreditCards","allowPrepaidCards","buttonOptions","buttonColor","buttonSizeMode","buttonSize","setGooglePayData","_base","_googlepay","_applepay","_klarna","components","forEach","unzerUiComponent","locale","Intl","Locale","navigator","language","userLanguage","updateCustomerData","ErrorHandler","$wrapper","$holder","$","find","html","hide","self","ReferenceError","__esModule","instance","Constructor","TypeError","_defineProperties","props","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","obj","_get","Reflect","get","property","receiver","base","superPropBase","desc","getOwnPropertyDescriptor","arguments","apply","_getPrototypeOf","setPrototypeOf","getPrototypeOf","__proto__","subClass","superClass","create","constructor","default","_typeof","assertThisInitialized","_setPrototypeOf","object","hasOwnProperty","Symbol","iterator"],"mappings":"CAAA,WAAA,SAAAA,EAAAC,EAAAC,EAAAC,GAAA,SAAAC,EAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,IAAAE,EAAA,mBAAAC,SAAAA,QAAA,IAAAF,GAAAC,EAAA,OAAAA,EAAAF,GAAA,GAAA,GAAAI,EAAA,OAAAA,EAAAJ,GAAA,GAAA,IAAAK,EAAA,IAAAC,MAAA,uBAAAN,EAAA,KAAA,MAAAK,EAAAE,KAAA,mBAAAF,EAAA,IAAAG,EAAAX,EAAAG,IAAAS,YAAAb,EAAAI,GAAA,GAAAU,KAAAF,EAAAC,QAAA,SAAAd,GAAA,OAAAI,EAAAH,EAAAI,GAAA,GAAAL,IAAAA,IAAAa,EAAAA,EAAAC,QAAAd,EAAAC,EAAAC,EAAAC,GAAA,OAAAD,EAAAG,GAAAS,QAAA,IAAA,IAAAL,EAAA,mBAAAD,SAAAA,QAAAH,EAAA,EAAAA,EAAAF,EAAAa,OAAAX,IAAAD,EAAAD,EAAAE,IAAA,OAAAD,EAAA,OAAAJ,EAAA,IAAAiB,GAAA,SAAAT,EAAAU,EAAAJ,ygCCGI,YACI,EAAAK,EAAA,UAAA,EAAAC,EAAA,SAAAC,EAAAC,WAAA,UAAAC,MAAAR,KAAAQ,MACAA,KAAKC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,EAAAJ,gFCdA,SAAAuL,EAAAjM,EAAAS,GAKA,OAJAK,EAAAJ,QAAAuL,EAAA5B,OAAAkB,eAAAlB,OAAAkB,eAAArH,OAAA,SAAAlE,EAAAS,GAEA,OADAT,EAAAyL,UAAAhL,EACAT,GACAc,EAAAJ,QAAAiJ,YAAA,EAAA7I,EAAAJ,QAAA,QAAAI,EAAAJ,QACAuL,EAAAjM,EAAAS,GAGAK,EAAAJ,QAAAuL,EAAAnL,EAAAJ,QAAAiJ,YAAA,EAAA7I,EAAAJ,QAAA,QAAAI,EAAAJ,iCCRA,IAAA8K,EAAApL,EAAA,uBAWAU,EAAAJ,QATA,SAAAwL,EAAApB,GACA,MAAAT,OAAAnJ,UAAAiL,eAAAxL,KAAAuL,EAAApB,IAEA,QADAoB,EAAAV,EAAAU,MAIA,OAAAA,GAGApL,EAAAJ,QAAAiJ,YAAA,EAAA7I,EAAAJ,QAAA,QAAAI,EAAAJ,yDCXA,SAAAqL,EAAArB,GACA,0BAEA,OAAA5J,EAAAJ,QAAAqL,EAAA,mBAAAK,QAAA,iBAAAA,OAAAC,SAAA,SAAA3B,GACA,cAAAA,GACA,SAAAA,GACA,OAAAA,GAAA,mBAAA0B,QAAA1B,EAAAmB,cAAAO,QAAA1B,IAAA0B,OAAAlL,UAAA,gBAAAwJ,GACA5J,EAAAJ,QAAAiJ,YAAA,EAAA7I,EAAAJ,QAAA,QAAAI,EAAAJ,QAAAqL,EAAArB,GAGA5J,EAAAJ,QAAAqL,EAAAjL,EAAAJ,QAAAiJ,YAAA,EAAA7I,EAAAJ,QAAA,QAAAI,EAAAJ","file":"unzer-ui-components.min.js","sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i {\n // return await this.unzerPayment?.submit()\n // .then(response => this.onPaymentSubmit(response))\n // .catch(err => this.logError(err));\n // };\n\n this.unzerPayment.setApplePayData(applePayData);\n }\n}","import ErrorHandler from \"../utils/errors\";\n\nexport default class\n{\n inputNames = {\n 'resourceId': 'paymentData[resourceId]',\n 'customerId': 'paymentData[customerId]',\n 'threatMetrixId': 'paymentData[threatMetrixId]',\n 'saveInfo': 'paymentData[saveInfo]'\n };\n\n unzerCheckout = null;\n unzerPayment = null;\n\n /**\n *@param {HTMLElement} el\n * @param {{component: string, hasSavedInfo: boolean, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings\n */\n constructor(el, settings) {\n this.el = el;\n this.settings = settings;\n this.customElement = \"unzer-\" + settings.component;\n this.submitButton = document.querySelector(settings.submitButton);\n this.errorHandler = new ErrorHandler();\n\n this.boot();\n this.register();\n }\n\n boot() {\n this.initUnzerCheckoutButton();\n }\n\n register() {\n // form\n this.submitButton?.addEventListener('click', e => {\n e.preventDefault();\n\n // Submit the form when we use a saved payment instead of the UI component\n if (this.settings.hasSavedInfo && document.querySelector(\"input[name='\" + this.inputNames.resourceId + \"']:checked\").value !== 'new') {\n this.el.closest('form').submit();\n }\n });\n\n // Radio Group for saved payment data\n if (this.settings.hasSavedInfo) {\n const radioButtons = this.el.querySelectorAll(\"input[name='\" + this.inputNames.resourceId + \"']\");\n\n for (let i = 0; i < radioButtons.length; i++) {\n radioButtons[i].addEventListener('change', (event) => {\n const targetElement = event.target;\n const unzerElementWrapper = this.el.querySelector('unzer-payment');\n unzerElementWrapper.hidden = targetElement.value !== 'new';\n\n if (targetElement.value !== 'new') {\n this.destroyUnzerCheckoutButton();\n } else {\n this.initUnzerCheckoutButton();\n }\n });\n\n }\n\n document\n .querySelector(\"input[name='\" + this.inputNames.resourceId + \"']:checked\")\n .dispatchEvent(new Event('change'));\n }\n }\n\n mounted() {\n if (! this.unzerCheckout) {\n return;\n }\n\n // this.unzerCheckout.autoDisable = true;\n this.unzerCheckout.onPaymentSubmit = this.onPaymentSubmit.bind(this);\n\n // Small style fix if needed\n if (this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout')) {\n this.unzerCheckout.shadowRoot.querySelector('.unzer-checkout').style.width = '100%';\n }\n\n // Set customer data if available\n if (this.settings.customer) {\n if (this.settings.isB2B) {\n this.settings.customer.customerSettings = {'type': 'B2B'};\n }\n\n this.unzerPayment.setCustomerData(this.settings.customer);\n }\n\n // Set basket data if available\n if (this.settings.basket) {\n this.unzerPayment.setBasketData(this.settings.basket);\n }\n\n // Autosubmit form\n if (this.settings.autoSubmit) {\n // document.querySelector('unzer-checkout > button[type=\"submit\"]').click();\n this.submitButton?.click();\n }\n }\n\n onPaymentSubmit(response) {\n try {\n if (this.settings.component === 'card' && response.submitResponse?.success !== true) {\n if (!response.submitResponse || response.submitResponse.status !== 'SUCCESS') {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n } else {\n if (!response.submitResponse || !response.submitResponse.success) {\n throw new Error(response.submitResponse.message ?? 'Failed payment response: ' + JSON.stringify(response, null, 2));\n }\n }\n\n console.log({ response });\n\n // Append payment resource id\n const resourceIdInput = document.createElement('input');\n resourceIdInput.setAttribute('type', 'hidden');\n resourceIdInput.setAttribute('name', this.inputNames.resourceId);\n resourceIdInput.setAttribute('value', response.submitResponse.data.id);\n this.el.appendChild(resourceIdInput);\n\n // append customer id\n if (response.customerResponse && response.customerResponse.success) {\n const customerIdInput = document.createElement('input');\n customerIdInput.setAttribute('type', 'hidden');\n customerIdInput.setAttribute('name', this.inputNames.customerId);\n customerIdInput.setAttribute('value', response.customerResponse.data.id);\n this.el.appendChild(customerIdInput);\n }\n\n // append threatmetrix id\n if (response.threatMetrixId) {\n const threatmetrixIdInput = document.createElement('input');\n threatmetrixIdInput.setAttribute('type', 'hidden');\n threatmetrixIdInput.setAttribute('name', this.inputNames.threatMetrixId);\n threatmetrixIdInput.setAttribute('value', response.threatMetrixId);\n this.el.appendChild(threatmetrixIdInput);\n }\n\n // COF payments\n if (response.saveInfoValue) {\n const saveInfoValueInput = document.createElement('input');\n saveInfoValueInput.setAttribute('type', 'hidden');\n saveInfoValueInput.setAttribute('name', this.inputNames.saveInfo);\n saveInfoValueInput.setAttribute('value', JSON.stringify(response.submitResponse.data));\n this.el.appendChild(saveInfoValueInput);\n }\n\n // submit ids to server side intergration to perform payment transaction\n this.el.closest('form').submit();\n } catch(err) {\n this.logError(err);\n }\n }\n\n logError(err) {\n this.errorHandler.show(err);\n console.error('Unzer UI Component Error', {err})\n }\n\n initUnzerCheckoutButton() {\n const wrapper = document.createElement('unzer-checkout');\n\n if (this.submitButton) {\n // Wrap Submit Button with for\n // \"automatic handling for enabling/disabling the submit button depending on the current status,\n // and showing/hiding of brand icons.\"\n wrapper.id = \"unzer-checkout-wrapper\"\n this.submitButton.parentNode.insertBefore(wrapper, this.submitButton);\n wrapper.appendChild(this.submitButton);\n this.submitButton.id = 'unzerUiComponentCheckoutBtn';\n } else {\n this.el.appendChild(wrapper);\n }\n\n // Wait for ui components to be loaded\n Promise.all([\n customElements.whenDefined(\"unzer-payment\"),\n customElements.whenDefined(\"unzer-checkout\"),\n customElements.whenDefined(this.customElement)\n ]).then(() => {\n this.unzerPayment = document.querySelector('unzer-payment');\n this.unzerCheckout = document.querySelector('unzer-checkout');\n this.mounted();\n })\n .catch((err) => this.logError(err));\n }\n\n destroyUnzerCheckoutButton() {\n const unzerCheckoutWrapper = document.querySelector('unzer-checkout');\n this.submitButton.disabled = false;\n\n if (unzerCheckoutWrapper) {\n while (unzerCheckoutWrapper.firstChild) {\n unzerCheckoutWrapper.parentNode.insertBefore(unzerCheckoutWrapper.firstChild, unzerCheckoutWrapper);\n }\n unzerCheckoutWrapper.remove();\n }\n }\n}","import BaseComponent from './base';\n\nexport default class extends BaseComponent {\n mounted() {\n super.mounted();\n\n this.inputNames.resourceId = 'unzer-payment-type-id';\n\n const settings = JSON.parse(this.el.dataset.paymentDataRequest) || {};\n const googlePayData = {\n gatewayMerchantId: settings.gatewayMerchantId,\n merchantInfo: settings.merchantInfo,\n transactionInfo: settings.transactionInfo,\n allowedCardNetworks: settings.allowedCardNetworks,\n allowCreditCards: settings.allowCreditCards,\n allowPrepaidCards: settings.allowPrepaidCards,\n buttonOptions: {\n buttonColor: settings.buttonOptions.buttonColor,\n buttonSizeMode: settings.buttonOptions.buttonSize,\n },\n // onPaymentAuthorizedCallback: async (paymentData) => {\n // return await this.unzerPayment?.submit()\n // .then(response => this.onPaymentSubmit(response))\n // .catch(err => this.logError(err));\n // }\n };\n\n this.unzerPayment.setGooglePayData(googlePayData);\n }\n}","/**\n * Unzer UI Components V2\n * @see https://docs.unzer.com/online-payments/ui-component-v2/\n */\nimport BaseComponent from \"./base\";\nimport ErrorHandler from \"../utils/errors\";\nimport GooglePayComponent from \"./googlepay\";\nimport ApplePayComponent from \"./applepay\";\nimport KlarnaComponent from \"./klarna\";\n\n// Init component\ndocument.addEventListener('DOMContentLoaded', function() {\n /** @type {NodeListOf} */\n const components = document.querySelectorAll('[data-unzer-ui-component]');\n\n if (!components || components.length === 0) {\n return;\n }\n\n components.forEach(el => {\n try {\n const settings = JSON.parse(el.dataset.unzerUiComponent) || {};\n\n if (settings.component === 'google-pay') {\n new GooglePayComponent(el, settings);\n } else if (settings.component === 'apple-pay') {\n new ApplePayComponent(el, settings);\n } else if (settings.component === 'klarna') {\n new KlarnaComponent(el, settings);\n } else {\n new BaseComponent(el, settings);\n }\n } catch(err) {\n (new ErrorHandler).show(err);\n console.error(err);\n }\n });\n});\n","import BaseComponent from './base';\n\nexport default class extends BaseComponent {\n mounted() {\n super.mounted();\n\n const locale = new Intl.Locale(navigator.language || navigator.userLanguage || 'en-GB');\n\n this.unzerPayment.updateCustomerData({\n \"language\": locale.language\n });\n }\n}","export default class ErrorHandler {\n /**\n * @param {JQuery|null} $wrapper Wrapper for Container to display error messages in\n * @param {JQuery|null} $holder Container to display error messages in\n */\n constructor($wrapper, $holder) {\n this.$wrapper = $wrapper || $('#error-container');\n this.$holder = $holder || this.$wrapper.find('.alert');\n }\n\n /**\n * Show Error message\n * @param {String} message\n */\n show(message) {\n this.$wrapper.show();\n this.$holder.html(message);\n }\n\n /**\n * Hide error message\n */\n hide() {\n this.$wrapper.hide();\n this.$holder.html();\n }\n}\n","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\n\nmodule.exports = _createClass, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var superPropBase = require(\"./superPropBase.js\");\n\nfunction _get() {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n module.exports = _get = Reflect.get.bind(), module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n } else {\n module.exports = _get = function _get(target, property, receiver) {\n var base = superPropBase(target, property);\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(arguments.length < 3 ? target : receiver);\n }\n\n return desc.value;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n }\n\n return _get.apply(this, arguments);\n}\n\nmodule.exports = _get, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\n\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\n\nvar assertThisInitialized = require(\"./assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var getPrototypeOf = require(\"./getPrototypeOf.js\");\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nmodule.exports = _superPropBase, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\n\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;"]} \ No newline at end of file diff --git a/frontend/src/js/components/base.js b/frontend/src/js/components/base.js index 50f1884..6f6b56e 100644 --- a/frontend/src/js/components/base.js +++ b/frontend/src/js/components/base.js @@ -5,7 +5,8 @@ export default class inputNames = { 'resourceId': 'paymentData[resourceId]', 'customerId': 'paymentData[customerId]', - 'threatMetrixId': 'paymentData[threatMetrixId]' + 'threatMetrixId': 'paymentData[threatMetrixId]', + 'saveInfo': 'paymentData[saveInfo]' }; unzerCheckout = null; @@ -13,7 +14,7 @@ export default class /** *@param {HTMLElement} el - * @param {{component: string, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings + * @param {{component: string, hasSavedInfo: boolean, autoSubmit: boolean, ?customer: object, ?basket:object, ?submitButton: string, ?isB2B: boolean}} settings */ constructor(el, settings) { this.el = el; @@ -27,48 +28,50 @@ export default class } boot() { - const wrapper = document.createElement('unzer-checkout'); - - if (this.submitButton) { - // Wrap Submit Button with for - // "automatic handling for enabling/disabling the submit button depending on the current status, - // and showing/hiding of brand icons." - wrapper.id = "unzer-checkout-wrapper" - this.submitButton.parentNode.insertBefore(wrapper, this.submitButton); - wrapper.appendChild(this.submitButton); - this.submitButton.id = 'unzerUiComponentCheckoutBtn'; - } else { - this.el.appendChild(wrapper); - } + this.initUnzerCheckoutButton(); } register() { // form this.submitButton?.addEventListener('click', e => { e.preventDefault(); - // this.el.closest('form').submit(); + + // Submit the form when we use a saved payment instead of the UI component + if (this.settings.hasSavedInfo && document.querySelector("input[name='" + this.inputNames.resourceId + "']:checked").value !== 'new') { + this.el.closest('form').submit(); + } }); - // this.#el.closest('form').addEventListener('submit', (e) => { - // console.log('on submit'); - // e.preventDefault(); - // document.querySelector('unzer-checkout > button[type="submit"]').click(); - // }) + // Radio Group for saved payment data + if (this.settings.hasSavedInfo) { + const radioButtons = this.el.querySelectorAll("input[name='" + this.inputNames.resourceId + "']"); - // Wait for ui components to be loaded - Promise.all([ - customElements.whenDefined("unzer-payment"), - customElements.whenDefined("unzer-checkout"), - customElements.whenDefined(this.customElement) - ]).then(() => { - this.unzerPayment = document.querySelector('unzer-payment'); - this.unzerCheckout = document.querySelector('unzer-checkout'); - this.mounted(); - }) - .catch((err) => this.logError(err)); + for (let i = 0; i < radioButtons.length; i++) { + radioButtons[i].addEventListener('change', (event) => { + const targetElement = event.target; + const unzerElementWrapper = this.el.querySelector('unzer-payment'); + unzerElementWrapper.hidden = targetElement.value !== 'new'; + + if (targetElement.value !== 'new') { + this.destroyUnzerCheckoutButton(); + } else { + this.initUnzerCheckoutButton(); + } + }); + + } + + document + .querySelector("input[name='" + this.inputNames.resourceId + "']:checked") + .dispatchEvent(new Event('change')); + } } mounted() { + if (! this.unzerCheckout) { + return; + } + // this.unzerCheckout.autoDisable = true; this.unzerCheckout.onPaymentSubmit = this.onPaymentSubmit.bind(this); @@ -137,6 +140,15 @@ export default class this.el.appendChild(threatmetrixIdInput); } + // COF payments + if (response.saveInfoValue) { + const saveInfoValueInput = document.createElement('input'); + saveInfoValueInput.setAttribute('type', 'hidden'); + saveInfoValueInput.setAttribute('name', this.inputNames.saveInfo); + saveInfoValueInput.setAttribute('value', JSON.stringify(response.submitResponse.data)); + this.el.appendChild(saveInfoValueInput); + } + // submit ids to server side intergration to perform payment transaction this.el.closest('form').submit(); } catch(err) { @@ -148,4 +160,44 @@ export default class this.errorHandler.show(err); console.error('Unzer UI Component Error', {err}) } + + initUnzerCheckoutButton() { + const wrapper = document.createElement('unzer-checkout'); + + if (this.submitButton) { + // Wrap Submit Button with for + // "automatic handling for enabling/disabling the submit button depending on the current status, + // and showing/hiding of brand icons." + wrapper.id = "unzer-checkout-wrapper" + this.submitButton.parentNode.insertBefore(wrapper, this.submitButton); + wrapper.appendChild(this.submitButton); + this.submitButton.id = 'unzerUiComponentCheckoutBtn'; + } else { + this.el.appendChild(wrapper); + } + + // Wait for ui components to be loaded + Promise.all([ + customElements.whenDefined("unzer-payment"), + customElements.whenDefined("unzer-checkout"), + customElements.whenDefined(this.customElement) + ]).then(() => { + this.unzerPayment = document.querySelector('unzer-payment'); + this.unzerCheckout = document.querySelector('unzer-checkout'); + this.mounted(); + }) + .catch((err) => this.logError(err)); + } + + destroyUnzerCheckoutButton() { + const unzerCheckoutWrapper = document.querySelector('unzer-checkout'); + this.submitButton.disabled = false; + + if (unzerCheckoutWrapper) { + while (unzerCheckoutWrapper.firstChild) { + unzerCheckoutWrapper.parentNode.insertBefore(unzerCheckoutWrapper.firstChild, unzerCheckoutWrapper); + } + unzerCheckoutWrapper.remove(); + } + } } \ No newline at end of file diff --git a/frontend/template/partials/saved_payment_methods.tpl b/frontend/template/partials/saved_payment_methods.tpl new file mode 100644 index 0000000..73c278b --- /dev/null +++ b/frontend/template/partials/saved_payment_methods.tpl @@ -0,0 +1,62 @@ + + + \ No newline at end of file diff --git a/info.xml b/info.xml index 5e616c7..ef98a98 100644 --- a/info.xml +++ b/info.xml @@ -6,7 +6,7 @@ http://www.solution360.de 100 5.0.0 - 2.0.2 + 2.0.3 s360_unzer_shop5 2020-10-27 @@ -400,6 +400,90 @@ + + s360_hp_savePaymentDataPaypal + + + + + + + + + + + + s360_hp_newPaymentDataPaypal + + + + + + + + + + + + s360_hp_savePaymentDataCreditCard + + + + + + + + + + + + s360_hp_newPaymentDataCreditCard + + + + + + + + + + + + s360_hp_savePaymentDataSepa + + + + + + + + + + + + s360_hp_newPaymentDataSepa + + + + + + + + + + + + s360_hp_saved_payment_methods + + + + + + + + + + @@ -443,6 +527,14 @@ + + + allow_save + + + + + @@ -468,6 +560,14 @@ + + + allow_save + + + + + @@ -559,8 +659,8 @@ template/dummy.tpl template/paylater_invoice_form.tpl - - + + @@ -626,6 +726,14 @@ + + + allow_save + + + + + @@ -949,8 +1057,8 @@ template/dummy.tpl template/paylater_installment_form.tpl - - + + diff --git a/locale/de-DE/base.mo b/locale/de-DE/base.mo index b2a6e2f22e10e0e273755677e103aef5e240f666..d33a766012907e4a56fff4a17ed1ca199244b30e 100644 GIT binary patch delta 4466 zcmbu>dvKK18OQOnvI)6|ghT>qlI0S@EqDoFfN+T{#55#AHj0Hx8aHn)kX=Fup-mmP z4O*Ist(Dhy6ajCkp;8Bd$+QAqxECl^3=tz$0y?$Y3w0_EBX;QbxBLFn=}bGLJNxeE zocDdtInQ~{dEeySt*!^3afRMbb^qM(xy11ejwwTpDR3E6lw?c-^_bztcrYEO;0)wz z{QM;12B-cI#!`O*)$Tb=#+NV^U&mqChokUA%rGWou2WFMj5K3L;}}dwFHXYcsDU0r zbznPoqXz256g=d37B!JSVI~ftGu@YiYCpws4kk0csi2U>g_X#p&HZ>2cA+}hk3?$D zA+ef&;Em|!XDnu-2AGHOxER&XJ*WZeF%G}$T;J%_AHi70H(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O1;*lDR6TX54qQWx_#I5t`|s-JT#$jfpd;!@x}t`@uRTB5o`1&fk3+4EN$BIn zZwP8C7It^)dlf_3e*@LAO4J(LY0n?QMzn8EP)NW!dqE%*tGSLv-bj;f_X|)RoP?^V z7&S7BF&>v&ccMCe7S+MasQXM$=RTM9VRTRDcqRqSbrtr(I-I2Ay_~sTjbqr~jm()z zdE8l4W06B76g<_3@z)&n{|#>dPQ)&F0`oD3 ztEt1xKsB%jSs)L(RUqn0X`GctX-Jes? zYX1t;@VdPq_6fd1S=B9YB+h37Rne6^XEonM-50>PtD?rJ4#cA$CSy8oBbuuHM2q<> z(RP@eWJ#D;J-ht9ZWR}QR(^=`5TZ);8fkl-gp}Qgh;XwYJYQd4bg`83D@5BNQcGSW zs|YW<=kJ{=yg_&>bC*0ten-}kOGKN-n|IkWzBRauyhC~sZS#pH{~LXM&C`*eZ9bGg zAl*qZ`8~Ntrjh4}wnC!Sq<3#9`HC1GK-)6XluRZaiN-XOY$j957ereH3DDQqKF_W( zyfU8cV?G&s&$8?79P)fF;Ij+)$g}6Hj^&i!u={!;|4j6k#Y{4W=-rGWkCSo|Pqh8V z!Sttn&#%H@TubuFFUdl3lW4o+;Q7_~yDcw97L;fEl+Qof@(-w0w#Dwduz>U>;bb?_ z_8~b%-0Hw(qRrdkr_ZgF638S{^wUxPfTKLf?*9{ylW}ATX+gAwkvLLEz9rgH$ptb& zJI?m3hcZ4pkWa`zJV%_5({P1kkVnZTa+RzhK_rwMBqzus@(39~lE_=+!S)gbzL?A? z&yw#%=`Z$_{@3nrluPXX11c%JO#V%plR4yV@+YD`wL^Z8WY_ct?dTRPvuj=pH>`AEJn-}c+f6YHYY5)KL diff --git a/locale/en-GB/base.po b/locale/en-GB/base.po index f509a91..a17738c 100644 --- a/locale/en-GB/base.po +++ b/locale/en-GB/base.po @@ -792,3 +792,24 @@ msgstr "Click to Pay" msgid "klarna" msgstr "Klarna" + +msgid "'Meine Kreditkarte für die nächste Bestellung speichern' anzeigen" +msgstr "Display 'Save my credit card for the next order'" + +msgid "'Mein SEPA Lastschrift-Mandat für die nächste Bestellung speichern' anzeigen" +msgstr "Display 'Save my SEPA direct debit mandate for the next order'" + +msgid "'Mein PayPal Account für die nächste Bestellung speichern' anzeigen" +msgstr "Display 'Save my PayPal account for the next order'" + +msgid "hpSettingspqSelectorSavedPaymentData" +msgstr "PQ-Selector for the saved payment data in the account section" + +msgid "hpSettingspqSelectorSavedPaymentDataHelp" +msgstr "The PHP-Query-Selector for the saved payment data in the account section" + +msgid "hpSettingspqMethodSavedPaymentData" +msgstr "PQ-Method for the saved payment data in the account section" + +msgid "hpSettingspqMethodSavedPaymentDataHelp" +msgstr "The PHP-Query-Method for the saved payment data in the account section" \ No newline at end of file diff --git a/paymentmethod/HeidelpayAlipay.php b/paymentmethod/HeidelpayAlipay.php index 179078c..1ca94ee 100644 --- a/paymentmethod/HeidelpayAlipay.php +++ b/paymentmethod/HeidelpayAlipay.php @@ -10,6 +10,7 @@ use UnzerSDK\Resources\TransactionTypes\Charge; use Plugin\s360_unzer_shop5\src\Payments\HeidelpayPaymentMethod; use Plugin\s360_unzer_shop5\src\Payments\Interfaces\RedirectPaymentInterface; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use Plugin\s360_unzer_shop5\src\Payments\Traits\HasCustomer; use Plugin\s360_unzer_shop5\src\Payments\Traits\HasMetadata; @@ -28,6 +29,7 @@ */ class HeidelpayAlipay extends HeidelpayPaymentMethod implements RedirectPaymentInterface { + use HasBasket; use HasMetadata; use HasCustomer; @@ -54,6 +56,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -65,7 +77,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayCreditCard.php b/paymentmethod/HeidelpayCreditCard.php index a7ebace..e90c15a 100644 --- a/paymentmethod/HeidelpayCreditCard.php +++ b/paymentmethod/HeidelpayCreditCard.php @@ -6,6 +6,7 @@ use Exception; use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasSavedPaymentData; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\PaymentTypes\Card; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; @@ -25,6 +26,8 @@ use Plugin\s360_unzer_shop5\src\Payments\Traits\HasDirectCharge; use Plugin\s360_unzer_shop5\src\Payments\Traits\HasMetadata; use Plugin\s360_unzer_shop5\src\Utils\Config; +use Plugin\s360_unzer_shop5\src\Utils\SessionHelper; +use UnzerSDK\Constants\RecurrenceTypes; use UnzerSDK\Resources\PaymentTypes\Clicktopay; /** @@ -54,6 +57,7 @@ class HeidelpayCreditCard extends HeidelpayPaymentMethod implements use HasAuthorization; use HasDirectCharge; use HasCustomer; + use HasSavedPaymentData; // Order Attributes public const ATTR_CARD_HOLDER = 'unzer_card_holder'; @@ -142,6 +146,9 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde { /** @var Config $config */ $config = Shop::Container()->get(Config::class); + if ($config->getPaymentSetting(Config::ALLOW_SAVE, $this->moduleID) === 'Y') { + $this->savePaymentData($payment); + } // Create or fetch customer resource $shopCustomer = $this->sessionHelper->getFrontendSession()->getCustomer(); @@ -172,10 +179,14 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde ); $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $recurrenceType = $this->sessionHelper->get(SessionHelper::KEY_SAVE_INFO) || $this->isSavedPaymentData($payment) + ? RecurrenceTypes::ONE_CLICK + : null; + // Authorize payment if ($config->getPaymentSetting(Config::PAYMENT_BOOKING_MODE, $this->moduleID) === 'authorize') { return $this->adapter->getCurrentConnection()->performAuthorization( - $this->createAuthorization($shopCustomer, $order, false), + $this->createAuthorization($shopCustomer, $order, false, $recurrenceType), $payment->getId(), $customer, $this->createMetadata(), @@ -184,10 +195,11 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde } return $this->adapter->getCurrentConnection()->performCharge( - $this->createCharge($order), + $this->createCharge($order, $recurrenceType), $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayEPS.php b/paymentmethod/HeidelpayEPS.php index dd6722f..ddcfebb 100644 --- a/paymentmethod/HeidelpayEPS.php +++ b/paymentmethod/HeidelpayEPS.php @@ -5,6 +5,7 @@ namespace Plugin\s360_unzer_shop5\paymentmethod; use JTL\Checkout\Bestellung; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -28,6 +29,7 @@ */ class HeidelpayEPS extends HeidelpayPaymentMethod implements RedirectPaymentInterface { + use HasBasket; use HasMetadata; use HasCustomer; @@ -59,6 +61,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -70,7 +82,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayPayPal.php b/paymentmethod/HeidelpayPayPal.php index 1f224ee..998c5af 100644 --- a/paymentmethod/HeidelpayPayPal.php +++ b/paymentmethod/HeidelpayPayPal.php @@ -6,6 +6,7 @@ use JTL\Checkout\Bestellung; use JTL\Shop; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasSavedPaymentData; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -42,6 +43,7 @@ class HeidelpayPayPal extends HeidelpayPaymentMethod implements RedirectPaymentI use HasAuthorization; use HasDirectCharge; use HasMetadata; + use HasSavedPaymentData; /** * Although Paypal support both auth as well as charge calls, we only support Direct Charge. @@ -55,6 +57,9 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde { /** @var Config $config */ $config = Shop::Container()->get(Config::class); + if ($config->getPaymentSetting(Config::ALLOW_SAVE, $this->moduleID) === 'Y') { + $this->savePaymentData($payment); + } // Create a customer with shipping address for Paypal's Buyer Protection $shopCustomer = $this->sessionHelper->getFrontendSession()->getCustomer(); @@ -95,7 +100,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->createCharge($order), $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayPrepayment.php b/paymentmethod/HeidelpayPrepayment.php index 2fbd4e5..e8a696a 100644 --- a/paymentmethod/HeidelpayPrepayment.php +++ b/paymentmethod/HeidelpayPrepayment.php @@ -4,6 +4,7 @@ namespace Plugin\s360_unzer_shop5\paymentmethod; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -30,6 +31,7 @@ */ class HeidelpayPrepayment extends HeidelpayPaymentMethod { + use HasBasket; use HasMetadata; use HasCustomer; @@ -100,6 +102,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -111,7 +123,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayPrzelewy24.php b/paymentmethod/HeidelpayPrzelewy24.php index 8dbe1df..7fa9d1a 100644 --- a/paymentmethod/HeidelpayPrzelewy24.php +++ b/paymentmethod/HeidelpayPrzelewy24.php @@ -5,6 +5,7 @@ namespace Plugin\s360_unzer_shop5\paymentmethod; use JTL\Checkout\Bestellung; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -26,6 +27,7 @@ */ class HeidelpayPrzelewy24 extends HeidelpayPaymentMethod implements RedirectPaymentInterface { + use HasBasket; use HasMetadata; use HasCustomer; @@ -57,6 +59,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -68,7 +80,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpaySEPADirectDebit.php b/paymentmethod/HeidelpaySEPADirectDebit.php index 0e8d225..abdcf80 100644 --- a/paymentmethod/HeidelpaySEPADirectDebit.php +++ b/paymentmethod/HeidelpaySEPADirectDebit.php @@ -5,6 +5,8 @@ namespace Plugin\s360_unzer_shop5\paymentmethod; use JTL\Checkout\Bestellung; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasSavedPaymentData; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -16,6 +18,7 @@ use Plugin\s360_unzer_shop5\src\Payments\Traits\HasCustomer; use Plugin\s360_unzer_shop5\src\Payments\Traits\HasMetadata; use Plugin\s360_unzer_shop5\src\Utils\Config; +use Plugin\s360_unzer_shop5\src\Utils\SessionHelper; use Plugin\s360_unzer_shop5\src\Utils\TranslatorTrait; /** @@ -35,6 +38,8 @@ class HeidelpaySEPADirectDebit extends HeidelpayPaymentMethod implements RedirectPaymentInterface, HandleStepAdditionalInterface { + use HasSavedPaymentData; + use HasBasket; use HasMetadata; use HasCustomer; use TranslatorTrait; @@ -73,6 +78,12 @@ public function handleStepAdditional(JTLSmarty $view): void */ protected function performTransaction(BasePaymentType $payment, Bestellung $order): AbstractTransactionType { + /** @var Config $config */ + $config = Shop::Container()->get(Config::class); + if ($config->getPaymentSetting(Config::ALLOW_SAVE, $this->moduleID) === 'Y') { + $this->savePaymentData($payment); + } + // Create / Update existing customer resource if needed $customer = $this->createOrFetchHeidelpayCustomer($this->adapter, $this->sessionHelper, false); $customer->setShippingAddress($this->createHeidelpayAddress($order->Lieferadresse)); @@ -85,6 +96,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -96,7 +117,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayWeChatPay.php b/paymentmethod/HeidelpayWeChatPay.php index 0b82a60..94acb62 100644 --- a/paymentmethod/HeidelpayWeChatPay.php +++ b/paymentmethod/HeidelpayWeChatPay.php @@ -5,6 +5,7 @@ namespace Plugin\s360_unzer_shop5\paymentmethod; use JTL\Checkout\Bestellung; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -25,6 +26,7 @@ */ class HeidelpayWeChatPay extends HeidelpayPaymentMethod implements RedirectPaymentInterface { + use HasBasket; use HasMetadata; use HasCustomer; @@ -56,6 +58,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -67,7 +79,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/HeidelpayiDEAL.php b/paymentmethod/HeidelpayiDEAL.php index b8b1e58..ae74e55 100644 --- a/paymentmethod/HeidelpayiDEAL.php +++ b/paymentmethod/HeidelpayiDEAL.php @@ -5,6 +5,7 @@ namespace Plugin\s360_unzer_shop5\paymentmethod; use JTL\Checkout\Bestellung; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -31,6 +32,7 @@ */ class HeidelpayiDEAL extends HeidelpayPaymentMethod implements RedirectPaymentInterface { + use HasBasket; use HasMetadata; use HasCustomer; @@ -62,6 +64,16 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $this->debugLog('Updated Customer Resource: ' . $customer->jsonSerialize(), static::class); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -73,7 +85,8 @@ protected function performTransaction(BasePaymentType $payment, Bestellung $orde $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/UnzerBancontact.php b/paymentmethod/UnzerBancontact.php index 21a5690..547a426 100644 --- a/paymentmethod/UnzerBancontact.php +++ b/paymentmethod/UnzerBancontact.php @@ -6,6 +6,7 @@ use JTL\Shop; use JTL\Smarty\JTLSmarty; +use Plugin\s360_unzer_shop5\src\Payments\Traits\HasBasket; use UnzerSDK\Resources\PaymentTypes\BasePaymentType; use UnzerSDK\Resources\TransactionTypes\AbstractTransactionType; use UnzerSDK\Resources\TransactionTypes\Charge; @@ -23,6 +24,7 @@ */ class UnzerBancontact extends HeidelpayPaymentMethod implements RedirectPaymentInterface, HandleStepAdditionalInterface { + use HasBasket; use HasCustomer; use HasMetadata; @@ -73,6 +75,16 @@ protected function performTransaction(BasePaymentType $payment, $order): Abstrac $customer = $this->adapter->getCurrentConnection()->updateCustomer($customer); } + // Create Basket + $session = $this->sessionHelper->getFrontendSession(); + $basket = $this->createHeidelpayBasket( + $session->getCart(), + $order->Waehrung, + $session->getLanguage(), + $order->cBestellNr ?? $payment->getId() + ); + $this->debugLog('Basket Resource: ' . $basket->jsonSerialize(), static::class); + $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), $order->Waehrung->getCode(), @@ -84,7 +96,8 @@ protected function performTransaction(BasePaymentType $payment, $order): Abstrac $charge, $payment->getId(), $customer, - $this->createMetadata() + $this->createMetadata(), + $basket ); } } diff --git a/paymentmethod/UnzerPaylaterDirectDebit.php b/paymentmethod/UnzerPaylaterDirectDebit.php index cbb5d1b..018e711 100644 --- a/paymentmethod/UnzerPaylaterDirectDebit.php +++ b/paymentmethod/UnzerPaylaterDirectDebit.php @@ -108,6 +108,9 @@ public function handleStepAdditional(JTLSmarty $view): void $this->sessionHelper->getFrontendSession()->get('Lieferadresse') ) ); + $customer->setBillingAddress( + $this->createHeidelpayAddress($this->sessionHelper->getFrontendSession()->getCustomer()) + ); $data = $view->getTemplateVars('hpPayment') ?: []; $data['customer'] = $customer; diff --git a/paymentmethod/UnzerPaylaterInvoice.php b/paymentmethod/UnzerPaylaterInvoice.php index 48551bc..d054654 100644 --- a/paymentmethod/UnzerPaylaterInvoice.php +++ b/paymentmethod/UnzerPaylaterInvoice.php @@ -113,6 +113,9 @@ public function handleStepAdditional(JTLSmarty $view): void $this->sessionHelper->getFrontendSession()->get('Lieferadresse') ) ); + $customer->setBillingAddress( + $this->createHeidelpayAddress($this->sessionHelper->getFrontendSession()->getCustomer()) + ); $this->sessionHelper->set(SessionHelper::KEY_CUSTOMER_ID, $customer->getId()); $data = $view->getTemplateVars('hpPayment') ?: []; diff --git a/paymentmethod/template/_components_v2.tpl b/paymentmethod/template/_components_v2.tpl index f1f054d..81e36e0 100644 --- a/paymentmethod/template/_components_v2.tpl +++ b/paymentmethod/template/_components_v2.tpl @@ -16,6 +16,31 @@ #unzer-checkout-wrapper { display: block; } + + /** Fixed for saved payments **/ + .label-slide #order-additional-payment .saved-payment-form-group label { + position: relative; + cursor: pointer; + font-size: inherit; + transform: none; + inset: 0; + line-height: inherit; + pointer-events: auto; + overflow: visible; + } + + .label-slide #order-additional-payment .saved-payment-form-group label:after { + top: 0.15625rem; + left: -1.5rem; + z-index: inherit; + height: 1rem; + width: 1rem; + background: 50%/50% 50% no-repeat; + } + + #order-additional-payment .custom-radio .custom-control-input:checked ~ .custom-control-label::after { + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23ffffff'/%3e%3c/svg%3e"); + } {if $hpPayment.isSandbox && $hpPayment.isDev} diff --git a/paymentmethod/template/credit_card_form.tpl b/paymentmethod/template/credit_card_form.tpl index 7d66bf6..07c5d49 100644 --- a/paymentmethod/template/credit_card_form.tpl +++ b/paymentmethod/template/credit_card_form.tpl @@ -1,10 +1,40 @@ {include file="{$hpPayment.pluginPath}paymentmethod/template/_components_v2.tpl"}
+ {* Save New Payment Data *} + {if $hpPayment.allowSave && !empty($hpPayment.savedInfo)} +
+
{lang key='s360_hp_savePaymentDataCreditCard' section="s360_unzer_shop5"}
+ {radiogroup stacked=true class="saved-payment-form-group"} + {foreach from=$hpPayment.savedInfo item=$item} + {radio + name="paymentData[resourceId]" + value=$item.payment_type_id + id="saved-payment-{$item.id}" + checked=($item@first) + } + + {$item.data.number} +

{$item.data.cardHolder} ({$item.data.expiryDate})

+
+ {/radio} + {/foreach} + + {radio name="paymentData[resourceId]" value="new" id="saved-payment-new"} + + {lang key='s360_hp_newPaymentDataCreditCard' section="s360_unzer_shop5"} + + {/radio} + {/radiogroup} +
+ {/if} + - + +
\ No newline at end of file diff --git a/paymentmethod/template/paypal_form.tpl b/paymentmethod/template/paypal_form.tpl index 699cd44..6f55aca 100644 --- a/paymentmethod/template/paypal_form.tpl +++ b/paymentmethod/template/paypal_form.tpl @@ -1,10 +1,39 @@ {include file="{$hpPayment.pluginPath}paymentmethod/template/_components_v2.tpl"}
+ {* Save New Payment Data *} + {if $hpPayment.allowSave && !empty($hpPayment.savedInfo)} +
+
{lang key='s360_hp_savePaymentDataPaypal' section="s360_unzer_shop5"}
+ {radiogroup stacked=true class="saved-payment-form-group"} + {foreach from=$hpPayment.savedInfo item=$item} + {radio + name="paymentData[resourceId]" + value=$item.payment_type_id + id="saved-payment-{$item.id}" + checked=($item@first) + } + + {$item.data.email} + + {/radio} + {/foreach} + + {radio name="paymentData[resourceId]" value="new" id="saved-payment-new"} + + {lang key='s360_hp_newPaymentDataPaypal' section="s360_unzer_shop5"} + + {/radio} + {/radiogroup} +
+ {/if} + - + +
\ No newline at end of file diff --git a/paymentmethod/template/sepa_form.tpl b/paymentmethod/template/sepa_form.tpl index e7f97d6..c112fab 100644 --- a/paymentmethod/template/sepa_form.tpl +++ b/paymentmethod/template/sepa_form.tpl @@ -1,10 +1,39 @@ {include file="{$hpPayment.pluginPath}paymentmethod/template/_components_v2.tpl"}
+ {* Save New Payment Data *} + {if $hpPayment.allowSave && !empty($hpPayment.savedInfo)} +
+
{lang key='s360_hp_savePaymentDataSepa' section="s360_unzer_shop5"}
+ {radiogroup stacked=true class="saved-payment-form-group"} + {foreach from=$hpPayment.savedInfo item=$item} + {radio + name="paymentData[resourceId]" + value=$item.payment_type_id + id="saved-payment-{$item.id}" + checked=($item@first) + } + + {$item.data.iban} + + {/radio} + {/foreach} + + {radio name="paymentData[resourceId]" value="new" id="saved-payment-new"} + + {lang key='s360_hp_newPaymentDataSepa' section="s360_unzer_shop5"} + + {/radio} + {/radiogroup} +
+ {/if} + - + +
diff --git a/src/Controllers/FrontendOutputController.php b/src/Controllers/FrontendOutputController.php index 9866631..847a94d 100644 --- a/src/Controllers/FrontendOutputController.php +++ b/src/Controllers/FrontendOutputController.php @@ -6,6 +6,7 @@ use JTL\Checkout\Bestellung; use JTL\Shop; +use Plugin\s360_unzer_shop5\src\Services\SavedPaymentDataService; use Plugin\s360_unzer_shop5\src\Utils\Config; /** @@ -17,12 +18,26 @@ class FrontendOutputController extends Controller { private const TEMPLATE_ID_CHANGE_PAYMENT_METHOD = 'template/partials/change_payment'; private const TEMPLATE_ID_PAYMENT_INFO = 'template/partials/payment_info'; + private const TEMPLATE_ID_SAVED_PAYMENT_DATA = 'template/partials/saved_payment_methods'; /** * @inheritDoc */ public function handle(): string { + // Show Saved payment data + if (Shop::getPageType() == \PAGE_MEINKONTO) { + $pqMethod = $this->config->get(Config::PQ_METHOD_SAVED_PAYMENT_DATA, 'after'); + $pqSelector = $this->config->get(Config::PQ_SELECTOR_SAVED_PAYMENT_DATA, '.account-data-item-orders'); + $paymentData = (new SavedPaymentDataService())->getUserPaymentData(); + + if (!empty($paymentData) && $pqSelector) { + pq($pqSelector)->{$pqMethod}( + $this->view(self::TEMPLATE_ID_SAVED_PAYMENT_DATA, ['s360_unzer' => ['savedPaymentMethods' => $paymentData]]) + ); + } + } + // Add "Change Payment Button"/Link if (Shop::getPageType() == \PAGE_BESTELLVORGANG) { $snippet = $this->view(self::TEMPLATE_ID_CHANGE_PAYMENT_METHOD); diff --git a/src/Payments/HeidelpayPaymentMethod.php b/src/Payments/HeidelpayPaymentMethod.php index 3178d0c..fd78248 100644 --- a/src/Payments/HeidelpayPaymentMethod.php +++ b/src/Payments/HeidelpayPaymentMethod.php @@ -287,6 +287,11 @@ public function validateAdditional(): bool $this->sessionHelper->set(SessionHelper::KEY_CUSTOMER_ID, $postPaymentData['customerId']); } + // Save Info that payment data should be saved + if (!empty($postPaymentData['saveInfo'])) { + $this->sessionHelper->set(SessionHelper::KEY_SAVE_INFO, json_decode($postPaymentData['saveInfo'], true)); + } + // Check Form Inputs if (isset($postPaymentData['resourceId'])) { // Abort if CSRF Token is invalid diff --git a/src/Payments/PaymentHandler.php b/src/Payments/PaymentHandler.php index f2f7e07..bdf3f95 100644 --- a/src/Payments/PaymentHandler.php +++ b/src/Payments/PaymentHandler.php @@ -420,6 +420,21 @@ public function prepareView(): void (int) Frontend::get('AktiveZahlungsart') ); $data['publicKey'] = trim($publicKey ?? $this->adapter->getKeypairService()->getDefaultPublicKey() ?? ''); + $data['allowSave'] = $this->config->getPaymentSetting(Config::ALLOW_SAVE, $this->paymentMethod->cModulId ?? '') === 'Y' + && Frontend::getCustomer()->getID() > 0; + + + $savedInfo = Shop::Container()->getDB()->selectAll( + 'xplugin_s360_unzer_shop5_saved_payment_data', + ['kKunde', 'payment_method'], + [Frontend::getCustomer()->getID(), $this->paymentMethod->cModulId], + 'id, payment_type_id, data', + 'created_at ASC', + ); + + $data['savedInfo'] = array_map(function ($payment) { + return ['id' => $payment->id, 'payment_type_id' => $payment->payment_type_id, 'data' => json_decode($payment->data, true)]; + }, $savedInfo); $smarty->assign('hpPayment', $data); } diff --git a/src/Payments/Traits/HasAuthorization.php b/src/Payments/Traits/HasAuthorization.php index 340b7e8..c6a8f41 100644 --- a/src/Payments/Traits/HasAuthorization.php +++ b/src/Payments/Traits/HasAuthorization.php @@ -15,7 +15,7 @@ trait HasAuthorization { - protected function createAuthorization(Customer $customer, Bestellung $order, bool $withRiskData = true): Authorization + protected function createAuthorization(Customer $customer, Bestellung $order, bool $withRiskData = true, ?string $recurrenceType = null): Authorization { $specialpages = Shop::Container()->getLinkService()->getSpecialPages(); @@ -44,6 +44,10 @@ protected function createAuthorization(Customer $customer, Bestellung $order, bo $authorization->setRiskData($riskData); } + if ($recurrenceType) { + $authorization->setRecurrenceType($recurrenceType); + } + return $authorization; } } \ No newline at end of file diff --git a/src/Payments/Traits/HasBasket.php b/src/Payments/Traits/HasBasket.php index cfccd3c..5557fae 100644 --- a/src/Payments/Traits/HasBasket.php +++ b/src/Payments/Traits/HasBasket.php @@ -161,13 +161,13 @@ protected function createHeidelpayBasketItem( ->setAmountPerUnitGross($roundedGrossAmount) ->setQuantity((int) $position->nAnzahl); - if ($this->isPromotionLineItemType((string) $position->nPosTyp)) { + if ($this->isPromotionLineItemType((string) $position->nPosTyp, $roundedGrossAmount)) { $basketItem->setAmountPerUnitGross(0); $basketItem->setAmountDiscountPerUnitGross($roundedGrossAmount * -1); } $basketItem->setVat((float) Tax::getSalesTax($position->kSteuerklasse)); - $basketItem->setType($this->getBasketLineItemType((string) $position->nPosTyp)); + $basketItem->setType($this->getBasketLineItemType((string) $position->nPosTyp, $roundedGrossAmount)); $basketItem->setBasketItemReferenceId($this->generateBasketItemReferenceId($position->cArtNr, $title)); return $basketItem; @@ -179,8 +179,12 @@ protected function createHeidelpayBasketItem( * @param string $type * @return string|null */ - private function getBasketLineItemType(string $type): ?string + private function getBasketLineItemType(string $type, float $amount = 0): ?string { + if ($amount < 0) { + return BasketItemTypes::VOUCHER; + } + switch ($type) { // Goods (includes digital, as jtl does not differ between those) case C_WARENKORBPOS_TYP_ARTIKEL: @@ -211,9 +215,9 @@ private function getBasketLineItemType(string $type): ?string * @param string $type * @return boolean */ - private function isPromotionLineItemType(string $type): bool + private function isPromotionLineItemType(string $type, float $amount = 0): bool { - return $this->getBasketLineItemType($type) === BasketItemTypes::VOUCHER; + return $this->getBasketLineItemType($type, $amount) === BasketItemTypes::VOUCHER; } /** diff --git a/src/Payments/Traits/HasCustomer.php b/src/Payments/Traits/HasCustomer.php index cbdefca..07bbfb0 100644 --- a/src/Payments/Traits/HasCustomer.php +++ b/src/Payments/Traits/HasCustomer.php @@ -151,7 +151,7 @@ protected function createHeidelpayCustomer(ShopCustomer $customer): Customer /** * Create a Heidelpay Address for Shipping * - * @param \stdClass|Adresse $address + * @param \stdClass|Adresse|\JTL\Customer\Customer $address * @return Address */ protected function createHeidelpayAddress($address): Address @@ -160,13 +160,18 @@ protected function createHeidelpayAddress($address): Address ? ShippingTypes::DIFFERENT_ADDRESS : ShippingTypes::EQUALS_BILLING; - return (new Address()) + $address = (new Address()) ->setName(Text::convertUTF8(html_entity_decode($address->cVorname . ' ' . $address->cNachname))) ->setStreet(Text::convertUTF8(html_entity_decode($address->cStrasse . ' ' . $address->cHausnummer))) ->setZip(Text::convertUTF8(html_entity_decode($address->cPLZ))) ->setCity(Text::convertUTF8(html_entity_decode($address->cOrt))) - ->setCountry(Text::convertUTF8(html_entity_decode($address->cLand))) - ->setShippingType($type); + ->setCountry(Text::convertUTF8(html_entity_decode($address->cLand))); + + if (! $address instanceof \JTL\Customer\Customer) { + $address->setShippingType($type); + } + + return $address; } /** diff --git a/src/Payments/Traits/HasDirectCharge.php b/src/Payments/Traits/HasDirectCharge.php index 8f16948..e111c15 100644 --- a/src/Payments/Traits/HasDirectCharge.php +++ b/src/Payments/Traits/HasDirectCharge.php @@ -13,7 +13,7 @@ */ trait HasDirectCharge { - protected function createCharge(Bestellung $order): Charge + protected function createCharge(Bestellung $order, ?string $recurrenceType = null): Charge { $charge = new Charge( $this->getTotalPriceCustomerCurrency($order), @@ -22,6 +22,10 @@ protected function createCharge(Bestellung $order): Charge ); $charge->setOrderId($order->cBestellNr ?? null); + if ($recurrenceType) { + $charge->setRecurrenceType($recurrenceType); + } + return $charge; } } \ No newline at end of file diff --git a/src/Payments/Traits/HasSavedPaymentData.php b/src/Payments/Traits/HasSavedPaymentData.php new file mode 100644 index 0000000..4e9f896 --- /dev/null +++ b/src/Payments/Traits/HasSavedPaymentData.php @@ -0,0 +1,45 @@ +canSavePaymentData()) { + Shop::Container()->getDB()->insert( + 'xplugin_s360_unzer_shop5_saved_payment_data', (object) [ + 'kKunde' => $this->sessionHelper->getFrontendSession()->getCustomer()->getID(), + 'payment_method' => $this->cModulId, + 'payment_type_id' => $payment->getId(), + 'data' => json_encode($this->sessionHelper->get(SessionHelper::KEY_SAVE_INFO)), + 'created_at' => date('Y-m-d H:i:s'), + ] + ); + } + } + + public function isSavedPaymentData(BasePaymentType $payment): bool + { + return Shop::Container()->getDB()->getSingleObject( + 'SELECT COUNT(*) as count FROM xplugin_s360_unzer_shop5_saved_payment_data WHERE payment_method = :payment_method AND payment_type_id = :payment_type_id', + ['payment_method' => $this->cModulId, 'payment_type_id' => $payment->getId()] + )?->count > 0; + } + + private function canSavePaymentData() + { + return $this->sessionHelper->get(SessionHelper::KEY_SAVE_INFO) + && $this->sessionHelper->getFrontendSession()->getCustomer()->getID() > 0; + } +} \ No newline at end of file diff --git a/src/Services/SavedPaymentDataService.php b/src/Services/SavedPaymentDataService.php new file mode 100644 index 0000000..c4a36bc --- /dev/null +++ b/src/Services/SavedPaymentDataService.php @@ -0,0 +1,68 @@ +database = Shop::Container()->getDB(); + } + + public function deleteUserPaymentData(string $paymentTypeId): bool + { + $affectedRows = $this->database->queryPrepared( + 'DELETE FROM xplugin_s360_unzer_shop5_saved_payment_data as pd + WHERE pd.kKunde = :customer AND pd.payment_type_id = :id', + ['customer' => Frontend::getCustomer()->getID(), 'id' => $paymentTypeId], + ReturnType::AFFECTED_ROWS + ); + + return $affectedRows > 0; + } + + /** + * @return array + */ + public function getUserPaymentData() + { + $savedInfo = $this->database->queryPrepared( + 'SELECT pd.id, pd.payment_type_id, pd.payment_method, pd.data, COALESCE(tzahlungsartsprache.cName, tzahlungsart.cName) as cName + FROM xplugin_s360_unzer_shop5_saved_payment_data as pd + LEFT JOIN tzahlungsart ON pd.payment_method = tzahlungsart.cModulId + LEFT JOIN tzahlungsartsprache ON tzahlungsartsprache.kZahlungsart = tzahlungsart.kZahlungsart AND tzahlungsartsprache.cISOSprache = :lang + WHERE pd.kKunde = :customer + ORDER BY pd.payment_method ASC, pd.created_at ASC', + ['customer' => Frontend::getCustomer()->getID(), 'lang' => Shop::Lang()->getIso()], + ReturnType::ARRAY_OF_OBJECTS + ); + + return array_map(function($row) { + $type = ''; + if (str_contains($row->payment_type_id, '-crd-')) { + $type = 'CARD'; + } elseif (str_contains($row->payment_type_id, '-sdd-')) { + $type = 'SEPA'; + } elseif (str_contains($row->payment_type_id, '-ppl-')) { + $type = 'PAYPAL'; + } + + return [ + 'id' => $row->id, + 'payment_type_id' => $row->payment_type_id, + 'type' => $type, + 'name' => $row->cName, + 'data' => json_decode($row->data, true) + ]; + }, $savedInfo); + } +} \ No newline at end of file diff --git a/src/Utils/Config.php b/src/Utils/Config.php index f07711a..04ffdcc 100644 --- a/src/Utils/Config.php +++ b/src/Utils/Config.php @@ -70,6 +70,8 @@ class Config public const PQ_SELECTOR_INSTALMENT_INFO = 'pqSelectorInstalmentInfo'; public const PQ_SELECTOR_PLACE_ORDER_BUTTON = 'pqSelectorPlaceOrderButton'; public const PQ_SELECTOR_ORDER_CONFIRM_FORM = 'pqSelectorOrderConfirmForm'; + public const PQ_SELECTOR_SAVED_PAYMENT_DATA = 'pqSelectorSavedPaymentData'; + public const PQ_METHOD_SAVED_PAYMENT_DATA = 'pqMethodSavedPaymentData'; public const PAYMENT_BOOKING_MODE = 'booking_mode'; public const UI_FONT_FAMILY = 'ui_fontFamily'; @@ -81,6 +83,7 @@ class Config public const UI_SHADOWS = 'ui_shadows'; public const ENABLE_CTP = 'enable_ctp'; + public const ALLOW_SAVE = 'allow_save'; // Apple Pay Config Keys public const APPLEPAY_MERCHANT_IDENTIFIER = 'applepay_merchant_identifier'; diff --git a/src/Utils/SessionHelper.php b/src/Utils/SessionHelper.php index c1df836..2e65201 100644 --- a/src/Utils/SessionHelper.php +++ b/src/Utils/SessionHelper.php @@ -30,6 +30,7 @@ class SessionHelper public const KEY_SHORT_ID = 'shortId'; public const KEY_PAYMENT_ID = 'paymentId'; public const KEY_CUSTOMER_ID = 'customerId'; + public const KEY_SAVE_INFO = 'saveInfo'; public const KEY_THREAT_METRIX_ID = 'threatMetrixId'; /**