Giter Club home page Giter Club logo

paytrail-for-adobe-commerce's Introduction

Paytrail for Adobe Commerce

Paytrail payment service for Adobe Commerce (formerly known as Magento 2)

WARNING: This module is not compatible with Markup/Paytrail module. Using both modules will cause errors.

Always perform a backup of your database and source code before installing any extensions.

This module has been tested on Adobe Commerce / Magento 2.4.5, 2.4.4 and 2.3.X {community|commerce} versions. Support for 2.2.X has ended and compatibility with older versions cannot be guaranteed.

Adobe Commerce system requirements per tested version can be found here.

Features

This payment module has the following features:

  • Payment methods provided by Paytrail payment service
  • The ability to restore and ship a cancelled order
  • Support for delayed payments (Collector etc.)
  • Support for multiple stores within a single Magento 2 instance
  • Recurring Payments

Installation

The module only supports installation via composer.

Steps:

  1. Make sure that you have Magento file system owner rights.
  2. Navigate to your Adobe Commerce root folder on the command line and enter:
    composer require paytrail/paytrail-for-adobe-commerce:<latest_version> --no-update
  3. If your credentials are asked, enter your Adobe Commerce marketplace access keys.
  4. Enter command:
    composer update paytrail/paytrail-for-adobe-commerce
  5. Run the following commands:
    php bin/magento module:enable Paytrail_PaymentService
    php bin/magento setup:upgrade
    php bin/magento setup:di:compile
    bin/magento setup:static-content:deploy
  6. Navigate to Adobe Commerce admin interface and select Stores -> Store Configuration -> Sales -> Payment Methods -> Paytrail for Adobe Commerce
  7. Enter your credentials and enable the module (Test credentials)
  8. Clear the cache

Usage

The module settings can be found from: Stores -> Configuration -> Sales -> Payment Methods -> Paytrail for Adobe Commerce

The module has the following settings:

  • Enable: Defines whether the payment method is enabled or not (Input: Yes / No)
  • Payment method selection on a separate page: Display payment method selection on a separate page (Input: Yes / No)
  • Merchant ID: Your Paytrail merchant ID (Input: Text)
  • Merchant Secret: Your Paytrail merchant secret (Input: Secret)
  • New Order Status: A custom status for a new order paid for with Paytrail (Input: Selection)
  • Email Address For Notifications: If a payment has been processed after the order has been cancelled, a notification will be sent to the merchant so that they can reactivate and ship the order (Input: Email address)
  • Payment from Applicable Countries: Allow payments from all countries or specific countries (Input: All / Specific)
  • Payment from Specific Countries: If the previous setting has been set to specific countries, this list can define the allowed countries (Input: Selection)

Setting up Recurring Payments

The module now supports recurring payments. Please refer to the full instructions on Recurring Payments to set it up.

Refunds

This payment module supports online refunds.

Steps:

  1. Navigate to Sales -> Orders and select the order you need to fully or partially refund
  2. Select Invoices from Order View side bar
  3. Select the invoice
  4. Select Credit Memo
  5. Define the items you want to refund and optionally define an adjustment fee
  6. Click Refund

Canceled order payment email notification

If the customer closes the browser window right after completing the payment BUT before returning to the store, Adobe Commerce is left with a “Pending payment” status for the order. This status has a timeout, so if the payment confirmation does not arrive within 8 hours of the purchase, Adobe Commerce automatically cancels the order. Paytrail informs Adobe Commerce of a payment that has gone through, but it may take over 8 hours.

When the confirmation is finally made, Adobe Commerce registers the transaction to the order and changes the order status to Processing. But since the stock may have changed in the interim, the items are still cancelled. The merchant will receive an email informing about the payment that has gone through, but they have to manually go to said order, make sure the items are still available, and click “Restore order” to be able to ship it.

Adjust the timeout
The timeout period of 8 hours can be adjusted in Adobe Commerce configuration. A longer period may allow for Paytrail to confirm the order before it gets canceled, but it also reserves the stock for that exact time.

  1. Go to Stores -> Configuration -> Sales -> Sales -> Orders Cron Settings
  2. Adjust the Pending Payment Order Lifetime (minutes) value to your liking.

