diff --git a/README.md b/README.md new file mode 100644 index 0000000..96fe42e --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# SprykerB2C Payment Integration by Novalnet +Spryker Commerce OS is a PHP-based e-commerce system for B2C. Novalnet payment module for Spryker simplifies your daily work by automating the entire payment process, from checkout till collection. This module is designed to help you increase your sales by offering various payment methods on a one-page checkout. The module which is perfectly adjusted to the Spryker shop with top-quality range of services of the payment provider. + +## Integration requirements +Novalnet merchant account is required for processing all international and local payments through this Spryker payment module. The module is available for the SprykerB2C versions 202204.0 in the following languages: EN & DE + +## Key features +- Easy configuration for all payment methods +- One platform for all relevant payment types and related services +- Complete automation of all payment processes +- More than 50 fraud prevention modules integrated to prevent risk in real-time +- No PCI DSS certification required when using our payment module +- Real-time monitoring of the transaction flow from the checkout to the receivables +- Multilevel claims management with integrated handover to collection and various export functions for the accounting +- Automated e-mail notification function concerning payment status reports +- Clear real-time overview and monitoring of payment status +- Automated bookkeeping report in XML, SOAP, CSV, MT940 +- Secure SSL- encoded gateways +- Seamless and fast integration of the payment module +- Credit Card with 3D Secure +- On-hold transaction configuration in the shop admin panel +- Easy way of confirmation and cancellation of on-hold transactions (Cancel & Confirm option) for Credit/Debit Cards, Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Invoice, Prepayment & PayPal. +- Refund option for Credit/Debit Cards, Direct Debit SEPA, Direct Debit SEPA with payment guarantee, Invoice, Invoice with payment guarantee, Prepayment, Barzahlen/viacash, Sofort, iDEAL, eps, giropay, PayPal, Przelewy24, PostFinance Card, PostFinance E-Finance & Bancontact. +- Responsive templates + +For detailed documentation and other technical inquiries, please send us an email at sales@novalnet.de + +## Integrated payment methods +- Direct Debit SEPA +- Credit/Debit Cards +- Invoice +- Prepayment +- Invoice with payment guarantee +- Direct Debit SEPA with payment guarantee +- iDEAL +- Sofort +- giropay +- Barzahlen/viacash +- Przelewy24 +- eps +- PayPal +- PostFinance Card +- PostFinance E-Finance +- Bancontact +- Multibanco + +## Installation via Composer + +#### Follow the below steps and run each command from the shop root directory + ##### 1. Run the below command to install the payment module + + ``` + php composer.phar require "novalnet/sprykerb2c-payment" + ``` + + ##### 2. Novalnet - General Configuration +Configure the required settings under +> vendor/novalnet/sprykerb2c-payment/config/config.dist.php + +To get the complete installation guide, contact sales@novalnet.de + +## License +See our License Agreement at: https://www.novalnet.com/payment-plugins/free/license + +## Documentation & Support +For more information about the Magento 2 Payment Integration by Novalnet, please get in touch with us: sales@novalnet.de or +49 89 9230683-20
+ +Novalnet AG
+Zahlungsinstitut (ZAG)
+Feringastr. 4
+85774 Unterföhring
+Deutschland
+Website: www.novalnet.de + +## Who is Novalnet AG? +

Novalnet AG is a leading financial service institution offering payment gateways for processing online payments. Operating in the market as a full payment service provider Novalnet AG provides online merchants user-friendly payment integration with all major shop systems and self-programmed sites.

+

Accept, manage and monitor payments all on one platform with one single contract!

+

Our SaaS engine is PCI DSS certified and designed to enable real-time risk management, secured payments via escrow accounts, efficient receivables management, dynamic member and subscription management, customized payment solutions for various business models (e.g. marketplaces, affiliate programs etc.) etc.

diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 0000000..8796c70 --- /dev/null +++ b/changelog.txt @@ -0,0 +1,20 @@ +*** Changelog *** + += 1.2.1 - 2022.08.29 = +* Fix - Adjusted the payment module to proceed payment process for the guest checkout + += 1.2.0 - 2022.01.05 = +* New - Implemented Direct Debit SEPA with payment guarantee, Invoice with payment guarantee +* Fix - Compatible for sprykerb2c version 202108.0 +* Enhanced - Callback for transactions has been optimized as per the new testcase + += 1.1.0 - 2021.05.08 = +* Fix - Optimized readme instructions in Installation guide +* Enhanced - Adjusted payment methods state machines +* Enhanced - Payment module updated with composer installation and adapted with new v2 API structure + += 1.0.0 - 2019.08.06 = +* - New release + + + diff --git a/composer.json b/composer.json new file mode 100755 index 0000000..5469076 --- /dev/null +++ b/composer.json @@ -0,0 +1,49 @@ +{ + "name": "novalnet/sprykerb2c-payment", + "description": "Novalnet module", + "license": "MIT", + "require": { + "php": ">=7.2", + "spryker-shop/checkout-page": "^1.0.0 || ^2.0.0 || ^3.0.0", + "spryker/kernel": "^3.30.0", + "spryker/oms": "^7.0.0 || ^8.0.0 || ^10.0.0 || ^11.0.0", + "spryker/propel-orm": "^1.0.0", + "spryker/quote": "^2.0.0", + "spryker/sales": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^10.0.0 || ^11.0.0", + "spryker/refund": "^5.0.0", + "spryker/step-engine": "^3.0.0", + "spryker/symfony": "^3.0.0", + "spryker/zed-request": "^3.0.0" + }, + "autoload": { + "psr-4": { + "Novalnet\\": "src/Novalnet/" + } + }, + "require-dev": { + "spryker/checkout": "*", + "spryker/payment": "*", + "spryker/propel": "*", + "spryker/router": "*", + "spryker-shop/shop-application": "*", + "spryker/silex": "*" + }, + "suggest": { + "spryker/checkout": "CheckoutPostSaveHookInterface is used.", + "spryker/payment": "If you want to use payment method filtering.", + "spryker-shop/shop-application": "Abstract Yves controller provider is used.", + "spryker/silex": "Silex application is used." + }, + "minimum-stability": "dev", + "prefer-stable": true, + "config": { + "preferred-install": "dist", + "sort-packages": true, + "process-timeout": 600 + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/config/Zed/Oms/NovalnetBancontact01.xml b/config/Zed/Oms/NovalnetBancontact01.xml new file mode 100755 index 0000000..1cca9ce --- /dev/null +++ b/config/Zed/Oms/NovalnetBancontact01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetBarzahlen01.xml b/config/Zed/Oms/NovalnetBarzahlen01.xml new file mode 100755 index 0000000..e3b7cbb --- /dev/null +++ b/config/Zed/Oms/NovalnetBarzahlen01.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + waiting for payment + authorize + + + + authorized + waiting for payment + waiting for payment + + + + authorized + waiting for payment + capture + + + + waiting for payment + canceled + callback canceled + + + + authorized + canceled + callback canceled + + + + authorized + paid + callback paid + + + + waiting for payment + paid + callback paid + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetCreditCard01.xml b/config/Zed/Oms/NovalnetCreditCard01.xml new file mode 100755 index 0000000..2c087f3 --- /dev/null +++ b/config/Zed/Oms/NovalnetCreditCard01.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + paid + authorize + + + + authorized + paid + capture + + + + authorized + paid + callback paid + + + + authorized + canceled + callback canceled + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetEps01.xml b/config/Zed/Oms/NovalnetEps01.xml new file mode 100755 index 0000000..416280c --- /dev/null +++ b/config/Zed/Oms/NovalnetEps01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetGiropay01.xml b/config/Zed/Oms/NovalnetGiropay01.xml new file mode 100755 index 0000000..f83cf28 --- /dev/null +++ b/config/Zed/Oms/NovalnetGiropay01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetIdeal01.xml b/config/Zed/Oms/NovalnetIdeal01.xml new file mode 100755 index 0000000..14eb4e1 --- /dev/null +++ b/config/Zed/Oms/NovalnetIdeal01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetInvoice01.xml b/config/Zed/Oms/NovalnetInvoice01.xml new file mode 100755 index 0000000..4faf33b --- /dev/null +++ b/config/Zed/Oms/NovalnetInvoice01.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + waiting for payment + authorize + + + + authorized + waiting for payment + waiting for payment + + + + authorized + waiting for payment + capture + + + + waiting for payment + canceled + callback canceled + + + + authorized + canceled + callback canceled + + + + authorized + paid + callback paid + + + + waiting for payment + paid + callback paid + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetInvoiceGuarantee01.xml b/config/Zed/Oms/NovalnetInvoiceGuarantee01.xml new file mode 100755 index 0000000..febc64b --- /dev/null +++ b/config/Zed/Oms/NovalnetInvoiceGuarantee01.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + waiting for payment + authorize + + + + new + paid + authorize + + + + authorized + paid + capture + + + + waiting for payment + canceled + callback canceled + + + + authorized + canceled + callback canceled + + + + authorized + paid + callback paid + + + + waiting for payment + paid + callback paid + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetMultibanco01.xml b/config/Zed/Oms/NovalnetMultibanco01.xml new file mode 100755 index 0000000..d1d4d7e --- /dev/null +++ b/config/Zed/Oms/NovalnetMultibanco01.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + waiting for payment + authorize + + + + authorized + waiting for payment + waiting for payment + + + + authorized + waiting for payment + capture + + + + waiting for payment + canceled + callback canceled + + + + authorized + canceled + callback canceled + + + + authorized + paid + callback paid + + + + waiting for payment + paid + callback paid + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetPaypal01.xml b/config/Zed/Oms/NovalnetPaypal01.xml new file mode 100755 index 0000000..70f916c --- /dev/null +++ b/config/Zed/Oms/NovalnetPaypal01.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + authorized + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + online transfer pending + waiting for payment + redirect response + + + + authorized + paid + capture + + + + authorized + paid + callback paid + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + authorized + canceled + callback canceled + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetPostfinance01.xml b/config/Zed/Oms/NovalnetPostfinance01.xml new file mode 100755 index 0000000..2480548 --- /dev/null +++ b/config/Zed/Oms/NovalnetPostfinance01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetPostfinanceCard01.xml b/config/Zed/Oms/NovalnetPostfinanceCard01.xml new file mode 100755 index 0000000..4868335 --- /dev/null +++ b/config/Zed/Oms/NovalnetPostfinanceCard01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetPrepayment01.xml b/config/Zed/Oms/NovalnetPrepayment01.xml new file mode 100755 index 0000000..4b196fa --- /dev/null +++ b/config/Zed/Oms/NovalnetPrepayment01.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + waiting for payment + authorize + + + + authorized + waiting for payment + waiting for payment + + + + authorized + waiting for payment + capture + + + + waiting for payment + canceled + callback canceled + + + + authorized + canceled + callback canceled + + + + authorized + paid + callback paid + + + + waiting for payment + paid + callback paid + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetPrzelewy01.xml b/config/Zed/Oms/NovalnetPrzelewy01.xml new file mode 100755 index 0000000..fa7b581 --- /dev/null +++ b/config/Zed/Oms/NovalnetPrzelewy01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetSepa01.xml b/config/Zed/Oms/NovalnetSepa01.xml new file mode 100755 index 0000000..31cb213 --- /dev/null +++ b/config/Zed/Oms/NovalnetSepa01.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + paid + authorize + + + + authorized + paid + capture + + + + authorized + paid + callback paid + + + + authorized + canceled + callback canceled + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetSepaGuarantee01.xml b/config/Zed/Oms/NovalnetSepaGuarantee01.xml new file mode 100755 index 0000000..96fc7b4 --- /dev/null +++ b/config/Zed/Oms/NovalnetSepaGuarantee01.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + new + authorized + authorize + + + + new + canceled + authorize + + + + new + paid + authorize + + + + authorized + paid + capture + + + + authorized + paid + callback paid + + + + authorized + canceled + callback canceled + + + + authorized + canceled + cancel + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + diff --git a/config/Zed/Oms/NovalnetSofort01.xml b/config/Zed/Oms/NovalnetSofort01.xml new file mode 100755 index 0000000..6a92bd0 --- /dev/null +++ b/config/Zed/Oms/NovalnetSofort01.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + new + online transfer pending + authorize + + + + new + invalid + authorize + + + + online transfer pending + waiting for payment + redirect response + + + + online transfer pending + paid + redirect response + + + + online transfer pending + canceled + redirect response + + + + waiting for payment + paid + callback paid + + + + waiting for payment + canceled + callback canceled + + + + paid + shipped + ship + + + + shipped + refunded + refund + + + + shipped + closed + close + + + + + + + + + + + + + + + + + + diff --git a/config/config.dist.php b/config/config.dist.php new file mode 100755 index 0000000..7301064 --- /dev/null +++ b/config/config.dist.php @@ -0,0 +1,123 @@ + 'NovalnetCreditCard01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA => 'NovalnetSepa01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA_GUARANTEE => 'NovalnetSepaGuarantee01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_INVOICE => 'NovalnetInvoice01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_INVOICE_GUARANTEE => 'NovalnetInvoiceGuarantee01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_PREPAYMENT => 'NovalnetPrepayment01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_IDEAL => 'NovalnetIdeal01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_SOFORT => 'NovalnetSofort01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_GIROPAY => 'NovalnetGiropay01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_BARZAHLEN => 'NovalnetBarzahlen01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_PRZELEWY => 'NovalnetPrzelewy01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_EPS => 'NovalnetEps01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_PAYPAL => 'NovalnetPaypal01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_POSTFINANCE_CARD => 'NovalnetPostfinanceCard01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_POSTFINANCE => 'NovalnetPostfinance01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_BANCONTACT => 'NovalnetBancontact01', + NovalnetConfig::NOVALNET_PAYMENT_METHOD_MULTIBANCO => 'NovalnetMultibanco01', +]; + +// ----------- Translator +$config[TranslatorConstants::TRANSLATION_ZED_FILE_PATH_PATTERNS] = [ + APPLICATION_ROOT_DIR . '/vendor/novalnet/sprykerb2c-payment/data/translation/Zed/[a-z][a-z]_[A-Z][A-Z].csv', +]; + +$config[NovalnetConstants::NOVALNET] = [ + // ------------------ Vendor Configurations ---------------------- + NovalnetConstants::NOVALNET_CREDENTIALS_SIGNATURE => '', // The signature is provided by Novalnet AG after the opening of a merchant account. + NovalnetConstants::NOVALNET_CREDENTIALS_TARIFF => '', // The tariff ID is a unique identification number for each project you have created. The merchant can create any number of tariffs in the Novalnet admin portal. + NovalnetConstants::NOVALNET_CREDENTIALS_ACCESS_KEY => '', // This is the secure public key for encrypting and decrypting transaction parameters. This is mandatory value for all online transfers, Credit Card-3D secure and wallet systems. + NovalnetConstants::NOVALNET_SANDBOX_MODE => false, // (true/false) true = The payment will be processed in the test mode therefore amount for this transaction will not be charged, false = The payment will be processed in the live mode. + // ------------------ Shop URL information ---------------------- + NovalnetConstants::NOVALNET_REDIRECT_SUCCESS_URL => sprintf( + '%s/novalnet/payment', + $config[ApplicationConstants::BASE_URL_YVES] + ), + NovalnetConstants::NOVALNET_REDIRECT_ERROR_URL => sprintf( + '%s/novalnet/payment', + $config[ApplicationConstants::BASE_URL_YVES] + ), + + // ------------------ Credit Card payment ---------------------- + NovalnetConstants::NOVALNET_CREDIT_CARD_ONHOLD_AMOUNT_LIMIT => '', // (in minimum unit of currency. Example. enter 100 which is equal to 1.00) In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. + NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_CLIENT_KEY => '', // A public unique key needs linked to your account. It is needed to do the client-side authentication. You can find this credential by logging into your Novalnet Admin Portal + NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_INLINE => true, // (true/false) true = Show Inline Credit card form form, false = Show Credit Card form in multi lines. + NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_STYLE_CONTAINER => '', // Customize styles of the Credit Card iframe. + NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_STYLE_INPUT => '', // Customize styles of the Credit Card iframe input element. + NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_STYLE_LABEL => '', // Customize styles of the Credit Card iframe label element. + + // ------------------ Invoice payment ---------------------- + NovalnetConstants::NOVALNET_INVOICE_DUE_DATE => '', // (in days) Enter the number of days within which the payment is to be made at Novalnet (at least 7 days). If this field is empty, 14 days will be set as the default time. + NovalnetConstants::NOVALNET_INVOICE_ONHOLD_AMOUNT_LIMIT => '', // (in minimum unit of currency. Example. enter 100 which is equal to 1.00) In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. + + // ------------------ Prepayment payment ---------------------- + NovalnetConstants::NOVALNET_PREPAYMENT_DUE_DATE => '', // (in days) Enter the number of days within which the payment is to be made at Novalnet (at least 7 days). If this field is empty, 14 days will be set as the default time. + + // ------------------ Guraranteed Invoice payment ---------------------- + NovalnetConstants::NOVALNET_INVOICE_GUARANTEE_MINIMUM_AMOUNT_LIMIT => '', // Enter the minimum amount (in cents) for the transaction to be processed with payment guarantee. For example, enter 100 which is equal to 1,00. By default, the amount will be 9,99 EUR + NovalnetConstants::NOVALNET_INVOICE_GUARANTEE_ONHOLD_AMOUNT_LIMIT => '', // (in minimum unit of currency. Example. enter 100 which is equal to 1.00) In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. + + // ------------------ Direct Debit SEPA payment ---------------------- + NovalnetConstants::NOVALNET_SEPA_DUE_DATE => '', // (in days) Enter the number of days after which the payment should be processed (must be between 2 and 14 days). + NovalnetConstants::NOVALNET_SEPA_ONHOLD_AMOUNT_LIMIT => '', // (in minimum unit of currency. Example. enter 100 which is equal to 1.00) In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. + + // ------------------ Guraranteed Direct Debit SEPA payment ---------------------- + NovalnetConstants::NOVALNET_SEPA_GUARANTEE_DUE_DATE => '', // (in days) Enter the number of days after which the payment should be processed (must be between 2 and 14 days). + NovalnetConstants::NOVALNET_SEPA_GUARANTEE_MINIMUM_AMOUNT_LIMIT => '', // Enter the minimum amount (in cents) for the transaction to be processed with payment guarantee. For example, enter 100 which is equal to 1,00. By default, the amount will be 9,99 EUR + NovalnetConstants::NOVALNET_SEPA_GUARANTEE_ONHOLD_AMOUNT_LIMIT => '', // (in minimum unit of currency. Example. enter 100 which is equal to 1.00) In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. + + // ------------------ Barzahlen payment ---------------------- + NovalnetConstants::NOVALNET_BARZAHLEN_SLIP_EXPIRY_DATE => '', // (in days) Enter the number of days within which your customer will pay the amount of the order in a cash partner store near him. If the ticket does not redeem and pay the payment in time, it will expire. If the field is empty, by default it is set to 14 days as the due date. + + // ------------------ PayPayl payment ---------------------- + NovalnetConstants::NOVALNET_PAYPAL_ONHOLD_AMOUNT_LIMIT => '', // (in minimum unit of currency. Example. enter 100 which is equal to 1.00) In case the order amount exceeds mentioned limit, the transaction will be set on hold till your confirmation of transaction. +]; + +// ------------------ Novalnet Callback Script ---------------------- +$config[NovalnetConstants::NOVALNET_CALLBACK] = [ + NovalnetConstants::NOVALNET_CALLBACK_DEBUG_MODE => false, // (true/false) Please disable this option before setting your shop to LIVE mode, to avoid unauthorized calls from external parties (excl. Novalnet). For LIVE, set the value as false. + NovalnetConstants::NOVALNET_CALLBACK_EMAIL_TO_ADDRESS => '', // E-mail address of the recipient for To +]; diff --git a/data/translation/Zed/de_DE.csv b/data/translation/Zed/de_DE.csv new file mode 100755 index 0000000..cadc90e --- /dev/null +++ b/data/translation/Zed/de_DE.csv @@ -0,0 +1,22 @@ +"Callback comments","Callback Kommentare" +"Transaction mode","Transaktionsmodus" +"Bank account details to transfer the amount","Bankverbindung zur Überweisung des Betrages" +"Guarantee payment pending comments","Zahlungsgarantie in Erwartung von Kommentaren" +"Transaction ID","Transaktions-ID" +"Payment method","Zahlungsart" +"novalnetCreditCard","Kredit-/Debitkarte" +"novalnetSepa","SEPA-Lastschrift" +"novalnetInvoice","Rechnung" +"novalnetPrepayment","Vorkasse" +"novalnetIdeal,"iDEAL" +"novalnetSofort","Sofortüberweisung" +"novalnetGiropay","giropay" +"novalnetBarzahlen","Barzahlen/viacash" +"novalnetPrzelewy","Przelewy24" +"novalnetEps","eps" +"novalnetPaypal","PayPal" +"novalnetPostfinanceCard","PostFinance Card" +"novalnetPostfinance","PostFinance E-Finance" +"novalnetBancontact","Bancontact" +"novalnetMultibanco","Multibanco" + diff --git a/data/translation/Zed/en_US.csv b/data/translation/Zed/en_US.csv new file mode 100755 index 0000000..d2e758b --- /dev/null +++ b/data/translation/Zed/en_US.csv @@ -0,0 +1,22 @@ +"Callback comments","Callback comments" +"Transaction mode","Transaction mode" +"Bank account details to transfer the amount","Bank account details to transfer the amount" +"Guarantee payment pending comments","Guarantee payment pending comments" +"Transaction ID","Transaction ID" +"Payment method","Payment method" +"novalnetCreditCard","Credit/Debit Cards" +"novalnetSepa","Direct Debit SEPA" +"novalnetInvoice","Invoice" +"novalnetPrepayment","Prepayment" +"novalnetIdeal,"iDEAL" +"novalnetSofort","Sofort" +"novalnetGiropay","giropay" +"novalnetBarzahlen","Barzahlen/viacash" +"novalnetPrzelewy","Przelewy24" +"novalnetEps","eps" +"novalnetPaypal","PayPal" +"novalnetPostfinanceCard","PostFinance Card" +"novalnetPostfinance","PostFinance E-Finance" +"novalnetBancontact","Bancontact" +"novalnetMultibanco","Multibanco" + diff --git a/src/Novalnet/Client/NovalnetPayment/Dependency/Client/NovalnetPaymentToZedRequestClientBridge.php b/src/Novalnet/Client/NovalnetPayment/Dependency/Client/NovalnetPaymentToZedRequestClientBridge.php new file mode 100755 index 0000000..f4f5e96 --- /dev/null +++ b/src/Novalnet/Client/NovalnetPayment/Dependency/Client/NovalnetPaymentToZedRequestClientBridge.php @@ -0,0 +1,33 @@ +zedRequestClient = $zedRequestClient; + } + + /** + * @param string $url + * @param \Spryker\Shared\Kernel\Transfer\TransferInterface $object + * @param array|int|null $requestOptions + * + * @return \Spryker\Shared\Kernel\Transfer\TransferInterface + */ + public function call($url, TransferInterface $object, $requestOptions = null): TransferInterface + { + return $this->zedRequestClient->call($url, $object, $requestOptions); + } +} diff --git a/src/Novalnet/Client/NovalnetPayment/Dependency/Client/NovalnetPaymentToZedRequestClientInterface.php b/src/Novalnet/Client/NovalnetPayment/Dependency/Client/NovalnetPaymentToZedRequestClientInterface.php new file mode 100755 index 0000000..17f297a --- /dev/null +++ b/src/Novalnet/Client/NovalnetPayment/Dependency/Client/NovalnetPaymentToZedRequestClientInterface.php @@ -0,0 +1,17 @@ +getFactory() + ->createZedNovalnetPaymentStub() + ->processRedirectPaymentResponse($redirectResponseTransfer); + } + + /** + * {@inheritDoc} + * + * @api + * + * @param \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + */ + public function processCallbackResponse(NovalnetCallbackResponseTransfer $callbackResponseTransfer): NovalnetCallbackResponseTransfer + { + return $this + ->getFactory() + ->createZedNovalnetPaymentStub() + ->processCallbackResponse($callbackResponseTransfer); + } + + /** + * {@inheritDoc} + * + * @api + * + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function getTransactionDetails(OrderTransfer $orderTransfer): OrderTransfer + { + return $this + ->getFactory() + ->createZedNovalnetPaymentStub() + ->getTransactionDetails($orderTransfer); + } +} diff --git a/src/Novalnet/Client/NovalnetPayment/NovalnetPaymentClientInterface.php b/src/Novalnet/Client/NovalnetPayment/NovalnetPaymentClientInterface.php new file mode 100755 index 0000000..b83da7f --- /dev/null +++ b/src/Novalnet/Client/NovalnetPayment/NovalnetPaymentClientInterface.php @@ -0,0 +1,49 @@ +addServiceZed($container); + + return $container; + } + + /** + * @param \Spryker\Client\Kernel\Container $container + * + * @return \Spryker\Client\Kernel\Container + */ + protected function addServiceZed(Container $container): Container + { + $container[self::CLIENT_ZED_REQUEST] = function (Container $container) { + return new NovalnetPaymentToZedRequestClientBridge($container->getLocator()->zedRequest()->client()); + }; + + return $container; + } +} diff --git a/src/Novalnet/Client/NovalnetPayment/NovalnetPaymentFactory.php b/src/Novalnet/Client/NovalnetPayment/NovalnetPaymentFactory.php new file mode 100755 index 0000000..ae4ef34 --- /dev/null +++ b/src/Novalnet/Client/NovalnetPayment/NovalnetPaymentFactory.php @@ -0,0 +1,27 @@ +getZedRequestClient()); + } + + /** + * @return \Novalnet\Client\NovalnetPayment\Dependency\Client\NovalnetPaymentToZedRequestClientInterface + */ + public function getZedRequestClient(): NovalnetPaymentToZedRequestClientInterface + { + return $this->getProvidedDependency(NovalnetPaymentDependencyProvider::CLIENT_ZED_REQUEST); + } +} diff --git a/src/Novalnet/Client/NovalnetPayment/Zed/NovalnetPaymentStub.php b/src/Novalnet/Client/NovalnetPayment/Zed/NovalnetPaymentStub.php new file mode 100755 index 0000000..de1d46e --- /dev/null +++ b/src/Novalnet/Client/NovalnetPayment/Zed/NovalnetPaymentStub.php @@ -0,0 +1,63 @@ +zedRequestClient = $zedRequestClient; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer $redirectResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer + */ + public function processRedirectPaymentResponse(NovalnetRedirectResponseTransfer $redirectResponseTransfer): NovalnetRedirectResponseTransfer + { + /** @var \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer $redirectResponseTransfer */ + $redirectResponseTransfer = $this->zedRequestClient->call('/novalnet-payment/gateway/process-redirect-payment-response', $redirectResponseTransfer); + + return $redirectResponseTransfer; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + */ + public function processCallbackResponse(NovalnetCallbackResponseTransfer $callbackResponseTransfer): NovalnetCallbackResponseTransfer + { + /** @var \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer */ + $callbackResponseTransfer = $this->zedRequestClient->call('/novalnet-payment/gateway/process-callback-response', $callbackResponseTransfer); + + return $callbackResponseTransfer; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function getTransactionDetails(OrderTransfer $orderTransfer): OrderTransfer + { + /** @var \Generated\Shared\Transfer\OrderTransfer $orderTransfer */ + $orderTransfer = $this->zedRequestClient->call('/novalnet-payment/gateway/transaction-details', $orderTransfer); + + return $orderTransfer; + } +} diff --git a/src/Novalnet/Client/NovalnetPayment/Zed/NovalnetPaymentStubInterface.php b/src/Novalnet/Client/NovalnetPayment/Zed/NovalnetPaymentStubInterface.php new file mode 100755 index 0000000..debd65a --- /dev/null +++ b/src/Novalnet/Client/NovalnetPayment/Zed/NovalnetPaymentStubInterface.php @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Novalnet/Yves/NovalnetPayment/Controller/NovalnetController.php b/src/Novalnet/Yves/NovalnetPayment/Controller/NovalnetController.php new file mode 100755 index 0000000..c49d2a7 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Controller/NovalnetController.php @@ -0,0 +1,145 @@ +getUrldecodedRequestBody($request); + + $redirectResponseTransfer = new NovalnetRedirectResponseTransfer(); + $redirectResponseTransfer->setStatusMessage(!empty($request['status_text']) ? $request['status_text'] : ''); + $redirectResponseTransfer->setPaymentResponse($request); + $redirectResponseTransfer = $this->processPaymentResponse($redirectResponseTransfer); + + return $this->handleRedirectFromNovalnet($redirectResponseTransfer); + } + + /** + * @param \Symfony\Component\HttpFoundation\Request $request + * + * @return array + */ + protected function getUrldecodedRequestBody(Request $request): array + { + $allRequestParameters = $request->query->all(); + + foreach ($allRequestParameters as $key => $value) { + if (is_string($value)) { + $allRequestParameters[$key] = urldecode($value); + } + } + + return $allRequestParameters; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer $redirectResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer + */ + protected function processPaymentResponse(NovalnetRedirectResponseTransfer $redirectResponseTransfer): NovalnetRedirectResponseTransfer + { + return $this + ->getClient() + ->processRedirectPaymentResponse($redirectResponseTransfer); + } + + /** + * @param \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer $responseTransfer + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + protected function handleRedirectFromNovalnet(NovalnetRedirectResponseTransfer $responseTransfer): RedirectResponse + { + if ($responseTransfer->getIsSuccess()) { + $this->addSuccessMessage($responseTransfer->getStatusMessage()); // Add payport status message + + return $this->redirectResponseInternal(static::ROUTE_CHECKOUT_SUCCESS); + } else { + $this->addErrorMessage($responseTransfer->getStatusMessage()); // Add payport status message + + return $this->redirectResponseInternal(static::CHECKOUT_ERROR); + } + } + + /** + * @param callable|null $callback + * @param int $status + * @param array $headers + * + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + protected function streamedResponse($callback = null, $status = 200, $headers = []): StreamedResponse + { + $streamedResponse = new StreamedResponse($callback, $status, $headers); + $streamedResponse->send(); + + return $streamedResponse; + } + + /** + * @param \Symfony\Component\HttpFoundation\Request $request + * + * @return \Symfony\Component\HttpFoundation\StreamedResponse + */ + public function callbackAction(Request $request): StreamedResponse + { + $clientIp = $request->getClientIp(); // Get the client IP address + $requestJson = $request->getContent(); + $request = json_decode($requestJson, true); + + $callbackResponseTransfer = new NovalnetCallbackResponseTransfer(); + + if (!empty($request['transaction']['order_no'])) { + $callbackResponseTransfer->setOrderNo($request['transaction']['order_no']); + } + + if (!empty($request['transaction']['payment_type'])) { + $callbackResponseTransfer->setPaymentType($request['transaction']['payment_type']); + } + + $callbackResponseTransfer->setClientIp($clientIp); + $callbackResponseTransfer->setCallbackResponse($request); + + $response = $this->processCallbackResponse($callbackResponseTransfer); + + $callback = function () use ($response) { + echo $response->getStatusMessage(); + }; + + return $this->streamedResponse($callback); + } + + /** + * @param \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + */ + protected function processCallbackResponse(NovalnetCallbackResponseTransfer $callbackResponseTransfer): NovalnetCallbackResponseTransfer + { + return $this + ->getClient() + ->processCallbackResponse($callbackResponseTransfer); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Exception/PaymentMethodNotFoundException.php b/src/Novalnet/Yves/NovalnetPayment/Exception/PaymentMethodNotFoundException.php new file mode 100755 index 0000000..6ea4d18 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Exception/PaymentMethodNotFoundException.php @@ -0,0 +1,9 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/BarzahlenSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/BarzahlenSubForm.php new file mode 100755 index 0000000..ff1083c --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/BarzahlenSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/CreditCardSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/CreditCardSubForm.php new file mode 100755 index 0000000..66ee0d3 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/CreditCardSubForm.php @@ -0,0 +1,317 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return void + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + $builder->add( + self::OPTION_PAN_HASH, + HiddenType::class, + ['label' => false] + ); + + $builder->add( + self::OPTION_UNIQUE_ID, + HiddenType::class, + ['label' => false] + ); + + $builder->add( + self::OPTION_DO_REDIRECT, + HiddenType::class, + ['label' => false] + ); + // Add iFrame data (clientKey, iFrame form customization inputs) + $this->addFrameData($builder, $options); + // Add transaction data (amount, currency, etc.,) + $this->addTransactionData($builder, $options); + // Add customer data (firstname, lastname, etc.,) + $this->addCustomerData($builder, $options); + // Add custom data (language) + $this->addCustomData($builder, $options); + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return $this + */ + protected function addFrameData(FormBuilderInterface $builder, array $options) + { + $builder->add( + self::OPTION_FORM_CLIENT_KEY, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_FORM_CLIENT_KEY], + ] + ); + + $builder->add( + self::OPTION_FORM_INLINE, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_FORM_INLINE], + ] + ); + + $builder->add( + self::OPTION_FORM_STYLE_CONTAINER, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_FORM_STYLE_CONTAINER], + ] + ); + + $builder->add( + self::OPTION_FORM_STYLE_INPUT, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_FORM_STYLE_INPUT], + ] + ); + + $builder->add( + self::OPTION_FORM_STYLE_LABEL, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_FORM_STYLE_LABEL], + ] + ); + + return $this; + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return $this + */ + protected function addTransactionData(FormBuilderInterface $builder, array $options) + { + $builder->add( + self::OPTION_AMOUNT, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_AMOUNT], + ] + ); + + $builder->add( + self::OPTION_CURRENCY, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CURRENCY], + ] + ); + + $builder->add( + self::OPTION_TEST_MODE, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_TEST_MODE], + ] + ); + + return $this; + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return $this + */ + protected function addCustomerData(FormBuilderInterface $builder, array $options) + { + $builder->add( + self::OPTION_FIRST_NAME, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_FIRST_NAME], + ] + ); + + $builder->add( + self::OPTION_LAST_NAME, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_LAST_NAME], + ] + ); + + $builder->add( + self::OPTION_EMAIL, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_EMAIL], + ] + ); + + $builder->add( + self::OPTION_STREET, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_STREET], + ] + ); + + $builder->add( + self::OPTION_HOUSE_NO, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_HOUSE_NO], + ] + ); + + $builder->add( + self::OPTION_CITY, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_CITY], + ] + ); + + $builder->add( + self::OPTION_ZIP, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_ZIP], + ] + ); + + $builder->add( + self::OPTION_COUNTRY_CODE, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_COUNTRY_CODE], + ] + ); + + return $this; + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return $this + */ + protected function addCustomData(FormBuilderInterface $builder, array $options) + { + $builder->add( + self::OPTION_LANG, + HiddenType::class, + [ + 'label' => false, + 'data' => $options[self::OPTIONS_FIELD_NAME][self::OPTION_LANG], + ] + ); + + return $this; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/BancontactFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/BancontactFormDataProvider.php new file mode 100755 index 0000000..e2ffba4 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/BancontactFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetBancontact(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/BarzahlenFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/BarzahlenFormDataProvider.php new file mode 100755 index 0000000..502fb7f --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/BarzahlenFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetBarzahlen(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/CreditCardFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/CreditCardFormDataProvider.php new file mode 100755 index 0000000..87a4ad1 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/CreditCardFormDataProvider.php @@ -0,0 +1,71 @@ +config = $config; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return \Generated\Shared\Transfer\QuoteTransfer + */ + public function getData(AbstractTransfer $quoteTransfer) + { + if ($quoteTransfer->getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetCreditCard(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return [ + CreditCardSubForm::OPTION_FIRST_NAME => $quoteTransfer->getBillingAddress()->getFirstName(), + CreditCardSubForm::OPTION_LAST_NAME => $quoteTransfer->getBillingAddress()->getLastName(), + CreditCardSubForm::OPTION_EMAIL => $quoteTransfer->getCustomer()->getEmail(), + CreditCardSubForm::OPTION_STREET => $quoteTransfer->getBillingAddress()->getAddress1(), + CreditCardSubForm::OPTION_HOUSE_NO => $quoteTransfer->getBillingAddress()->getAddress2(), + CreditCardSubForm::OPTION_CITY => $quoteTransfer->getBillingAddress()->getCity(), + CreditCardSubForm::OPTION_ZIP => $quoteTransfer->getBillingAddress()->getZipCode(), + CreditCardSubForm::OPTION_COUNTRY_CODE => $quoteTransfer->getBillingAddress()->getIso2Code(), + CreditCardSubForm::OPTION_AMOUNT => $quoteTransfer->getTotals()->getGrandTotal(), + CreditCardSubForm::OPTION_CURRENCY => $this->config->getCurrency(), + CreditCardSubForm::OPTION_TEST_MODE => ($this->config->getTestMode() === true ? 1 : 0), + CreditCardSubForm::OPTION_LANG => $this->config->getLanguage(), + CreditCardSubForm::OPTION_FORM_CLIENT_KEY => $this->config->getCreditCardClientKey(), + CreditCardSubForm::OPTION_FORM_INLINE => ($this->config->getCreditCardInline() === true ? 1 : 0), + CreditCardSubForm::OPTION_FORM_STYLE_CONTAINER => $this->config->getCreditCardStyleContainer(), + CreditCardSubForm::OPTION_FORM_STYLE_INPUT => $this->config->getCreditCardStyleInput(), + CreditCardSubForm::OPTION_FORM_STYLE_LABEL => $this->config->getCreditCardStyleLabel(), + ]; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/EpsFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/EpsFormDataProvider.php new file mode 100755 index 0000000..62284d6 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/EpsFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetEps(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/GiropayFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/GiropayFormDataProvider.php new file mode 100755 index 0000000..1b361a5 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/GiropayFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetGiropay(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/IdealFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/IdealFormDataProvider.php new file mode 100755 index 0000000..97b0857 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/IdealFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetIdeal(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/InvoiceFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/InvoiceFormDataProvider.php new file mode 100755 index 0000000..6368ba9 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/InvoiceFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetInvoice(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/InvoiceGuaranteeFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/InvoiceGuaranteeFormDataProvider.php new file mode 100755 index 0000000..1ccd9d5 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/InvoiceGuaranteeFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetInvoiceGuarantee(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/MultibancoFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/MultibancoFormDataProvider.php new file mode 100755 index 0000000..ff02463 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/MultibancoFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetMultibanco(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PaypalFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PaypalFormDataProvider.php new file mode 100755 index 0000000..8c763a1 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PaypalFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetPaypal(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PostfinanceCardFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PostfinanceCardFormDataProvider.php new file mode 100755 index 0000000..c2e65b2 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PostfinanceCardFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetPostfinanceCard(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PostfinanceFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PostfinanceFormDataProvider.php new file mode 100755 index 0000000..1e75b2e --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PostfinanceFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetPostfinance(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PrepaymentFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PrepaymentFormDataProvider.php new file mode 100755 index 0000000..866c664 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PrepaymentFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetPrepayment(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PrzelewyFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PrzelewyFormDataProvider.php new file mode 100755 index 0000000..16bcf19 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/PrzelewyFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetPrzelewy(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SepaFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SepaFormDataProvider.php new file mode 100755 index 0000000..e50e706 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SepaFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetSepa(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SepaGuaranteeFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SepaGuaranteeFormDataProvider.php new file mode 100755 index 0000000..88b2242 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SepaGuaranteeFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetSepaGuarantee(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SofortFormDataProvider.php b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SofortFormDataProvider.php new file mode 100755 index 0000000..24fa89a --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/DataProvider/SofortFormDataProvider.php @@ -0,0 +1,38 @@ +getPayment() === null) { + $paymentTransfer = new PaymentTransfer(); + $paymentTransfer->setNovalnetSofort(new NovalnetTransfer()); + + $quoteTransfer->setPayment($paymentTransfer); + } + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return array + */ + public function getOptions(AbstractTransfer $quoteTransfer) + { + return []; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/EpsSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/EpsSubForm.php new file mode 100755 index 0000000..4fac4d1 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/EpsSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/GriopaySubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/GriopaySubForm.php new file mode 100755 index 0000000..a1db3c6 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/GriopaySubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/IdealSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/IdealSubForm.php new file mode 100755 index 0000000..58a5526 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/IdealSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/InvoiceGuaranteeSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/InvoiceGuaranteeSubForm.php new file mode 100755 index 0000000..f18a517 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/InvoiceGuaranteeSubForm.php @@ -0,0 +1,87 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return void + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + parent::buildForm($builder, $options); + + $builder->add( + self::FIELD_DOB, + TextType::class, + [ + 'label' => static::DOB_LABEL, + 'required' => true, + ] + ); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/InvoiceSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/InvoiceSubForm.php new file mode 100755 index 0000000..aff2f17 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/InvoiceSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/MultibancoSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/MultibancoSubForm.php new file mode 100755 index 0000000..900c023 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/MultibancoSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/PaypalSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/PaypalSubForm.php new file mode 100755 index 0000000..70239ee --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/PaypalSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/PostfinanceCardSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/PostfinanceCardSubForm.php new file mode 100755 index 0000000..0da4a90 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/PostfinanceCardSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/PostfinanceSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/PostfinanceSubForm.php new file mode 100755 index 0000000..59bc246 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/PostfinanceSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/PrepaymentSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/PrepaymentSubForm.php new file mode 100755 index 0000000..acf89cb --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/PrepaymentSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/PrzelewySubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/PrzelewySubForm.php new file mode 100755 index 0000000..490b469 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/PrzelewySubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/SepaGuaranteeSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/SepaGuaranteeSubForm.php new file mode 100755 index 0000000..b697875 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/SepaGuaranteeSubForm.php @@ -0,0 +1,154 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return void + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + parent::buildForm($builder, $options); + $this->addIBAN($builder); + + $builder->add( + self::FIELD_DOB, + TextType::class, + [ + 'label' => static::DOB_LABEL, + 'required' => true, + ] + ); + } + + /** + * @param \Symfony\Component\Form\FormView $view The view + * @param \Symfony\Component\Form\FormInterface $form The form + * @param array $options The options + * + * @return void + */ + public function buildView(FormView $view, FormInterface $form, array $options): void + { + parent::buildView($view, $form, $options); + $selectedOptions = $options[static::OPTIONS_FIELD_NAME]; + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * + * @return $this + */ + protected function addIBAN(FormBuilderInterface $builder) + { + $builder->add( + self::FIELD_IBAN, + TextType::class, + [ + 'label' => static::IBAN_LABEL, + 'required' => true, + 'constraints' => [ + $this->createNotBlankConstraint(), + $this->createIbanValidationConstraint(), + ], + ] + ); + + return $this; + } + + /** + * @return \Symfony\Component\Validator\Constraint + */ + protected function createNotBlankConstraint() + { + return new NotBlank(['groups' => $this->getPropertyPath()]); + } + + /** + * @return \Symfony\Component\Validator\Constraint + */ + protected function createIbanValidationConstraint() + { + return new Regex([ + 'pattern' => '/^(?:[a-z]{2}[0-9]+$)/i', + 'message' => static::VALIDATION_IBAN_MESSAGE, + 'groups' => $this->getPropertyPath(), + ]); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/SepaSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/SepaSubForm.php new file mode 100755 index 0000000..58c5189 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/SepaSubForm.php @@ -0,0 +1,110 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * @param array $options + * + * @return void + */ + public function buildForm(FormBuilderInterface $builder, array $options): void + { + parent::buildForm($builder, $options); + $this->addIBAN($builder); + } + + /** + * @param \Symfony\Component\Form\FormBuilderInterface $builder + * + * @return $this + */ + protected function addIBAN(FormBuilderInterface $builder) + { + $builder->add( + self::FIELD_IBAN, + TextType::class, + [ + 'label' => static::IBAN_LABEL, + 'required' => true, + 'constraints' => [ + $this->createNotBlankConstraint(), + ], + ] + ); + + return $this; + } + + /** + * @return \Symfony\Component\Validator\Constraint + */ + protected function createNotBlankConstraint() + { + return new NotBlank(['groups' => $this->getPropertyPath()]); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Form/SofortSubForm.php b/src/Novalnet/Yves/NovalnetPayment/Form/SofortSubForm.php new file mode 100755 index 0000000..f8a2021 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Form/SofortSubForm.php @@ -0,0 +1,61 @@ +configureOptions($resolver); + } + + /** + * @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver + * + * @return void + */ + public function configureOptions(OptionsResolver $resolver) + { + $resolver->setDefaults([ + 'data_class' => NovalnetTransfer::class, + ])->setRequired(self::OPTIONS_FIELD_NAME); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Handler/NovalnetHandler.php b/src/Novalnet/Yves/NovalnetPayment/Handler/NovalnetHandler.php new file mode 100755 index 0000000..7a6dbac --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Handler/NovalnetHandler.php @@ -0,0 +1,100 @@ + NovalnetConfig::NOVALNET_PAYMENT_METHOD_CC, + PaymentTransfer::NOVALNET_SEPA => NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA, + PaymentTransfer::NOVALNET_SEPA_GUARANTEE => NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA_GUARANTEE, + PaymentTransfer::NOVALNET_INVOICE => NovalnetConfig::NOVALNET_PAYMENT_METHOD_INVOICE, + PaymentTransfer::NOVALNET_INVOICE_GUARANTEE => NovalnetConfig::NOVALNET_PAYMENT_METHOD_INVOICE_GUARANTEE, + PaymentTransfer::NOVALNET_PREPAYMENT => NovalnetConfig::NOVALNET_PAYMENT_METHOD_PREPAYMENT, + PaymentTransfer::NOVALNET_IDEAL => NovalnetConfig::NOVALNET_PAYMENT_METHOD_IDEAL, + PaymentTransfer::NOVALNET_SOFORT => NovalnetConfig::NOVALNET_PAYMENT_METHOD_SOFORT, + PaymentTransfer::NOVALNET_GIROPAY => NovalnetConfig::NOVALNET_PAYMENT_METHOD_GIROPAY, + PaymentTransfer::NOVALNET_BARZAHLEN => NovalnetConfig::NOVALNET_PAYMENT_METHOD_BARZAHLEN, + PaymentTransfer::NOVALNET_PRZELEWY => NovalnetConfig::NOVALNET_PAYMENT_METHOD_PRZELEWY, + PaymentTransfer::NOVALNET_EPS => NovalnetConfig::NOVALNET_PAYMENT_METHOD_EPS, + PaymentTransfer::NOVALNET_PAYPAL => NovalnetConfig::NOVALNET_PAYMENT_METHOD_PAYPAL, + PaymentTransfer::NOVALNET_POSTFINANCE_CARD => NovalnetConfig::NOVALNET_PAYMENT_METHOD_POSTFINANCE_CARD, + PaymentTransfer::NOVALNET_POSTFINANCE => NovalnetConfig::NOVALNET_PAYMENT_METHOD_POSTFINANCE, + PaymentTransfer::NOVALNET_BANCONTACT => NovalnetConfig::NOVALNET_PAYMENT_METHOD_BANCONTACT, + PaymentTransfer::NOVALNET_MULTIBANCO => NovalnetConfig::NOVALNET_PAYMENT_METHOD_MULTIBANCO, + ]; + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return \Generated\Shared\Transfer\QuoteTransfer + */ + public function addPaymentToQuote(QuoteTransfer $quoteTransfer) + { + $paymentSelection = $quoteTransfer->getPayment()->getPaymentSelection(); + + $this->setPaymentProviderAndMethod($quoteTransfer, $paymentSelection); + $this->setNovalnetPayment($quoteTransfer, $paymentSelection); + + return $quoteTransfer; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param string $paymentSelection + * + * @return void + */ + protected function setPaymentProviderAndMethod(QuoteTransfer $quoteTransfer, $paymentSelection) + { + $quoteTransfer->getPayment() + ->setPaymentSelection($paymentSelection) + ->setPaymentProvider(self::PAYMENT_PROVIDER) + ->setPaymentMethod(self::$paymentMethods[$paymentSelection]); + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param string $paymentSelection + * + * @return void + */ + protected function setNovalnetPayment(QuoteTransfer $quoteTransfer, $paymentSelection) + { + $novalnetPaymentTransfer = $this->getNovalnetPaymentTransfer($quoteTransfer, $paymentSelection); + $method = 'set' . ucfirst($paymentSelection); + $quoteTransfer->getPayment()->$method(clone $novalnetPaymentTransfer); + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param string $paymentSelection + * + * @throws \Novalnet\Yves\NovalnetPayment\Exception\PaymentMethodNotFoundException + * + * @return \Generated\Shared\Transfer\NovalnetTransfer + */ + protected function getNovalnetPaymentTransfer(QuoteTransfer $quoteTransfer, $paymentSelection) + { + $paymentMethod = ucfirst($paymentSelection); + $method = 'get' . $paymentMethod; + $paymentTransfer = $quoteTransfer->getPayment(); + + if (!method_exists($paymentTransfer, $method) || ($quoteTransfer->getPayment()->$method() === null)) { + throw new PaymentMethodNotFoundException(sprintf('Selected payment method "%s" not found in PaymentTransfer', $paymentMethod)); + } + $novalnetPaymentTransfer = $quoteTransfer->getPayment()->$method(); + + return $novalnetPaymentTransfer; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/NovalnetPaymentConfig.php b/src/Novalnet/Yves/NovalnetPayment/NovalnetPaymentConfig.php new file mode 100755 index 0000000..1bccebf --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/NovalnetPaymentConfig.php @@ -0,0 +1,86 @@ +get(NovalnetConstants::NOVALNET); + + return $settings[NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_CLIENT_KEY]; + } + + /** + * @return bool + */ + public function getCreditCardInline() + { + $settings = $this->get(NovalnetConstants::NOVALNET); + + return $settings[NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_INLINE]; + } + + /** + * @return string + */ + public function getCreditCardStyleContainer() + { + $settings = $this->get(NovalnetConstants::NOVALNET); + + return $settings[NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_STYLE_CONTAINER]; + } + + /** + * @return string + */ + public function getCreditCardStyleInput() + { + $settings = $this->get(NovalnetConstants::NOVALNET); + + return $settings[NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_STYLE_INPUT]; + } + + /** + * @return string + */ + public function getCreditCardStyleLabel() + { + $settings = $this->get(NovalnetConstants::NOVALNET); + + return $settings[NovalnetConstants::NOVALNET_CREDIT_CARD_FORM_STYLE_LABEL]; + } + + /** + * @return bool + */ + public function getTestMode() + { + $settings = $this->get(NovalnetConstants::NOVALNET); + + return $settings[NovalnetConstants::NOVALNET_SANDBOX_MODE]; + } + + /** + * @return string + */ + public function getCurrency() + { + return Store::getInstance()->getCurrencyIsoCode(); + } + + /** + * @return string + */ + public function getLanguage() + { + return Store::getInstance()->getCurrentLanguage(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/NovalnetPaymentDependencyProvider.php b/src/Novalnet/Yves/NovalnetPayment/NovalnetPaymentDependencyProvider.php new file mode 100755 index 0000000..447e8df --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/NovalnetPaymentDependencyProvider.php @@ -0,0 +1,9 @@ +getConfig()); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\SepaSubForm + */ + public function createSepaForm() + { + return new SepaSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\SepaFormDataProvider + */ + public function createSepaFormDataProvider() + { + return new SepaFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\SepaGuaranteeSubForm + */ + public function createSepaGuaranteeForm() + { + return new SepaGuaranteeSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\SepaGuaranteeFormDataProvider + */ + public function createSepaGuaranteeFormDataProvider() + { + return new SepaGuaranteeFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\InvoiceSubForm + */ + public function createInvoiceForm() + { + return new InvoiceSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\InvoiceFormDataProvider + */ + public function createInvoiceFormDataProvider() + { + return new InvoiceFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\InvoiceGuaranteeSubForm + */ + public function createInvoiceGuaranteeForm() + { + return new InvoiceGuaranteeSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\InvoiceGuaranteeFormDataProvider + */ + public function createInvoiceGuaranteeFormDataProvider() + { + return new InvoiceGuaranteeFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\PrepaymentSubForm + */ + public function createPrepaymentForm() + { + return new PrepaymentSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\PrepaymentFormDataProvider + */ + public function createPrepaymentFormDataProvider() + { + return new PrepaymentFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\IdealSubForm + */ + public function createIdealForm() + { + return new IdealSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\IdealFormDataProvider + */ + public function createIdealFormDataProvider() + { + return new IdealFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\SofortSubForm + */ + public function createSofortForm() + { + return new SofortSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\SofortFormDataProvider + */ + public function createSofortFormDataProvider() + { + return new SofortFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\GriopaySubForm + */ + public function createGiropayForm() + { + return new GriopaySubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\GiropayFormDataProvider + */ + public function createGiropayFormDataProvider() + { + return new GiropayFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\BarzahlenSubForm + */ + public function createBarzahlenForm() + { + return new BarzahlenSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\BarzahlenFormDataProvider + */ + public function createBarzahlenFormDataProvider() + { + return new BarzahlenFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\PrzelewySubForm + */ + public function createPrzelewyForm() + { + return new PrzelewySubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\PrzelewyFormDataProvider + */ + public function createPrzelewyFormDataProvider() + { + return new PrzelewyFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\EpsSubForm + */ + public function createEpsForm() + { + return new EpsSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\EpsFormDataProvider + */ + public function createEpsFormDataProvider() + { + return new EpsFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\PaypalSubForm + */ + public function createPaypalForm() + { + return new PaypalSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\PaypalFormDataProvider + */ + public function createPaypalFormDataProvider() + { + return new PaypalFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\PostfinanceCardSubForm + */ + public function createPostfinanceCardForm() + { + return new PostfinanceCardSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\PostfinanceCardFormDataProvider + */ + public function createPostfinanceCardFormDataProvider() + { + return new PostfinanceCardFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\PostfinanceSubForm + */ + public function createPostfinanceForm() + { + return new PostfinanceSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\PostfinanceFormDataProvider + */ + public function createPostfinanceFormDataProvider() + { + return new PostfinanceFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\BancontactSubForm + */ + public function createBancontactForm() + { + return new BancontactSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\BancontactFormDataProvider + */ + public function createBancontactFormDataProvider() + { + return new BancontactFormDataProvider(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\MultibancoSubForm + */ + public function createMultibancoForm() + { + return new MultibancoSubForm(); + } + + /** + * @return \Novalnet\Yves\NovalnetPayment\Form\DataProvider\MultibancoFormDataProvider + */ + public function createMultibancoFormDataProvider() + { + return new MultibancoFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/BancontactSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/BancontactSubFormPlugin.php new file mode 100755 index 0000000..27976ef --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/BancontactSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createBancontactForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createBancontactFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/BarzahlenSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/BarzahlenSubFormPlugin.php new file mode 100755 index 0000000..d0b43de --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/BarzahlenSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createBarzahlenForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createBarzahlenFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/CreditCardSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/CreditCardSubFormPlugin.php new file mode 100755 index 0000000..9c8c907 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/CreditCardSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createCreditCardForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createCreditCardFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/EpsSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/EpsSubFormPlugin.php new file mode 100755 index 0000000..8d44a2a --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/EpsSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createEpsForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createEpsFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/GiropaySubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/GiropaySubFormPlugin.php new file mode 100755 index 0000000..c500f6a --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/GiropaySubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createGiropayForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createGiropayFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/IdealSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/IdealSubFormPlugin.php new file mode 100755 index 0000000..c23e1af --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/IdealSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createIdealForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createIdealFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/InvoiceGuaranteeSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/InvoiceGuaranteeSubFormPlugin.php new file mode 100755 index 0000000..562b06f --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/InvoiceGuaranteeSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createInvoiceGuaranteeForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createInvoiceGuaranteeFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/InvoiceSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/InvoiceSubFormPlugin.php new file mode 100755 index 0000000..240224f --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/InvoiceSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createInvoiceForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createInvoiceFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/MultibancoSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/MultibancoSubFormPlugin.php new file mode 100755 index 0000000..3fd0d98 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/MultibancoSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createMultibancoForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createMultibancoFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/NovalnetHandlerPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/NovalnetHandlerPlugin.php new file mode 100755 index 0000000..e7b7b13 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/NovalnetHandlerPlugin.php @@ -0,0 +1,25 @@ +getFactory()->createNovalnetHandler()->addPaymentToQuote($quoteTransfer); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/PaypalSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/PaypalSubFormPlugin.php new file mode 100755 index 0000000..d57f5b0 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/PaypalSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createPaypalForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createPaypalFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/PostfinanceCardSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/PostfinanceCardSubFormPlugin.php new file mode 100755 index 0000000..69a6116 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/PostfinanceCardSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createPostfinanceCardForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createPostfinanceCardFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/PostfinanceSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/PostfinanceSubFormPlugin.php new file mode 100755 index 0000000..bc5cdf0 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/PostfinanceSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createPostfinanceForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createPostfinanceFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/PrepaymentSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/PrepaymentSubFormPlugin.php new file mode 100755 index 0000000..3ac60d8 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/PrepaymentSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createPrepaymentForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createPrepaymentFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/PrzelewySubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/PrzelewySubFormPlugin.php new file mode 100755 index 0000000..c0794ca --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/PrzelewySubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createPrzelewyForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createPrzelewyFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/Router/NovalnetRouteProviderPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/Router/NovalnetRouteProviderPlugin.php new file mode 100755 index 0000000..e139abd --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/Router/NovalnetRouteProviderPlugin.php @@ -0,0 +1,59 @@ +addNovalnetIndexRoute($routeCollection); + $routeCollection = $this->addNovalnetCallbackRoute($routeCollection); + + return $routeCollection; + } + + /** + * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection + * + * @return \Spryker\Yves\Router\Route\RouteCollection + */ + protected function addNovalnetIndexRoute(RouteCollection $routeCollection): RouteCollection + { + $route = $this->buildRoute('/novalnet/payment', 'NovalnetPayment', 'Novalnet', 'paymentAction'); + $route = $route->setMethods(['GET', 'POST']); + $routeCollection->add(static::NOVALNET_PAYMENT, $route); + + return $routeCollection; + } + + /** + * @param \Spryker\Yves\Router\Route\RouteCollection $routeCollection + * + * @return \Spryker\Yves\Router\Route\RouteCollection + */ + protected function addNovalnetCallbackRoute(RouteCollection $routeCollection): RouteCollection + { + $route = $this->buildRoute('/novalnet/callback', 'NovalnetPayment', 'Novalnet', 'callbackAction'); + $route = $route->setMethods(['GET', 'POST']); + $routeCollection->add(static::NOVALNET_CALLBACK, $route); + + return $routeCollection; + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/SepaGuaranteeSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/SepaGuaranteeSubFormPlugin.php new file mode 100755 index 0000000..dc8d1fd --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/SepaGuaranteeSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createSepaGuaranteeForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createSepaGuaranteeFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/SepaSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/SepaSubFormPlugin.php new file mode 100755 index 0000000..a322443 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/SepaSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createSepaForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createSepaFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Plugin/SofortSubFormPlugin.php b/src/Novalnet/Yves/NovalnetPayment/Plugin/SofortSubFormPlugin.php new file mode 100755 index 0000000..0ed3fe5 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Plugin/SofortSubFormPlugin.php @@ -0,0 +1,28 @@ +getFactory()->createSofortForm(); + } + + /** + * @return \Spryker\Yves\StepEngine\Dependency\Form\StepEngineFormDataProviderInterface + */ + public function createSubFormDataProvider() + { + return $this->getFactory()->createSofortFormDataProvider(); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Resources/glossary.csv b/src/Novalnet/Yves/NovalnetPayment/Resources/glossary.csv new file mode 100755 index 0000000..45e410a --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Resources/glossary.csv @@ -0,0 +1,116 @@ +"novalnetCreditCard","Credit/Debit Cards",en_US +"novalnetCreditCard","Kredit-/Debitkarte",de_DE +"novalnetSepa","Direct Debit SEPA",en_US +"novalnetSepa","SEPA-Lastschrift",de_DE +"novalnetSepaGuarantee","Direct Debit SEPA with payment guarantee",en_US +"novalnetSepaGuarantee","SEPA-Lastschrift mit Zahlungsgarantie",de_DE +"novalnetInvoice","Invoice",en_US +"novalnetInvoice","Rechnung",de_DE +"novalnetInvoiceGuarantee","Invoice with payment guarantee",en_US +"novalnetInvoiceGuarantee","Rechnung mit Zahlungsgarantie",de_DE +"novalnetPrepayment","Prepayment",en_US +"novalnetPrepayment","Vorkasse",de_DE +"novalnetIdeal","iDEAL",en_US +"novalnetIdeal","iDEAL",de_DE +"novalnetSofort","Sofort",en_US +"novalnetSofort","Sofortüberweisung",de_DE +"novalnetGiropay","giropay",en_US +"novalnetGiropay","giropay",de_DE +"novalnetBarzahlen","Barzahlen/viacash",en_US +"novalnetBarzahlen","Barzahlen/viacash",de_DE +"novalnetPrzelewy","Przelewy24",en_US +"novalnetPrzelewy","Przelewy24",de_DE +"novalnetEps","eps",en_US +"novalnetEps","eps",de_DE +"novalnetPaypal","PayPal",en_US +"novalnetPaypal","PayPal",de_DE +"novalnetPostfinanceCard","PostFinance Card",en_US +"novalnetPostfinanceCard","PostFinance Card",de_DE +"novalnetPostfinance","PostFinance E-Finance",en_US +"novalnetPostfinance","PostFinance E-Finance",de_DE +"novalnetBancontact","Bancontact",en_US +"novalnetBancontact","Bancontact",de_DE +"novalnetMultibanco","Multibanco",en_US +"novalnetMultibanco","Multibanco",de_DE +"novalnet.sepa-iban","IBAN",en_US +"novalnet.sepa-iban","IBAN",de_DE +"novalnet.sepa-payment-description","The amount will be debited from your account by Novalnet",en_US +"novalnet.sepa-payment-description","Der Betrag wird durch Novalnet von Ihrem Konto abgebucht",de_DE +"novalnet.credit-card-payment-description","The amount will be debited from your credit/debit card",en_US +"novalnet.credit-card-payment-description","Der Betrag wird Ihrer Kredit-/Debitkarte belastet",de_DE +"novalnet.invoice-payments-description","You will receive an e-mail with the Novalnet account details to complete the payment",en_US +"novalnet.invoice-payments-description","Sie erhalten eine E-Mail mit den Bankdaten von Novalnet, um die Zahlung abzuschließen",de_DE +"novalnet.sofort-payment-description","You will be redirected to Sofort. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.sofort-payment-description","Sie werden zu Sofortüberweisung weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.giropay-payment-description","You will be redirected to giropay. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.giropay-payment-description","Sie werden zu giropay weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.przelewy-payment-description","You will be redirected to Przelewy24. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.przelewy-payment-description","Sie werden zu Przelewy24 weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.eps-payment-description","You will be redirected to eps. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.eps-payment-description","Sie werden zu eps weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.paypal-payment-description","You will be redirected to PayPal. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.paypal-payment-description","Sie werden zu PayPal weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.postfinance-payment-description","You will be redirected to PostFinance. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.postfinance-payment-description","Sie werden zu PostFinance weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.bancontact-payment-description","You will be redirected to Bancontact. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.bancontact-payment-description","Sie werden zu Bancontact weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.ideal-payment-description","You will be redirected to iDEAL. Please don’t close or refresh the browser until the payment is completed",en_US +"novalnet.ideal-payment-description","Sie werden zu iDEAL weitergeleitet. Um eine erfolgreiche Zahlung zu gewährleisten, darf die Seite nicht geschlossen oder neu geladen werden, bis die Bezahlung abgeschlossen ist.",de_DE +"novalnet.multibanco-payment-description","On successful checkout, you will receive a payment reference. Using this payment reference, you can either pay in the Multibanco ATM or through your online bank account",en_US +"novalnet.multibanco-payment-description","Nach erfolgreichem Bestellabschluss erhalten Sie eine Zahlungsreferenz. Damit können Sie entweder an einem Multibanco-Geldautomaten oder im Onlinebanking bezahlen.",de_DE +"novalnet.barzahlen-payment-description","On successful checkout, you will receive a payment slip/SMS to pay your online purchase at one of our retail partners (e.g. supermarket)",en_US +"novalnet.barzahlen-payment-description","Nach erfolgreichem Bestellabschluss erhalten Sie einen Zahlschein bzw. eine SMS. Damit können Sie Ihre Online-Bestellung bei einem unserer Partner im Einzelhandel (z.B. Drogerie, Supermarkt etc.) bezahlen",de_DE +"novalnet.payment-confirmed","The transaction has been confirmed on %confirmed%",en_US +"novalnet.payment-confirmed","Die Buchung wurde am %confirmed% bestätigt.",de_DE +"novalnet.payment-void","The transaction has been canceled on %cancelled%",en_US +"novalnet.payment-void","Die Transaktion wurde am %cancelled%" Uhr storniert,de_DE +"novalnet.payment-partial-refund","Refund has been initiated for the TID: %parentTid% with the amount of %amount%. New TID: %referenceTid% for the refunded amount.",en_US +"novalnet.payment-partial-refund","Die Rückerstattung für die TID %parentTid% mit dem Betrag %amount% wurde veranlasst. Die neue TID für den erstatteten Betrag lautet: %referenceTid%",de_DE +"novalnet.payment-full-refund","Refund has been initiated for the TID: %parentTid% with the amount of %amount%.",en_US +"novalnet.payment-full-refund","Die Rückerstattung für die TID %parentTid% mit dem Betrag %amount% wurde veranlasst.",de_DE +"novalnet.invoice-bank-note-transfer-text-with-due-date","Please transfer the amount of %amount% to the following account on or before %due_date%",en_US +"novalnet.invoice-bank-note-transfer-text-with-due-date","Bitte überweisen Sie den Betrag von %amount% spätestens bis zum %due_date% auf das folgende Konto",de_DE +"novalnet.invoice-bank-note-transfer-text","Please transfer the amount of %amount% %currency% to the following account",en_US +"novalnet.invoice-bank-note-transfer-text","Bitte überweisen Sie den Betrag %amount% %currency% auf das folgende Konto.",de_DE +"novalnet.invoice-bank-note-account-holder","Account holder: %holder%",en_US +"novalnet.invoice-bank-note-account-holder","Kontoinhaber: %holder%",de_DE +"novalnet.invoice-bank-note-iban","IBAN: %iban%",en_US +"novalnet.invoice-bank-note-iban","IBAN: %iban%",de_DE +"novalnet.invoice-bank-note-bic","BIC: %bic%",en_US +"novalnet.invoice-bank-note-bic","BIC: %bic%",de_DE +"novalnet.invoice-bank-note-bank","Bank: %bank% %place%",en_US +"novalnet.invoice-bank-note-bank","Bank: %bank% %place%",de_DE +"novalnet.invoice-bank-note-amount","Amount: %amount% %currency%",en_US +"novalnet.invoice-bank-note-amount","Betrag: %amount% %currency%",de_DE +"novalnet.invoice-bank-note-reference-text","Please use any one of the following references as the payment reference, as only through this way your payment is matched and assigned to the order:",en_US +"novalnet.invoice-bank-note-reference-text","Bitte verwenden Sie einen der unten angegebenen Verwendungszwecke für die Überweisung, da nur so Ihr Geldeingang zugeordnet werden kann:",de_DE +"novalnet.invoice-bank-note-reference-one","Payment Reference 1: TID %ref1%",en_US +"novalnet.invoice-bank-note-reference-one","Verwendungszweck 1: TID %ref1%",de_DE +"novalnet.invoice-bank-note-reference-two","Payment Reference 2: %ref2%",en_US +"novalnet.invoice-bank-note-reference-two","Verwendungszweck 2: %ref2%",de_DE +"novalnet.cashpayment-slip-expiry-date","Slip expiry date: %date%",en_US +"novalnet.cashpayment-slip-expiry-date","Verfallsdatum des Zahlscheins: %date%",de_DE +"novalnet.multibanco-reference-note","Please use the following payment reference details to pay the amount of %amount% %currency% at a Multibanco ATM or through your internet banking.",en_US +"novalnet.multibanco-reference-note","Bitte verwenden Sie die folgende Zahlungsreferenz, um den Betrag von %amount% %currency% an einem Multibanco-Geldautomaten oder über Ihr Onlinebanking zu",de_DE +"novalnet.multibanco-reference-comment","Payment reference: %ref%",en_US +"novalnet.multibanco-reference-comment","Verwendungszweck: %ref%",de_DE +"novalnet.cashpayment-stores-near-you","Store(s) near you:",en_US +"novalnet.cashpayment-stores-near-you","Barzahlen-Partnerfiliale in Ihrer Nähe:",de_DE +"novalnet.payment-test-mode-description","The payment will be processed in the test mode therefore amount for this transaction will not be charged",en_US +"novalnet.payment-test-mode-description","Die Zahlung wird im Testmodus durchgeführt, daher wird der Betrag für diese Transaktion nicht eingezogen.",de_DE +"novalnet.transaction-mode","Transaction Mode: Test",en_US +"novalnet.transaction-mode","Transaktion modus: Test",de_DE +"novalnet.transaction-id","Novalnet Transaction ID: %tid%",en_US +"novalnet.transaction-id","Novalnet Transaktions-ID: %tid%",de_DE +"novalnet.guarantee-sepa-pending-text","Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.",en_US +"novalnet.guarantee-sepa-pending-text","Ihre Bestellung wird derzeit überprüft. Wir werden Sie in Kürze über den Bestellstatus informieren. Bitte beachten Sie, dass dies bis zu 24 Stunden dauern kann.",de_DE +"novalnet.guarantee-invoice-pending-text","Your order is being verified. Once confirmed, we will send you our bank details to which the order amount should be transferred. Please note that this may take up to 24 hours",en_US +"novalnet.guarantee-invoice-pending-text","Ihre Bestellung wird überprüft. Nach der Bestätigung senden wir Ihnen unsere Bankverbindung, an die Sie bitte den Gesamtbetrag der Bestellung überweisen. Bitte beachten Sie, dass dies bis zu 24 Stunden dauern kann",de_DE +"novalnet.guarantee-payment-dob","Your date of birth",en_US +"novalnet.guarantee-payment-dob","Ihr Geburtsdatum",de_DE +"novalnet.guarantee-bithdate-missing","Please enter your date of birth",en_US +"novalnet.guarantee-bithdate-missing","Geben Sie bitte Ihr Geburtsdatum ein",de_DE +"novalnet.guarantee-bithdate-invalid","Please enter valid birth date",en_US +"novalnet.guarantee-bithdate-invalid","Geben Sie ein gültiges Geburtsdatum ein",de_DE +"novalnet.guarantee-birth_date","DD.MM.YYYY",en_US +"novalnet.guarantee-birth_date","TT.MM.JJJJ",de_DE diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.scss b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.scss new file mode 100755 index 0000000..59a2c1b --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.scss @@ -0,0 +1,12 @@ +.novalnet-challenge-window-overlay { + position: fixed; + width: 100%; + height: 100% ! important; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0,0,0,0.5); + z-index: 9999; + cursor: pointer; +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.ts b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.ts new file mode 100755 index 0000000..f94c12e --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.ts @@ -0,0 +1,95 @@ +import Component from 'ShopUi/models/component'; + +export default class CreditCard extends Component { + form: HTMLFormElement; + + protected submitButton: HTMLButtonElement[]; + + protected readyCallback(): void {} + + init() { + const element = document.getElementsByName('paymentForm'); + + element[0].addEventListener('submit', event => { + var checkedValue = null; + var inputElements = document.getElementsByName("paymentForm[paymentSelection]"); + for (var i = 0; inputElements[i]; ++i) { + if (inputElements[i].checked) { + checkedValue = inputElements[i].value; + break; + } + } + if (checkedValue == 'novalnetCreditCard' && document.getElementById("paymentForm_novalnetCreditCard_panHash").value == '') { + event.preventDefault(); + event.stopImmediatePropagation(); + NovalnetUtility.getPanHash(); + } + }); + document.getElementById("paymentForm_novalnetCreditCard_panHash").value = ''; + this.initiateIframe(); + } + + /**Initiate Iframe */ + initiateIframe() { + var iframe = document.getElementById('novalnet_cc_iframe').contentWindow; + if (document.getElementById("paymentForm_novalnetCreditCard_formClientKey").value === undefined || + document.getElementById("paymentForm_novalnetCreditCard_formClientKey").value == '') { + return false; + } + NovalnetUtility.setClientKey(document.getElementById("paymentForm_novalnetCreditCard_formClientKey").value); + var request_object = { + callback: { + on_success: function(data) { + document.getElementById("paymentForm_novalnetCreditCard_panHash").value = data['hash']; + document.getElementById("paymentForm_novalnetCreditCard_uniqueId").value = data['unique_id']; + document.getElementById("paymentForm_novalnetCreditCard_doRedirect").value = data['do_redirect']; + document.paymentForm.submit(); + }, + on_error: function on_error(data) { + alert(data['error_message']); + document.getElementById("nn_overlay").classList.remove("novalnet-challenge-window-overlay"); + document.getElementById("novalnet_cc_iframe").classList.remove("novalnet-challenge-window-overlay"); + }, + on_show_overlay: function on_show_overlay() { + document.getElementById('novalnet_cc_iframe').classList.add("novalnet-challenge-window-overlay"); + }, + on_hide_overlay: function on_hide_overlay() { + document.getElementById("novalnet_cc_iframe").classList.remove("novalnet-challenge-window-overlay"); + document.getElementById("nn_overlay").classList.add("novalnet-challenge-window-overlay"); + }, + on_show_captcha: function on_show_captcha() { + window.scrollTo(0, 200); + } + }, + iframe: { + id: 'novalnet_cc_iframe', + inline: document.getElementById("paymentForm_novalnetCreditCard_formInline").value, + style: { + container: document.getElementById("paymentForm_novalnetCreditCard_formStyleContainer").value, + input: document.getElementById("paymentForm_novalnetCreditCard_formStyleInput").value, + label: document.getElementById("paymentForm_novalnetCreditCard_formStyleLabel").value, + } + }, + customer: { + first_name: document.getElementById("paymentForm_novalnetCreditCard_firstName").value, + last_name: document.getElementById("paymentForm_novalnetCreditCard_lastName").value, + email: document.getElementById("paymentForm_novalnetCreditCard_email").value, + billing: { + street: document.getElementById("paymentForm_novalnetCreditCard_street").value + ',' + document.getElementById("paymentForm_novalnetCreditCard_houseNo").value, + city: document.getElementById("paymentForm_novalnetCreditCard_city").value, + zip: document.getElementById("paymentForm_novalnetCreditCard_zip").value, + country_code: document.getElementById("paymentForm_novalnetCreditCard_countryCode").value, + }, + }, + transaction: { + amount: document.getElementById("paymentForm_novalnetCreditCard_amount").value, + currency: document.getElementById("paymentForm_novalnetCreditCard_currency").value, + test_mode: document.getElementById("paymentForm_novalnetCreditCard_testMode").value, + }, + custom: { + lang: document.getElementById("paymentForm_novalnetCreditCard_lang").value + } + }; + NovalnetUtility.createCreditCardForm(request_object); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.twig new file mode 100755 index 0000000..71469eb --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/credit-card.twig @@ -0,0 +1,18 @@ +{% extends model('component') %} + +{% define config = { + name: 'credit-card', + tag: 'credit-card' +} %} + +{% block body %} + + +

{{ 'novalnet.credit-card-payment-description' | trans }}

+
+
+ + {{ form_errors(data.form.novalnetCreditCard) }} + {{ form_widget(data.form.novalnetCreditCard) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/index.ts b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/index.ts new file mode 100755 index 0000000..27f4822 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/credit-card/index.ts @@ -0,0 +1,9 @@ +import './credit-card.scss'; +// Import the 'register' function from the Shop Application +import register from 'ShopUi/app/registry'; + +// Register the component +export default register( + 'credit-card', + () => import(/* webpackMode: "lazy" */'./credit-card') +); diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/index.ts b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/index.ts new file mode 100755 index 0000000..0e6431b --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/index.ts @@ -0,0 +1,9 @@ +import './invoice-guarantee.scss'; +// Import the 'register' function from the Shop Application +import register from 'ShopUi/app/registry'; + +// Register the component +export default register( + 'invoice-guarantee', + () => import(/* webpackMode: "lazy" */'./invoice-guarantee') +); diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.scss b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.scss new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.scss @@ -0,0 +1 @@ + diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.ts b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.ts new file mode 100755 index 0000000..5b5868c --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.ts @@ -0,0 +1,63 @@ +import Component from 'ShopUi/models/component'; + +export default class InvoiceGuarantee extends Component { + form: HTMLFormElement; + + protected submitButton: HTMLButtonElement[]; + + protected readyCallback(): void {} + + init() { + var element = document.getElementsByName('paymentForm'); + + element[0].addEventListener('submit', event => { + var checkedValue = null; + var inputElements = document.getElementsByName("paymentForm[paymentSelection]"); + for (var i = 0; inputElements[i]; ++i) { + if (inputElements[i].checked) { + checkedValue = inputElements[i].value; + break; + } + } + + var birthdate = document.getElementById("paymentForm_novalnetInvoiceGuarantee_dob").value; + + if (checkedValue == 'novalnetInvoiceGuarantee') { + if (birthdate == undefined || birthdate == '' ) { + event.preventDefault(); + event.stopImmediatePropagation(); + alert(document.getElementById("birthdate_missing").value); + } else { + var isValid = true; + if (!NovalnetUtility.validateDateFormat(birthdate)) { + isValid = false; + } else { + var dateOfBirth = birthdate.split('.'); + var formatedDob = new Date(dateOfBirth[2], (dateOfBirth[1] - 1), dateOfBirth[0]); + // calculate month difference from current date in time + var monthDiff = Date.now() - formatedDob.getTime(); + + // convert the calculated difference in date format + var dateDiff = new Date(monthDiff); + + // extract year from date + var year = dateDiff.getUTCFullYear(); + + // now calculate the age of the user + var age = Math.abs(year - 1970); + + if (age < 18) { + isValid = false; + } + } + + if (isValid == false) { + event.preventDefault(); + event.stopImmediatePropagation(); + alert(document.getElementById("birthdate_invalid").value); + } + } + } + }); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.twig new file mode 100755 index 0000000..da5661f --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/invoice-guarantee/invoice-guarantee.twig @@ -0,0 +1,20 @@ +{% extends model('component') %} + +{% define config = { + name: 'invoice-guarantee', + tag: 'invoice-guarantee' +} %} + +{% block body %} + + +
+

{{ 'novalnet.invoice-payments-description' | trans }}

+
+ + {{ form_widget(data.form.novalnetInvoiceGuarantee.dob, { 'attr': { 'placeholder': 'novalnet.guarantee-birth_date' | trans } }) }} +
+ + +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/index.ts b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/index.ts new file mode 100755 index 0000000..9b262a5 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/index.ts @@ -0,0 +1,9 @@ +import './sepa-guarantee.scss'; +// Import the 'register' function from the Shop Application +import register from 'ShopUi/app/registry'; + +// Register the component +export default register( + 'sepa-guarantee', + () => import(/* webpackMode: "lazy" */'./sepa-guarantee') +); diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.scss b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.scss new file mode 100755 index 0000000..8b13789 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.scss @@ -0,0 +1 @@ + diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.ts b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.ts new file mode 100755 index 0000000..86f6f3e --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.ts @@ -0,0 +1,63 @@ +import Component from 'ShopUi/models/component'; + +export default class SepaGuarantee extends Component { + form: HTMLFormElement; + + protected submitButton: HTMLButtonElement[]; + + protected readyCallback(): void {} + + init() { + var element = document.getElementsByName('paymentForm'); + + element[0].addEventListener('submit', event => { + var checkedValue = null; + var inputElements = document.getElementsByName("paymentForm[paymentSelection]"); + for (var i = 0; inputElements[i]; ++i) { + if (inputElements[i].checked) { + checkedValue = inputElements[i].value; + break; + } + } + + var birthdate = document.getElementById("paymentForm_novalnetSepaGuarantee_dob").value; + + if (checkedValue == 'novalnetSepaGuarantee') { + if (birthdate == undefined || birthdate == '' ) { + event.preventDefault(); + event.stopImmediatePropagation(); + alert(document.getElementById("birthdate_missing").value); + } else { + var isValid = true; + if (!NovalnetUtility.validateDateFormat(birthdate)) { + isValid = false; + } else { + var dateOfBirth = birthdate.split('.'); + var formatedDob = new Date(dateOfBirth[2], (dateOfBirth[1] - 1), dateOfBirth[0]); + // calculate month difference from current date in time + var monthDiff = Date.now() - formatedDob.getTime(); + + // convert the calculated difference in date format + var dateDiff = new Date(monthDiff); + + // extract year from date + var year = dateDiff.getUTCFullYear(); + + // now calculate the age of the user + var age = Math.abs(year - 1970); + + if (age < 18) { + isValid = false; + } + } + + if (isValid == false) { + event.preventDefault(); + event.stopImmediatePropagation(); + alert(document.getElementById("birthdate_invalid").value); + } + } + } + }); + } +} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.twig new file mode 100755 index 0000000..1d705a3 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/components/molecules/sepa-guarantee/sepa-guarantee.twig @@ -0,0 +1,29 @@ +{% extends model('component') %} + +{% define config = { + name: 'sepa-guarantee', + tag: 'sepa-guarantee' +} %} + +{% define data = { + form: required, +} %} + +{% block body %} + + +
+

{{ 'novalnet.sepa-payment-description' | trans }}

+ +
+ {{ form_widget(data.form.novalnetSepaGuarantee.iban, {'attr': { 'style': 'text-transform: uppercase;', 'autocomplete': 'off' }}) }} + {{ form_errors(data.form.novalnetSepaGuarantee.iban) }} +
+
+ + {{ form_widget(data.form.novalnetSepaGuarantee.dob, { 'attr': { 'placeholder': 'novalnet.guarantee-birth_date' | trans } }) }} +
+ + +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/bancontact/bancontact.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/bancontact/bancontact.twig new file mode 100755 index 0000000..ac90eec --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/bancontact/bancontact.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.bancontact-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetBancontact) }} + {{ form_widget(data.form.novalnetBancontact) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/barzahlen/barzahlen.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/barzahlen/barzahlen.twig new file mode 100755 index 0000000..54a9491 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/barzahlen/barzahlen.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.barzahlen-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetBarzahlen) }} + {{ form_widget(data.form.novalnetBarzahlen) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/credit-card/credit-card.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/credit-card/credit-card.twig new file mode 100755 index 0000000..da1be2c --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/credit-card/credit-card.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form, +} %} + +{% block body %} + {% include molecule('credit-card', 'NovalnetPayment') with { + data: { + form: data.form, + }, + } only %} +{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/eps/eps.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/eps/eps.twig new file mode 100755 index 0000000..a7ebcce --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/eps/eps.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.eps-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetEps) }} + {{ form_widget(data.form.novalnetEps) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/griopay/griopay.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/griopay/griopay.twig new file mode 100755 index 0000000..c4751be --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/griopay/griopay.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.giropay-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetGiropay) }} + {{ form_widget(data.form.novalnetGiropay) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/ideal/ideal.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/ideal/ideal.twig new file mode 100755 index 0000000..c385844 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/ideal/ideal.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.ideal-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetIdeal) }} + {{ form_widget(data.form.novalnetIdeal) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/invoice-guarantee/invoice-guarantee.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/invoice-guarantee/invoice-guarantee.twig new file mode 100755 index 0000000..4981715 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/invoice-guarantee/invoice-guarantee.twig @@ -0,0 +1,14 @@ +{% extends model('template') %} + +{% define data = { + form: form, +} %} + +{% block body %} + {% include molecule('invoice-guarantee', 'NovalnetPayment') with { + data: { + form: data.form, + }, + } only %} +{% endblock %} + diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/invoice/invoice.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/invoice/invoice.twig new file mode 100755 index 0000000..52ecdb9 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/invoice/invoice.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.invoice-payments-description' | trans }}

+ {{ form_errors(data.form.novalnetInvoice) }} + {{ form_widget(data.form.novalnetInvoice) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/multibanco/multibanco.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/multibanco/multibanco.twig new file mode 100755 index 0000000..76df45e --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/multibanco/multibanco.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.multibanco-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetMultibanco) }} + {{ form_widget(data.form.novalnetMultibanco) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/paypal/paypal.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/paypal/paypal.twig new file mode 100755 index 0000000..b66237c --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/paypal/paypal.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.paypal-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetPaypal) }} + {{ form_widget(data.form.novalnetPaypal) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/postfinance-card/postfinance-card.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/postfinance-card/postfinance-card.twig new file mode 100755 index 0000000..3a7d51a --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/postfinance-card/postfinance-card.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.postfinance-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetPostfinanceCard) }} + {{ form_widget(data.form.novalnetPostfinanceCard) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/postfinance/postfinance.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/postfinance/postfinance.twig new file mode 100755 index 0000000..15d5399 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/postfinance/postfinance.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.postfinance-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetPostfinance) }} + {{ form_widget(data.form.novalnetPostfinance) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/prepayment/prepayment.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/prepayment/prepayment.twig new file mode 100755 index 0000000..8f72ba6 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/prepayment/prepayment.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.invoice-payments-description' | trans }}

+ {{ form_errors(data.form.novalnetPrepayment) }} + {{ form_widget(data.form.novalnetPrepayment) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/przelewy24/przelewy24.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/przelewy24/przelewy24.twig new file mode 100755 index 0000000..5c8e0e8 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/przelewy24/przelewy24.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.przelewy-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetPrzelewy) }} + {{ form_widget(data.form.novalnetPrzelewy) }} +
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sepa-guarantee/sepa-guarantee.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sepa-guarantee/sepa-guarantee.twig new file mode 100755 index 0000000..1951eb9 --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sepa-guarantee/sepa-guarantee.twig @@ -0,0 +1,14 @@ +{% extends model('template') %} + +{% define data = { + form: form, +} %} + +{% block body %} + {% include molecule('sepa-guarantee', 'NovalnetPayment') with { + data: { + form: data.form, + }, + } only %} +{% endblock %} + diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sepa/sepa.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sepa/sepa.twig new file mode 100755 index 0000000..0bfda1d --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sepa/sepa.twig @@ -0,0 +1,17 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.sepa-payment-description' | trans }}

+ + +
+ {{ form_widget(form.novalnetSepa.iban, {'attr': { 'style': 'text-transform: uppercase;', 'autocomplete': 'off' }}) }} + {{ form_errors(form.novalnetSepa.iban) }} +
+
+{% endblock %} diff --git a/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sofort/sofort.twig b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sofort/sofort.twig new file mode 100755 index 0000000..423c97f --- /dev/null +++ b/src/Novalnet/Yves/NovalnetPayment/Theme/default/views/sofort/sofort.twig @@ -0,0 +1,13 @@ +{% extends model('template') %} + +{% define data = { + form: form +} %} + +{% block body %} +
+

{{ 'novalnet.sofort-payment-description' | trans }}

+ {{ form_errors(data.form.novalnetSofort) }} + {{ form_widget(data.form.novalnetSofort) }} +
+{% endblock %} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/Api/Adapter/AdapterInterface.php b/src/Novalnet/Zed/NovalnetPayment/Business/Api/Adapter/AdapterInterface.php new file mode 100755 index 0000000..1667bc7 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/Api/Adapter/AdapterInterface.php @@ -0,0 +1,22 @@ +url = $paymentGatewayUrl; + } + + /** + * @param int $timeout + * + * @return void + */ + public function setTimeout($timeout) + { + $this->timeout = $timeout; + } + + /** + * @return int + */ + public function getTimeout() + { + return $this->timeout; + } + + /** + * @param array $params + * @param string $payportUrl + * + * @return array + */ + public function sendRawRequest(array $params, $payportUrl) + { + $result = $this->performRequest($params, $payportUrl); + + return $result; + } + + /** + * @param array $requestData + * @param string $transactionType + * + * @return array + */ + public function sendRequest($requestData, $transactionType) + { + try { + $payportUrl = $this->getPayportUrl($requestData, $transactionType); + + return $this->sendRawRequest($requestData, $payportUrl); + } catch (TimeoutException $e) { + $fakeArray = [ + 'status' => 'TIMEOUT', + ]; + + return $fakeArray; + } + } + + /** + * @param array $params + * @param string $payportUrl + * + * @return array + */ + abstract protected function performRequest(array $params, $payportUrl); + + /** + * @param array $requestData + * @param string $transactionType + * + * @return string|null + */ + public function getPayportUrl($requestData, $transactionType) + { + $payportUrl = 'https://payport.novalnet.de/v2/'; + + if ($transactionType == 'authorize') { + $transactionUrl = 'authorize'; + } elseif ($transactionType == 'capture') { + $transactionUrl = 'transaction/capture'; + } elseif ($transactionType == 'cancel') { + $transactionUrl = 'transaction/cancel'; + } elseif ($transactionType == 'refund') { + $transactionUrl = 'transaction/refund'; + } elseif ($transactionType == 'transaction') { + $transactionUrl = 'transaction/details'; + } else { + $transactionUrl = 'payment'; + } + + return $payportUrl . $transactionUrl; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/Api/Adapter/Http/Guzzle.php b/src/Novalnet/Zed/NovalnetPayment/Business/Api/Adapter/Http/Guzzle.php new file mode 100755 index 0000000..fdfdb67 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/Api/Adapter/Http/Guzzle.php @@ -0,0 +1,54 @@ + 'application/json', + 'Charset' => 'utf-8', + 'Accept' => 'application/json', + 'X-NN-Access-Key' => base64_encode($accessKey), + ]; + $options['timeout'] = $this->getTimeout(); + + $this->client = new Client($options); + } + + /** + * @param array $params + * @param string $payportUrl + * + * @throws \Novalnet\Zed\NovalnetPayment\Business\Exception\TimeoutException + * + * @return array + */ + protected function performRequest(array $params, $payportUrl) + { + try { + $response = $this->client->post($payportUrl, ['body' => json_encode($params)]); + } catch (ConnectException $e) { + throw new TimeoutException('Timeout - Novalnet Communication: ' . $e->getMessage()); + } catch (ClientException $e) { + $response = $e->getResponse(); + } + + $result = json_decode((string)$response->getBody()); + return $result; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/Exception/TimeoutException.php b/src/Novalnet/Zed/NovalnetPayment/Business/Exception/TimeoutException.php new file mode 100755 index 0000000..4d43106 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/Exception/TimeoutException.php @@ -0,0 +1,9 @@ +createExecutionAdapter(), + $this->getQueryContainer(), + $this->getStandardParameter(), + $this->getGlossaryFacade() + ); + + return $paymentManager; + } + + /** + * @return \Novalnet\Zed\NovalnetPayment\Business\Api\Adapter\AdapterInterface + */ + protected function createExecutionAdapter() + { + $config = $this->getStandardParameter(); + + return new Guzzle($config->getAccessKey()); + } + + /** + * @return \Generated\Shared\Transfer\NovalnetStandardParameterTransfer + */ + protected function getStandardParameter() + { + if ($this->standardParameter === null) { + $this->standardParameter = $this->getConfig()->getRequestStandardParameter(); + } + + return $this->standardParameter; + } + + /** + * @return \Novalnet\Zed\NovalnetPayment\Business\Payment\CallbackManagerInterface + */ + public function createCallbackManager() + { + $callbackManager = new CallbackManager( + $this->getQueryContainer(), + $this->getCallbackParameter(), + $this->getStandardParameter(), + $this->getGlossaryFacade() + ); + + return $callbackManager; + } + + /** + * @return \Generated\Shared\Transfer\NovalnetCallbackScriptParameterTransfer + */ + protected function getCallbackParameter() + { + if ($this->callbackParameter === null) { + $this->callbackParameter = $this->getConfig()->getCallbackScriptParameter(); + } + + return $this->callbackParameter; + } + + /** + * @return \Novalnet\Zed\NovalnetPayment\Dependency\Facade\NovalnetPaymentToGlossaryInterface + */ + protected function getGlossaryFacade() + { + return $this->getProvidedDependency(NovalnetPaymentDependencyProvider::FACADE_GLOSSARY); + } + + /** + * @return \Novalnet\Zed\NovalnetPayment\Business\Payment\PaymentMethodFilterInterface + */ + public function createPaymentMethodFilter(): PaymentMethodFilterInterface + { + return new PaymentMethodFilter($this->getConfig()); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/NovalnetPaymentFacade.php b/src/Novalnet/Zed/NovalnetPayment/Business/NovalnetPaymentFacade.php new file mode 100755 index 0000000..726c692 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/NovalnetPaymentFacade.php @@ -0,0 +1,362 @@ +getFactory() + ->createPaymentManager() + ->authorize($orderTransfer); + } + + /** + * Specification: + * - Handles redirects and errors after order placement. + * + * @api + * + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse + * + * @return \Generated\Shared\Transfer\CheckoutResponseTransfer + */ + public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse) + { + return $this->getFactory() + ->createPaymentManager() + ->postSaveHook($quoteTransfer, $checkoutResponse); + } + + /** + * Specification: + * - Handles payment detail saving process. + * + * @api + * + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer + * + * @return \Generated\Shared\Transfer\saveOrderTransfer + */ + public function saveOrderHook(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer) + { + return $this->getFactory() + ->createPaymentManager() + ->saveOrderHook($quoteTransfer, $saveOrderTransfer); + } + + /** + * Specification: + * - Handles redirect payment response. + * + * @api + * + * @param \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer $redirectResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer + */ + public function processRedirectPaymentResponse(NovalnetRedirectResponseTransfer $redirectResponseTransfer) + { + return $this->getFactory() + ->createPaymentManager() + ->processRedirectPaymentResponse($redirectResponseTransfer); + } + + /** + * Specification: + * - Check whether the payment request is authorized. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isAuthorized(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isAuthorized($idSalesOrder); + } + + /** + * Specification: + * - Check whether the authorize payment request is error. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isAuthorizeError(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isAuthorizeError($idSalesOrder); + } + + /** + * Specification: + * - Check the payment trasnaction is under paid (like on-hold). + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentAuthorized(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isPaymentAuthorized($idSalesOrder); + } + + /** + * Specification: + * - Check the payment trasnaction is under paid (like Prepayment & Invoice). + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isWaitingForPayment(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isWaitingForPayment($idSalesOrder); + } + + /** + * Specification: + * - Check the payment canceled for the authorized transaction. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentCanceled(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isPaymentCanceled($idSalesOrder); + } + + /** + * Specification: + * - Check the payment received from the end-customer account for the transaction. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentPaid(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isPaymentPaid($idSalesOrder); + } + + /** + * Specification: + * - Performs payment capture for authorized payment transaction. + * + * @api + * + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return void + */ + public function capturePayment(OrderTransfer $orderTransfer) + { + return $this->getFactory() + ->createPaymentManager() + ->capture($orderTransfer); + } + + /** + * Specification: + * - Check the payment captured for the authorized transaction. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentCaptured(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isPaymentCaptured($idSalesOrder); + } + + /** + * Specification: + * - Performs payment cancel for authorized payment transaction. + * + * @api + * + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return void + */ + public function cancelPayment(OrderTransfer $orderTransfer) + { + return $this->getFactory() + ->createPaymentManager() + ->cancel($orderTransfer); + } + + /** + * Specification: + * - Check the payment canceled by the customer or bank. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentVoided(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isPaymentVoided($idSalesOrder); + } + + /** + * Specification: + * - Performs payment refund for confirmed transaction. + * + * @api + * + * @param \Generated\Shared\Transfer\NovalnetRefundTransfer $refundTransfer + * + * @return void + */ + public function refundPayment(NovalnetRefundTransfer $refundTransfer) + { + return $this->getFactory() + ->createPaymentManager() + ->refund($refundTransfer); + } + + /** + * Specification: + * - Check the payment is refunded. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentRefunded(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isPaymentRefunded($idSalesOrder); + } + + /** + * Specification: + * - Handles callback process for the payment transactions. + * + * @api + * + * @param \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + */ + public function processCallbackResponse(NovalnetCallbackResponseTransfer $callbackResponseTransfer) + { + return $this->getFactory() + ->createCallbackManager() + ->processCallback($callbackResponseTransfer); + } + + /** + * Specification: + * - Update the order status to paid based on the Novalnet callback response. + * + * @api + * + * @param int $idSalesOrder + * + * @return bool + */ + public function isCallbackPaid(int $idSalesOrder) + { + return $this->getFactory() + ->createPaymentManager() + ->isCallbackPaid($idSalesOrder); + } + + /** + * Specification: + * - Get payment transaction details. + * + * @api + * + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function getTransactionDetails(OrderTransfer $orderTransfer) + { + return $this->getFactory() + ->createPaymentManager() + ->getTransactionDetails($orderTransfer); + } + + /** + * Specification: + * - Filters Novalnet payment methods. + * + * @api + * + * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return \Generated\Shared\Transfer\PaymentMethodsTransfer + */ + public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer + { + return $this->getFactory() + ->createPaymentMethodFilter() + ->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/NovalnetPaymentFacadeInterface.php b/src/Novalnet/Zed/NovalnetPayment/Business/NovalnetPaymentFacadeInterface.php new file mode 100755 index 0000000..b283287 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/NovalnetPaymentFacadeInterface.php @@ -0,0 +1,244 @@ +queryContainer = $queryContainer; + $this->callbackParameter = $callbackParameter; + $this->standardParameter = $standardParameter; + $this->glossaryFacade = $glossaryFacade; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + */ + public function processCallback(NovalnetCallbackResponseTransfer $callbackResponseTransfer) + { + // Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + $this->callbackResponseTransfer = $callbackResponseTransfer; + // Current timestamp value + $this->currentTime = date('Y-m-d H:i:s'); + + // Assign callback script debug mode (only for testing purpose) + $this->test = $this->callbackParameter->getDebugMode(); + + // Assign Access key + $this->payment_access_key = $this->standardParameter->getAccessKey(); + + // Validate the IP control check + if (!$this->validateIpAddress($callbackResponseTransfer->getClientIp())) { + return $callbackResponseTransfer; + } + + // Assign callback script request parameters + $this->callbackResponse = $callbackResponseTransfer->getCallbackResponse(); + + // Set Event data. + $this->event_type = $this->callbackResponse['event']['type']; + $this->event_tid = $this->callbackResponse['event']['tid']; + $this->parent_tid = $this->event_tid; + if (!empty($this->callbackResponse['event']['parent_tid'])) { + $this->parent_tid = $this->callbackResponse['event']['parent_tid']; + } + + // Assign order reference number + $this->orderNo = $this->getOrderIncrementId(); + if (empty($this->orderNo)) { + return $callbackResponseTransfer; + } + + // Check the callback mandatory parameters + if (!$this->checkParams()) { + return $callbackResponseTransfer; + } + + // Validate the + if (!$this->validateEventData()) { + return $callbackResponseTransfer; + } + + // Get order using order reference + $this->order = $this->getOrder(); + if (!$callbackResponseTransfer->getOrderNo()) { + $callbackResponseTransfer->setOrderNo($this->orderNo); + } + + if (empty($this->order) || ($this->order && !$this->order->getOrderReference())) { + $this->showDebug(['message' => 'Transaction mapping failed']); + + return $callbackResponseTransfer; + } + + // Complete the order in-case response failure from Novalnet server + if ($this->handleCommunicationFailure()) { + return $callbackResponseTransfer; + } + + // Handle callback process + if (!$this->hanldeCallbackProcess()) { + return $callbackResponseTransfer; + } + + if (!empty($this->emailBody)) { + $this->sendCallbackMail(); + } + + $callbackResponseTransfer->setIsSuccess(true); + + return $callbackResponseTransfer; + } + + /** + * @param string|null $callerIp + * + * @return bool|string + */ + protected function validateIpAddress($callerIp = null) + { + $allowedIp = gethostbyname('pay-nn.de'); + + if (empty($allowedIp)) { + $this->showDebug([ 'message' => 'Novalnet HOST IP missing']); + + return false; + } + + if ($callerIp != $allowedIp && !$this->test) { + $this->showDebug([ 'message' => 'Unauthorised access from the IP [' . $callerIp . ']']); + + return false; + } + + return true; + } + + /** + * @param string $text + * + * @return void + */ + protected function showDebug($text) + { + if (!empty($text)) { + $this->callbackResponseTransfer->setStatusMessage(json_encode($text)); + } + } + + /** + * @return int + */ + protected function getOrderIncrementId() + { + // Get order increment id + $orderNo = !empty($this->callbackResponse['transaction']['order_no']) ? $this->callbackResponse['transaction']['order_no'] : ''; + $orderNo = $orderNo ? $orderNo : $this->getOrderIdByTransId(); + + if (empty($orderNo)) { + $this->showDebug(['message' => 'Required (Transaction ID) not Found!']); + + return false; + } + + return $orderNo; + } + + /** + * @return bool + */ + protected function validateEventData() + { + $token_string = $this->callbackResponse['event']['tid'] . $this->callbackResponse['event']['type'] . $this->callbackResponse['result']['status']; + + if (isset($this->callbackResponse['transaction']['amount'])) { + $token_string .= $this->callbackResponse['transaction']['amount']; + } + if (isset($this->callbackResponse['transaction']['currency'])) { + $token_string .= $this->callbackResponse['transaction']['currency']; + } + if (!empty($this->payment_access_key)) { + $token_string .= strrev($this->payment_access_key); + } + + $generated_checksum = hash('sha256', $token_string); + + if ($generated_checksum !== $this->callbackResponse['event']['checksum']) { + $this->showDebug([ 'message' => 'While notifying some data has been changed. The hash check failed' ]); + + return false; + } + + return true; + } + + /** + * @return bool + */ + protected function checkParams() + { + if (!empty($this->callbackResponse['custom']['shop_invoked'])) { + $this->showDebug(['message' => 'Process already handled in the shop.' ]); + + return false; + } + + $paramsRequired = $this->getRequiredParams(); // Get required params for callback process + // Check the necessary params for callback script process + foreach ($paramsRequired as $category => $parameters) { + if (empty($this->callbackResponse[$category])) { + // Could be a possible manipulation in the notification data. + $this->showDebug(['message' => "Required parameter category($category) not received" ]); + + return false; + } elseif (!empty($parameters)) { + foreach ($parameters as $parameter) { + if (empty($this->callbackResponse[$category][$parameter])) { + // Could be a possible manipulation in the notification data. + $this->showDebug([ 'message' => "Required parameter($parameter) in the category($category) not received" ]); + + return false; + } elseif (in_array($parameter, [ 'tid', 'parent_tid' ], true) && !preg_match('/^\d{17}$/', $this->callbackResponse[$category][$parameter])) { + $this->showDebug([ 'message' => "Invalid TID received in the category($category) not received $parameter" ]); + + return false; + } + } + } + } + + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderReference($this->orderNo); + $transactionLog = $transactionLogsQuery->findOne(); + + if ($transactionLog) { + $orderTid = $transactionLog->getTransactionId(); + if (!preg_match('/^' . $this->getParentTid() . '/i', $orderTid)) { + $this->showDebug([ 'message' => 'Order no is not valid']); + + return false; + } + } + + if ($this->callbackResponse['result']['status'] != 'SUCCESS') { + $this->showDebug([ 'message' => 'Status is not valid. Refer Order :' . $this->orderNo]); + + return false; + } + + return true; + } + + /** + * @return array + */ + protected function getRequiredParams() + { + $paramsRequired = [ + 'event' => [ + 'type', + 'checksum', + 'tid', + ], + 'merchant' => [ + 'vendor', + 'project', + ], + 'result' => [ + 'status', + ], + 'transaction' => [ + 'tid', + 'payment_type', + 'status', + ], + ]; + + return $paramsRequired; + } + + /** + * @return int + */ + protected function getParentTid() + { + // Get the original/parent transaction id + $tid = $this->event_tid; + + if (!empty($this->parent_tid)) { + $tid = $this->parent_tid; + } + + return $tid; + } + + /** + * @return int + */ + protected function getOrderIdByTransId() + { + $parentTid = $this->getParentTid(); // Get the original/parent transaction id + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByTransactionId($parentTid); + $transactionLog = $transactionLogsQuery->findOne(); + $orderId = ''; + + if ($transactionLog) { + $orderId = $transactionLog->getOrderReference(); + } + + return $orderId; + } + + /** + * @return object + */ + protected function getOrder() + { + $order = SpySalesOrderQuery::create() + ->filterByOrderReference($this->orderNo) + ->findOne(); + + return $order; + } + + /** + * @return object + */ + protected function getTransactionByOrderId() + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderReference($this->orderNo); + $transactionLog = $transactionLogsQuery->findOne(); + + return ($transactionLog ? $transactionLog : ''); + } + + /** + * @return object|null + */ + protected function getCallbackByOrderId() + { + $callbackQuery = $this->queryContainer->createLastCallbackByOrderReference($this->orderNo); + $callback = $callbackQuery->findOne(); + + return ($callback ? $callback : ''); + } + + /** + * @return object + */ + protected function getOrderTotals() + { + $orderTotals = SpySalesOrderTotalsQuery::create() + ->filterByFkSalesOrder($this->order->getIdSalesOrder()) + ->findOne(); + + return $orderTotals; + } + + /** + * @return bool + */ + protected function hanldeCallbackProcess() + { + if ($this->order) { + $this->currency = $this->order->getCurrencyIsoCode(); + $this->callbackResponseTransfer->setOrderNo($this->orderNo); + + switch ($this->event_type) { + case 'PAYMENT': + $this->showDebug([ 'message' => 'The Payment has been received' ]); + + return true; + case 'TRANSACTION_CAPTURE': + $this->transactionConfirmation(); + + return true; + case 'TRANSACTION_CANCEL': + $this->transactionCancellation(); + + return true; + case 'TRANSACTION_REFUND': + case 'CHARGEBACK': + case 'RETURN_DEBIT': + case 'REVERSAL': + $this->transactionRefund(); + + return true; + case 'TRANSACTION_UPDATE': + $this->transactionUpdate(); + + return true; + case 'CREDIT': + $this->paymentCreditProcess(); + + return true; + default: + $this->showDebug([ 'message' => "The webhook notification has been received for the unhandled EVENT type($this->event_type)" ]); + + return false; + } + + return true; + } else { + $this->showDebug([ 'message' => "Novalnet Callback: No order for Increment-ID $this->orderNo found." ]); + + return false; + } + } + + /** + * @return bool + */ + protected function handleCommunicationFailure() + { + $transactionLog = $this->getTransactionByOrderId(); + + if ($transactionLog && empty($transactionLog->getTransactionId())) { + $transactionLog->setTransactionId($this->event_tid); + $transactionLog->setStatus($this->callbackResponse['transaction']['status']); + $transactionLog->setTransactionStatus($this->callbackResponse['transaction']['status']); + $transactionLog->setPaymentMethod($this->callbackResponse['transaction']['payment_type']); + $paymentMethod = $this->callbackResponse['transaction']['payment_type']; + if (!empty($paymentMethod)) { + $transactionLog->setPaymentMethod($paymentMethod); + } + $additionalData = $this->getAdditionalData($transactionLog, $this->callbackResponse); + $transactionLog->setAdditionalData(json_encode($additionalData)); + + $transactionLog->save(); + + // Update order status + $this->updateOrderStatus('communication_failure'); + $this->showDebug([ 'message' => 'The Payment has been received' ]); + + return true; + } + + return false; + } + + /** + * @return void + */ + protected function transactionConfirmation() + { + $transactionId = $this->getParentTid(); + $transactionLog = $this->getTransactionByOrderId(); + + if ( + !empty($this->callbackResponse['transaction']['due_date']) + && in_array($this->callbackResponse['transaction']['payment_type'], ['PREPAYMENT', 'INVOICE', 'GUARANTEED_INVOICE']) + ) { + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + $invoiceComments = explode('|', $additionalData['invoice_comments']); + $invoiceComments[1] = $this->glossaryFacade->translate('novalnet.invoice-bank-note-transfer-text-with-due-date', ['%amount%' => number_format($this->callbackResponse['transaction']['amount'] / 100, 2, '.') . ' ' . $this->callbackResponse['transaction']['currency'], '%due_date%' => $this->callbackResponse['transaction']['due_date']]); + $additionalData['invoice_comments'] = implode('|', $invoiceComments); + + if ($this->callbackResponse['transaction']['payment_type'] == 'GUARANTEED_INVOICE') { + $additionalData['guarantee_pending_comments'] = ''; + } + + $transactionLog->setAdditionalData(json_encode($additionalData))->save(); + } + + $paymentStatus = $transactionLog->getTransactionStatus(); // Get payment original transaction status + $orderStatus = 'paid'; + if ($this->callbackResponse['transaction']['payment_type'] == 'INVOICE') { + $orderStatus = 'waiting_for_payment'; + } + $transactionLog->setTransactionStatus($this->callbackResponse['transaction']['status']); + $transactionLog->save(); + + $statusMessage = ['message' => "The transaction has been confirmed on $this->currentTime"]; + $this->setCallbackComments($statusMessage); + $this->updateOrderStatus($orderStatus); + $this->emailBody = $statusMessage; + $this->sendCallbackMail(); + $this->showDebug($statusMessage); + } + + /** + * @return void + */ + protected function transactionCancellation() + { + // Get Novalnet transaction using order reference + $transactionLog = $this->getTransactionByOrderId(); + $transactionLog->setTransactionStatus($this->callbackResponse['transaction']['status'])->save(); + $statusMessage = ['message' => "The transaction has been canceled on $this->currentTime"]; + $this->setCallbackComments($statusMessage); + $this->updateOrderStatus('canceled'); + $this->emailBody = $statusMessage; + $this->sendCallbackMail(); + $this->showDebug($statusMessage); + } + + /** + * @return void + */ + protected function transactionRefund() + { + // Update callback comments for Refunds + $amount = ($this->event_type == 'TRANSACTION_REFUND') ? $this->callbackResponse['transaction']['refund']['amount'] : $this->callbackResponse['transaction']['amount']; + $amount = number_format($amount / 100, 2, '.') . ' ' . $this->currency; + $transactionId = $this->parent_tid; + $tid = $this->event_tid; + + $statusMessage = ($this->event_type == 'TRANSACTION_REFUND') + ? ['message' => "Refund has been initiated for the TID: $transactionId with the amount of $amount. New TID: $tid for the refunded amount."] + : ['message' => "Chargeback executed successfully for the TID: $transactionId amount: $amount on $this->currentTime. The subsequent TID: $tid"]; + + $this->setCallbackComments($statusMessage); + $this->emailBody = $statusMessage; + $this->showDebug($statusMessage); + } + + /** + * @return void + */ + protected function transactionUpdate() + { + $orderStatus = $statusMessage = ''; + $transactionId = $this->getParentTid(); + $transactionLog = $this->getTransactionByOrderId(); + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + $amount = number_format($this->callbackResponse['transaction']['amount'] / 100, 2, '.') . ' ' . $this->currency; + $paymentStatus = $transactionLog->getTransactionStatus(); // Get payment original transaction status + + if ($paymentStatus == 'PENDING' && $this->callbackResponse['transaction']['status'] == 'ON_HOLD') { + if ($this->callbackResponse['transaction']['payment_type'] == 'GUARANTEED_INVOICE') { + $additionalData['guarantee_pending_comments'] = ''; + $transactionLog->setAdditionalData(json_encode($additionalData))->save(); + } + + $orderStatus = 'authorize'; + $statusMessage = ['message' => "The transaction status has been changed from pending to on hold for the TID: $transactionId on $this->currentTime."]; + } elseif ($paymentStatus == 'PENDING' && $this->callbackResponse['transaction']['status'] == 'CONFIRMED') { + if ($this->callbackResponse['transaction']['payment_type'] == 'GUARANTEED_INVOICE') { + $additionalData['guarantee_pending_comments'] = ''; + $transactionLog->setAdditionalData(json_encode($additionalData))->save(); + } + + $statusMessage = ['message' => "Transaction updated successfully for the TID: $transactionId with amount $amount"]; + $orderStatus = 'paid'; + } elseif ($paymentStatus == 'PENDING' && $this->callbackResponse['transaction']['status'] == 'PENDING') { + if ( + !empty($this->callbackResponse['transaction']['update_type']) && $this->callbackResponse['transaction']['update_type'] == 'DUE_DATE' + && !empty($this->callbackResponse['transaction']['due_date']) + ) { + $dueDate = $this->callbackResponse['transaction']['due_date']; + /* translators: %1$s: tid, %2$s: amount, %3$s: due date */ + $statusMessage = ['message' => "Transaction updated successfully for the TID: $transactionId with amount $amount and due date $dueDate"]; + } else { + /* translators: %1$s: tid, %2$s: amount*/ + $statusMessage = ['message' => "Transaction updated successfully for the TID: $transactionId with amount $amount"]; + } + + $invoiceComments = explode('|', $additionalData['invoice_comments']); + $invoiceComments[1] = $this->glossaryFacade->translate('novalnet.invoice-bank-note-transfer-text-with-due-date', ['%amount%' => $amount, '%due_date%' => $this->callbackResponse['transaction']['due_date']]); + $additionalData['invoice_comments'] = implode('|', $invoiceComments); + $transactionLog->setAdditionalData(json_encode($additionalData))->save(); + + $orderStatus = 'authorize'; + } + + if ($orderStatus) { + $this->updateOrderStatus($orderStatus); + } + + if ($statusMessage) { + $this->setCallbackComments($statusMessage); + } + $statusMessage = ['message' => $statusMessage]; + $transactionLog->setTransactionStatus($this->callbackResponse['transaction']['status'])->save(); + // Update callback comments for Refunds + $amount = number_format($this->callbackResponse['transaction']['amount'] / 100, 2, '.') . ' ' . $this->currency; + $transactionId = $this->parent_tid; + $tid = $this->event_tid; + $this->showDebug($statusMessage); + } + + /** + * @return void + */ + protected function paymentCreditProcess() + { + $amount = number_format($this->callbackResponse['transaction']['amount'] / 100, 2, '.') . ' ' . $this->currency; + $transactionId = $this->parent_tid; + $referenceTid = $this->event_tid; + + if (in_array($this->callbackResponse['transaction']['payment_type'], ['MULTIBANCO_CREDIT', 'INVOICE_CREDIT', 'ONLINE_TRANSFER_CREDIT', 'CASHPAYMENT_CREDIT'])) { + $callbackLog = $this->getCallbackByOrderId(); + $callbackAmount = ($callbackLog && $callbackLog->getCallbackAmount()) ? $callbackLog->getCallbackAmount() : 0; + $totalAmount = sprintf(($this->callbackResponse['transaction']['amount'] + $callbackAmount), 0.2); + $orderPaidAmount = ($callbackLog && $callbackLog->getCallbackAmount()) ? sprintf($callbackLog->getCallbackAmount(), 0.2) : 0; + $orderTotals = $this->getOrderTotals(); + $grandTotal = round(sprintf($orderTotals->getGrandTotal(), 0.2)); + $statusMessage = "Credit has been successfully received for the TID: $transactionId with amount $amount on $this->currentTime. Please refer PAID order details in our Novalnet Admin Portal for the TID: $referenceTid. "; + + // Log callback data + $this->logCallbackInfo($callbackLog, $totalAmount); + + if ($orderPaidAmount < $grandTotal) { + if ($this->callbackResponse['transaction']['payment_type'] == 'ONLINE_TRANSFER_CREDIT') { + $statusMessage = ($totalAmount >= $grandTotal) ? $statusMessage . "The amount of $amount for the order $this->orderNo has been paid. Please verify received amount and TID details, and update the order status accordingly." : $statusMessage; + } elseif ($totalAmount >= $grandTotal) { + $this->updateOrderStatus('paid'); + $transactionLog = $this->getTransactionByOrderId(); + $transactionLog->setTransactionStatus($this->callbackResponse['transaction']['status'])->save(); + } + $statusMessage = ['message' => $statusMessage]; + $this->setCallbackComments($statusMessage); + $this->emailBody = $statusMessage; + $this->showDebug($statusMessage); + } else { + $this->showDebug( + [ + 'message' => 'Callback Script executed already. Refer Order :' . $this->orderNo, + ] + ); + } + } else { + $statusMessage = ['message' => "Credit has been successfully received for the TID: $transactionId with amount $amount on $this->currentTime. Please refer PAID order details in our Novalnet Admin Portal for the TID: $referenceTid."]; + + $this->setCallbackComments($statusMessage); + $this->emailBody = $statusMessage; + $this->showDebug($statusMessage); + } + } + + /** + * @param Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetCallbackQuery $callbackLog + * @param float $amount + * + * @return void + */ + protected function logCallbackInfo($callbackLog, $amount) + { + $transactionId = $this->getParentTid(); // Get the original/parent transaction id + + if (!$callbackLog) { + $callbackLog = new SpyPaymentNovalnetCallback(); + } + + $callbackLog->setFkSalesOrder($this->order->getIdSalesOrder()); + $callbackLog->setOrderReference($this->orderNo); + $callbackLog->setCallbackAmount($amount); + $callbackLog->setReferenceTid($this->event_tid); + $callbackLog->setTransactionId($transactionId); + $callbackLog->setCallbackLog(json_encode($this->callbackResponse)); + $callbackLog->save(); + } + + /** + * @param string $orderStatus + * + * @return void + */ + protected function updateOrderStatus($orderStatus) + { + if ($orderStatus) { + $this->callbackResponseTransfer->setOrderStatus($orderStatus); + } + } + + /** + * @param string|null $statusMessage + * + * @return void + */ + protected function setCallbackComments($statusMessage = null) + { + if ($statusMessage) { + $transactionLog = $this->getTransactionByOrderId(); + + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + $callbackComments = !empty($additionalData['callback_comments']) ? $additionalData['callback_comments'] . $statusMessage['message'] : $statusMessage['message']; + $additionalData['callback_comments'] = $callbackComments . '|'; + + $transactionLog->setAdditionalData(json_encode($additionalData))->save(); + } + } + + /** + * Send callback notification E-mail + * + * @throws \Exception + * + * @return void + */ + public function sendCallbackMail() + { + if ($this->callbackParameter->getCallbackMailToAddress()) { + try { + $subject = 'Novalnet Callback Script Access Report'; + $emailToAddr = $this->validateEmail($this->callbackParameter->getCallbackMailToAddress()); + $senderMail = $this->glossaryFacade->translate('mail.sender.email', []); + $headers = "From: $senderMail\r\n"; + + mail($emailToAddr, $subject, $this->emailBody['message'], $headers); // Send mail + } catch (ClientException $e) { + throw new Exception($e->getResponse()); + } + } + } + + /** + * Check the email id is valid + * + * @param string $emailAddress + * + * @return string + */ + public function validateEmail($emailAddress) + { + $email = explode(',', $emailAddress); + + $validMail = []; + foreach ($email as $emailAddrVal) { + if (preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", trim($emailAddrVal))) { // Check the email id is valid + $validMail[] = $emailAddrVal; + } + } + + return implode(',', $validMail); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/Payment/CallbackManagerInterface.php b/src/Novalnet/Zed/NovalnetPayment/Business/Payment/CallbackManagerInterface.php new file mode 100755 index 0000000..2786bb8 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/Payment/CallbackManagerInterface.php @@ -0,0 +1,15 @@ +executionAdapter = $executionAdapter; + $this->queryContainer = $queryContainer; + $this->standardParameter = $standardParameter; + $this->glossaryFacade = $glossaryFacade; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return array + */ + public function authorize(OrderTransfer $orderTransfer) + { + $requestData = $this->buildRequestData($orderTransfer); + $response = $this->performAuthorizationRequest($orderTransfer, $requestData); + + return $response; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return array + */ + protected function buildRequestData(OrderTransfer $orderTransfer) + { + $requestData = []; + + // Build Merchant Data + $this->setMerchantData($requestData); + + // Build Customer Data + $this->setCustomerData($orderTransfer, $requestData); + + // Build Custom Data + $this->setCustomData($requestData); + + // Build Transaction Data + $this->setTransactionData($orderTransfer, $requestData); + + // Filter request Data + $requestData = $this->filterStandardParameter($requestData); + + return $requestData; + } + + /** + * @param array $requestData + * + * @return void + */ + protected function setMerchantData(&$requestData) + { + $requestData['merchant'] = [ + 'signature' => $this->standardParameter->getSignature(), + 'tariff' => $this->standardParameter->getTariffId(), + ]; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * @param array $requestData + * + * @return void + */ + protected function setCustomerData(OrderTransfer $orderTransfer, &$requestData) + { + $customerObj = $orderTransfer->getCustomer(); + $customerData = [ + 'first_name' => $orderTransfer->getBillingAddress()->getFirstName(), + 'last_name' => $orderTransfer->getBillingAddress()->getLastName(), + 'email' => !empty($customerObj) ? $customerObj->getEmail() : $orderTransfer->getEmail(), + 'tel' => $orderTransfer->getBillingAddress()->getPhone(), + 'customer_no' => !empty($customerObj) ? $customerObj->getIdCustomer() : 'guest', + 'customer_ip' => $this->getIpAddress(), + 'billing' => [ + 'street' => $orderTransfer->getBillingAddress()->getAddress1(), + 'house_no' => $orderTransfer->getBillingAddress()->getAddress2(), + 'city' => $orderTransfer->getBillingAddress()->getCity(), + 'zip' => $orderTransfer->getBillingAddress()->getZipCode(), + 'country_code' => $orderTransfer->getBillingAddress()->getIso2Code(), + 'company' => !empty($orderTransfer->getBillingAddress()->getCompany()) + ? $orderTransfer->getBillingAddress()->getCompany() : '', + ], + ]; + + if (!empty($orderTransfer->getShippingAddress())) { + if ( + $orderTransfer->getBillingAddress()->getFirstName() == $orderTransfer->getShippingAddress()->getFirstName() + && $orderTransfer->getBillingAddress()->getLastName() == $orderTransfer->getShippingAddress()->getLastName() + && $orderTransfer->getBillingAddress()->getAddress1() == $orderTransfer->getShippingAddress()->getAddress1() + && $orderTransfer->getBillingAddress()->getAddress2() == $orderTransfer->getShippingAddress()->getAddress2() + && $orderTransfer->getBillingAddress()->getCity() == $orderTransfer->getShippingAddress()->getCity() + && $orderTransfer->getBillingAddress()->getZipCode() == $orderTransfer->getShippingAddress()->getZipCode() + && $orderTransfer->getBillingAddress()->getIso2Code() == $orderTransfer->getShippingAddress()->getIso2Code() + && $orderTransfer->getBillingAddress()->getCompany() == $orderTransfer->getShippingAddress()->getCompany() + && $orderTransfer->getBillingAddress()->getPhone() == $orderTransfer->getShippingAddress()->getPhone() + ) { + $customerData['shipping'] = ['same_as_billing' => 1]; + } else { + $customerData['shipping'] = [ + 'first_name' => $orderTransfer->getShippingAddress()->getFirstName(), + 'last_name' => $orderTransfer->getShippingAddress()->getLastName(), + 'email' => !empty($customerObj) ? $customerObj->getEmail() : $orderTransfer->getEmail(), + 'street' => $orderTransfer->getShippingAddress()->getAddress1(), + 'house_no' => $orderTransfer->getShippingAddress()->getAddress2(), + 'city' => $orderTransfer->getShippingAddress()->getCity(), + 'zip' => $orderTransfer->getShippingAddress()->getZipCode(), + 'country_code' => $orderTransfer->getShippingAddress()->getIso2Code(), + 'company' => $orderTransfer->getShippingAddress()->getCompany(), + 'tel' => $orderTransfer->getShippingAddress()->getPhone(), + ]; + } + } + + $requestData['customer'] = $customerData; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * @param array $requestData + * + * @return void + */ + protected function setTransactionData(OrderTransfer $orderTransfer, &$requestData) + { + $paymentType = $this->getPaymentType($orderTransfer); + + $transactionData = [ + 'payment_type' => $paymentType, + 'amount' => $orderTransfer->getTotals()->getGrandTotal(), + 'currency' => $this->standardParameter->getCurrency(), + 'test_mode' => ($this->standardParameter->getTestMode() === true ? 1 : 0), + 'order_no' => $orderTransfer->getOrderReference(), + 'system_ip' => $this->getIpAddress('SERVER_ADDR'), + 'system_name' => 'Spryker-B2C', + 'system_version' => '202204.0-NN1.2.1', + ]; + + $paymentData = $this->getPaymentData($orderTransfer, $paymentType, $requestData); + if (!empty($paymentData)) { + $transactionData = array_merge($transactionData, $paymentData); + } + + $requestData['transaction'] = $transactionData; + } + + /** + * @param array $requestData + * + * @return void + */ + protected function setCustomData(&$requestData) + { + $requestData['custom'] = [ + 'lang' => strtoupper($this->standardParameter->getLanguage()), + 'input1' => 'locale', + 'inputval1' => Store::getInstance()->getCurrentLocale(), + ]; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return string|null + */ + protected function getPaymentType(OrderTransfer $orderTransfer) + { + $paymentMethod = ''; + foreach ($orderTransfer->getPayments() as $payments) { + if ($payments->getPaymentProvider() == 'Novalnet') { + $paymentMethod = $payments->getPaymentMethod(); + } + } + + $paymentMethods = [ + 'novalnetCreditCard' => 'CREDITCARD', + 'novalnetSepa' => 'DIRECT_DEBIT_SEPA', + 'novalnetSepaGuarantee' => 'GUARANTEED_DIRECT_DEBIT_SEPA', + 'novalnetInvoice' => 'INVOICE', + 'novalnetInvoiceGuarantee' => 'GUARANTEED_INVOICE', + 'novalnetPrepayment' => 'PREPAYMENT', + 'novalnetIdeal' => 'IDEAL', + 'novalnetSofort' => 'ONLINE_TRANSFER', + 'novalnetGiropay' => 'GIROPAY', + 'novalnetBarzahlen' => 'CASHPAYMENT', + 'novalnetPrzelewy' => 'PRZELEWY24', + 'novalnetEps' => 'EPS', + 'novalnetPaypal' => 'PAYPAL', + 'novalnetPostfinanceCard' => 'POSTFINANCE_CARD', + 'novalnetPostfinance' => 'POSTFINANCE', + 'novalnetBancontact' => 'BANCONTACT', + 'novalnetMultibanco' => 'MULTIBANCO', + ]; + + return $paymentMethods[$paymentMethod]; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * @param string $paymentType + * @param array $requestData + * + * @return array + */ + protected function getPaymentData(OrderTransfer $orderTransfer, $paymentType, &$requestData) + { + $paymentData = []; + + switch ($paymentType) { + case 'CREDITCARD': + $getPaymentDetail = $this->getPaymentDetails($orderTransfer); + $paymentData['payment_data']['pan_hash'] = !empty($getPaymentDetail['pan_hash']) ? $getPaymentDetail['pan_hash'] : ''; + $paymentData['payment_data']['unique_id'] = !empty($getPaymentDetail['unique_id']) ? $getPaymentDetail['unique_id'] : ''; + + if (!empty($getPaymentDetail['do_redirect'])) { + $this->getRedirectPaymentDetails($paymentData); + } + + if ( + is_numeric($this->standardParameter->getCreditCardOnHoldLimit()) && $orderTransfer->getTotals()->getGrandTotal() + && (string)$this->standardParameter->getCreditCardOnHoldLimit() <= (string)$orderTransfer->getTotals()->getGrandTotal() + ) { + $this->transactionType = 'authorize'; + } + + break; + case 'DIRECT_DEBIT_SEPA': + $getPaymentDetail = $this->getPaymentDetails($orderTransfer); + $paymentData['payment_data']['iban'] = !empty($getPaymentDetail['iban']) ? $getPaymentDetail['iban'] : ''; + $paymentData['payment_data']['account_holder'] = $orderTransfer->getBillingAddress()->getFirstName() . ' ' . $orderTransfer->getBillingAddress()->getLastName(); + + if ( + is_numeric($this->standardParameter->getSepaDueDate()) + && $this->standardParameter->getSepaDueDate() >= 2 && $this->standardParameter->getSepaDueDate() <= 14 + ) { + $paymentData['due_date'] = date('Y-m-d', strtotime('+ ' . $this->standardParameter->getSepaDueDate() . ' day')); + } + + if ( + is_numeric($this->standardParameter->getSepaOnHoldLimit()) && $orderTransfer->getTotals()->getGrandTotal() + && (string)$this->standardParameter->getSepaOnHoldLimit() <= (string)$orderTransfer->getTotals()->getGrandTotal() + ) { + $this->transactionType = 'authorize'; + } + + break; + case 'GUARANTEED_DIRECT_DEBIT_SEPA': + $getPaymentDetail = $this->getPaymentDetails($orderTransfer); + $paymentData['payment_data']['iban'] = !empty($getPaymentDetail['iban']) ? $getPaymentDetail['iban'] : ''; + $paymentData['payment_data']['account_holder'] = $orderTransfer->getBillingAddress()->getFirstName() . ' ' . $orderTransfer->getBillingAddress()->getLastName(); + $requestData['customer']['birth_date'] = !empty($getPaymentDetail['birthdate']) ? $getPaymentDetail['birthdate'] : ''; + + if ( + is_numeric($this->standardParameter->getSepaDueDate()) + && $this->standardParameter->getSepaGuaranteeDueDate() >= 2 && $this->standardParameter->getSepaGuaranteeDueDate() <= 14 + ) { + $paymentData['due_date'] = date('Y-m-d', strtotime('+ ' . $this->standardParameter->getSepaGuaranteeDueDate() . ' day')); + } + + if ( + is_numeric($this->standardParameter->getSepaGuaranteeOnHoldLimit()) && $orderTransfer->getTotals()->getGrandTotal() + && (string)$this->standardParameter->getSepaGuaranteeOnHoldLimit() <= (string)$orderTransfer->getTotals()->getGrandTotal() + ) { + $this->transactionType = 'authorize'; + } + + break; + case 'PREPAYMENT': + if ( + is_numeric($this->standardParameter->getPrepaymentDueDate()) + && $this->standardParameter->getPrepaymentDueDate() >= 7 + ) { + $paymentData['due_date'] = date('Y-m-d', strtotime('+ ' . $this->standardParameter->getPrepaymentDueDate() . ' day')); + } + + break; + case 'INVOICE': + if ( + is_numeric($this->standardParameter->getInvoiceDueDate()) + && $this->standardParameter->getInvoiceDueDate() >= 7 + ) { + $paymentData['due_date'] = date('Y-m-d', strtotime('+ ' . $this->standardParameter->getInvoiceDueDate() . ' day')); + } + + if ( + is_numeric($this->standardParameter->getInvoiceOnHoldLimit()) && $orderTransfer->getTotals()->getGrandTotal() + && (string)$this->standardParameter->getInvoiceOnHoldLimit() <= (string)$orderTransfer->getTotals()->getGrandTotal() + ) { + $this->transactionType = 'authorize'; + } + + break; + case 'GUARANTEED_INVOICE': + $getPaymentDetail = $this->getPaymentDetails($orderTransfer); + $requestData['customer']['birth_date'] = !empty($getPaymentDetail['birthdate']) ? $getPaymentDetail['birthdate'] : ''; + + if ( + is_numeric($this->standardParameter->getInvoiceGuaranteeOnHoldLimit()) && $orderTransfer->getTotals()->getGrandTotal() + && (string)$this->standardParameter->getInvoiceGuaranteeOnHoldLimit() <= (string)$orderTransfer->getTotals()->getGrandTotal() + ) { + $this->transactionType = 'authorize'; + } + + break; + case 'CASHPAYMENT': + if (is_numeric($this->standardParameter->getCpDueDate())) { + $paymentData['due_date'] = date('Y-m-d', strtotime('+ ' . $this->standardParameter->getCpDueDate() . ' day')); + } + + break; + case 'PAYPAL': + $this->getRedirectPaymentDetails($paymentData); + if ( + is_numeric($this->standardParameter->getPaypalOnHoldLimit()) && $orderTransfer->getTotals()->getGrandTotal() + && (string)$this->standardParameter->getPaypalOnHoldLimit() <= (string)$orderTransfer->getTotals()->getGrandTotal() + ) { + $this->transactionType = 'authorize'; + } + + break; + case 'IDEAL': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'ONLINE_TRANSFER': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'GIROPAY': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'PRZELEWY24': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'EPS': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'POSTFINANCE_CARD': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'POSTFINANCE': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'BANCONTACT': + $this->getRedirectPaymentDetails($paymentData); + + break; + case 'PREPAYMENT': + case 'MULTIBANCO': + break; + } + + return $paymentData; + } + + /** + * @param array $paymentData + * + * @return void + */ + protected function getRedirectPaymentDetails(&$paymentData) + { + $paymentData['return_url'] = $this->standardParameter->getReturnUrl(); + $paymentData['error_return_url'] = $this->standardParameter->getErrorReturnUrl(); + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return array + */ + protected function getPaymentDetails(OrderTransfer $orderTransfer) + { + $getPaymentDetail = []; + + $paymentDetailQuery = $this->queryContainer->createLastDetailByOrderId($orderTransfer->getIdSalesOrder()); + $paymentDetailLog = $paymentDetailQuery->findOne(); + + if ($paymentDetailLog && !empty($paymentDetailLog->getPaymentDetails())) { + $getPaymentDetail = json_decode($paymentDetailLog->getPaymentDetails(), true); + } + + return $getPaymentDetail; + } + + /** + * @param object $responseData + * + * @return void + */ + protected function updatePaymentDetails($responseData) + { + if (!empty($responseData->transaction->order_no)) { + $paymentDetailQuery = $this->queryContainer->createLastDetailByOrderReference($responseData->transaction->order_no); + $paymentDetailLog = $paymentDetailQuery->findOne(); + + if ($paymentDetailLog && !empty($responseData->transaction->payment_data)) { + $paymentData = json_decode(json_encode($responseData->transaction->payment_data), true); + $paymentDetailLog->setPaymentDetails(json_encode($paymentData)); + $paymentDetailLog->setTransactionId($responseData->transaction->tid); + $paymentDetailLog->setCustomerId($responseData->customer->customer_no); + $paymentDetailLog->save(); + } + } + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * @param array $requestData + * + * @return object|null + */ + protected function performAuthorizationRequest(OrderTransfer $orderTransfer, $requestData) + { + $apiLogEntity = $this->initializeApiLog($orderTransfer, $requestData); + $response = $this->executionAdapter->sendRequest($requestData, $this->transactionType); + + $this->updateApiLogAfterAuthorization($apiLogEntity, $response); + + return $response; + } + + /** + * @param array $requestData + * + * @return array + */ + protected function filterStandardParameter($requestData) + { + $excludedParams = ['test_mode']; + + foreach ($requestData as $key => $value) { + if (is_array($value)) { + $requestData[$key] = $this->filterStandardParameter($requestData[$key]); + } + + if (!in_array($key, $excludedParams) && empty($requestData[$key])) { + unset($requestData[$key]); + } + } + + return $requestData; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * @param array $requestData + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery + */ + protected function initializeApiLog(OrderTransfer $orderTransfer, $requestData) + { + $paymentMethod = ''; + foreach ($orderTransfer->getPayments() as $payments) { + if ($payments->getPaymentProvider() == 'Novalnet') { + $paymentMethod = $payments->getPaymentMethod(); + } + } + $idSalesOrder = $orderTransfer->getIdSalesOrder(); + + $entity = new SpyPaymentNovalnetTransactionLog(); + $entity->setFkSalesOrder($idSalesOrder); + $entity->setOrderReference($requestData['transaction']['order_no']); + $entity->setTransactionType($this->transactionType); + $entity->setPaymentMethod($paymentMethod); + + // Logging request data for debug + $entity->setRawRequest(json_encode($requestData)); + $entity->save(); + + return $entity; + } + + /** + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $apiLogEntity + * @param object $response + * + * @return void + */ + protected function updateApiLogAfterAuthorization(SpyPaymentNovalnetTransactionLog $apiLogEntity, $response) + { + $apiLogEntity->setStatus($response->result->status_code); + $apiLogEntity->setStatusMessage($response->result->status_text); + + if (!empty($response->result->redirect_url)) { + $additionalData = ['redirect_url' => $response->result->redirect_url]; + $apiLogEntity->setAdditionalData(json_encode($additionalData)); + $apiLogEntity->setRawResponse(json_encode($response)); + $apiLogEntity->save(); + } elseif ( + !empty($response->transaction->tid) && !empty($response->transaction->status) + && empty($apiLogEntity->getTransactionId()) + ) { + $apiLogEntity->setTransactionId($response->transaction->tid); + $apiLogEntity->setTransactionStatus($response->transaction->status); + $additionalData = $this->getAdditionalData($apiLogEntity, $response); + $apiLogEntity->setAdditionalData(json_encode($additionalData)); + $apiLogEntity->setPaymentResponse(json_encode($response)); + $apiLogEntity->save(); + + if (!empty($response->transaction->payment_data)) { + $this->updatePaymentDetails($response); + } + } + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param \Generated\Shared\Transfer\CheckoutResponseTransfer $checkoutResponse + * + * @return \Generated\Shared\Transfer\CheckoutResponseTransfer + */ + public function postSaveHook(QuoteTransfer $quoteTransfer, CheckoutResponseTransfer $checkoutResponse) + { + $paymentSelection = $quoteTransfer->getPayment()->getPaymentSelection(); + $method = 'get' . ucfirst($paymentSelection); + + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($quoteTransfer->getPayment()->$method()->getFkSalesOrder()); + $transactionLog = $transactionLogsQuery->findOne(); + + if ($transactionLog) { + $additionalData = $transactionLog->getAdditionalData() ? json_decode($transactionLog->getAdditionalData()) : ''; + $redirectUrl = !empty($additionalData->redirect_url) ? $additionalData->redirect_url : ''; + + if ($redirectUrl !== null) { + $checkoutResponse->setIsExternalRedirect(true); + $checkoutResponse->setRedirectUrl($redirectUrl); + } + + $status = $transactionLog->getStatus(); + + if (!empty($transactionLog->getTransactionId()) && $status == 100) { + $checkoutResponse->setIsSuccess(true); + } elseif ($status != 100) { + $error = new CheckoutErrorTransfer(); + $error->setMessage($transactionLog->getStatusMessage()); + $error->setErrorCode($status); + $checkoutResponse->addError($error); + $checkoutResponse->setIsSuccess(false); + } + } + + return $checkoutResponse; + } + + /** + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * @param \Generated\Shared\Transfer\SaveOrderTransfer $saveOrderTransfer + * + * @return \Generated\Shared\Transfer\SaveOrderTransfer + */ + public function saveOrderHook(QuoteTransfer $quoteTransfer, SaveOrderTransfer $saveOrderTransfer) + { + $idSalesOrder = $saveOrderTransfer->getIdSalesOrder(); + + $paymentSelection = $quoteTransfer->getPayment()->getPaymentSelection(); + $method = 'get' . ucfirst($paymentSelection); + $paymentTransfer = $quoteTransfer->getPayment()->$method(); + $paymentTransfer->setFkSalesOrder($idSalesOrder); + + $paymentDetail = []; + + if ( + in_array($paymentSelection, [NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA, NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA_GUARANTEE]) + && !empty($paymentTransfer->getIban()) + ) { + $paymentDetail['iban'] = $paymentTransfer->getIban(); + } + + if ( + in_array($paymentSelection, [NovalnetConfig::NOVALNET_PAYMENT_METHOD_INVOICE_GUARANTEE, NovalnetConfig::NOVALNET_PAYMENT_METHOD_SEPA_GUARANTEE]) + && !empty($paymentTransfer->getDob()) + ) { + $paymentDetail['birthdate'] = $paymentTransfer->getDob(); + } + + if ( + $paymentSelection == NovalnetConfig::NOVALNET_PAYMENT_METHOD_CC + && !empty($paymentTransfer->getPanHash()) + && !empty($paymentTransfer->getUniqueId()) + ) { + $paymentDetail['pan_hash'] = $paymentTransfer->getPanHash(); + $paymentDetail['unique_id'] = $paymentTransfer->getUniqueId(); + $paymentDetail['do_redirect'] = $paymentTransfer->getDoRedirect(); + } + + $paymentDetailQuery = $this->queryContainer->createLastDetailByOrderId($idSalesOrder); + $paymentDetailLog = $paymentDetailQuery->findOne(); + + if ($paymentDetailLog) { + $paymentDetailLog->setPaymentDetails(json_encode($paymentDetail)); + $paymentDetailLog->setPaymentMethod($paymentSelection); + $paymentDetailLog->save(); + } else { + $orderReference = $saveOrderTransfer->getOrderReference(); + $entity = new SpyPaymentNovalnetDetail(); + $entity->setFkSalesOrder($idSalesOrder); + $entity->setOrderReference($orderReference); + $entity->setPaymentDetails(json_encode($paymentDetail)); + $entity->save(); + } + + return $saveOrderTransfer; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer $redirectResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetRedirectResponseTransfer + */ + public function processRedirectPaymentResponse(NovalnetRedirectResponseTransfer $redirectResponseTransfer) + { + $paymentResponse = $redirectResponseTransfer->getPaymentResponse(); + + $transactionData = []; + if ( + !empty($paymentResponse['checksum']) && !empty($paymentResponse['tid']) + && !empty($paymentResponse['tid']) + ) { + $requestData['transaction'] = [ + 'tid' => $paymentResponse['tid'], + ]; + $transactionData = $this->executionAdapter->sendRequest($requestData, 'transaction'); + } + + $transactionLog = ''; + + if (!empty($transactionData->transaction->order_no)) { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderReference($transactionData->transaction->order_no); + $transactionLog = $transactionLogsQuery->findOne(); + } + + if ($transactionLog) { + $transactionLog->setPaymentResponse(json_encode($transactionData)); + $transactionLog->setStatusMessage($transactionData->result->status_text); + $transactionLog->setStatus($transactionData->result->status_code); + + $redirectResponseTransfer->setOrderNo($transactionData->transaction->order_no); + $redirectResponseTransfer->setPaymentMethod($transactionLog->getPaymentMethod()); + + if (!empty($transactionData->transaction->tid) && !empty($transactionData->transaction->status)) { + if (empty($transactionLog->getTransactionId())) { + $transactionLog->setTransactionId($transactionData->transaction->tid); + $transactionLog->setTransactionStatus($transactionData->transaction->status); + $additionalData = $this->getAdditionalData($transactionLog, $transactionData); + $transactionLog->setAdditionalData(json_encode($additionalData)); + } + + if (in_array($transactionData->transaction->status, ['CONFIRMED', 'PENDING', 'ON_HOLD'])) { + $redirectResponseTransfer->setIsSuccess(true); + } else { + $redirectResponseTransfer->setIsSuccess(false); + } + } else { + $redirectResponseTransfer->setIsSuccess(false); + } + + $transactionLog->save(); + } + + return $redirectResponseTransfer; + } + + /** + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $transactionLog + * @param object $transactionData + * + * @return array + */ + protected function getAdditionalData(SpyPaymentNovalnetTransactionLog $transactionLog, $transactionData) + { + $paymentMode = (int)($this->standardParameter->getTestMode() === true || $transactionData->transaction->test_mode == 1); + $comments = ['test_mode' => $paymentMode]; + $paymentComments = $this->getPaymentComments($transactionLog, $transactionData); + $comments = array_merge($paymentComments, $comments); + + if (!empty($transactionLog->getAdditionalData())) { + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + $comments = array_merge($additionalData, $comments); + } + + return $comments; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isAuthorized(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = $transactionLog->getStatus() == 100 ? true : false; + } + + return $status; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isAuthorizeError(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = true; + + if ($transactionLog) { + $status = $transactionLog->getStatus() != 100 ? true : false; + } + + return $status; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentAuthorized(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = (in_array($transactionLog->getTransactionStatus(), $this->pendingStatus)) ? true : false; + } + + return $status; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isWaitingForPayment(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = ($transactionLog->getTransactionStatus() == 'PENDING') ? true : false; + } + + return $status; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentCanceled(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = !in_array($transactionLog->getTransactionStatus(), $this->successStatus) ? true : false; + } + + return $status; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentPaid(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = $transactionLog->getTransactionStatus() == 'CONFIRMED' ? true : false; + } + + return $status; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isCallbackPaid(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = $transactionLog->getTransactionStatus() == 'CONFIRMED' ? true : false; + } + + return $status; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return bool|null + */ + public function capture(OrderTransfer $orderTransfer) + { + $idSalesOrder = $orderTransfer->getIdSalesOrder(); + + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + if ($transactionLog) { + $response = $this->performCaptureRequest($transactionLog); + + if ($response->result->status) { + $transactionLog->setStatus($response->result->status); + + if ( + $response->transaction->status == 'CONFIRMED' + || (in_array($response->transaction->payment_type, ['INVOICE', 'PREPAYMENT', 'MULTIBANCO', 'CASHPAYMENT']) + && $response->transaction->status == 'PENDING') + ) { + $transactionLog->setTransactionStatus($response->transaction->status); + $comments = $this->getTransactionComments('capture', $transactionLog, $response); + $transactionLog->setAdditionalData(json_encode($comments)); + } + + $transactionLog->save(); + } + + return true; + } + } + + /** + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $transactionLog + * + * @return object|null + */ + protected function performCaptureRequest(SpyPaymentNovalnetTransactionLog $transactionLog) + { + $captureParams = [ + 'transaction' => [ + 'tid' => $transactionLog->getTransactionId(), + ], + 'custom' => [ + 'lang' => $this->standardParameter->getLanguage(), + ], + ]; + + $response = $this->executionAdapter->sendRequest($captureParams, 'capture'); + + return $response; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentCaptured(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = ($transactionLog->getTransactionStatus() == 'CONFIRMED' + || (in_array($transactionLog->getPaymentMethod(), ['novalnetInvoice', 'novalnetPrepayment', 'novalnetBarzahlen', 'novalnetMultibanco']) + && $transactionLog->getTransactionStatus() == 'PENDING')) ? true : false; + } + + return $status; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return bool|null + */ + public function cancel(OrderTransfer $orderTransfer) + { + $idSalesOrder = $orderTransfer->getIdSalesOrder(); + + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + if ($transactionLog) { + $response = $this->performCancelRequest($transactionLog); + + if ($response->result->status) { + $transactionLog->setStatus($response->result->status); + + if ($response->transaction->status == 'DEACTIVATED') { + $transactionLog->setTransactionStatus($response->transaction->status); + $comments = $this->getTransactionComments('cancel', $transactionLog); + $transactionLog->setAdditionalData(json_encode($comments)); + } + + $transactionLog->save(); + } + + return true; + } + } + + /** + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $transactionLog + * + * @return object + */ + protected function performCancelRequest(SpyPaymentNovalnetTransactionLog $transactionLog) + { + $cancelParams = [ + 'transaction' => [ + 'tid' => $transactionLog->getTransactionId(), + ], + 'custom' => [ + 'lang' => $this->standardParameter->getLanguage(), + ], + ]; + + $response = $this->executionAdapter->sendRequest($cancelParams, 'cancel'); + + return $response; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentVoided(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = ($transactionLog->getTransactionStatus() == 'DEACTIVATED') ? true : false; + } + + return $status; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetRefundTransfer $refundTransfer + * + * @return object|null + */ + public function refund(NovalnetRefundTransfer $refundTransfer) + { + $orderTransfer = $refundTransfer->getOrder(); + $idSalesOrder = $orderTransfer->getIdSalesOrder(); + + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + if ($transactionLog) { + $refundAmount = $refundTransfer->getAmount(); + $response = $this->performRefundRequest($transactionLog, $refundAmount); + + if ($response->result->status) { + $transactionLog->setStatus($response->result->status); + + if ($response->transaction->status) { + $transactionLog->setTransactionStatus($response->transaction->status); + $comments = $this->getTransactionComments('', $transactionLog, $response, $refundTransfer); + $transactionLog->setAdditionalData(json_encode($comments)); + } + + $transactionLog->save(); + } + + return $response; + } + } + + /** + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $transactionLog + * @param int $refundAmount + * + * @return object + */ + protected function performRefundRequest(SpyPaymentNovalnetTransactionLog $transactionLog, int $refundAmount) + { + $refundParams = [ + 'transaction' => [ + 'tid' => $transactionLog->getTransactionId(), + 'amount' => $refundAmount, + ], + 'custom' => [ + 'lang' => $this->standardParameter->getLanguage(), + ], + ]; + + $response = $this->executionAdapter->sendRequest($refundParams, 'refund'); + + return $response; + } + + /** + * @param int $idSalesOrder + * + * @return bool + */ + public function isPaymentRefunded(int $idSalesOrder) + { + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + $status = false; + + if ($transactionLog) { + $status = (in_array($transactionLog->getTransactionStatus(), ['CONFIRMED', 'DEACTIVATED'])) ? true : false; + } + + return $status; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function getTransactionDetails(OrderTransfer $orderTransfer) + { + $idSalesOrder = $orderTransfer->getIdSalesOrder(); + + $transactionLogsQuery = $this->queryContainer->createLastApiLogsByOrderId($idSalesOrder); + $transactionLog = $transactionLogsQuery->findOne(); + + if ($transactionLog) { + $novalnetTransfer = new NovalnetTransfer(); + + $novalnetTransfer->setFkSalesOrder($idSalesOrder); + $novalnetTransfer->setTransactionId($transactionLog->getTransactionId()); + $novalnetTransfer->setTransactionStatus($transactionLog->getTransactionStatus()); + + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + + if ( + $transactionLog->getStatusMessage() + && !in_array($transactionLog->getTransactionStatus(), $this->successStatus) + ) { + $novalnetTransfer->setTransactionComments($transactionLog->getStatusMessage()); + } + + if (!empty($additionalData['test_mode'])) { + $novalnetTransfer->setPaymentMode($additionalData['test_mode']); + } + + if (!empty($additionalData['trans_comments'])) { + $novalnetTransfer->setTransactionComments($additionalData['trans_comments']); + } + + if (!empty($additionalData['callback_comments'])) { + $novalnetTransfer->setCallbackComments($additionalData['callback_comments']); + } + + if ( + !empty($additionalData['invoice_comments']) + && ((in_array($transactionLog->getPaymentMethod(), ['novalnetInvoice', 'novalnetPrepayment']) && !in_array($transactionLog->getTransactionStatus(), ['CONFIRMED', 'DEACTIVATED'])) + || ($transactionLog->getPaymentMethod() == 'novalnetInvoiceGuarantee' && !in_array($transactionLog->getTransactionStatus(), ['PENDING', 'DEACTIVATED']))) + ) { + $novalnetTransfer->setInvoiceComments($additionalData['invoice_comments']); + } + + if (!empty($additionalData['guarantee_pending_comments']) && $transactionLog->getTransactionStatus() == 'PENDING') { + $novalnetTransfer->setguaranteePendingComments($additionalData['guarantee_pending_comments']); + } + + $orderTransfer->setNovalnet($novalnetTransfer); + } + + return $orderTransfer; + } + + /** + * @param string|null $transactionType + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $transactionLog + * @param object|null $response + * @param \Generated\Shared\Transfer\NovalnetRefundTransfer|null $refundTransfer + * + * @return array + */ + protected function getTransactionComments( + $transactionType, + SpyPaymentNovalnetTransactionLog $transactionLog, + $response = null, + ?NovalnetRefundTransfer $refundTransfer = null + ) { + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + $transactionText = ''; + + if (in_array($transactionType, ['capture', 'cancel'])) { + $transactionText = ($transactionType == 'capture') + ? $this->translate('novalnet.payment-confirmed', ['%confirmed%' => date('Y-m-d H:i:s')]) + : $this->translate('novalnet.payment-void', ['%cancelled%' => date('Y-m-d H:i:s')]); + if (!empty($response->transaction->due_date) && in_array($response->transaction->payment_type, ['PREPAYMENT', 'INVOICE', 'GUARANTEED_INVOICE'])) { + $invoiceComments = explode('|', $additionalData['invoice_comments']); + $invoiceComments[1] = $this->translate('novalnet.invoice-bank-note-transfer-text-with-due-date', ['%amount%' => number_format($response->transaction->amount / 100, 2, '.') . ' ' . $response->transaction->currency, '%due_date%' => $response->transaction->due_date]); + $additionalData['invoice_comments'] = implode('|', $invoiceComments); + } + } else { + $amount = number_format($refundTransfer->getAmount() / 100, 2, '.') . ' ' . $refundTransfer->getOrder()->getCurrencyIsoCode(); + $transactionText = $this->translate('novalnet.payment-full-refund', ['%parentTid%' => $transactionLog->getTransactionId(), '%amount%' => $amount]); + + if (!empty($response->transaction->refund->tid)) { + $transactionText = $this->translate('novalnet.payment-partial-refund', ['%parentTid%' => $transactionLog->getTransactionId(), '%amount%' => $amount, '%referenceTid%' => $response->transaction->refund->tid]); + } + } + + $transactionComments = !empty($additionalData['trans_comments']) + ? $additionalData['trans_comments'] . $transactionText : $transactionText; + + $additionalData['trans_comments'] = $transactionComments . '|'; + + return $additionalData; + } + + /** + * @param \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery $transactionLog + * @param object $paymentResponse + * + * @return array + */ + protected function getPaymentComments(SpyPaymentNovalnetTransactionLog $transactionLog, $paymentResponse) + { + $additionalData = []; + $transactionText = ''; + + if (!empty($transactionLog->getAdditionalData())) { + $additionalData = json_decode($transactionLog->getAdditionalData(), true); + } + + if (is_array($paymentResponse)) { + $paymentResponse = json_decode(json_encode($paymentResponse), false); + } + + if (in_array($paymentResponse->transaction->payment_type, ['PREPAYMENT', 'INVOICE', 'GUARANTEED_INVOICE'])) { + $invoiceComments = $this->getInvoicePaymentNote($paymentResponse); + $additionalData['invoice_comments'] = $invoiceComments . '|'; + } + + if ( + in_array($paymentResponse->transaction->payment_type, ['GUARANTEED_INVOICE', 'GUARANTEED_DIRECT_DEBIT_SEPA']) + && $paymentResponse->transaction->status == 'PENDING' + ) { + $additionalData['guarantee_pending_comments'] = ($paymentResponse->transaction->payment_type == 'GUARANTEED_INVOICE') + ? $this->translate('novalnet.guarantee-invoice-pending-text') : $this->translate('novalnet.guarantee-sepa-pending-text'); + } + + if ($paymentResponse->transaction->payment_type == 'CASHPAYMENT') { + $transactionText = $this->getCashPaymentComments($paymentResponse); + } + + if ($paymentResponse->transaction->payment_type == 'MULTIBANCO') { + $transactionText = $this->getMultibancoComments($paymentResponse); + } + + if ($transactionText) { + $transactionComments = !empty($additionalData['trans_comments']) + ? $additionalData['trans_comments'] . $transactionText : $transactionText; + + $additionalData['trans_comments'] = $transactionComments . '|'; + } + + return $additionalData; + } + + /** + * @param object $response + * + * @return string + */ + protected function getInvoicePaymentNote($response) + { + $note = null; + $amount = number_format($response->transaction->amount / 100, 2, '.'); + $note = '|' . $this->translate('novalnet.invoice-bank-note-transfer-text', ['%amount%' => $amount, '%currency%' => $response->transaction->currency]); + + if (!empty($response->transaction->due_date) && $response->transaction->status != 'ON_HOLD') { + $note = '|' . $this->translate('novalnet.invoice-bank-note-transfer-text-with-due-date', ['%amount%' => $amount . ' ' . $response->transaction->currency, '%due_date%' => $response->transaction->due_date]); + } + + $note .= '|' . $this->translate('novalnet.invoice-bank-note-account-holder', ['%holder%' => $response->transaction->bank_details->account_holder]); + $note .= '|' . $this->translate('novalnet.invoice-bank-note-iban', ['%iban%' => $response->transaction->bank_details->iban]); + $note .= '|' . $this->translate('novalnet.invoice-bank-note-bic', ['%bic%' => $response->transaction->bank_details->bic]); + $note .= '|' . $this->translate('novalnet.invoice-bank-note-bank', ['%bank%' => $response->transaction->bank_details->bank_name, '%place%' => $response->transaction->bank_details->bank_place]); + $note .= '|' . $this->translate('novalnet.invoice-bank-note-reference-text', []); + if (!empty($response->transaction->invoice_ref)) { + $note .= '|' . $this->translate('novalnet.invoice-bank-note-reference-one', ['%ref1%' => $response->transaction->tid]); + } + $note .= '|' . $this->translate('novalnet.invoice-bank-note-reference-two', ['%ref2%' => $response->transaction->invoice_ref]); + + return $note; + } + + /** + * @param array $response + * + * @return string + */ + protected function getMultibancoComments($response) + { + $amount = number_format($response->transaction->amount / 100, 2, '.'); + $note = null; + $note .= '|' . $this->translate('novalnet.multibanco-reference-note', ['%amount%' => $amount, '%currency%' => $response->transaction->currency]); + $note .= '|' . $this->translate('novalnet.multibanco-reference-comment', ['%ref%' => $response->transaction->partner_payment_reference]); + + return $note; + } + + /** + * @param array $response + * + * @return string + */ + protected function getCashPaymentComments($response) + { + $note = $this->translate('novalnet.cashpayment-slip-expiry-date', ['%date%' => $response->transaction->due_date]); + $note .= '|' . $this->translate('novalnet.cashpayment-stores-near-you', []); + + foreach ($response->transaction->nearest_stores as $count => $storeInfo) { + $note .= "| Store($count):"; + $note .= '|' . $storeInfo->store_name; + $note .= '|' . $storeInfo->country_code; + $note .= '|' . $storeInfo->street; + $note .= '|' . $storeInfo->city; + $note .= '|' . $storeInfo->zip; + } + + return $note; + } + + /** + * @param string $keyName + * @param array $data + * + * @return string + */ + public function translate($keyName, array $data = []) + { + $keyName = $this->glossaryFacade->translate($keyName, $data); + + return $keyName; + } + + /** + * @param string $type + * + * @return string + */ + public function getIpAddress($type = 'REMOTE_ADDR') + { + // Check to determine the IP address type + if ($type == 'SERVER_ADDR') { + if (empty($_SERVER['SERVER_ADDR'])) { + // Handled for IIS server + $ip_address = gethostbyname($_SERVER['SERVER_NAME']); + } else { + $ip_address = $_SERVER['SERVER_ADDR']; + } + } else { // For remote address + $ip_address = $this->getRemoteAddress(); + } + + return (filter_var($ip_address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) ? '127.0.0.1' : $ip_address; + } + + /** + * @return string + */ + public function getRemoteAddress() + { + $ip_keys = ['HTTP_X_FORWARDED_HOST', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR']; + foreach ($ip_keys as $key) { + if (array_key_exists($key, $_SERVER) === true) { + foreach (explode(',', $_SERVER[$key]) as $ip) { + // trim for safety measures + return trim($ip); + } + } + } + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/Payment/PaymentManagerInterface.php b/src/Novalnet/Zed/NovalnetPayment/Business/Payment/PaymentManagerInterface.php new file mode 100755 index 0000000..3a55222 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/Payment/PaymentManagerInterface.php @@ -0,0 +1,141 @@ +config = $config; + } + + /** + * @param \Generated\Shared\Transfer\PaymentMethodsTransfer $paymentMethodsTransfer + * @param \Generated\Shared\Transfer\QuoteTransfer $quoteTransfer + * + * @return \Generated\Shared\Transfer\PaymentMethodsTransfer + */ + public function filterPaymentMethods(PaymentMethodsTransfer $paymentMethodsTransfer, QuoteTransfer $quoteTransfer): PaymentMethodsTransfer + { + $result = new ArrayObject(); + + foreach ($paymentMethodsTransfer->getMethods() as $paymentMethod) { + $enabledPayments[] = $paymentMethod->getMethodName(); + } + + foreach ($paymentMethodsTransfer->getMethods() as $paymentMethod) { + if ( + $this->isPaymentMethodNovalnet($paymentMethod) + && !$this->isAvailable($paymentMethod, $quoteTransfer, $enabledPayments) + ) { + continue; + } + $result->append($paymentMethod); + } + + $paymentMethodsTransfer->setMethods($result); + + return $paymentMethodsTransfer; + } + + /** + * @param \Generated\Shared\Transfer\PaymentMethodTransfer $paymentMethodTransfer + * + * @return bool + */ + protected function isPaymentMethodNovalnet(PaymentMethodTransfer $paymentMethodTransfer): bool + { + return strpos($paymentMethodTransfer->getMethodName(), static::NOVALNET_PAYMENT_METHOD) !== false; + } + + /** + * @param \Generated\Shared\Transfer\PaymentMethodTransfer $paymentMethodTransfer + * + * @return bool + */ + protected function isAvailable(PaymentMethodTransfer $paymentMethodTransfer, QuoteTransfer $quoteTransfer, $enabledPayments): bool + { + $paymentMethod = $paymentMethodTransfer->getMethodName(); + $standardParameter = $this->config->getRequestStandardParameter(); + $orderTotal = $quoteTransfer->getTotals()->getGrandTotal(); + $flag = true; + + if (in_array($paymentMethod, [ 'novalnetSepaGuarantee', 'novalnetInvoiceGuarantee', 'novalnetSepa', 'novalnetInvoice' ], true)) { + if (in_array($paymentMethod, [ 'novalnetInvoiceGuarantee', 'novalnetInvoice' ])) { + $guaranteeMinimumAmount = $standardParameter->getInvoiceGuaranteeMinAmtLimit(); + } elseif (in_array($paymentMethod, [ 'novalnetSepaGuarantee', 'novalnetSepa' ])) { + $guaranteeMinimumAmount = $standardParameter->getSepaGuaranteeMinAmtLimit(); + } + + $guaranteeMinimumAmount = (empty($guaranteeMinimumAmount) || $guaranteeMinimumAmount < 999) ? 999 : $guaranteeMinimumAmount; + + if ( + $orderTotal >= $guaranteeMinimumAmount + && $quoteTransfer->getBillingAddress()->getFirstName() == $quoteTransfer->getShippingAddress()->getFirstName() + && $quoteTransfer->getBillingAddress()->getLastName() == $quoteTransfer->getShippingAddress()->getLastName() + && $quoteTransfer->getBillingAddress()->getAddress1() == $quoteTransfer->getShippingAddress()->getAddress1() + && $quoteTransfer->getBillingAddress()->getAddress2() == $quoteTransfer->getShippingAddress()->getAddress2() + && $quoteTransfer->getBillingAddress()->getCity() == $quoteTransfer->getShippingAddress()->getCity() + && $quoteTransfer->getBillingAddress()->getZipCode() == $quoteTransfer->getShippingAddress()->getZipCode() + && $quoteTransfer->getBillingAddress()->getIso2Code() == $quoteTransfer->getShippingAddress()->getIso2Code() + && $quoteTransfer->getBillingAddress()->getCompany() == $quoteTransfer->getShippingAddress()->getCompany() + && $quoteTransfer->getBillingAddress()->getPhone() == $quoteTransfer->getShippingAddress()->getPhone() + && in_array($quoteTransfer->getBillingAddress()->getIso2Code(), ['DE', 'AT', 'CH'], true) + && $quoteTransfer->getCurrency()->getCode() === 'EUR' + ) { + $flag = true; + if ($paymentMethod === 'novalnetSepa' && in_array('novalnetSepaGuarantee', $enabledPayments, 1)) { + $flag = false; + } elseif ($paymentMethod === 'novalnetInvoice' && in_array('novalnetInvoiceGuarantee', $enabledPayments, 1)) { + $flag = false; + } + } elseif (in_array($paymentMethod, [ 'novalnetSepaGuarantee', 'novalnetInvoiceGuarantee' ], true)) { + $flag = false; + } + } + + return ( !empty($standardParameter->getSignature()) && $flag ) ? true : false; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Business/Payment/PaymentMethodFilterInterface.php b/src/Novalnet/Zed/NovalnetPayment/Business/Payment/PaymentMethodFilterInterface.php new file mode 100755 index 0000000..c1e2166 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Business/Payment/PaymentMethodFilterInterface.php @@ -0,0 +1,17 @@ +getFacade()->processRedirectPaymentResponse($redirectResponseTransfer); + + $orderItems = SpySalesOrderItemQuery::create() + ->useOrderQuery() + ->filterByOrderReference($redirectResponseTransfer->getOrderNo()) + ->endUse() + ->find(); + + $this->getFactory()->getOmsFacade()->triggerEvent('redirect response', $orderItems, []); + + return $response; + } + + /** + * @param \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer $callbackResponseTransfer + * + * @return \Generated\Shared\Transfer\NovalnetCallbackResponseTransfer + */ + public function processCallbackResponseAction(NovalnetCallbackResponseTransfer $callbackResponseTransfer): NovalnetCallbackResponseTransfer + { + $response = $this->getFacade()->processCallbackResponse($callbackResponseTransfer); + + if ($callbackResponseTransfer->getOrderStatus()) { + $orderItems = SpySalesOrderItemQuery::create() + ->useOrderQuery() + ->filterByOrderReference($callbackResponseTransfer->getOrderNo()) + ->endUse() + ->find(); + + if ($callbackResponseTransfer->getOrderStatus() == 'communication_failure') { + $this->getFactory()->getOmsFacade()->triggerEvent('redirect response', $orderItems, []); + } elseif ($callbackResponseTransfer->getOrderStatus() == 'waiting_for_payment') { + $this->getFactory()->getOmsFacade()->triggerEvent('waiting for payment', $orderItems, []); + } elseif ($callbackResponseTransfer->getOrderStatus() == 'paid') { + $this->getFactory()->getOmsFacade()->triggerEvent('callback paid', $orderItems, []); + } elseif ($callbackResponseTransfer->getOrderStatus() == 'canceled') { + $this->getFactory()->getOmsFacade()->triggerEvent('callback canceled', $orderItems, []); + } + } + + return $response; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function transactionDetailsAction(OrderTransfer $orderTransfer): OrderTransfer + { + $response = $this->getFacade()->getTransactionDetails($orderTransfer); + + return $response; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/NovalnetPaymentCommunicationFactory.php b/src/Novalnet/Zed/NovalnetPayment/Communication/NovalnetPaymentCommunicationFactory.php new file mode 100755 index 0000000..46567be --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/NovalnetPaymentCommunicationFactory.php @@ -0,0 +1,38 @@ +getProvidedDependency(NovalnetPaymentDependencyProvider::FACADE_OMS); + } + + /** + * @return \Novalnet\Zed\NovalnetPayment\Dependency\Facade\NovalnetPaymentToSalesInterface + */ + public function getSalesFacade() + { + return $this->getProvidedDependency(NovalnetPaymentDependencyProvider::FACADE_SALES); + } + + /** + * @return \Novalnet\Zed\NovalnetPayment\Dependency\Facade\NovalnetPaymentToRefundInterface + */ + public function getRefundFacade() + { + return $this->getProvidedDependency(NovalnetPaymentDependencyProvider::FACADE_REFUND); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Checkout/NovalnetPaymentPostCheckPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Checkout/NovalnetPaymentPostCheckPlugin.php new file mode 100755 index 0000000..d994aa7 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Checkout/NovalnetPaymentPostCheckPlugin.php @@ -0,0 +1,30 @@ +getFacade()->postSaveHook($quoteTransfer, $checkoutResponseTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Checkout/NovalnetPaymentSaveOrderPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Checkout/NovalnetPaymentSaveOrderPlugin.php new file mode 100755 index 0000000..b5bb2f3 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Checkout/NovalnetPaymentSaveOrderPlugin.php @@ -0,0 +1,32 @@ +getFacade()->saveOrderHook($quoteTransfer, $saveOrderTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/AuthorizePlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/AuthorizePlugin.php new file mode 100755 index 0000000..5f8f757 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/AuthorizePlugin.php @@ -0,0 +1,47 @@ +getOrderTransfer($orderEntity); + $this->getFacade()->authorizePayment($orderTransfer); + + return []; + } + + /** + * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + protected function getOrderTransfer(SpySalesOrder $orderEntity) + { + return $this + ->getFactory() + ->getSalesFacade() + ->getOrderByIdSalesOrder($orderEntity->getIdSalesOrder()); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/CancelPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/CancelPlugin.php new file mode 100755 index 0000000..cf7990b --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/CancelPlugin.php @@ -0,0 +1,47 @@ +getOrderTransfer($orderEntity); + $this->getFacade()->cancelPayment($orderTransfer); + + return []; + } + + /** + * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + protected function getOrderTransfer(SpySalesOrder $orderEntity) + { + return $this + ->getFactory() + ->getSalesFacade() + ->getOrderByIdSalesOrder($orderEntity->getIdSalesOrder()); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/CapturePlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/CapturePlugin.php new file mode 100755 index 0000000..f880b4a --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/CapturePlugin.php @@ -0,0 +1,47 @@ +getOrderTransfer($orderEntity); + $this->getFacade()->capturePayment($orderTransfer); + + return []; + } + + /** + * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + protected function getOrderTransfer(SpySalesOrder $orderEntity) + { + return $this + ->getFactory() + ->getSalesFacade() + ->getOrderByIdSalesOrder($orderEntity->getIdSalesOrder()); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/RefundPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/RefundPlugin.php new file mode 100755 index 0000000..29dbb56 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Command/RefundPlugin.php @@ -0,0 +1,75 @@ +getRefundTransfer($salesOrderItems, $orderEntity); + + $novalnetRefundTransfer = new NovalnetRefundTransfer(); + + $novalnetRefundTransfer->setAmount($refundTransfer->getAmount()); + $novalnetRefundTransfer->setOrder($this->getOrderTransfer($orderEntity)); + + $paymentRefundResult = $this->getFacade()->refundPayment($novalnetRefundTransfer); + + if ($paymentRefundResult->transaction->status == 'CONFIRMED') { + $refundTransfer->setComment($paymentRefundResult->result->status_text); + $this->getFactory() + ->getRefundFacade() + ->saveRefund($refundTransfer); + } + + return []; + } + + /** + * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + protected function getOrderTransfer(SpySalesOrder $orderEntity) + { + return $this + ->getFactory() + ->getSalesFacade() + ->getOrderByIdSalesOrder($orderEntity->getIdSalesOrder()); + } + + /** + * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $salesOrderItems + * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $orderEntity + * + * @return \Generated\Shared\Transfer\RefundTransfer + */ + protected function getRefundTransfer(array $salesOrderItems, SpySalesOrder $orderEntity) + { + return $this + ->getFactory() + ->getRefundFacade() + ->calculateRefund($salesOrderItems, $orderEntity); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsAuthorizeErrorPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsAuthorizeErrorPlugin.php new file mode 100755 index 0000000..db7c642 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsAuthorizeErrorPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isAuthorizeError($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsAuthorizedPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsAuthorizedPlugin.php new file mode 100755 index 0000000..6f95ed9 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsAuthorizedPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isAuthorized($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsCallbackPaidPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsCallbackPaidPlugin.php new file mode 100755 index 0000000..06ff289 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsCallbackPaidPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isCallbackPaid($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentAuthorizedPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentAuthorizedPlugin.php new file mode 100755 index 0000000..1e08b4f --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentAuthorizedPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isPaymentAuthorized($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentCanceledPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentCanceledPlugin.php new file mode 100755 index 0000000..6539d79 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentCanceledPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isPaymentCanceled($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentCapturedPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentCapturedPlugin.php new file mode 100755 index 0000000..d3fc497 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentCapturedPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isPaymentCaptured($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentPaidPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentPaidPlugin.php new file mode 100755 index 0000000..0048daa --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentPaidPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isPaymentPaid($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentRefundedPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentRefundedPlugin.php new file mode 100755 index 0000000..1c0d746 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentRefundedPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isPaymentRefunded($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentVoidedPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentVoidedPlugin.php new file mode 100755 index 0000000..62961ea --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsPaymentVoidedPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isPaymentVoided($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsWaitingForPaymentPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsWaitingForPaymentPlugin.php new file mode 100755 index 0000000..5a55688 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Oms/Condition/IsWaitingForPaymentPlugin.php @@ -0,0 +1,30 @@ +getFkSalesOrder(); + + return $this->getFacade()->isWaitingForPayment($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Payment/NovalnetPaymentMethodFilterPlugin.php b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Payment/NovalnetPaymentMethodFilterPlugin.php new file mode 100755 index 0000000..1e9b8dd --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Communication/Plugin/Payment/NovalnetPaymentMethodFilterPlugin.php @@ -0,0 +1,33 @@ +getFacade()->filterPaymentMethods($paymentMethodsTransfer, $quoteTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToGlossaryBridge.php b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToGlossaryBridge.php new file mode 100755 index 0000000..59262c9 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToGlossaryBridge.php @@ -0,0 +1,33 @@ +glossaryFacade = $glossaryFacade; + } + + /** + * @param string $keyName + * @param array $data + * @param \Generated\Shared\Transfer\LocaleTransfer|null $localeTransfer + * + * @return string + */ + public function translate($keyName, array $data = [], ?LocaleTransfer $localeTransfer = null) + { + return $this->glossaryFacade->translate($keyName, $data, $localeTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToGlossaryInterface.php b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToGlossaryInterface.php new file mode 100755 index 0000000..944d5cd --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToGlossaryInterface.php @@ -0,0 +1,17 @@ +omsFacade = $omsFacade; + } + + /** + * @param string $eventId + * @param \Propel\Runtime\Collection\ObjectCollection $orderItems + * @param array $logContext + * @param array $data + * + * @return array + */ + public function triggerEvent($eventId, ObjectCollection $orderItems, array $logContext, array $data = []) + { + return $this->omsFacade->triggerEvent($eventId, $orderItems, $logContext, $data); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToOmsInterface.php b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToOmsInterface.php new file mode 100755 index 0000000..64cbd1e --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToOmsInterface.php @@ -0,0 +1,18 @@ +refundFacade = $refundFacade; + } + + /** + * @param \Orm\Zed\Sales\Persistence\SpySalesOrderItem[] $salesOrderItems + * @param \Orm\Zed\Sales\Persistence\SpySalesOrder $salesOrderEntity + * + * @return \Generated\Shared\Transfer\RefundTransfer + */ + public function calculateRefund(array $salesOrderItems, SpySalesOrder $salesOrderEntity) + { + return $this->refundFacade->calculateRefund($salesOrderItems, $salesOrderEntity); + } + + /** + * @param \Generated\Shared\Transfer\RefundTransfer $refundTransfer + * + * @return bool + */ + public function saveRefund(RefundTransfer $refundTransfer) + { + return $this->refundFacade->saveRefund($refundTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToRefundInterface.php b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToRefundInterface.php new file mode 100755 index 0000000..6dc9866 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToRefundInterface.php @@ -0,0 +1,24 @@ +salesFacade = $salesFacade; + } + + /** + * @param int $idSalesOrder + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function getOrderByIdSalesOrder($idSalesOrder) + { + return $this->salesFacade->getOrderByIdSalesOrder($idSalesOrder); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToSalesInterface.php b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToSalesInterface.php new file mode 100755 index 0000000..fa9da12 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/NovalnetPaymentToSalesInterface.php @@ -0,0 +1,13 @@ +paymentFacade = $paymentFacade; + } + + /** + * @param \Generated\Shared\Transfer\OrderTransfer $orderTransfer + * + * @return \Generated\Shared\Transfer\OrderTransfer + */ + public function getTransactionDetails($orderTransfer) + { + return $this->paymentFacade->getTransactionDetails($orderTransfer); + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/PaymentToNovalnetPaymentFacadeInterface.php b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/PaymentToNovalnetPaymentFacadeInterface.php new file mode 100755 index 0000000..28267e5 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Dependency/Facade/PaymentToNovalnetPaymentFacadeInterface.php @@ -0,0 +1,13 @@ +get(NovalnetConstants::NOVALNET); + $standardParameter = new NovalnetStandardParameterTransfer(); + // ------------------ Vendor information ---------------------- + $standardParameter->setSignature($settings[NovalnetConstants::NOVALNET_CREDENTIALS_SIGNATURE]); + $standardParameter->setTariffId($settings[NovalnetConstants::NOVALNET_CREDENTIALS_TARIFF]); + $standardParameter->setAccessKey($settings[NovalnetConstants::NOVALNET_CREDENTIALS_ACCESS_KEY]); + $standardParameter->setTestMode($settings[NovalnetConstants::NOVALNET_SANDBOX_MODE]); + // ------------------ Shop information ---------------------- + $standardParameter->setCurrency(Store::getInstance()->getCurrencyIsoCode()); + $standardParameter->setLanguage(Store::getInstance()->getCurrentLanguage()); + $standardParameter->setReturnUrl($settings[NovalnetConstants::NOVALNET_REDIRECT_SUCCESS_URL]); + $standardParameter->setErrorReturnUrl($settings[NovalnetConstants::NOVALNET_REDIRECT_ERROR_URL]); + // ------------------ Payment information ---------------------- + $standardParameter->setPrepaymentDueDate($settings[NovalnetConstants::NOVALNET_PREPAYMENT_DUE_DATE]); + $standardParameter->setInvoiceDueDate($settings[NovalnetConstants::NOVALNET_INVOICE_DUE_DATE]); + $standardParameter->setSepaDueDate($settings[NovalnetConstants::NOVALNET_SEPA_DUE_DATE]); + $standardParameter->setSepaGuaranteeDueDate($settings[NovalnetConstants::NOVALNET_SEPA_GUARANTEE_DUE_DATE]); + $standardParameter->setCpDueDate($settings[NovalnetConstants::NOVALNET_BARZAHLEN_SLIP_EXPIRY_DATE]); + // ------------------ Payment on-hold amount limit ---------------------- + $standardParameter->setCreditCardOnHoldLimit($settings[NovalnetConstants::NOVALNET_CREDIT_CARD_ONHOLD_AMOUNT_LIMIT]); + $standardParameter->setSepaOnHoldLimit($settings[NovalnetConstants::NOVALNET_SEPA_ONHOLD_AMOUNT_LIMIT]); + $standardParameter->setSepaGuaranteeMinAmtLimit($settings[NovalnetConstants::NOVALNET_SEPA_GUARANTEE_MINIMUM_AMOUNT_LIMIT]); + $standardParameter->setSepaGuaranteeOnHoldLimit($settings[NovalnetConstants::NOVALNET_SEPA_GUARANTEE_ONHOLD_AMOUNT_LIMIT]); + $standardParameter->setInvoiceOnHoldLimit($settings[NovalnetConstants::NOVALNET_INVOICE_ONHOLD_AMOUNT_LIMIT]); + $standardParameter->setInvoiceGuaranteeMinAmtLimit($settings[NovalnetConstants::NOVALNET_INVOICE_GUARANTEE_MINIMUM_AMOUNT_LIMIT]); + $standardParameter->setInvoiceGuaranteeOnHoldLimit($settings[NovalnetConstants::NOVALNET_INVOICE_GUARANTEE_ONHOLD_AMOUNT_LIMIT]); + $standardParameter->setPaypalOnHoldLimit($settings[NovalnetConstants::NOVALNET_PAYPAL_ONHOLD_AMOUNT_LIMIT]); + + return $standardParameter; + } + + /** + * @return \Generated\Shared\Transfer\NovalnetCallbackScriptParameterTransfer + */ + public function getCallbackScriptParameter() + { + $settings = $this->get(NovalnetConstants::NOVALNET_CALLBACK); + $standardParameter = new NovalnetCallbackScriptParameterTransfer(); + $standardParameter->setDebugMode($settings[NovalnetConstants::NOVALNET_CALLBACK_DEBUG_MODE]); + $standardParameter->setCallbackMailToAddress($settings[NovalnetConstants::NOVALNET_CALLBACK_EMAIL_TO_ADDRESS]); + + return $standardParameter; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/NovalnetPaymentDependencyProvider.php b/src/Novalnet/Zed/NovalnetPayment/NovalnetPaymentDependencyProvider.php new file mode 100755 index 0000000..ad26c65 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/NovalnetPaymentDependencyProvider.php @@ -0,0 +1,57 @@ +getLocator()->oms()->facade()); + }; + + $container[self::FACADE_SALES] = function (Container $container) { + return new NovalnetPaymentToSalesBridge($container->getLocator()->sales()->facade()); + }; + + $container[self::FACADE_REFUND] = function (Container $container) { + return new NovalnetPaymentToRefundBridge($container->getLocator()->refund()->facade()); + }; + + return $container; + } + + /** + * @param \Spryker\Zed\Kernel\Container $container + * + * @return \Spryker\Zed\Kernel\Container + */ + public function provideBusinessLayerDependencies(Container $container) + { + $container[static::FACADE_GLOSSARY] = function (Container $container) { + return new NovalnetPaymentToGlossaryBridge($container->getLocator()->glossary()->facade()); + }; + + return $container; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Persistence/NovalnetPaymentPersistenceFactory.php b/src/Novalnet/Zed/NovalnetPayment/Persistence/NovalnetPaymentPersistenceFactory.php new file mode 100755 index 0000000..b908cb3 --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Persistence/NovalnetPaymentPersistenceFactory.php @@ -0,0 +1,39 @@ +getFactory() + ->createPaymentNovalnetTransactionLogQuery() + ->filterByFkSalesOrder($idSalesOrder) + ->filterByTransactionType('redirect'); + } + + /** + * @api + * + * @param int $idSalesOrder + * @param string $transactionType + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery + */ + public function queryTransactionByIdSalesOrderAndType(int $idSalesOrder, string $transactionType): SpyPaymentNovalnetTransactionLogQuery + { + return $this->getFactory() + ->createPaymentNovalnetTransactionLogQuery() + ->filterByFkSalesOrder($idSalesOrder) + ->filterByTransactionType($transactionType); + } + + /** + * @api + * + * @param int $idSalesOrder + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery + */ + public function createLastApiLogsByOrderId($idSalesOrder) + { + $query = $this->getFactory()->createPaymentNovalnetTransactionLogQuery() + ->filterByFkSalesOrder($idSalesOrder) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } + + /** + * @api + * + * @param int $orderReference + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery + */ + public function createLastApiLogsByOrderReference($orderReference) + { + $query = $this->getFactory()->createPaymentNovalnetTransactionLogQuery() + ->filterByOrderReference($orderReference) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } + + /** + * @api + * + * @param int $transactionId + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetTransactionLogQuery + */ + public function createLastApiLogsByTransactionId($transactionId) + { + $query = $this->getFactory()->createPaymentNovalnetTransactionLogQuery() + ->filterByTransactionId($transactionId) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } + + /** + * @api + * + * @param int $idSalesOrder + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetCallbackQuery + */ + public function createLastCallbackByOrderId($idSalesOrder) + { + $query = $this->getFactory()->createPaymentNovalnetCallbackQuery() + ->filterByFkSalesOrder($idSalesOrder) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } + + /** + * @api + * + * @param int $orderReference + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetCallbackQuery + */ + public function createLastCallbackByOrderReference($orderReference) + { + $query = $this->getFactory()->createPaymentNovalnetCallbackQuery() + ->filterByOrderReference($orderReference) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } + + /** + * @api + * + * @param int $idSalesOrder + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetDetailQuery + */ + public function createLastDetailByOrderId($idSalesOrder) + { + $query = $this->getFactory()->createPaymentNovalnetDetailQuery() + ->filterByFkSalesOrder($idSalesOrder) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } + + /** + * @api + * + * @param int $orderReference + * + * @return \Orm\Zed\Novalnet\Persistence\SpyPaymentNovalnetDetailQuery + */ + public function createLastDetailByOrderReference($orderReference) + { + $query = $this->getFactory()->createPaymentNovalnetDetailQuery() + ->filterByOrderReference($orderReference) + ->orderByCreatedAt(Criteria::DESC); + + return $query; + } +} diff --git a/src/Novalnet/Zed/NovalnetPayment/Persistence/NovalnetPaymentQueryContainerInterface.php b/src/Novalnet/Zed/NovalnetPayment/Persistence/NovalnetPaymentQueryContainerInterface.php new file mode 100755 index 0000000..c0e5f1f --- /dev/null +++ b/src/Novalnet/Zed/NovalnetPayment/Persistence/NovalnetPaymentQueryContainerInterface.php @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ +