Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Revert "Add dedicated fields for Adyen plugin (#17938)" (#17948)

Lukasz Ostrowski90b4fcb8940c
diff --git a/saleor/payment/gateways/adyen/plugin.py b/saleor/payment/gateways/adyen/plugin.py
index d3d8c522c2..73e830d8b8 100644
--- a/saleor/payment/gateways/adyen/plugin.py
+++ b/saleor/payment/gateways/adyen/plugin.py
@@ -1,5 +1,4 @@
import json
-import logging
from typing import Optional
from urllib.parse import urlencode, urljoin
@@ -50,8 +49,6 @@ GATEWAY_NAME = "Adyen"
WEBHOOK_PATH = "/webhooks"
ADDITIONAL_ACTION_PATH = "/additional-actions"
-logger = logging.getLogger(__name__)
-
class AdyenGatewayPlugin(BasePlugin):
PLUGIN_ID = "mirumee.payments.adyen"
@@ -468,17 +465,10 @@ class AdyenGatewayPlugin(BasePlugin):
currency=payment_information.currency,
transaction_id=result.message.get("pspReference", ""),
error=error_message,
- # @deprecated
raw_response=result.message,
action_required_data=action,
payment_method_info=payment_method_info,
psp_reference=psp_reference,
- legacy_adyen_plugin_payment_method=result.message.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=result.message.get("resultCode", "")
- .strip()
- .lower(),
)
@classmethod
@@ -552,16 +542,9 @@ class AdyenGatewayPlugin(BasePlugin):
currency=payment_information.currency,
transaction_id=result.message.get("pspReference", ""),
error=result.message.get("refusalReason"),
- # @deprecated
raw_response=result.message,
psp_reference=result.message.get("pspReference", ""),
payment_method_info=payment_method_info,
- legacy_adyen_plugin_payment_method=result.message.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=result.message.get("resultCode", "")
- .strip()
- .lower(),
)
def confirm_payment(
@@ -612,27 +595,10 @@ class AdyenGatewayPlugin(BasePlugin):
# standard flow for confirming an additional action
return self._process_additional_action(payment_information, kind)
- result_code_temporary_field = transaction.legacy_adyen_plugin_result_code
- payment_method_temporary_field = transaction.legacy_adyen_plugin_payment_method
-
- if (not result_code_temporary_field) and (not payment_method_temporary_field):
- # Track legacy reads, so we keep grace period in case of enqueued messages
- logger.warning("Reading deprecated raw_response from Adyen plugin.")
-
- if result_code_temporary_field:
- result_code = result_code_temporary_field
- else:
- result_code = (
- transaction.gateway_response.get("resultCode", "").strip().lower()
- )
-
- if payment_method_temporary_field:
- payment_method = payment_method_temporary_field
- else:
- payment_method = (
- transaction.gateway_response.get("paymentMethod", "").strip().lower()
- )
-
+ result_code = transaction.gateway_response.get("resultCode", "").strip().lower()
+ payment_method = (
+ transaction.gateway_response.get("paymentMethod", "").strip().lower()
+ )
if result_code and result_code in PENDING_STATUSES:
kind = TransactionKind.PENDING
elif result_code == AUTH_STATUS and payment_method == "ideal":
@@ -672,7 +638,6 @@ class AdyenGatewayPlugin(BasePlugin):
currency=payment_information.currency,
transaction_id=token,
error=None,
- # @deprecated
raw_response={},
transaction_already_processed=bool(transaction_already_processed),
psp_reference=token,
@@ -741,15 +706,8 @@ class AdyenGatewayPlugin(BasePlugin):
currency=currency,
transaction_id=result.message.get("pspReference", ""),
error="",
- # @deprecated
raw_response=result.message,
psp_reference=result.message.get("pspReference", ""),
- legacy_adyen_plugin_payment_method=result.message.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=result.message.get("resultCode", "")
- .strip()
- .lower(),
)
def capture_payment(
@@ -778,16 +736,9 @@ class AdyenGatewayPlugin(BasePlugin):
currency=payment_information.currency,
transaction_id=result.message.get("pspReference", ""),
error="",
- # @deprecated
raw_response=result.message,
payment_method_info=payment_method_info,
psp_reference=result.message.get("pspReference", ""),
- legacy_adyen_plugin_payment_method=result.message.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=result.message.get("resultCode", "")
- .strip()
- .lower(),
)
def void_payment(
@@ -816,15 +767,8 @@ class AdyenGatewayPlugin(BasePlugin):
currency=payment_information.currency,
transaction_id=result.message.get("pspReference", ""),
error="",
- # @deprecated
raw_response=result.message,
psp_reference=result.message.get("pspReference", ""),
- legacy_adyen_plugin_payment_method=result.message.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=result.message.get("resultCode", "")
- .strip()
- .lower(),
)
@classmethod
diff --git a/saleor/payment/gateways/adyen/tests/test_plugin.py b/saleor/payment/gateways/adyen/tests/test_plugin.py
index 0376d22011..dbe30b6c6e 100644
--- a/saleor/payment/gateways/adyen/tests/test_plugin.py
+++ b/saleor/payment/gateways/adyen/tests/test_plugin.py
@@ -47,8 +47,6 @@ def test_process_additional_action(
raw_response=expected_message,
psp_reference="ref-id",
payment_method_info=PaymentMethodInfo(),
- legacy_adyen_plugin_result_code=expected_message.get("resultCode"),
- legacy_adyen_plugin_payment_method="",
)
mocked_api_call.assert_called_with(
dummy_payment_data.data, plugin.adyen.checkout.payments_details
diff --git a/saleor/payment/gateways/adyen/webhooks.py b/saleor/payment/gateways/adyen/webhooks.py
index 1aa1fedae5..642a4f7887 100644
--- a/saleor/payment/gateways/adyen/webhooks.py
+++ b/saleor/payment/gateways/adyen/webhooks.py
@@ -153,12 +153,6 @@ def create_new_transaction(notification, payment, kind):
error="",
raw_response=notification,
psp_reference=transaction_id,
- legacy_adyen_plugin_payment_method=notification.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=notification.get("resultCode", "")
- .strip()
- .lower(),
)
return create_transaction(
payment,
@@ -1174,12 +1168,6 @@ def handle_api_response(
raw_response=response.message,
action_required_data=response.message.get("action"),
psp_reference=response.message.get("pspReference", ""),
- legacy_adyen_plugin_payment_method=response.message.get("paymentMethod", "")
- .strip()
- .lower(),
- legacy_adyen_plugin_result_code=response.message.get("resultCode", "")
- .strip()
- .lower(),
)
create_transaction(
diff --git a/saleor/payment/interface.py b/saleor/payment/interface.py
index c5bf578886..0d30b5afdf 100644
--- a/saleor/payment/interface.py
+++ b/saleor/payment/interface.py
@@ -316,7 +316,6 @@ class GatewayResponse:
error: str | None
customer_id: str | None = None
payment_method_info: PaymentMethodInfo | None = None
- # @deprecated
raw_response: dict[str, str] | None = None
action_required_data: JSONType | None = None
# Some gateway can process transaction asynchronously. This value define if we
@@ -324,11 +323,6 @@ class GatewayResponse:
transaction_already_processed: bool = False
psp_reference: str | None = None
- # Temporary pass Adyen-plugin-specific data to model, so we can drop raw_response
- # After the plugin is gone, this should be removed
- legacy_adyen_plugin_result_code: str | None = None
- legacy_adyen_plugin_payment_method: str | None = None
-
@dataclass
class AddressData:
diff --git a/saleor/payment/migrations/0064_transaction_legacy_adyen_plugin_payment_method_and_more.py b/saleor/payment/migrations/0064_transaction_legacy_adyen_plugin_payment_method_and_more.py
deleted file mode 100644
index df99fdd4e3..0000000000
--- a/saleor/payment/migrations/0064_transaction_legacy_adyen_plugin_payment_method_and_more.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Generated by Django 5.2.1 on 2025-07-08 08:49
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
- dependencies = [
- ("payment", "0063_transactionitem_payment_method_type_ids_and_more"),
- ]
-
- operations = [
- migrations.AddField(
- model_name="transaction",
- name="legacy_adyen_plugin_payment_method",
- field=models.TextField(null=True),
- ),
- migrations.AddField(
- model_name="transaction",
- name="legacy_adyen_plugin_result_code",
- field=models.TextField(null=True),
- ),
- ]
diff --git a/saleor/payment/models.py b/saleor/payment/models.py
index 1023d82c12..adc19ba487 100644
--- a/saleor/payment/models.py
+++ b/saleor/payment/models.py
@@ -467,22 +467,9 @@ class Transaction(models.Model):
)
error = models.TextField(null=True)
customer_id = models.CharField(max_length=256, null=True)
- # @deprecated
gateway_response = JSONField(encoder=DjangoJSONEncoder)
already_processed = models.BooleanField(default=False)
- """
- Legacy fields that allow Adyen plugin to work until it's removed.
-
- Previously Adyen plugin was using gateway_response which holds entire response for every Payment plugin.
- Adyen plugin is the only plugin using this field, it has access to result_code and payment_method.
-
- To remove gateway_response we introduce two legacy fields that Adyen can write to and gateway_response can be removed.
- Once plugin is removed, these fields should be removed from the model.
- """
- legacy_adyen_plugin_result_code = models.TextField(null=True)
- legacy_adyen_plugin_payment_method = models.TextField(null=True)
-
class Meta:
ordering = ("pk",)
indexes = [
diff --git a/saleor/payment/utils.py b/saleor/payment/utils.py
index 7624bdcc44..30bca3dad9 100644
--- a/saleor/payment/utils.py
+++ b/saleor/payment/utils.py
@@ -488,8 +488,6 @@ def create_transaction(
customer_id=gateway_response.customer_id,
gateway_response=gateway_response.raw_response or {},
action_required_data=gateway_response.action_required_data or {},
- legacy_adyen_plugin_result_code=gateway_response.legacy_adyen_plugin_result_code,
- legacy_adyen_plugin_payment_method=gateway_response.legacy_adyen_plugin_payment_method,
)
return txn