Order status

Pending Payment
Assigned to an order when customer is redirected to the payment provider of their choosing.

Pending Paytrail Payment Service
Assigned to an order if Paytrail for Adobe Commerce is still waiting for a confirmation of payment. Applies to invoices, such as Collector.

Processing
Assigned to an order once payment is completed and items are ready for shipping.

Canceled
Assigned to an order if Pending Payment status has been active for over 8 hours.

Available statuses:

  • Processing
  • Suspected Fraud
  • Pending Payment
  • Pending Paytrail Payment Service
  • Payment Review
  • Pending
  • On Hold
  • Complete
  • Closed
  • Canceled

Multiple stores

If you have multiple stores, you can set up the payment module differently depending on the selected store. In configuration settings, there is a selection for Store View.

By changing the Store View, you can define different settings for each store within the Adobe Commerce instance.

Rounding problems with certain providers (Collector)

In some cases, this module might send a so-called "rounding-row" item in the order data, which might result in an error if this value is negative (this has been observed with Collector payment method). This is related to how Adobe Commerce calculates and rounds taxes and how this module compensates for possible mismatches between the total and sum of individual items.

There are three algorithms for tax calculation in Adobe Commerce which can be set in Stores -> Configuration -> Sales -> Tax -> Tax Calculation Method Based On

  • Unit Price based
  • Row Total based
  • Total based

If the described error occurs when the calculation algorithm is Total based, changing it to Unit Price based might result in tax calculation with no mismatches.

Note: Changing the setting does not mean that the Unit Price based algorithm is better than Total or Row Total based, all three can have rounding issues in certain situations that can be resolved by choosing one of the other algorithms. The algorithms end up with the same calculations majority of the time.


Disclaimer: This open source module is provided to help merchants get started with our payment service. However, we do not offer any warranty or guarantee that the module will work as intended and provide limited support for it. Use at your own risk.

paytrail-for-adobe-commerce's People

Contributors

bartoszkaluzny-solteq avatar juhanihaapala avatar konrad-konieczny avatar loueranta-paytrail avatar maleksei avatar nikitasedletskiy avatar nikolaybaychenko avatar richard-madarasz avatar robert-chmielewski avatar seppo-konttinen-solteq avatar sheepfy avatar taskula avatar tommi-martin avatar vuorelaj-p avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

paytrail-for-adobe-commerce's Issues

Incorrect error message

Describe the bug
If a required checkbox is unchecked when clicking "Place Order", a red banner pops up saying "No payment method selected. Please select one."

To Reproduce

  1. Select a payment method
  2. Leave a required checkbox unchecked
  3. Click "Place Order"

Expected behavior
Only a red text under the checkbox saying "This is a required field."

Return Error on Save CARD from checkout

Describe the bug

When click on save card from checkout it redirect to enter card details, when enter details and submit i got this error

1 exception(s): Exception #0 (Paytrail\PaymentService\Exceptions\CheckoutException): Client error: POST https://services.paytrail.com/tokenization/e7886a28-87b3-483e-8851-0ff10dad8c3e` resulted in a 422 Unprocessable Entity response:
{"status":"error","message":"Unexpected response code: 200.100"}
`
To Reproduce

  1. Add product to cart
  2. Go to checkout fill all details and select payment method.
  3. You can see the button to Save Card for logged in user.

Expected behavior

Screenshots

Additional context

Custom order status assignment is not working properly

Description

we have custom status for order and assigned as "New order status" on paytrail payment at store configuration. But when order is placed using paytrail method, and payment is captured online. So invoice is generated at order time. but when we create shipment for that order, order status should be complete, but it's not updated.

Expected Behavior

Suppose I created new status with code invoiced and assign processing as state, then in it should assign processing as state to order.

Actual Behavior

For now its assigning invoiced as order state

Note

It's important to address this issue promptly as it impacts the correct functioning of order management in Magento and may lead to confusion among Admins.

PHP7.x compatibility issues in version 1.4.3

Describe the bug

There is still non-backwards compatible php syntax in the module which causes bin/magento setup:di:compile to fail with the error below. I suspect it to be caused by class properties being declared with the syntax private ClassName $foo

syntax error, unexpected 'private' (T_PRIVATE), expecting variable (T_VARIABLE)#0 /var/www/html/vendor/composer/ClassLoader.php(443): Composer\Autoload\ClassLoader::Composer\Autoload\{closure}('/var/www/html/v...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Paytrail\\Paymen...')
#2 [internal function]: spl_autoload_call('Paytrail\\Paymen...')
#3 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php(134): class_exists('Paytrail\\Paymen...')

To Reproduce

Run bin/magento setup:di:compile with module version 1.4.3 and PHP 7.x

A problem occurred during Paytrail Api connection: Items units can't be a negative number

I have an order with 3 x 74.65 priced product, 9.90 shopping row and discount code of 10.
in file: vendor/paytrail/paytrail-for-adobe-commerce/Helper/ApiData.php::getOrderItemLines
we get a $itemSum != $orderTotal which created the rounding-row with units of -1 .

Then, in file: vendor/paytrail/paytrail-php-sdk/src/Model/Item.php::validate
we have this validation:
if ($props['units'] < 0) {
throw new ValidationException('Items units can't be a negative number');
}

If customer does not choose payment method order is created with status "Pending Payment"

Describe the bug
If a customer does not choose payment method and proceeds to transaction order is created and left behind with a status "Pending Payment". This generates a lot of ghost orders.

To Reproduce
Order something and do not choose payment method. Click proceed a couple of times and see Sales -> Orders. For every click there is a new order that has been created.

Expected behavior
Order should be overwritten.

Could not reproduce this issue - closing it

Callback does not process payment when order is pending but status is not "pending_payment"

Describe the bug
We've had a couple of payments where when customer is not for some reason redirected back to /payment/receipt, then Magento only receives a callback request to /payment/callback, and the order then does not change status and stays in pending state.

I've debugged it down to this condition which has hardcoded pending_payment status and determines whether order processing at this callback should commence.

if ($status == 'pending_payment' || in_array($status, Receipt::ORDER_CANCEL_STATUSES)) {
// order status could be changed by receipt
// if not, status change needs to be forced by processing the payment
$response['error'] = $this->processPayment->process($this->request->getParams(), $this->session);

Our orders are in pending status, so this condition is never true. As a temporary solution we've managed to get this working by adding an additional || $status == 'pending' condition. Could we implement another way to force payment processing instead of checking hardcoded order status? I honestly don't know why our installation has pending as default and not pending_payment, but hardcoding at a quick glance doesn't seem like a nice way to handle things.

To Reproduce

  1. Have order in "pending" status
  2. GET /paytrail/callback/?checkout-account=xxx&checkout-algorithm=sha256&checkout-amount=xxx&checkout-stamp=xxx&checkout-reference=xxx&checkout-status=ok&checkout-provider=xxx&checkout-transaction-id=xxxsignature=xxx
  3. Observe order stays in pending status

Expected behavior

  1. Have order in "pending" status
  2. GET /paytrail/callback/?checkout-account=xxx&checkout-algorithm=sha256&checkout-amount=xxx&checkout-stamp=xxx&checkout-reference=xxx&checkout-status=ok&checkout-provider=xxx&checkout-transaction-id=xxxsignature=xxx
  3. Observe order moving to processing status

Additional context
On a side note, the line inside this block dies and needs fixing. See #78

$response['error'] = $this->processPayment->process($this->request->getParams(), $this->session);

main.CRITICAL: Error: Cannot use object of type Magento\Framework\Controller\Result\Json\Interceptor as array in /vendor/paytrail/paytrail-for-adobe-commerce/Controller/Callback/Index.php:59

Product edit page: "componentType" configuration parameter is required for the "" component

Describe the bug
If recurring_payment_schedule attribute is removed from attribute sets AND Paytrail recurring payments is set to NO, Magento will produce an error on product edit page:

1 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): The "componentType" configuration parameter is required for the "" component.

To Reproduce
Either delete attribute recurring_payment_schedule or remove it from attribute sets and set "Enabled Recurring payment" to NO. Then try to edit any product.

Expected behavior
Expected not to have an error on product edit page.

Additional context
Not a critical error and easy enough to circumvent (just don't delete the attribute and keep it in attribute sets), but still an issue that shouldn't happen. Also filing this bug report just in case someone else stumbles upon it.

PHP7.x compatibility issues in version 1.4.2

Describe the bug

There is still PHP7.x compatibility issues in version 1.4.2 even composer allows PHP7.3.

To Reproduce

Run code compiler with Magento version (<= 2.4.3-p3) that runs on PHP7.x:
bin/magento setup:di:compile

Expected behavior

No errors during code compilation.

Screenshots

Additional context

Patch we applied for 1.4.2 to fix these issues:

--- Helper/ApiData.php.orig	2023-08-08 19:37:57
+++ Helper/ApiData.php	2023-08-08 19:40:47
@@ -416,7 +416,7 @@
      *
      * @throws \Paytrail\PaymentService\Exceptions\CheckoutException
      */
-    private function setRefundRequestData(RefundRequest $paytrailRefund, float|int|null $amount): void
+    private function setRefundRequestData(RefundRequest $paytrailRefund, $amount): void
     {
         if ($amount <= 0) {
             $this->helper->processError('Refund amount must be above 0');
@@ -439,7 +439,7 @@
      */
     private function setEmailRefundRequestData(
         EmailRefundRequest $paytrailEmailRefund,
-        float|int|null $amount,
+        $amount,
         Order $order
     ): void {
         $paytrailEmailRefund->setEmail($order->getBillingAddress()->getEmail());
--- Model/Email/Order/PendingOrderEmailConfirmation.php.orig	2023-08-08 19:48:50
+++ Model/Email/Order/PendingOrderEmailConfirmation.php	2023-08-08 19:48:54
@@ -24,7 +24,7 @@
     public function __construct(
         ScopeConfigInterface $scopeConfig,
         OrderSender          $orderSender,
-        LoggerInterface      $logger,
+        LoggerInterface      $logger
     ) {
         $this->scopeConfig = $scopeConfig;
         $this->orderSender = $orderSender;
--- Model/FinnishReferenceNumber.php.orig	2023-08-08 19:50:24
+++ Model/FinnishReferenceNumber.php	2023-08-08 19:52:14
@@ -11,15 +11,27 @@
 
 class FinnishReferenceNumber
 {
+    private $gatewayConfig;
+
+    private $orderFactory;
+
+    private $orderRepository;
+
+    private $criteriaBuilderFactory;
+
     /**
      * FinnishReferenceNumber constructor.
      */
     public function __construct(
-        private readonly Config $gatewayConfig,
-        private readonly OrderFactory $orderFactory,
-        private readonly OrderRepositoryInterface $orderRepository,
-        private readonly SearchCriteriaBuilderFactory $criteriaBuilderFactory
+        Config $gatewayConfig,
+        OrderFactory $orderFactory,
+        OrderRepositoryInterface $orderRepository,
+        SearchCriteriaBuilderFactory $criteriaBuilderFactory
     ) {
+        $this->gatewayConfig = $gatewayConfig;
+        $this->orderFactory = $orderFactory;
+        $this->orderRepository = $orderRepository;
+        $this->criteriaBuilderFactory = $criteriaBuilderFactory;
     }
 
     /**

Composer update fails on PHP 8.1

Describe the bug
Composer requirements on composer.json prevent update from 1.1.1 -> 1.1.2 with Magento version 2.4.4 running PHP 8.*

To Reproduce
Update PHP version to 8.* and try running:

composer update

Problem 1
- Root composer.json requires paytrail/paytrail-for-adobe-commerce 1.1.2 -> satisfiable by paytrail/paytrail-for-adobe-commerce[1.1.2].
- paytrail/paytrail-for-adobe-commerce 1.1.2 requires php ^7.1 -> your php version (8.1.4) does not satisfy that requirement.

Expected behavior
Normal update on the package.

Issue with installing v1.2.0 via composer

Hi,

when trying to install module v.1.2.0.0 I get the following error message:

[Composer\Downloader\TransportException]
The "https://repo.magento.com/archives/paytrail/paytrail-for-adobe-commerce/paytrail-paytrail-for-adobe-commerce-1.2.0.0.zip" file could not be downloaded (HTTP/1.1
404 Not Found)

Steps To Reproduce:
If you have an Adobe Commerce project (former Magento) with the following set in composer.json:
...
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/"
}
],
...
It will throw the error.
Removing repo.magento.com from repositories will enable composer to fetch from github.

Expected behavior
Composer should install specified package successfully.

Actual behavoiur
Throw exception stated at the beginning of the report.

Quote is not restored after payment is cancelled

Quote is not restored after payment is cancelled. When selecting a payment method provided by Paytrail (for example Pivo) and placing an order, user is redirected to payment page. After cancelling the payment (with browser's back button) user is redirected back to Magento with an empty shopping cart (meaning that quote is not restored). Is this a bug or normal behavior?

To Reproduce

  1. Add product to cart
  2. Go to checkout
  3. Select "Paytrail for Adobe Commerce" payment method (I used Pivo)
  4. Go to payment page
  5. Cancel the payment by pressing the back button in browser

Expected behavior
User gets redirected back to Magento and quote is restored

Actual result
User gets redirected back to Magento and quote is not restored

/paytrail/callback controller should return ResultInterface or ResponseInterface

Describe the bug

Controller/Callback/Index.php::execute() should return either ResultInterface or ResponseInterface instead of void

Expected behavior

Callback returns http code 200

Actual behavior
Callback returns http code 500 server error, and exception is thrown

Screenshots

vendor/magento/framework/App/Http.php
image

Actual result:
image

Additional context

rest/all/schema fails

The "\Magento\Framework\Phrase" parameter type is invalid. Verify the parameter and try again.

happens because this:
vendor/paytrail/paytrail-for-adobe-commerce/Api/SubscriptionManagementInterface.php

has this:

 * @return \Magento\Framework\Phrase

Customer can pay with S-Pankki after order is canceled and order status is set to "Closed".

Describe the bug
If a customer ends the payment transaction just before the final step of paying with "Tunnuslukutaulukko" on S-Pankki and comes back to the transaction with browser back button it is possible to make a successful payment but the order itself is set to "Closed" status.

To Reproduce

  • Set Stores -> Configuration -> Sales -> Payment Methods -> Automatically cancel orders if the first response from Paytrail API is a failure setting to yes.
  • Order something with S-Pankki payment method and "Tunnuslukutaulukko" (Password table?) but push "Poistu" or exit just at the last step of payment.
  • Push back on browser
  • Finish payment
  • Order is set to "Closed" and customer receives mail that the payment has gone through.

Expected behavior
Order should be set to "Paid".

Shopping cart rule causes exception on canceled orders

Is your feature request related to a problem? Please describe.
Magento does not check if cart price rule (or coupon) is saved to order when it is canceled and causes an exception. This is fixed on development branch. See Magento/SalesRule/Model/Coupon/Usage/Processor#L149

To Reproduce

  • Create a shopping cart rule
  • Set Stores -> Configuration -> Sales -> Payment Methods -> Automatically cancel orders if the first response from Paytrail API is a failure setting to yes.
  • Log in
  • Order something and cancel payment.
  • Exception is thrown.

Describe the solution you'd like
This could be covered in manual.

Error with PHP 8.2 and M 2.4.6-p2

I'm getting this kind of error when getting back to shop after payment. I have PHP 8.2 in use with Magento 2.4.6-p2.

Exception #0 (Exception): Deprecated Functionality: Creation of dynamic property Paytrail\PaymentService\Model\ReceiptDataProvider::$orderIncrementalId is deprecated in /public_html/vendor/paytrail/paytrail-for-adobe-commerce/Model/ReceiptDataProvider.php on line 46
<pre>#1 Paytrail\PaymentService\Model\ReceiptDataProvider->execute() called at [vendor/paytrail/paytrail-for-adobe-commerce/Model/Receipt/ProcessPayment.php:113]
#2 Paytrail\PaymentService\Model\Receipt\ProcessPayment->processPayment() called at [vendor/paytrail/paytrail-for-adobe-commerce/Model/Receipt/ProcessPayment.php:73]
#3 Paytrail\PaymentService\Model\Receipt\ProcessPayment->process() called at [vendor/paytrail/paytrail-for-adobe-commerce/Controller/Receipt/Index.php:52]
#4 Paytrail\PaymentService\Controller\Receipt\Index->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#5 Paytrail\PaymentService\Controller\Receipt\Index\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#6 Paytrail\PaymentService\Controller\Receipt\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#7 Paytrail\PaymentService\Controller\Receipt\Index\Interceptor->___callPlugins() called at [generated/code/Paytrail/PaymentService/Controller/Receipt/Index/Interceptor.php:23]
#8 Paytrail\PaymentService\Controller\Receipt\Index\Interceptor->execute() called at [vendor/magento/framework/App/FrontController.php:248]
#9 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#10 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:146]
#11 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#12 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#13 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
#14 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#15 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:75]
#16 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#17 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/swissup/module-amp/Plugin/Framework/FrontController.php:48]
#18 Swissup\Amp\Plugin\Framework\FrontController->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#19 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#20 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#21 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#22 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#23 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#24 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
</pre>

Having a order item with an SKU longer than 100 characters causes error "Request payload schema validation failed. Validate request against the provided schema.","m (truncated...)

Describe the bug
The Paytrail API does not allow product codes longer than 100 characters. This is an issue since in Magento it is possible to have skus longer than 100 characters on the order item. For example having a product with multiple customizable options will cause an error pictured when paying your order on checkout with Paytrail.
Screenshot from 2023-06-16 07-58-35

To Reproduce
Have a product with an SKU 50 characters long and with two customizable options that both have 50 characters long skus.
Add the product and the customizable options to your cart.
Checkout with Paytrail.

Expected behavior
You are redirected to the payment portal.

Screenshots

Additional context
One can work around this issue by truncating the length of the product code here https://github.com/paytrail/paytrail-php-sdk/blob/master/src/Model/Item.php#L198

No payment method selected error is shown if terms and conditions are not accepted

"No payment method selected. Please select one." error is shown if additional validators fail even if the payment method is selected. For example if terms and conditions are not accepted.

To Reproduce

  1. Create new terms and conditions item that is manually applied
  2. Go to Stores > Configuration > Sales > Checkout > Checkout Options. Set the Enable Terms and Conditions field to Yes.
  3. Add product to cart
  4. Go to checkout
  5. Select "Paytrail for Adobe Commerce" payment method and choose any payment method
  6. Leave the terms and conditions checkbox unchecked
  7. Place Order

Expected behavior
"No payment method selected. Please select one." error is not shown.

Actual result
"No payment method selected. Please select one." error is shown.

Screenshots

Screenshot from 2023-05-23 16-43-25

Additional context

Tested with fresh Magento version 2.4.6 and paytrail/paytrail-for-adobe-commerce version 1.3.2.

https://github.com/paytrail/paytrail-for-adobe-commerce/blob/master/view/frontend/web/js/view/payment/method-renderer/paytrail-method.js#L122-L128

Composer can't install 1.1.2 with magento repository in composer.json

Composer can't install 1.1.2 if magento repository is in compsoer.json

$ composer require paytrail/paytrail-for-adobe-commerce:1.1.2
The "hirak/prestissimo" plugin (installed globally) was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.3.0"). You may need to run composer update with the "--no-plugins" option.
./composer.json has been updated
The "hirak/prestissimo" plugin (installed globally) was skipped because it requires a Plugin API version ("^1.0.0") that does not match your Composer installation ("2.3.0"). You may need to run composer update with the "--no-plugins" option.
Running composer update paytrail/paytrail-for-adobe-commerce
Loading composer repositories with package information
In Laminas\DependencyPlugin\DependencyRewriterV2::onPrePoolCreate
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires paytrail/paytrail-for-adobe-commerce 1.1.2, it is satisfiable by paytrail/paytrail-for-adobe-commerce[1.1.2] from composer repo (https://repo.packagist.org) but paytrail/paytrail-for-adobe-commerce[1.0.1, ..., 1.1.0] from composer repo (https://repo.magento.com) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I can solve it if I temporarily remove this magento repository from "repositories" in composer.json:

    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },

Placing order doesn't run payment validators if Payment method selection on a separate page is not explicitly set

Describe the bug
If "Payment method selection on a separate page" setting is not explicitly set, placing order doesn't run any js validators (including Paytrails own check for selected method).

To Reproduce
Check "Use system value" box for "Payment method selection on a separate page" setting which would appear to set the setting to "No".

Expected behavior
Additional payment validators and Paytrail payment method check are run when placing order.

Additional context
If "Payment method selection on a separate page" setting is not explicitly set, self.getSkipMethodSelection() check in placeOrder in paytrail-method.js fails, because null == false is not truthy.

payment/paytrail/skip_bank_selection doesn't have a default config set in config.xml which leads to getSkipBankSelection() in Config.php to return null if "Use system value" is set for the "Payment method selection on a separate page" setting.

This leads to failing self.getSkipMethodSelection() == false check in placeOrder() and causes placeOrderBypass to run without checking for any validators.

Mobilepay always returns "Order processing has been aborted. Please contact customer service." error

Describe the bug
Anytime user chooses mobilepay as payment method we see that the user is returned to site with checkout-status=ok, but they always end up doing the payment again. A client sent us a bug report where the error is described as seeing "Order processing has been aborted. Please contact customer service." and having to do payment again.

As far as we know, no money is still charged twice (most likely due to second request being identical to first one, with same transaction-id, checkout-reference, signature and checkout-stamp). Also no duplicate orders are placed.

First payment gets both async and sync requests as expected and returned ok:

17:28:47.667 +02:00 "GET /fi/paytrail/callback/?checkout-account=...&checkout-algorithm=sha256&checkout-amount=...&checkout-stamp=...&checkout-reference=...%...%...&checkout-transaction-id=...&checkout-status=ok&checkout-provider=mobilepay&signature=... HTTP/2.0" 200 20 "-" "Paytrail Payment Registration"

17:28:49.669 +02:00 "GET /fi/paytrail/receipt/?checkout-account=...&checkout-algorithm=sha256&checkout-amount=...&checkout-stamp=...&checkout-reference=...%...%...&checkout-transaction-id=...&checkout-status=ok&checkout-provider=mobilepay&signature=... HTTP/2.0" 302 20 "https://products.mobilepay.dk/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.69"

=> At this point the client is served with an error and a minute later there's a second try with same info:

17:29:43.693 +02:00 "GET /fi/paytrail/callback/?checkout-account=...&checkout-algorithm=sha256&checkout-amount=...&checkout-stamp=...&checkout-reference=...%...%...&checkout-transaction-id=...&checkout-status=ok&checkout-provider=mobilepay&signature=... HTTP/2.0" 200 20 "-" "Paytrail Payment Registration"

17:29:48.311 +02:00 "GET /fi/paytrail/receipt/?checkout-account=...&checkout-algorithm=sha256&checkout-amount=...&checkout-stamp=...&checkout-reference=...%...%...&checkout-transaction-id=...&checkout-status=ok&checkout-provider=mobilepay&signature=... HTTP/2.0" 302 20 "-" "PaymentHighway"

=> Order status is changed successfully and payment is successful.

I'm unsure if the payment provider header is something worth looking into, first one has "https://products.mobilepay.dk/" and the latter "PaymentHighway".

To Reproduce

  • Choose mobile pay as payment method, it happens every time, according to our logs.

Expected behavior
Payment status is succesfully changed and user only has to go through the payment process once.

Screenshots

Additional context
This seems to only happen with mobilepay, all other payment methods seem to be working as expected. As mobile pay is not one of the payment methods that can be tested with test credentials, I'm unable to provide further test-data.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.