From 084001d59b5c4aaf9971eeb3f866d78fefdad623 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Wed, 3 Jul 2024 14:23:13 +0300 Subject: [PATCH] PIPRES-441: new payment methods added and giropay method deleted --- Makefile | 14 ++++++++++++-- README.md | 2 +- README_DE.md | 5 ----- README_ES.md | 5 ----- README_FR.md | 5 ----- README_NL.md | 5 ----- controllers/front/webhook.php | 2 +- .../03_mollie.ps1785.PaymentTestsOrdersAPI.js | 14 +------------- .../05_mollie.ps1785.PaymentTestsPaymentsAPI.js | 14 +------------- .../e2e/ps8/03_mollie.ps8.PaymentTestsOrdersAPI.js | 13 ------------- .../ps8/05_mollie.ps8.PaymentTestsPaymentsAPI.js | 13 ------------- cypress/support/commands.js | 4 ++-- src/Config/Config.php | 10 ++++++++-- src/Service/ApiService.php | 3 +++ src/Service/TransactionService.php | 5 +++++ 15 files changed, 34 insertions(+), 80 deletions(-) diff --git a/Makefile b/Makefile index 7c3ace459..dea5c6703 100755 --- a/Makefile +++ b/Makefile @@ -93,6 +93,16 @@ prepare-zip: cp .github/.htaccess vendor/.htaccess rm -rf .git .docker .editorconfig .github tests .php-cs-fixer.php Makefile cypress .docker cypress.config.js cypress.env.json docker-compose*.yml .gitignore bin codeception.yml package-lock.json package.json .php_cs.dist .php-cs-fixer.dist - - +# Define SQL commands +SQL_COMMANDS := \ + "UPDATE \`ps_configuration\` SET \`value\` = '1' WHERE \`name\` = 'PS_SSL_ENABLED';" \ + "UPDATE \`ps_configuration\` SET \`value\` = '1' WHERE \`name\` = 'PS_SSL_ENABLED_EVERYWHERE';" \ + "UPDATE \`ps_shop_url\` SET \`domain\` = '$(DOMAIN_NAME)' WHERE active = 1;" \ + "UPDATE \`ps_shop_url\` SET \`domain_ssl\` = '$(DOMAIN_NAME)' WHERE active = 1;" + +# Target to change shop URL +change-shop-url: + @echo "Executing SQL commands to change shop URL..." + docker exec -i $(DOCKER_CONTAINER_NAME) mysql -u$(MYSQL_USER) -p$(MYSQL_PASSWORD) $(MYSQL_DATABASE) -e "$(SQL_COMMANDS)" + @echo "Shop URL updated successfully." diff --git a/README.md b/README.md index 639346878..847b381e4 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Receive payments from European customers with ease. Mollie provides payment meth Choose the best payment provider available for your online PrestaShop store. Create your merchant account at [Mollie.com](https://www.mollie.com/). -Mollie supports the following payment methods: iDEAL, Credit card, Bancontact, SOFORT Banking, ING Home’Pay, Bank transfers, PayPal, KBC / CBC Payment Button, Belfius, CartaSi, Cartes Bancaires, EPS, Giropay, Klarna: Pay later, Klarna: Slice it +Mollie supports the following payment methods: iDEAL, Credit card, Bancontact, SOFORT Banking, ING Home’Pay, Bank transfers, PayPal, KBC / CBC Payment Button, Belfius, CartaSi, Cartes Bancaires, EPS, Klarna: Pay later, Klarna: Slice it [![Build Status](https://travis-ci.org/mollie/PrestaShop.svg?branch=master)](https://travis-ci.org/mollie/PrestaShop) [![Greenkeeper badge](https://badges.greenkeeper.io/mollie/PrestaShop.svg)](https://greenkeeper.io/) diff --git a/README_DE.md b/README_DE.md index acf6f2a01..c255125c5 100644 --- a/README_DE.md +++ b/README_DE.md @@ -128,11 +128,6 @@ Die Karten tragen ebenfalls das Markenzeichen von Visa. Dies macht sie zur wichtigsten Zahlungsmethode in Österreich, die bei österreichischen Konsumenten hohe Beliebtheit genießt. -### Giropay -[Giropay](https://www.mollie.com/de/payments/giropay). Giropay ist eine der beliebtesten Überweisungsmethoden Deutschlands. - -Deutsche Kunden schenken dieser Zahlungsmethode ihr Vertrauen, da sie von über 1.500 Banken landesweit unterstützt wird. - ### Klarna: Rechnung [Klarna: Rechnung](https://www.mollie.com/de/payments/klarna-pay-later). Klarna ist eine flexible Zahlungslösung, die Ihren Kunden verschiedene, flexible Zahlungsmöglichkeiten zur Verfügung stellt. diff --git a/README_ES.md b/README_ES.md index 1bf6155e9..df0f1fe9a 100644 --- a/README_ES.md +++ b/README_ES.md @@ -128,11 +128,6 @@ Las tarjetas que comparten marca con Visa. Esto hace que el EPS sea el principal tipo de pago por transferencia bancaria en Austria y muy popular entre los compradores austriacos. -### Giropay -[Giropay](https://www.mollie.com/es/payments/giropay). Giropay es un tipo de pago por transferencia bancaria, popular en Alemania. - -Utiliza más de 1.500 bancos alemanes, lo que lo convierte en un tipo de pago confiable para los clientes alemanes. - ### Klarna: Pay later [Klarna: Pay later](https://www.mollie.com/es/payments/klarna-pay-later). Klarna es una solución de pago flexible que les permite a sus clientes diversas formas de pago flexibles. diff --git a/README_FR.md b/README_FR.md index ccd4ff9d5..bb1cc73e5 100644 --- a/README_FR.md +++ b/README_FR.md @@ -128,11 +128,6 @@ Les cartes sont co-marquées avec Visa. Devenue très populaire auprès des consommateurs autrichiens, EPS est la référence en matière de virement bancaire en Autriche. -### Giropay -[Giropay](https://www.mollie.com/fr/payments/giropay). Giropay est une méthode de paiement très populaire de virement bancaire en Allemagne. - -Utilisé par plus de 15000 à travers le pays, cela en fait un moyen de paiement fiable, réputé auprès des consommateurs allemands. - ### Klarna : Pay later [Klarna : Pay later](https://www.mollie.com/fr/payments/klarna-pay-later). Klarna est une solution de paiement flexible, qui permet à vos clients des modes de paiement variés. diff --git a/README_NL.md b/README_NL.md index c2d142407..3b9554016 100644 --- a/README_NL.md +++ b/README_NL.md @@ -117,11 +117,6 @@ De kaarten zijn co-branded met Visa. Dit maakt EPS de belangrijkste betaalmethode voor bankoverboekingen in Oostenrijk en zeer populair bij Oostenrijkse klanten. -### Giropay -[Giropay](https://www.mollie.com/nl/payments/giropay). Giropay is een populaire bankoverboeking betaalmethode in Duitsland. - -Het maakt gebruik van meer dan 1.500 Duitse banken, waardoor het een vertrouwde betaalmethode is onder Duitse klanten. - ### Klarna: Achteraf betalen [Klarna: Achteraf betalen](https://www.mollie.com/nl/payments/klarna-pay-later). Klarna is een flexibele betaaloplossing, waarmee je je klanten diverse mogelijkheden voor uitgestelde betaling biedt. diff --git a/controllers/front/webhook.php b/controllers/front/webhook.php index fa2710aa3..251bfade8 100644 --- a/controllers/front/webhook.php +++ b/controllers/front/webhook.php @@ -131,7 +131,7 @@ protected function executeWebhook(string $transactionId): void } else { $transaction = $this->module->getApiClient()->payments->get($transactionId); - if ($transaction->orderId) { + if ($transaction->orderId && $transaction->status !== 'expired') { $transaction = $this->module->getApiClient()->orders->get($transaction->orderId, ['embed' => 'payments']); } } diff --git a/cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js b/cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js index 9f28a15a3..9d69131bc 100755 --- a/cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js +++ b/cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js @@ -215,19 +215,7 @@ it('C339365: 28 Przelewy24 Checkouting [Orders API]', () => { it('C339366: 29 Przelewy24 Order Shipping, Refunding [Orders API]', () => { cy.OrderRefundingShippingOrdersAPI() }) -it('C339367: 30 Giropay Checkouting [Orders API]', () => { - cy.navigatingToThePayment() - //Payment method choosing - cy.contains('giropay').click({force:true}) - cy.get('.condition-label > .js-terms').click({force:true}) - cy.contains('Place order').click() - cy.get('[value="paid"]').click() - cy.get('[class="button form__button"]').click() - cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') -}); -it('C339368: 31 Giropay Order Shipping, Refunding [Orders API]', () => { - cy.OrderRefundingShippingOrdersAPI() -}) + it('C339369: 32 EPS Checkouting [Orders API]', () => { cy.navigatingToThePayment() //Payment method choosing diff --git a/cypress/e2e/ps1785/05_mollie.ps1785.PaymentTestsPaymentsAPI.js b/cypress/e2e/ps1785/05_mollie.ps1785.PaymentTestsPaymentsAPI.js index faffc9163..a78b25544 100755 --- a/cypress/e2e/ps1785/05_mollie.ps1785.PaymentTestsPaymentsAPI.js +++ b/cypress/e2e/ps1785/05_mollie.ps1785.PaymentTestsPaymentsAPI.js @@ -180,19 +180,7 @@ it('C339391: 56 Przelewy24 Checkouting [Payments API]', () => { it('C339392: 57 Przelewy24 BO Refunding, Partial Refunding [Payments API]', () => { cy.OrderRefundingPartialPaymentsAPI() }); -it('C339393: 58 Giropay Checkouting [Payments API]', () => { - cy.navigatingToThePayment() - //Payment method choosing - cy.contains('giropay').click({force:true}) - cy.get('.condition-label > .js-terms').click({force:true}) - cy.contains('Place order').click() - cy.get('[value="paid"]').click() - cy.get('[class="button form__button"]').click() - cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') -}); -it('C339394: 59 Giropay BO Refunding, Partial Refunding [Payments API]', () => { - cy.OrderRefundingPartialPaymentsAPI() -}); + it('C339395: 60 EPS Checkouting [Payments API]', () => { cy.navigatingToThePayment() //Payment method choosing diff --git a/cypress/e2e/ps8/03_mollie.ps8.PaymentTestsOrdersAPI.js b/cypress/e2e/ps8/03_mollie.ps8.PaymentTestsOrdersAPI.js index 85586a8c3..c6964ffa2 100755 --- a/cypress/e2e/ps8/03_mollie.ps8.PaymentTestsOrdersAPI.js +++ b/cypress/e2e/ps8/03_mollie.ps8.PaymentTestsOrdersAPI.js @@ -204,19 +204,6 @@ it('C339365: 28 Przelewy24 Checkouting [Orders API]', () => { it('C339366: 29 Przelewy24 Order Shipping, Refunding [Orders API]', () => { cy.OrderRefundingShippingOrdersAPI() }) -it('C339367: 30 Giropay Checkouting [Orders API]', () => { - cy.navigatingToThePaymentPS8() - //Payment method choosing - cy.contains('giropay').click({force:true}) - cy.get('.condition-label > .js-terms').click({force:true}) - cy.contains('Place order').click() - cy.get('[value="paid"]').click() - cy.get('[class="button form__button"]').click() - cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') -}); -it('C339368: 31 Giropay Order Shipping, Refunding [Orders API]', () => { - cy.OrderRefundingShippingOrdersAPI() -}) it('C339369: 32 EPS Checkouting [Orders API]', () => { cy.navigatingToThePaymentPS8() //Payment method choosing diff --git a/cypress/e2e/ps8/05_mollie.ps8.PaymentTestsPaymentsAPI.js b/cypress/e2e/ps8/05_mollie.ps8.PaymentTestsPaymentsAPI.js index fd98721ef..8b0657a29 100755 --- a/cypress/e2e/ps8/05_mollie.ps8.PaymentTestsPaymentsAPI.js +++ b/cypress/e2e/ps8/05_mollie.ps8.PaymentTestsPaymentsAPI.js @@ -170,19 +170,6 @@ it('C339391: 56 Przelewy24 Checkouting [Payments API]', () => { it('C339392: 57 Przelewy24 BO Refunding, Partial Refunding [Payments API]', () => { cy.OrderRefundingPartialPaymentsAPI() }); -it('C339393: 58 Giropay Checkouting [Payments API]', () => { - cy.navigatingToThePaymentPS8() - //Payment method choosing - cy.contains('giropay').click({force:true}) - cy.get('.condition-label > .js-terms').click({force:true}) - cy.contains('Place order').click() - cy.get('[value="paid"]').click() - cy.get('[class="button form__button"]').click() - cy.get('#content-hook_order_confirmation > .card-block').should('be.visible') -}); -it('C339394: 59 Giropay BO Refunding, Partial Refunding [Payments API]', () => { - cy.OrderRefundingPartialPaymentsAPI() -}); it('C339395: 60 EPS Checkouting [Payments API]', () => { cy.navigatingToThePaymentPS8() //Payment method choosing diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 860faab4d..c398bce51 100755 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -42,7 +42,7 @@ import 'cypress-iframe'; // Cypress.Commands.add("login", (email, password) => { ... }) Cypress.Commands.add("ConfOrdersAPI1784", () => { - const paymentMethods = ["applepay", "ideal", "creditcard", "in3", "klarnapaylater", "klarnapaynow", "klarnasliceit", "paypal", "banktransfer", "bancontact", "eps", "giropay", "przelewy24", "kbc", "belfius", "voucher", "directdebit", "billie", "klarna", "twint", "blik", "bancomatpay"]; + const paymentMethods = ["applepay", "ideal", "creditcard", "in3", "klarnapaylater", "klarnapaynow", "klarnasliceit", "paypal", "banktransfer", "bancontact", "eps", "przelewy24", "kbc", "belfius", "voucher", "directdebit", "billie", "klarna", "twint", "blik", "bancomatpay"]; // Iterate through the paymentMethods array using forEach paymentMethods.forEach(method => { @@ -59,7 +59,7 @@ Cypress.Commands.add("ConfOrdersAPI1784", () => { }) Cypress.Commands.add("ConfPaymentsAPI1784", () => { - const paymentMethods = ["giropay", "eps", "przelewy24", "kbc", "belfius", "bancontact", "creditcard", "ideal", "banktransfer", "paypal", "applepay", "twint", "blik", "bancomatpay"]; + const paymentMethods = ["eps", "przelewy24", "kbc", "belfius", "bancontact", "creditcard", "ideal", "banktransfer", "paypal", "applepay", "twint", "blik", "bancomatpay"]; // Iterate through the paymentMethods array using forEach paymentMethods.forEach(method => { diff --git a/src/Config/Config.php b/src/Config/Config.php index 6ca067414..2ce5beaab 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -47,7 +47,6 @@ class Config 'ideal' => ['nl'], 'bancontact' => ['be'], 'paypal' => [], - 'giropay' => ['de'], 'eps' => ['at'], 'belfius' => ['be'], 'inghomepay' => ['be'], @@ -64,6 +63,9 @@ class Config 'ro', 'bl', 'mf', 'pm', 'sm', 'sk', 'sl', 'es', 'se', 'ch', 'gb', 'uk', ], 'mybank' => [], + 'trustly' => ['at', 'de', 'ee', 'es', 'fi', 'lt', 'lv', 'nl'], + 'riverty' => ['nl','be','de','at'], + 'payconiq' => [], ]; const SUPPORTED_PHP_VERSION = '5.6'; @@ -240,6 +242,7 @@ class Config const MOLLIE_METHOD_ID_APPLE_PAY = 'applepay'; const MOLLIE_VOUCHER_METHOD_ID = 'voucher'; const MOLLIE_in3_METHOD_ID = 'in3'; + const RIVERTY = 'riverty'; const MOLLIE_VOUCHER_CATEGORY_NULL = 'null'; const MOLLIE_VOUCHER_CATEGORY_MEAL = 'meal'; @@ -275,6 +278,7 @@ class Config PaymentMethod::BILLIE, self::MOLLIE_VOUCHER_METHOD_ID, self::MOLLIE_in3_METHOD_ID, + self::RIVERTY, ]; const PAYMENT_API_ONLY_METHODS = [ @@ -301,7 +305,6 @@ class Config 'directdebit' => 'Direct Debit', 'eps' => 'EPS', 'giftcard' => 'Giftcard', - 'giropay' => 'Giropay', 'ideal' => 'iDEAL', 'inghomepay' => 'ING Homepay', 'kbc' => 'KBC', @@ -322,6 +325,9 @@ class Config 'alma' => 'Alma', 'blik' => 'BLIK', 'klarna' => 'Pay with Klarna.', + 'riverty' => 'Riverty', + 'payconiq' => 'Payconiq', + 'trustly' => 'Trustly', ]; const MOLLIE_BUTTON_ORDER_TOTAL_REFRESH = 'MOLLIE_BUTTON_ORDER_TOTAL_REFRESH'; diff --git a/src/Service/ApiService.php b/src/Service/ApiService.php index 4f557430c..f7629d5f8 100644 --- a/src/Service/ApiService.php +++ b/src/Service/ApiService.php @@ -123,6 +123,9 @@ public function getMethodsForConfig(MollieApiClient $api) $apiMethods = $apiMethods->getArrayCopy(); /** @var Method $method */ foreach ($apiMethods as $key => $method) { + if ($method->status === 'pending-review') { // TODO REMOVE THIS ONCE RIVERTY IS IMPLEMENTED + continue; + } if ($method->status !== 'activated') { unset($apiMethods[$key]); } diff --git a/src/Service/TransactionService.php b/src/Service/TransactionService.php index d34a154e0..2b1781ac4 100644 --- a/src/Service/TransactionService.php +++ b/src/Service/TransactionService.php @@ -170,6 +170,9 @@ public function processTransaction($apiPayment) return $apiPayment; } + /** @var PrestaLoggerInterface $logger */ + $logger = $this->module->getService(PrestaLoggerInterface::class); + $logger->error($apiPayment->resource); switch ($apiPayment->resource) { case Config::MOLLIE_API_STATUS_PAYMENT: PrestaShopLogger::addLog(__METHOD__ . ' said: Starting to process PAYMENT transaction.', Config::NOTICE); @@ -284,6 +287,8 @@ public function processTransaction($apiPayment) $this->configurationAdapter->get(Config::MOLLIE_AUTHORIZABLE_PAYMENT_INVOICE_ON_STATUS) === Config::MOLLIE_AUTHORIZABLE_PAYMENT_STATUS_DEFAULT; + + $logger->error($apiPayment->method); if ( !$isAuthorizablePaymentInvoiceOnStatusDefault && $apiPayment->status === OrderStatus::STATUS_COMPLETED