Skip to content

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

Add Problems API for apps (#18724)

Lukasz Ostrowski917690526c6e
diff --git a/AGENTS.md b/AGENTS.md
index bac80f4b43..998d065579 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,5 +1,15 @@
# Saleor
+## Graphql
+
+### API versioning
+
+- Check last git tag to find what version we are branched from (e.g. 3.22 tag). Based on that, add description to new fields with ADDED_IN_{VERSION} clause
+
+
+### GraphQL permissions
+- Use PermissionsField to describe field restrictions
+
# Testing
## Running tests
@@ -15,3 +25,96 @@
- Use `pytest` fixtures for setup and teardown
- Declare test suites flat in file. Do not wrapp in classes
- Prefer using fixtures over mocking. Fixtures are usually within directory "tests/fixtures" and are functions decorated with`@pytest.fixture`
+- When you create an object for testing and fixture for it doesn't exist, create new one. You can use factory to pass arguments to the fixture.
+- When writing assertions, prefer assertion on actual returned value instead of checking if it's not none. For example: `assert email is "[email protected]` instead if `assert email is not None`
+- When asserting GraphQL errors, assert error message too
+- When asserting to Enum, import enum in a test file and use `assert error.code == MyEnum.SOME_ERROR.name` instead plain string comparison
+- Avoid assertion to plain values, if you already have references to existing value. For example, when you create entity in database and assert if entity is returned in response, compare response fields with entity fields, instead plain values.
+-
+
+# Concurrency and Thread Safety
+
+Saleor runs across many Python services that execute concurrently. Follow these patterns to ensure thread-safe code.
+
+## Atomic Increment Pattern
+
+Never use `instance.count += 1; instance.save()` - this is NOT atomic and causes lost updates.
+
+**Bad:**
+```python
+existing.count += 1
+existing.save(update_fields=["count"])
+```
+
+**Good - use F() expressions:**
+```python
+from django.db.models import F
+
+Model.objects.filter(pk=existing.pk).update(count=F("count") + 1)
+```
+
+## Avoid Check-Then-Act Race Conditions
+
+Never check if a record exists and then create/update it in separate operations.
+
+**Bad:**
+```python
+existing = Model.objects.filter(app=app, key=key).first()
+if not existing:
+ Model.objects.create(app=app, key=key, ...) # Race condition: duplicate may be created
+else:
+ existing.update(...)
+```
+
+**Good - use update_or_create with unique constraint:**
+```python
+obj, created = Model.objects.update_or_create(
+ app=app, key=key, # Lookup fields
+ defaults={"message": message, "updated_at": now} # Fields to update
+)
+```
+
+**Note:** `update_or_create` requires a unique constraint on the lookup fields to be truly safe.
+
+
+## Row-Level Locking with select_for_update
+
+For complex operations requiring multiple reads/writes on the same row, use `select_for_update`:
+
+```python
+from saleor.core.tracing import traced_atomic_transaction
+
+with traced_atomic_transaction():
+ obj = Model.objects.select_for_update().get(pk=pk)
+ # Perform operations - row is locked until transaction ends
+ obj.save()
+```
+
+**Pattern: Create lock_objects.py modules** (like `saleor/payment/lock_objects.py`):
+
+```python
+def my_model_qs_select_for_update() -> QuerySet[MyModel]:
+ return MyModel.objects.order_by("pk").select_for_update(of=["self"])
+```
+
+## Database Transactions
+
+Wrap related operations in transactions using `traced_atomic_transaction`:
+
+```python
+from saleor.core.tracing import traced_atomic_transaction
+
+with traced_atomic_transaction():
+ # All operations here are atomic
+ obj1.save()
+ obj2.save()
+```
+
+## Summary of Patterns Used in Saleor
+
+| Pattern | Module Example | When to Use |
+|---------|---------------|-------------|
+| `F()` atomic increment | `saleor/discount/utils/voucher.py:85` | Counter updates |
+| `select_for_update` | `saleor/payment/lock_objects.py` | Complex read-modify-write |
+| `update_or_create` | `saleor/graphql/attribute/utils/type_handlers.py` | Upsert operations |
+| `traced_atomic_transaction` | `saleor/core/tracing.py` | Multi-operation atomicity |
diff --git a/saleor/app/error_codes.py b/saleor/app/error_codes.py
index 7c426708a7..4b38acb11c 100644
--- a/saleor/app/error_codes.py
+++ b/saleor/app/error_codes.py
@@ -17,3 +17,18 @@ class AppErrorCode(Enum):
OUT_OF_SCOPE_APP = "out_of_scope_app"
OUT_OF_SCOPE_PERMISSION = "out_of_scope_permission"
UNSUPPORTED_SALEOR_VERSION = "unsupported_saleor_version"
+
+
+class AppProblemCreateErrorCode(Enum):
+ GRAPHQL_ERROR = "graphql_error"
+ INVALID = "invalid"
+ REQUIRED = "required"
+ NOT_FOUND = "not_found"
+
+
+class AppProblemDismissErrorCode(Enum):
+ GRAPHQL_ERROR = "graphql_error"
+ INVALID = "invalid"
+ REQUIRED = "required"
+ NOT_FOUND = "not_found"
+ OUT_OF_SCOPE_APP = "out_of_scope_app"
diff --git a/saleor/app/lock_objects.py b/saleor/app/lock_objects.py
new file mode 100644
index 0000000000..4be501ba61
--- /dev/null
+++ b/saleor/app/lock_objects.py
@@ -0,0 +1,11 @@
+from django.db.models import QuerySet
+
+from .models import App, AppProblem
+
+
+def app_qs_select_for_update() -> QuerySet[App]:
+ return App.objects.order_by("pk").select_for_update(of=["self"])
+
+
+def app_problem_qs_select_for_update() -> QuerySet[AppProblem]:
+ return AppProblem.objects.order_by("pk").select_for_update(of=["self"])
diff --git a/saleor/app/migrations/0035_appproblem.py b/saleor/app/migrations/0035_appproblem.py
new file mode 100644
index 0000000000..823b400c14
--- /dev/null
+++ b/saleor/app/migrations/0035_appproblem.py
@@ -0,0 +1,60 @@
+# Generated by Django 5.2.11 on 2026-02-13 11:44
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("account", "0095_repopulate_user_number_of_orders"),
+ ("app", "0034_alter_appextension_mount"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="AppProblem",
+ fields=[
+ (
+ "id",
+ models.AutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("created_at", models.DateTimeField(auto_now_add=True)),
+ ("updated_at", models.DateTimeField(auto_now=True)),
+ ("message", models.CharField(max_length=2048)),
+ ("key", models.CharField(max_length=128)),
+ ("count", models.PositiveIntegerField(default=1)),
+ ("is_critical", models.BooleanField(default=False)),
+ ("dismissed", models.BooleanField(default=False)),
+ (
+ "dismissed_by_user_email",
+ models.EmailField(blank=True, max_length=256, null=True),
+ ),
+ (
+ "app",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="problems",
+ to="app.app",
+ ),
+ ),
+ (
+ "dismissed_by_user",
+ models.ForeignKey(
+ blank=True,
+ null=True,
+ on_delete=django.db.models.deletion.SET_NULL,
+ related_name="+",
+ to="account.user",
+ ),
+ ),
+ ],
+ options={
+ "ordering": ("-created_at",),
+ },
+ ),
+ ]
diff --git a/saleor/app/migrations/0038_merge_20260213_1154.py b/saleor/app/migrations/0038_merge_20260213_1154.py
new file mode 100644
index 0000000000..489093ff09
--- /dev/null
+++ b/saleor/app/migrations/0038_merge_20260213_1154.py
@@ -0,0 +1,12 @@
+# Generated by Django 5.2.11 on 2026-02-13 11:54
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("app", "0035_appproblem"),
+ ("app", "0037_app_extensions_loosen_mount"),
+ ]
+
+ operations = []
diff --git a/saleor/app/models.py b/saleor/app/models.py
index 2acbdbc9a1..29fde4f86f 100644
--- a/saleor/app/models.py
+++ b/saleor/app/models.py
@@ -174,6 +174,45 @@ class AppExtension(models.Model):
settings = models.JSONField(blank=True, default=dict, db_default={})
+class AppProblem(models.Model):
+ # Note: When increasing this value, please revise performance. Now dismissing 100 rows is cheap,
+ # but if we increase this number, it can be too heavy and we may need to find more performant way,
+ # e.g. delegate to Celery
+ MAX_PROBLEMS_PER_APP = 100
+
+ app = models.ForeignKey(App, on_delete=models.CASCADE, related_name="problems")
+ created_at = models.DateTimeField(auto_now_add=True)
+ updated_at = models.DateTimeField(auto_now=True)
+ message = models.CharField(max_length=2048)
+ key = models.CharField(max_length=128)
+ count = models.PositiveIntegerField(default=1)
+ is_critical = models.BooleanField(default=False)
+ dismissed = models.BooleanField(default=False)
+ dismissed_by_user_email = models.EmailField(max_length=256, blank=True, null=True)
+ dismissed_by_user = models.ForeignKey(
+ "account.User",
+ null=True,
+ blank=True,
+ on_delete=models.SET_NULL,
+ related_name="+",
+ )
+
+ class Meta:
+ ordering = ("-created_at",)
+
+ def is_dismissed_by_user(self) -> bool:
+ """Check if the problem was dismissed by a user (staff).
+
+ Uses the denormalized ``dismissed_by_user_email`` field instead of the
+ ``dismissed_by_user`` FK because the FK is set to NULL when the user is
+ deleted, whereas the email field is preserved indefinitely.
+
+ Method abstracts the fact that we don't store dedicated "by app" or "by user" field,
+ We have only one needed (email) that is enough to deduct this.
+ """
+ return self.dismissed_by_user_email is not None
+
+
class AppInstallation(Job):
uuid = models.UUIDField(unique=True, default=uuid4)
app_name = models.CharField(max_length=60)
diff --git a/saleor/app/tests/fixtures/__init__.py b/saleor/app/tests/fixtures/__init__.py
index 7c7c8b8eeb..22651221dc 100644
--- a/saleor/app/tests/fixtures/__init__.py
+++ b/saleor/app/tests/fixtures/__init__.py
@@ -1,6 +1,7 @@
from .app import * # noqa: F403
from .app_extension import * # noqa: F403
from .app_installation import * # noqa: F403
+from .app_problem import * # noqa: F403
from .webhooks.payment_app import * # noqa: F403
from .webhooks.shipping_app import * # noqa: F403
from .webhooks.tax_app import * # noqa: F403
diff --git a/saleor/app/tests/fixtures/app_problem.py b/saleor/app/tests/fixtures/app_problem.py
new file mode 100644
index 0000000000..bb1f5c3077
--- /dev/null
+++ b/saleor/app/tests/fixtures/app_problem.py
@@ -0,0 +1,46 @@
+from datetime import datetime
+
+import pytest
+from django.utils import timezone
+
+from ....account.models import User
+from ...models import App, AppProblem
+
+
+def app_problem_generator():
+ def create_problem(
+ app: App,
+ key: str = "test-key",
+ message: str = "Test problem",
+ count: int = 1,
+ is_critical: bool = False,
+ dismissed: bool = False,
+ dismissed_by_user: User | None = None,
+ updated_at: datetime | None = None,
+ ) -> AppProblem:
+ if updated_at is None:
+ updated_at = timezone.now()
+
+ dismissed_by_user_email = None
+ if dismissed_by_user is not None:
+ dismissed_by_user_email = dismissed_by_user.email
+
+ problem = AppProblem.objects.create(
+ app=app,
+ message=message,
+ key=key,
+ count=count,
+ is_critical=is_critical,
+ dismissed=dismissed,
+ dismissed_by_user_email=dismissed_by_user_email,
+ dismissed_by_user=dismissed_by_user,
+ )
+ # Use .update() to set specific updated_at for testing since auto_now=True
+ # ignores values passed to create/save
+ if updated_at is not None:
+ AppProblem.objects.filter(pk=problem.pk).update(updated_at=updated_at)
+ problem.refresh_from_db()
+ return problem
+
+ return create_problem
diff --git a/saleor/graphql/app/dataloaders/__init__.py b/saleor/graphql/app/dataloaders/__init__.py
index e65cbf6649..819fdc9c50 100644
--- a/saleor/graphql/app/dataloaders/__init__.py
+++ b/saleor/graphql/app/dataloaders/__init__.py
@@ -1,5 +1,6 @@
from .app import ActiveAppByIdLoader, AppByIdLoader, AppByTokenLoader
from .app_extension import AppExtensionByAppIdLoader, AppExtensionByIdLoader
+from .app_problems import AppProblemsByAppIdLoader
from .app_tokens import AppTokensByAppIdLoader
from .apps import ActiveAppsByAppIdentifierLoader, AppsByEventTypeLoader
from .thumbnail import (
@@ -13,6 +14,7 @@ __all__ = [
"ActiveAppsByAppIdentifierLoader",
"app_promise_callback",
"AppByIdLoader",
+ "AppProblemsByAppIdLoader",
"AppByTokenLoader",
"AppExtensionByAppIdLoader",
"AppExtensionByIdLoader",
diff --git a/saleor/graphql/app/dataloaders/app_problems.py b/saleor/graphql/app/dataloaders/app_problems.py
new file mode 100644
index 0000000000..fffc0130dd
--- /dev/null
+++ b/saleor/graphql/app/dataloaders/app_problems.py
@@ -0,0 +1,17 @@
+from collections import defaultdict
+
+from ....app.models import AppProblem
+from ...core.dataloaders import DataLoader
+
+
+class AppProblemsByAppIdLoader(DataLoader[int, list[AppProblem]]):
+ context_key = "app_problems_by_app_id"
+
+ def batch_load(self, keys):
+ problems = AppProblem.objects.using(self.database_connection_name).filter(
+ app_id__in=keys
+ )
+ problem_map = defaultdict(list)
+ for problem in problems:
+ problem_map[problem.app_id].append(problem)
+ return [problem_map.get(app_id, []) for app_id in keys]
diff --git a/saleor/graphql/app/enums.py b/saleor/graphql/app/enums.py
index 0883800f40..0bb6cf8ca7 100644
--- a/saleor/graphql/app/enums.py
+++ b/saleor/graphql/app/enums.py
@@ -2,6 +2,7 @@ from typing import Final
import graphene
+from ...app import error_codes
from ...app.types import AppType
from ..core.doc_category import DOC_CATEGORY_APPS
from ..core.enums import to_enum
@@ -63,3 +64,25 @@ CircuitBreakerStateEnum.doc_category = DOC_CATEGORY_APPS
AppTypeEnum: Final[graphene.Enum] = to_enum(AppType, description=description)
AppTypeEnum.doc_category = DOC_CATEGORY_APPS
+
+
+class AppProblemDismissedBy:
+ APP = "app"
+ USER = "user"
+
+ CHOICES = [
+ (APP, "app"),
+ (USER, "user"),
+ ]
+
+
+AppProblemDismissedByEnum: Final[graphene.Enum] = to_enum(AppProblemDismissedBy)
+AppProblemDismissedByEnum.doc_category = DOC_CATEGORY_APPS
+
+
+AppProblemCreateErrorCode: Final[graphene.Enum] = graphene.Enum.from_enum(
+ error_codes.AppProblemCreateErrorCode
+)
+AppProblemDismissErrorCode: Final[graphene.Enum] = graphene.Enum.from_enum(
+ error_codes.AppProblemDismissErrorCode
+)
diff --git a/saleor/graphql/app/mutations/__init__.py b/saleor/graphql/app/mutations/__init__.py
index e49fc2768a..c2d7086b5e 100644
--- a/saleor/graphql/app/mutations/__init__.py
+++ b/saleor/graphql/app/mutations/__init__.py
@@ -5,6 +5,8 @@ from .app_delete import AppDelete
from .app_delete_failed_installation import AppDeleteFailedInstallation
from .app_fetch_manifest import AppFetchManifest
from .app_install import AppInstall
+from .app_problem_create import AppProblemCreate
+from .app_problem_dismiss import AppProblemDismiss
from .app_reenable_sync_webhooks import AppReenableSyncWebhooks
from .app_retry_install import AppRetryInstall
from .app_token_create import AppTokenCreate
@@ -18,6 +20,8 @@ __all__ = [
"AppDeactivate",
"AppDeleteFailedInstallation",
"AppDelete",
+ "AppProblemCreate",
+ "AppProblemDismiss",
"AppFetchManifest",
"AppInstall",
"AppRetryInstall",
diff --git a/saleor/graphql/app/mutations/app_problem_create.py b/saleor/graphql/app/mutations/app_problem_create.py
new file mode 100644
index 0000000000..6c25cbb998
--- /dev/null
+++ b/saleor/graphql/app/mutations/app_problem_create.py
@@ -0,0 +1,202 @@
+import datetime
+from typing import Annotated, Any, cast
+
+import graphene
+from django.utils import timezone
+from pydantic import BaseModel, ConfigDict, Field, StringConstraints, field_validator
+from pydantic import ValidationError as PydanticValidationError
+
+from ....app.error_codes import (
+ AppProblemCreateErrorCode as AppProblemCreateErrorCodeEnum,
+)
+from ....app.lock_objects import app_qs_select_for_update
+from ....app.models import App as AppModel
+from ....app.models import AppProblem
+from ....core.tracing import traced_atomic_transaction
+from ....permission.auth_filters import AuthorizationFilters
+from ...core import ResolveInfo
+from ...core.descriptions import ADDED_IN_322
+from ...core.doc_category import DOC_CATEGORY_APPS
+from ...core.mutations import BaseMutation
+from ...core.scalars import Minute, PositiveInt
+from ...core.types import Error
+from ...error import pydantic_to_validation_error
+from ..enums import AppProblemCreateErrorCode
+from ..types import AppProblem as AppProblemType
+
+
+class AppProblemCreateError(Error):
+ code = AppProblemCreateErrorCode(description="The error code.", required=True)
+
+
+class AppProblemCreateValidatedInput(BaseModel):
+ model_config = ConfigDict(frozen=True)
+
+ message: Annotated[str, StringConstraints(min_length=3)]
+ key: Annotated[str, StringConstraints(min_length=3, max_length=128)]
+ # No threshold - will never escalate to critical if not set by App itself
+ critical_threshold: Annotated[int, Field(ge=1)] | None = None
+ # Minutes
+ aggregation_period: Annotated[int, Field(ge=0)] = 60
+
+ @field_validator("message", mode="after")
+ @classmethod
+ def truncate_message(cls, v: str) -> str:
+ """Truncate message to 2048 characters including '...' suffix if too long."""
+ if len(v) > 2048:
+ return v[:2045] + "..."
+ return v
+
+ @field_validator("aggregation_period", mode="before")
+ @classmethod
+ def default_aggregation_period(cls, v: int | None) -> int:
+ """Accept null from GraphQL and map to default (60)."""
+ if v is None:
+ return 60
+ return v
+
+
+class AppProblemCreateInput(graphene.InputObjectType):
+ message = graphene.String(
+ required=True,
+ description=(
+ "The problem message to display. Must be at least 3 characters. "
+ "Messages longer than 2048 characters will be truncated to 2048 "
+ "characters with '...' suffix."
+ ),
+ )
+ key = graphene.String(
+ required=True,
+ description=(
+ "Key identifying the type of problem. App can add multiple problems under "
+ "the same key, to merge them together or delete them in batch. "
+ "Must be between 3 and 128 characters."
+ ),
+ )
+ critical_threshold = PositiveInt(
+ required=False,
+ description=(
+ "If set, the problem becomes critical when count reaches this value. "
+ "If sent again with higher value than already counted, problem can be de-escalated."
+ ),
+ )
+ aggregation_period = Minute(
+ required=False,
+ default_value=60,
+ description=(
+ "Time window in minutes for aggregating problems with the same key. "
+ "Defaults to 60. If 0, a new problem is always created."
+ ),
+ )
+
+
+class AppProblemCreate(BaseMutation):
+ app_problem = graphene.Field(
+ AppProblemType, description="The created or updated app problem."
+ )
+
+ class Arguments:
+ input = AppProblemCreateInput(
+ required=True, description="Fields required to create an app problem."
+ )
+
+ class Meta:
+ description = "Add a problem to the calling app." + ADDED_IN_322
+ doc_category = DOC_CATEGORY_APPS
+ permissions = (AuthorizationFilters.AUTHENTICATED_APP,)
+ error_type_class = AppProblemCreateError
+
+ @classmethod
+ def perform_mutation(
+ cls, _root: None, info: ResolveInfo, /, **data: Any
+ ) -> "AppProblemCreate":
+ app = cast(AppModel, info.context.app)
+ input_data = data["input"]
+ try:
+ validated = AppProblemCreateValidatedInput(**input_data)
+ except PydanticValidationError as exc:
+ raise pydantic_to_validation_error(
+ exc, error_code=AppProblemCreateErrorCodeEnum.INVALID.value
+ ) from exc
+
+ now = timezone.now()
+
+ with traced_atomic_transaction():
+ # Lock the App row to serialize all problem operations for this app
+ # At this point it trades performance for correctness
+ # If we need to improve performance, we can skip locking entire app row and
+ # schedule a cleanup task for > 100 items
+ app_qs_select_for_update().filter(pk=app.pk).first()
+
+ existing = (
+ AppProblem.objects.filter(app=app, key=validated.key, dismissed=False)
+ .order_by("-updated_at")
+ .first()
+ )
+
+ if not existing:
+ problem = cls._create_new_problem(app, validated, now)
+ return AppProblemCreate(app_problem=problem)
+
+ # Flow for existing / update
+ aggregation_enabled = validated.aggregation_period > 0
+ cutoff = now - datetime.timedelta(minutes=validated.aggregation_period)
+ within_aggregation_window = (
+ aggregation_enabled and existing.updated_at >= cutoff
+ )
+
+ if not within_aggregation_window:
+ problem = cls._create_new_problem(app, validated, now)
+ return AppProblemCreate(app_problem=problem)
+
+ cls._aggregate_existing(existing, validated, now)
+ return AppProblemCreate(app_problem=existing)
+
+ @classmethod
+ def _aggregate_existing(
+ cls,
+ existing: AppProblem,
+ validated: AppProblemCreateValidatedInput,
+ now: datetime.datetime,
+ ) -> None:
+ # In transaction block - we can safely modify in memory
+ existing.count += 1
+ existing.is_critical = bool(
+ validated.critical_threshold
+ and existing.count >= validated.critical_threshold
+ )
+ existing.message = validated.message
+ existing.updated_at = now
+ existing.save(update_fields=["count", "updated_at", "message", "is_critical"])
+
+ @classmethod
+ def _create_new_problem(
+ cls,
+ app: AppModel,
+ validated: AppProblemCreateValidatedInput,
+ now: datetime.datetime,
+ ) -> AppProblem:
+ total_count = AppProblem.objects.filter(app=app).count()
+ # +1 accounts for the new problem we're about to create
+ excess_count = total_count - AppProblem.MAX_PROBLEMS_PER_APP + 1
+
+ if excess_count > 0:
+ oldest_pks = list(
+ AppProblem.objects.filter(app=app)
+ .order_by("updated_at")
+ .values_list("pk", flat=True)[:excess_count]
+ )
+ if oldest_pks:
+ AppProblem.objects.filter(pk__in=oldest_pks).delete()
+
+ immediately_critical = bool(
+ validated.critical_threshold and validated.critical_threshold <= 1
+ )
+
+ return AppProblem.objects.create(
+ app=app,
+ message=validated.message,
+ key=validated.key,
+ count=1,
+ is_critical=immediately_critical,
+ )
diff --git a/saleor/graphql/app/mutations/app_problem_dismiss.py b/saleor/graphql/app/mutations/app_problem_dismiss.py
new file mode 100644
index 0000000000..5739518a5a
--- /dev/null
+++ b/saleor/graphql/app/mutations/app_problem_dismiss.py
@@ -0,0 +1,327 @@
+from typing import Any, cast
+
+import graphene
+from django.core.exceptions import ValidationError
+
+from ....account.models import User
+from ....app.error_codes import (
+ AppProblemDismissErrorCode as AppProblemDismissErrorCodeEnum,
+)
+from ....app.lock_objects import app_problem_qs_select_for_update
+from ....app.models import App as AppModel
+from ....app.models import AppProblem
+from ....core.tracing import traced_atomic_transaction
+from ....permission.auth_filters import AuthorizationFilters
+from ....permission.enums import AppPermission
+from ...core import ResolveInfo
+from ...core.descriptions import ADDED_IN_322
+from ...core.doc_category import DOC_CATEGORY_APPS
+from ...core.mutations import BaseMutation
+from ...core.types import BaseInputObjectType, Error, NonNullList
+from ...core.utils import from_global_id_or_error
+from ...core.validators import validate_one_of_args_is_in_mutation
+from ...utils import get_user_or_app_from_context
+from ..enums import AppProblemDismissErrorCode
+from ..types import App
+
+MAX_ITEMS_LIMIT = 100
+
+
+class AppProblemDismissError(Error):
+ code = AppProblemDismissErrorCode(description="The error code.", required=True)
+
+
+class AppProblemDismissByAppInput(BaseInputObjectType):
+ """Input for app callers to dismiss their own problems."""
+
+ ids = NonNullList(
+ graphene.ID,
+ required=False,
+ description=f"List of problem IDs to dismiss. Cannot be combined with keys. Max {MAX_ITEMS_LIMIT}.",
+ )
+ keys = NonNullList(
+ graphene.String,
+ required=False,
+ description=f"List of problem keys to dismiss. Cannot be combined with ids. Max {MAX_ITEMS_LIMIT}.",
+ )
+
+ class Meta:
+ doc_category = DOC_CATEGORY_APPS
+
+
+class AppProblemDismissByStaffWithIdsInput(BaseInputObjectType):
+ """Input for staff callers to dismiss problems by IDs."""
+
+ ids = NonNullList(
+ graphene.ID,
+ required=True,
+ description=f"List of problem IDs to dismiss. Max {MAX_ITEMS_LIMIT}.",
+ )
+
+ class Meta:
+ doc_category = DOC_CATEGORY_APPS
+
+
+class AppProblemDismissByStaffWithKeysInput(BaseInputObjectType):
+ """Input for staff callers to dismiss problems by keys."""
+
+ keys = NonNullList(
+ graphene.String,
+ required=True,
+ description=f"List of problem keys to dismiss. Max {MAX_ITEMS_LIMIT}.",
+ )
+ app = graphene.ID(
+ required=True,
+ description="ID of the app whose problems to dismiss.",
+ )
+
+ class Meta:
+ doc_category = DOC_CATEGORY_APPS
+
+
+class AppProblemDismissInput(BaseInputObjectType):
+ """Input for dismissing app problems. Only one can be specified."""
+
+ by_app = graphene.Field(
+ AppProblemDismissByAppInput,
+ description="For app callers only - dismiss own problems.",
+ )
+ by_staff_with_ids = graphene.Field(
+ AppProblemDismissByStaffWithIdsInput,
+ description="For staff callers - dismiss problems by IDs.",
+ )
+ by_staff_with_keys = graphene.Field(
+ AppProblemDismissByStaffWithKeysInput,
+ description="For staff callers - dismiss problems by keys for specified app.",
+ )
+
+ class Meta:
+ doc_category = DOC_CATEGORY_APPS
+
+
+class AppProblemDismiss(BaseMutation):
+ class Arguments:
+ input = AppProblemDismissInput(
+ required=True,
+ description="Input for dismissing app problems.",
+ )
+
+ class Meta:
+ description = "Dismiss problems for an app." + ADDED_IN_322
+ doc_category = DOC_CATEGORY_APPS
+ permissions = (
+ AppPermission.MANAGE_APPS,
+ AuthorizationFilters.AUTHENTICATED_APP,
+ )
+ error_type_class = AppProblemDismissError
+
+ @classmethod
+ def perform_mutation(
+ cls, _root: None, info: ResolveInfo, /, **data: Any
+ ) -> "AppProblemDismiss":
+ caller_app = info.context.app
+ input_data = data.get("input", {})
+
+ by_app = input_data.get("by_app")
+ by_staff_with_ids = input_data.get("by_staff_with_ids")
+ by_staff_with_keys = input_data.get("by_staff_with_keys")
+
+ validate_one_of_args_is_in_mutation(
+ "by_app",
+ by_app,
+ "by_staff_with_ids",
+ by_staff_with_ids,
+ "by_staff_with_keys",
+ by_staff_with_keys,
+ use_camel_case=True,
+ )
+
+ if by_app and caller_app:
+ cls._validate_by_app_input(by_app)
+ cls._dismiss_for_app_caller(by_app, caller_app)
+ elif by_staff_with_ids and not caller_app:
+ cls._validate_items_limit(by_staff_with_ids["ids"], "ids")
+ cls._dismiss_by_ids_for_staff(info, by_staff_with_ids["ids"])
+ elif by_staff_with_keys and not caller_app:
+ cls._validate_items_limit(by_staff_with_keys["keys"], "keys")
+ cls._dismiss_by_keys_for_staff(
+ info, by_staff_with_keys["keys"], by_staff_with_keys["app"]
+ )
+ else:
+ cls._raise_caller_type_mismatch(by_app, by_staff_with_ids)
+
+ return AppProblemDismiss()
+
+ @classmethod
+ def _raise_caller_type_mismatch(
+ cls,
+ by_app: dict | None,
+ by_staff_with_ids: dict | None,
+ ) -> None:
+ if by_app is not None:
+ raise ValidationError(
+ {
+ "byApp": ValidationError(
+ "Only app callers can use 'byApp'.",
+ code=AppProblemDismissErrorCodeEnum.INVALID.value,
+ )
+ }
+ )
+ field = "byStaffWithIds" if by_staff_with_ids else "byStaffWithKeys"
+ raise ValidationError(
+ {
+ field: ValidationError(
+ "App callers cannot use this input. Use 'byApp' instead.",
+ code=AppProblemDismissErrorCodeEnum.INVALID.value,
+ )
+ }
+ )
+
+ @classmethod
+ def _validate_by_app_input(cls, by_app: dict) -> None:
+ """Validate byApp input has exactly one of ids or keys."""
+ ids = by_app.get("ids")
+ keys = by_app.get("keys")
+
+ if ids and keys:
+ raise ValidationError(
+ {
+ "byApp": ValidationError(
+ "Cannot specify both 'ids' and 'keys'.",
+ code=AppProblemDismissErrorCodeEnum.INVALID.value,
+ )
+ }
+ )
+
+ if not ids and not keys:
+ raise ValidationError(
+ {
+ "byApp": ValidationError(
+ "Must provide either 'ids' or 'keys'.",
+ code=AppProblemDismissErrorCodeEnum.REQUIRED.value,
+ )
+ }
+ )
+
+ items = ids or keys
+ assert items is not None
+ cls._validate_items_limit(items, "ids" if ids else "keys")
+
+ @classmethod
+ def _dismiss_for_app_caller(
+ cls,
+ by_app: dict,
+ caller_app: AppModel,
+ ) -> None:
+ """Dismiss problems for an app caller (can only dismiss own problems)."""
+ ids = by_app.get("ids")
+ keys = by_app.get("keys")
+
+ if ids:
+ problem_pks = cls._parse_problem_ids(ids)
+ with traced_atomic_transaction():
+ # Validate that all provided IDs belong to the caller app
+ other_app_problems = AppProblem.objects.filter(
+ pk__in=problem_pks
+ ).exclude(app=caller_app)
+ if other_app_problems.exists():
+ raise ValidationError(
+ {
+ "ids": ValidationError(
+ "Cannot dismiss problems belonging to other apps.",
+ code=AppProblemDismissErrorCodeEnum.INVALID.value,
+ )
+ }
+ )
+
+ pks = (
+ app_problem_qs_select_for_update()
+ .filter(pk__in=problem_pks, app=caller_app, dismissed=False)
+ .values_list("pk", flat=True)
+ )
+ AppProblem.objects.filter(pk__in=pks).update(dismissed=True)
+ else:
+ with traced_atomic_transaction():
+ pks = (
+ app_problem_qs_select_for_update()
+ .filter(key__in=keys, app=caller_app, dismissed=False)
+ .values_list("pk", flat=True)
+ )
+ AppProblem.objects.filter(pk__in=pks).update(dismissed=True)
+
+ @classmethod
+ def _validate_items_limit(cls, items: list[str], field_name: str) -> None:
+ """Validate that items list does not exceed MAX_ITEMS_LIMIT."""
+ if len(items) > MAX_ITEMS_LIMIT:
+ raise ValidationError(
+ {
+ field_name: ValidationError(
+ f"Cannot specify more than {MAX_ITEMS_LIMIT} items.",
+ code=AppProblemDismissErrorCodeEnum.INVALID.value,
+ )
+ }
+ )
+
+ @classmethod
+ def _dismiss_by_ids_for_staff(
+ cls,
+ info: ResolveInfo,
+ ids: list[str],
+ ) -> None:
+ """Dismiss problems by IDs for a staff caller."""
+ requestor = cast(User, get_user_or_app_from_context(info.context))
+ problem_pks = cls._parse_problem_ids(ids)
+
+ with traced_atomic_transaction():
+ pks = (
+ app_problem_qs_select_for_update()
+ .filter(pk__in=problem_pks, dismissed=False)
+ .values_list("pk", flat=True)
+ )
+ AppProblem.objects.filter(pk__in=pks).update(
+ dismissed=True,
+ dismissed_by_user_email=requestor.email,
+ dismissed_by_user=requestor,
+ )
+
+ @classmethod
+ def _dismiss_by_keys_for_staff(
+ cls,
+ info: ResolveInfo,
+ keys: list[str],
+ app_id: str,
+ ) -> None:
+ """Dismiss problems by keys for a staff caller."""
+ requestor = cast(User, get_user_or_app_from_context(info.context))
+ target_app = cls.get_node_or_error(info, app_id, field="app", only_type=App)
+
+ with traced_atomic_transaction():
+ pks = (
+ app_problem_qs_select_for_update()
+ .filter(app=target_app, key__in=keys, dismissed=False)
+ .values_list("pk", flat=True)
+ )
+ AppProblem.objects.filter(pk__in=pks).update(
+ dismissed=True,
+ dismissed_by_user_email=requestor.email,
+ dismissed_by_user=requestor,
+ )
+
+ @classmethod
+ def _parse_problem_ids(cls, global_ids: list[str]) -> list[int]:
+ """Convert global IDs to database PKs."""
+ problem_pks = []
+ for global_id in global_ids:
+ _, pk = from_global_id_or_error(global_id, "AppProblem")
+ try:
+ problem_pks.append(int(pk))
+ except (ValueError, TypeError) as err:
+ raise ValidationError(
+ {
+ "ids": ValidationError(
+ f"Invalid ID: {global_id}.",
+ code=AppProblemDismissErrorCodeEnum.INVALID.value,
+ )
+ }
+ ) from err
+ return problem_pks
diff --git a/saleor/graphql/app/schema.py b/saleor/graphql/app/schema.py
index da0f515cb6..5d1b83cfb4 100644
--- a/saleor/graphql/app/schema.py
+++ b/saleor/graphql/app/schema.py
@@ -20,6 +20,8 @@ from .mutations import (
AppDeleteFailedInstallation,
AppFetchManifest,
AppInstall,
+ AppProblemCreate,
+ AppProblemDismiss,
AppReenableSyncWebhooks,
AppRetryInstall,
AppTokenCreate,
@@ -191,4 +193,7 @@ class AppMutations(graphene.ObjectType):
app_activate = AppActivate.Field()
app_deactivate = AppDeactivate.Field()
+ app_problem_create = AppProblemCreate.Field()
+ app_problem_dismiss = AppProblemDismiss.Field()
+
app_reenable_sync_webhooks = AppReenableSyncWebhooks.Field()
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_create.py b/saleor/graphql/app/tests/mutations/test_app_problem_create.py
new file mode 100644
index 0000000000..b65de8cc59
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_create.py
@@ -0,0 +1,59 @@
+from .....app.models import AppProblem
+from ....tests.utils import assert_no_permission, get_graphql_content
+
+APP_PROBLEM_CREATE_MUTATION = """
+ mutation AppProblemCreate($input: AppProblemCreateInput!) {
+ appProblemCreate(input: $input) {
+ appProblem {
+ id
+ message
+ key
+ count
+ isCritical
+ updatedAt
+ }
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_create(app_api_client, app):
+ # given
+ variables = {"input": {"message": "Something went wrong", "key": "error-1"}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem_data = data["appProblem"]
+ assert problem_data["message"] == variables["input"]["message"]
+ assert problem_data["key"] == variables["input"]["key"]
+ assert problem_data["count"] == 1
+ assert problem_data["isCritical"] is False
+
+ db_problem = AppProblem.objects.get(app=app)
+ assert db_problem.message == variables["input"]["message"]
+ assert db_problem.key == variables["input"]["key"]
+ assert db_problem.count == 1
+
+
+def test_app_problem_create_by_staff_user_fails(
+ staff_api_client, permission_manage_apps
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ variables = {"input": {"message": "Something went wrong", "key": "err"}}
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+
+ # then
+ assert_no_permission(response)
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_create_aggregation.py b/saleor/graphql/app/tests/mutations/test_app_problem_create_aggregation.py
new file mode 100644
index 0000000000..1b5b407487
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_create_aggregation.py
@@ -0,0 +1,214 @@
+import datetime
+
+from django.utils import timezone
+
+from .....app.models import AppProblem
+from ....tests.utils import get_graphql_content
+
+APP_PROBLEM_CREATE_MUTATION = """
+ mutation AppProblemCreate($input: AppProblemCreateInput!) {
+ appProblemCreate(input: $input) {
+ appProblem {
+ id
+ message
+ key
+ count
+ isCritical
+ updatedAt
+ }
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_create_aggregates_within_period(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="First occurrence",
+ key="agg-key",
+ count=1,
+ updated_at=now - datetime.timedelta(minutes=30),
+ )
+ variables = {
+ "input": {
+ "message": "Second occurrence",
+ "key": "agg-key",
+ "aggregationPeriod": 60,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == 1
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 2
+ assert problem.message == variables["input"]["message"]
+
+
+def test_app_problem_create_new_when_period_expired(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Old problem",
+ key="exp-key",
+ count=3,
+ updated_at=now - datetime.timedelta(minutes=120),
+ )
+ variables = {
+ "input": {
+ "message": "New problem",
+ "key": "exp-key",
+ "aggregationPeriod": 60,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problems = AppProblem.objects.filter(app=app).order_by("created_at")
+ assert problems.count() == 2
+ assert problems[0].count == 3
+ assert problems[0].message == "Old problem"
+ assert problems[1].count == 1
+ assert problems[1].message == variables["input"]["message"]
+
+
+def test_app_problem_create_zero_aggregation_period_always_creates_new(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Existing",
+ key="no-agg",
+ count=1,
+ updated_at=now - datetime.timedelta(minutes=1),
+ )
+ variables = {
+ "input": {"message": "New one", "key": "no-agg", "aggregationPeriod": 0}
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == 2
+
+
+def test_app_problem_create_default_aggregation_period_aggregates(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Recent",
+ key="def-agg",
+ count=1,
+ updated_at=now - datetime.timedelta(minutes=30),
+ )
+ # No aggregationPeriod specified — defaults to 60 minutes
+ variables = {"input": {"message": "Should aggregate", "key": "def-agg"}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == 1
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 2
+ assert problem.message == variables["input"]["message"]
+
+
+def test_app_problem_create_dismissed_problem_not_aggregated(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Dismissed one",
+ key="dis-key",
+ count=5,
+ updated_at=now - datetime.timedelta(minutes=5),
+ dismissed=True,
+ )
+ variables = {
+ "input": {
+ "message": "Fresh problem",
+ "key": "dis-key",
+ "aggregationPeriod": 60,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == 2
+ new_problem = AppProblem.objects.filter(app=app, dismissed=False).get()
+ assert new_problem.count == 1
+ assert new_problem.message == variables["input"]["message"]
+
+
+def test_app_problem_create_message_updates_on_aggregation(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Original message",
+ key="msg-key",
+ count=1,
+ updated_at=now - datetime.timedelta(minutes=5),
+ )
+ variables = {
+ "input": {
+ "message": "Updated message",
+ "key": "msg-key",
+ "aggregationPeriod": 60,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.message == variables["input"]["message"]
+ assert problem.count == 2
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_create_critical.py b/saleor/graphql/app/tests/mutations/test_app_problem_create_critical.py
new file mode 100644
index 0000000000..38e9bd1ba2
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_create_critical.py
@@ -0,0 +1,223 @@
+import datetime
+
+from django.utils import timezone
+
+from .....app.models import AppProblem
+from ....tests.utils import get_graphql_content
+
+APP_PROBLEM_CREATE_MUTATION = """
+ mutation AppProblemCreate($input: AppProblemCreateInput!) {
+ appProblemCreate(input: $input) {
+ appProblem {
+ id
+ message
+ key
+ count
+ isCritical
+ updatedAt
+ }
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_create_critical_threshold_reached(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Almost critical",
+ key="crit-key",
+ count=4,
+ updated_at=now - datetime.timedelta(minutes=5),
+ )
+ variables = {
+ "input": {
+ "message": "Critical now",
+ "key": "crit-key",
+ "aggregationPeriod": 60,
+ "criticalThreshold": 5,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 5
+ assert problem.is_critical is True
+
+
+def test_app_problem_create_critical_threshold_not_reached(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Not critical yet",
+ key="nc-key",
+ count=2,
+ updated_at=now - datetime.timedelta(minutes=5),
+ )
+ variables = {
+ "input": {
+ "message": "Still not critical",
+ "key": "nc-key",
+ "aggregationPeriod": 60,
+ "criticalThreshold": 10,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 3
+ assert problem.is_critical is False
+
+
+def test_app_problem_create_critical_threshold_reached_via_aggregation(
+ app_api_client, app, app_problem_generator
+):
+ # given - existing problem with count=4, one more push with threshold=5
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Problem",
+ key="rolling-key",
+ count=4,
+ updated_at=now - datetime.timedelta(minutes=5),
+ )
+ variables = {
+ "input": {
+ "message": "Problem 5",
+ "key": "rolling-key",
+ "aggregationPeriod": 60,
+ "criticalThreshold": 5,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - count=5 meets threshold=5, should be critical
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 5
+ assert problem.is_critical is True
+
+
+def test_app_problem_create_critical_threshold_de_escalates(
+ app_api_client, app, app_problem_generator
+):
+ # given - existing critical problem with count=5
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Problem",
+ key="rolling-key",
+ count=5,
+ is_critical=True,
+ updated_at=now - datetime.timedelta(minutes=5),
+ )
+
+ # when - send problem with higher threshold=10
+ variables = {
+ "input": {
+ "message": "Problem 6",
+ "key": "rolling-key",
+ "aggregationPeriod": 60,
+ "criticalThreshold": 10,
+ }
+ }
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - count=6 is below new threshold=10, should de-escalate
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 6
+ assert problem.is_critical is False
+
+
+def test_app_problem_create_critical_threshold_not_reached_due_to_expired_aggregation(
+ app_api_client, app, app_problem_generator
+):
+ # given - existing problem with count=4, threshold=5
+ # but aggregation period expired, so a new problem is created instead
+ now = timezone.now()
+ existing = app_problem_generator(
+ app,
+ message="Almost critical",
+ key="crit-key",
+ count=4,
+ updated_at=now - datetime.timedelta(minutes=120),
+ )
+ variables = {
+ "input": {
+ "message": "New occurrence",
+ "key": "crit-key",
+ "aggregationPeriod": 60,
+ "criticalThreshold": 5,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - a new problem is created instead of aggregating
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app, key="crit-key").count() == 2
+
+ # old problem stays at count=4, not critical
+ existing.refresh_from_db()
+ assert existing.count == 4
+ assert existing.is_critical is False
+
+ # new problem starts at count=1, not critical
+ new_problem = data["appProblem"]
+ assert new_problem["count"] == 1
+ assert new_problem["isCritical"] is False
+
+
+def test_app_problem_create_critical_on_first_problem(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Immediately critical",
+ "key": "imm-crit",
+ "criticalThreshold": 1,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.is_critical is True
+ assert problem.count == 1
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_create_eviction.py b/saleor/graphql/app/tests/mutations/test_app_problem_create_eviction.py
new file mode 100644
index 0000000000..0f294fbd34
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_create_eviction.py
@@ -0,0 +1,98 @@
+import datetime
+from unittest.mock import patch
+
+from django.utils import timezone
+
+from .....app.models import AppProblem
+from ....tests.utils import get_graphql_content
+
+APP_PROBLEM_CREATE_MUTATION = """
+ mutation AppProblemCreate($input: AppProblemCreateInput!) {
+ appProblemCreate(input: $input) {
+ appProblem {
+ id
+ message
+ key
+ count
+ isCritical
+ updatedAt
+ }
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+MOCKED_MAX = 2
+
+
[email protected](AppProblem, "MAX_PROBLEMS_PER_APP", MOCKED_MAX)
+def test_app_problem_create_limit_eviction(app_api_client, app):
+ # given
+ now = timezone.now()
+ AppProblem.objects.bulk_create(
+ [
+ AppProblem(
+ app=app,
+ message=f"Problem {i}",
+ key=f"key-{i}",
+ updated_at=now - datetime.timedelta(minutes=MOCKED_MAX - i),
+ )
+ for i in range(MOCKED_MAX)
+ ]
+ )
+ oldest_id = AppProblem.objects.filter(app=app).order_by("updated_at").first().id
+ variables = {"input": {"message": "One more", "key": "new-key"}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == MOCKED_MAX
+ assert not AppProblem.objects.filter(id=oldest_id).exists()
+ assert AppProblem.objects.filter(app=app, key="new-key").exists()
+
+
[email protected](AppProblem, "MAX_PROBLEMS_PER_APP", MOCKED_MAX)
+def test_app_problem_create_bulk_eviction_when_over_limit(app_api_client, app):
+ """Test that multiple oldest problems are evicted when count exceeds limit."""
+ # given - create 4 problems (2 over the mocked limit of 2)
+ over_limit = MOCKED_MAX + 2
+ now = timezone.now()
+ AppProblem.objects.bulk_create(
+ [
+ AppProblem(
+ app=app,
+ message=f"Problem {i}",
+ key=f"key-{i}",
+ updated_at=now,
+ )
+ for i in range(over_limit)
+ ]
+ )
+ # Track the 3 oldest problem IDs (should be evicted to make room for the new one)
+ evict_count = over_limit - MOCKED_MAX + 1
+ oldest_ids = list(
+ AppProblem.objects.filter(app=app)
+ .order_by("created_at")
+ .values_list("id", flat=True)[:evict_count]
+ )
+ variables = {"input": {"message": "One more", "key": "new-key"}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == MOCKED_MAX
+ for old_id in oldest_ids:
+ assert not AppProblem.objects.filter(id=old_id).exists()
+ assert AppProblem.objects.filter(app=app, key="new-key").exists()
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_create_validation.py b/saleor/graphql/app/tests/mutations/test_app_problem_create_validation.py
new file mode 100644
index 0000000000..a6cb1d8b24
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_create_validation.py
@@ -0,0 +1,255 @@
+import datetime
+
+from django.utils import timezone
+
+from .....app.error_codes import AppProblemCreateErrorCode
+from .....app.models import AppProblem
+from ....tests.utils import get_graphql_content
+
+APP_PROBLEM_CREATE_MUTATION = """
+ mutation AppProblemCreate($input: AppProblemCreateInput!) {
+ appProblemCreate(input: $input) {
+ appProblem {
+ id
+ message
+ key
+ count
+ isCritical
+ updatedAt
+ }
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_create_negative_aggregation_period_fails(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Something went wrong",
+ "key": "error-1",
+ "aggregationPeriod": -1,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+
+ # then - Minute scalar rejects negative values at GraphQL level
+ assert response.status_code == 400
+ content = response.json()
+ assert "errors" in content
+ error_message = content["errors"][0]["message"]
+ assert 'Expected type "Minute", found -1' in error_message
+ assert AppProblem.objects.filter(app=app).count() == 0
+
+
+def test_app_problem_create_zero_critical_threshold_fails(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Something went wrong",
+ "key": "error-1",
+ "criticalThreshold": 0,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+
+ # then - PositiveInt scalar rejects 0 at GraphQL level
+ assert response.status_code == 400
+ content = response.json()
+ assert "errors" in content
+ assert "PositiveInt" in content["errors"][0]["message"]
+ assert AppProblem.objects.filter(app=app).count() == 0
+
+
+def test_app_problem_create_negative_critical_threshold_fails(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Something went wrong",
+ "key": "error-1",
+ "criticalThreshold": -5,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+
+ # then - PositiveInt scalar rejects negative values at GraphQL level
+ assert response.status_code == 400
+ content = response.json()
+ assert "errors" in content
+ assert "PositiveInt" in content["errors"][0]["message"]
+ assert AppProblem.objects.filter(app=app).count() == 0
+
+
+def test_app_problem_create_null_aggregation_period_defaults_to_60(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ now = timezone.now()
+ app_problem_generator(
+ app,
+ message="Recent problem",
+ key="null-agg-key",
+ count=1,
+ updated_at=now - datetime.timedelta(minutes=30),
+ )
+ # Explicitly pass null for aggregationPeriod
+ variables = {
+ "input": {
+ "message": "Should aggregate with default period",
+ "key": "null-agg-key",
+ "aggregationPeriod": None,
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - null should default to 60 minutes, so it aggregates with the existing problem
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ assert AppProblem.objects.filter(app=app).count() == 1
+ problem = AppProblem.objects.get(app=app)
+ assert problem.count == 2
+ assert problem.message == "Should aggregate with default period"
+
+
+def test_app_problem_create_message_too_short_fails(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "ab", # min_length=3
+ "key": "error-1",
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "message"
+ assert data["errors"][0]["code"] == AppProblemCreateErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "String should have at least 3 characters"
+ assert AppProblem.objects.filter(app=app).count() == 0
+
+
+def test_app_problem_create_message_too_long_is_truncated(app_api_client, app):
+ # given
+ long_message = "a" * 3000
+ variables = {
+ "input": {
+ "message": long_message,
+ "key": "error-1",
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert len(problem.message) == 2048
+ assert problem.message == "a" * 2045 + "..."
+
+
+def test_app_problem_create_key_too_short_fails(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Something went wrong",
+ "key": "ab", # min_length=3
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "key"
+ assert data["errors"][0]["code"] == AppProblemCreateErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "String should have at least 3 characters"
+ assert AppProblem.objects.filter(app=app).count() == 0
+
+
+def test_app_problem_create_key_too_long_fails(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Something went wrong",
+ "key": "a" * 129, # max_length=128
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "key"
+ assert data["errors"][0]["code"] == AppProblemCreateErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "String should have at most 128 characters"
+ assert AppProblem.objects.filter(app=app).count() == 0
+
+
+def test_app_problem_create_message_at_2048_chars_is_not_truncated(app_api_client, app):
+ # given
+ message = "a" * 2048
+ variables = {
+ "input": {
+ "message": message,
+ "key": "error-1",
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert problem.message == message
+ assert len(problem.message) == 2048
+
+
+def test_app_problem_create_key_at_max_length_succeeds(app_api_client, app):
+ # given
+ variables = {
+ "input": {
+ "message": "Something went wrong",
+ "key": "a" * 128, # exactly at max_length
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_CREATE_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemCreate"]
+ assert not data["errors"]
+ problem = AppProblem.objects.get(app=app)
+ assert len(problem.key) == 128
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_dismiss.py b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss.py
new file mode 100644
index 0000000000..eb3e72aa2e
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss.py
@@ -0,0 +1,122 @@
+import base64
+
+import graphene
+
+from .....app.error_codes import AppProblemDismissErrorCode
+from ....tests.utils import assert_no_permission, get_graphql_content
+
+APP_PROBLEM_DISMISS_MUTATION = """
+ mutation AppProblemDismiss($input: AppProblemDismissInput!) {
+ appProblemDismiss(input: $input) {
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_dismiss_multiple_inputs_fails(
+ app_api_client, app, app_problem_generator
+):
+ # given
+ p1 = app_problem_generator(app)
+ variables = {
+ "input": {
+ "byApp": {"ids": [graphene.Node.to_global_id("AppProblem", p1.id)]},
+ "byStaffWithIds": {
+ "ids": [graphene.Node.to_global_id("AppProblem", p1.id)]
+ },
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] is None
+ assert data["errors"][0]["code"] == "GRAPHQL_ERROR"
+ assert (
+ data["errors"][0]["message"]
+ == "Argument 'byApp' cannot be combined with 'byStaffWithIds'"
+ )
+
+
+def test_app_problem_dismiss_no_input_fails(app_api_client, app):
+ # given
+ variables = {"input": {}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] is None
+ assert data["errors"][0]["code"] == "GRAPHQL_ERROR"
+ assert (
+ data["errors"][0]["message"]
+ == "At least one of arguments is required: 'byApp', 'byStaffWithIds', 'byStaffWithKeys'."
+ )
+
+
+def test_app_problem_dismiss_empty_by_app_fails(app_api_client, app):
+ # given - byApp provided but without ids or keys
+ variables = {"input": {"byApp": {}}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - empty byApp ({}) is falsy, so treated as not provided
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] is None
+ assert data["errors"][0]["code"] == "GRAPHQL_ERROR"
+ assert (
+ data["errors"][0]["message"]
+ == "At least one of arguments is required: 'byApp', 'byStaffWithIds', 'byStaffWithKeys'."
+ )
+
+
+def test_app_problem_dismiss_without_permission(
+ staff_api_client, app, app_problem_generator
+):
+ # given
+ p1 = app_problem_generator(app)
+ variables = {
+ "input": {
+ "byStaffWithIds": {"ids": [graphene.Node.to_global_id("AppProblem", p1.id)]}
+ }
+ }
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+
+ # then
+ assert_no_permission(response)
+
+
+def test_app_problem_dismiss_with_non_integer_id_fails(app_api_client, app):
+ # given - ID with UUID instead of integer pk
+ invalid_id = base64.b64encode(
+ b"AppProblem:a7f47ac1-058c-4372-a567-0e02b2c3d479"
+ ).decode("utf-8")
+ variables = {"input": {"byApp": {"ids": [invalid_id]}}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "ids"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert "Invalid ID" in data["errors"][0]["message"]
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_app.py b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_app.py
new file mode 100644
index 0000000000..87d6342940
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_app.py
@@ -0,0 +1,225 @@
+import graphene
+
+from .....app.error_codes import AppProblemDismissErrorCode
+from ....tests.utils import get_graphql_content
+from ...mutations.app_problem_dismiss import MAX_ITEMS_LIMIT
+
+APP_PROBLEM_DISMISS_MUTATION = """
+ mutation AppProblemDismiss($input: AppProblemDismissInput!) {
+ appProblemDismiss(input: $input) {
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_dismiss_by_ids_as_app(app_api_client, app, app_problem_generator):
+ # given
+ p1 = app_problem_generator(app, key="k1", message="Problem 1")
+ p2 = app_problem_generator(app, key="k2", message="Problem 2")
+ variables = {
+ "input": {
+ "byApp": {
+ "ids": [graphene.Node.to_global_id("AppProblem", p1.id)],
+ }
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert not data["errors"]
+ p1.refresh_from_db()
+ p2.refresh_from_db()
+ assert p1.dismissed is True
+ assert p1.dismissed_by_user_email is None # Dismissed by app, no email
+ assert p1.dismissed_by_user is None
+ assert p2.dismissed is False
+
+
+def test_app_problem_dismiss_by_keys_as_app(app_api_client, app, app_problem_generator):
+ # given
+ p1 = app_problem_generator(app, key="same-key", message="Problem 1")
+ p2 = app_problem_generator(app, key="same-key", message="Problem 2")
+ p3 = app_problem_generator(app, key="other-key", message="Problem 3")
+ variables = {"input": {"byApp": {"keys": ["same-key"]}}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert not data["errors"]
+ p1.refresh_from_db()
+ p2.refresh_from_db()
+ p3.refresh_from_db()
+ assert p1.dismissed is True
+ assert p2.dismissed is True
+ assert p3.dismissed is False
+
+
+def test_app_problem_dismiss_by_ids_and_keys_as_app_fails(
+ app_api_client, app, app_problem_generator
+):
+ # given - cannot specify both ids and keys
+ p1 = app_problem_generator(app, key="k1", message="Problem 1")
+ variables = {
+ "input": {
+ "byApp": {
+ "ids": [graphene.Node.to_global_id("AppProblem", p1.id)],
+ "keys": ["k2"],
+ }
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "byApp"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "Cannot specify both 'ids' and 'keys'."
+
+
+def test_app_problem_dismiss_idempotent(app_api_client, app, app_problem_generator):
+ # given - problem already dismissed
+ p1 = app_problem_generator(app, key="k1", dismissed=True)
+ variables = {
+ "input": {"byApp": {"ids": [graphene.Node.to_global_id("AppProblem", p1.id)]}}
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert not data["errors"]
+ p1.refresh_from_db()
+ assert p1.dismissed is True
+
+
+def test_app_cannot_dismiss_other_apps_problems(
+ app_api_client, app, app_with_token, app_problem_generator
+):
+ # given - p1 belongs to a different app
+ other_app = app_with_token
+ p1 = app_problem_generator(other_app, key="k1")
+ variables = {
+ "input": {"byApp": {"ids": [graphene.Node.to_global_id("AppProblem", p1.id)]}}
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - error returned
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "ids"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert (
+ data["errors"][0]["message"]
+ == "Cannot dismiss problems belonging to other apps."
+ )
+ p1.refresh_from_db()
+ assert p1.dismissed is False
+
+
+def test_app_caller_cannot_use_by_staff_with_ids(
+ app_api_client, app, app_problem_generator
+):
+ # given - app caller tries to use byStaffWithIds (staff-only)
+ p1 = app_problem_generator(app)
+ variables = {
+ "input": {
+ "byStaffWithIds": {"ids": [graphene.Node.to_global_id("AppProblem", p1.id)]}
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "byStaffWithIds"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert (
+ data["errors"][0]["message"]
+ == "App callers cannot use this input. Use 'byApp' instead."
+ )
+
+
+def test_app_caller_cannot_use_by_staff_with_keys(app_api_client, app):
+ # given - app caller tries to use byStaffWithKeys (staff-only)
+ variables = {
+ "input": {
+ "byStaffWithKeys": {
+ "keys": ["k1"],
+ "app": graphene.Node.to_global_id("App", app.id),
+ }
+ }
+ }
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "byStaffWithKeys"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert (
+ data["errors"][0]["message"]
+ == "App callers cannot use this input. Use 'byApp' instead."
+ )
+
+
+def test_app_problem_dismiss_by_app_with_too_many_ids_fails(app_api_client, app):
+ # given
+ ids = [
+ graphene.Node.to_global_id("AppProblem", i) for i in range(MAX_ITEMS_LIMIT + 1)
+ ]
+ variables = {"input": {"byApp": {"ids": ids}}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "ids"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "Cannot specify more than 100 items."
+
+
+def test_app_problem_dismiss_by_app_with_too_many_keys_fails(app_api_client, app):
+ # given
+ keys = [f"key-{i}" for i in range(MAX_ITEMS_LIMIT + 1)]
+ variables = {"input": {"byApp": {"keys": keys}}}
+
+ # when
+ response = app_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "keys"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "Cannot specify more than 100 items."
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_ids.py b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_ids.py
new file mode 100644
index 0000000000..e9d9a80325
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_ids.py
@@ -0,0 +1,123 @@
+import graphene
+
+from .....app.error_codes import AppProblemDismissErrorCode
+from ....tests.utils import get_graphql_content
+from ...mutations.app_problem_dismiss import MAX_ITEMS_LIMIT
+
+APP_PROBLEM_DISMISS_MUTATION = """
+ mutation AppProblemDismiss($input: AppProblemDismissInput!) {
+ appProblemDismiss(input: $input) {
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_dismiss_by_ids_as_staff(
+ staff_api_client, app, permission_manage_apps, app_problem_generator
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ p1 = app_problem_generator(app, key="k1")
+ variables = {
+ "input": {
+ "byStaffWithIds": {
+ "ids": [graphene.Node.to_global_id("AppProblem", p1.id)],
+ }
+ }
+ }
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert not data["errors"]
+ p1.refresh_from_db()
+ assert p1.dismissed is True
+ assert p1.dismissed_by_user_email == staff_api_client.user.email
+ assert p1.dismissed_by_user == staff_api_client.user
+
+
+def test_staff_can_dismiss_problems_from_multiple_apps(
+ staff_api_client, app, app_with_token, permission_manage_apps, app_problem_generator
+):
+ # given - problems from 2 different apps
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ p1 = app_problem_generator(app, key="k1", message="Problem from app 1")
+ p2 = app_problem_generator(app_with_token, key="k2", message="Problem from app 2")
+ variables = {
+ "input": {
+ "byStaffWithIds": {
+ "ids": [
+ graphene.Node.to_global_id("AppProblem", p1.id),
+ graphene.Node.to_global_id("AppProblem", p2.id),
+ ]
+ }
+ }
+ }
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then - both problems should be dismissed
+ data = content["data"]["appProblemDismiss"]
+ assert not data["errors"]
+ p1.refresh_from_db()
+ p2.refresh_from_db()
+ assert p1.dismissed is True
+ assert p1.dismissed_by_user_email == staff_api_client.user.email
+ assert p1.dismissed_by_user == staff_api_client.user
+ assert p2.dismissed is True
+ assert p2.dismissed_by_user_email == staff_api_client.user.email
+ assert p2.dismissed_by_user == staff_api_client.user
+
+
+def test_user_caller_cannot_use_by_app(
+ staff_api_client, app, permission_manage_apps, app_problem_generator
+):
+ # given - staff caller tries to use byApp
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ p1 = app_problem_generator(app)
+ variables = {
+ "input": {"byApp": {"ids": [graphene.Node.to_global_id("AppProblem", p1.id)]}}
+ }
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "byApp"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "Only app callers can use 'byApp'."
+
+
+def test_app_problem_dismiss_by_staff_with_too_many_ids_fails(
+ staff_api_client, app, permission_manage_apps
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ ids = [
+ graphene.Node.to_global_id("AppProblem", i) for i in range(MAX_ITEMS_LIMIT + 1)
+ ]
+ variables = {"input": {"byStaffWithIds": {"ids": ids}}}
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "ids"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "Cannot specify more than 100 items."
diff --git a/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_keys.py b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_keys.py
new file mode 100644
index 0000000000..ca013930e6
--- /dev/null
+++ b/saleor/graphql/app/tests/mutations/test_app_problem_dismiss_by_staff_with_keys.py
@@ -0,0 +1,72 @@
+import graphene
+
+from .....app.error_codes import AppProblemDismissErrorCode
+from ....tests.utils import get_graphql_content
+from ...mutations.app_problem_dismiss import MAX_ITEMS_LIMIT
+
+APP_PROBLEM_DISMISS_MUTATION = """
+ mutation AppProblemDismiss($input: AppProblemDismissInput!) {
+ appProblemDismiss(input: $input) {
+ errors {
+ field
+ code
+ message
+ }
+ }
+ }
+"""
+
+
+def test_app_problem_dismiss_by_keys_as_staff(
+ staff_api_client, app, permission_manage_apps, app_problem_generator
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ p1 = app_problem_generator(app, key="k1")
+ variables = {
+ "input": {
+ "byStaffWithKeys": {
+ "keys": ["k1"],
+ "app": graphene.Node.to_global_id("App", app.id),
+ }
+ }
+ }
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert not data["errors"]
+ p1.refresh_from_db()
+ assert p1.dismissed is True
+ assert p1.dismissed_by_user_email == staff_api_client.user.email
+ assert p1.dismissed_by_user == staff_api_client.user
+
+
+def test_app_problem_dismiss_by_staff_with_too_many_keys_fails(
+ staff_api_client, app, permission_manage_apps
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ keys = [f"key-{i}" for i in range(MAX_ITEMS_LIMIT + 1)]
+ variables = {
+ "input": {
+ "byStaffWithKeys": {
+ "keys": keys,
+ "app": graphene.Node.to_global_id("App", app.id),
+ }
+ }
+ }
+
+ # when
+ response = staff_api_client.post_graphql(APP_PROBLEM_DISMISS_MUTATION, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["appProblemDismiss"]
+ assert len(data["errors"]) == 1
+ assert data["errors"][0]["field"] == "keys"
+ assert data["errors"][0]["code"] == AppProblemDismissErrorCode.INVALID.name
+ assert data["errors"][0]["message"] == "Cannot specify more than 100 items."
diff --git a/saleor/graphql/app/tests/queries/test_app_problems.py b/saleor/graphql/app/tests/queries/test_app_problems.py
new file mode 100644
index 0000000000..612d088603
--- /dev/null
+++ b/saleor/graphql/app/tests/queries/test_app_problems.py
@@ -0,0 +1,639 @@
+import graphene
+
+from .....app.models import AppProblem
+from ....tests.utils import get_graphql_content, get_graphql_content_from_response
+
+QUERY_APP_PROBLEMS = """
+ query ($id: ID) {
+ app(id: $id) {
+ id
+ problems {
+ id
+ message
+ key
+ createdAt
+ updatedAt
+ count
+ isCritical
+ }
+ }
+ }
+"""
+
+QUERY_APP_PROBLEMS_WITH_LIMIT = """
+ query ($id: ID, $limit: PositiveInt) {
+ app(id: $id) {
+ id
+ problems(limit: $limit) {
+ id
+ message
+ }
+ }
+ }
+"""
+
+QUERY_APP_PROBLEMS_WITH_DISMISSED_BY = """
+ query ($id: ID) {
+ app(id: $id) {
+ id
+ problems {
+ id
+ dismissed {
+ by
+ }
+ }
+ }
+ }
+"""
+
+QUERY_APP_PROBLEMS_WITH_DISMISSED_BY_AND_EMAIL = """
+ query ($id: ID) {
+ app(id: $id) {
+ id
+ problems {
+ id
+ dismissed {
+ by
+ userEmail
+ }
+ }
+ }
+ }
+"""
+
+QUERY_APP_PROBLEMS_WITH_DISMISSED_USER = """
+ query ($id: ID) {
+ app(id: $id) {
+ id
+ problems {
+ id
+ dismissed {
+ user {
+ id
+ email
+ }
+ }
+ }
+ }
+ }
+"""
+
+QUERY_APP_PROBLEMS_WITH_DISMISSED_EMAIL_ONLY = """
+ query ($id: ID) {
+ app(id: $id) {
+ id
+ problems {
+ id
+ dismissed {
+ userEmail
+ }
+ }
+ }
+ }
+"""
+
+
+def test_app_problems_empty(app_api_client, app):
+ # given
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS, variables)
+ content = get_graphql_content(response)
+
+ # then
+ data = content["data"]["app"]
+ assert data["problems"] == []
+
+
+def test_app_problems_returns_problems(app_api_client, app):
+ # given
+ p1 = AppProblem.objects.create(app=app, message="Issue 1", key="k1")
+ p2 = AppProblem.objects.create(app=app, message="Issue 2", key="k2")
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS, variables)
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 2
+ # Ordered by created_at desc, so p2 comes first
+ assert problems[0]["id"] == graphene.Node.to_global_id("AppProblem", p2.id)
+ assert problems[0]["message"] == p2.message
+ assert problems[0]["key"] == p2.key
+ assert problems[0]["count"] == 1
+ assert problems[0]["isCritical"] is False
+ assert problems[1]["id"] == graphene.Node.to_global_id("AppProblem", p1.id)
+ assert problems[1]["message"] == p1.message
+ assert problems[1]["key"] == p1.key
+ assert problems[1]["count"] == 1
+ assert problems[1]["isCritical"] is False
+
+
+def test_app_problems_ordered_by_created_at_desc(app_api_client, app):
+ # given
+ p1 = AppProblem.objects.create(app=app, message="First", key="k1")
+ p2 = AppProblem.objects.create(app=app, message="Second", key="k2")
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS, variables)
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 2
+ assert problems[0]["id"] == graphene.Node.to_global_id("AppProblem", p2.id)
+ assert problems[0]["message"] == p2.message
+ assert problems[0]["key"] == p2.key
+ assert problems[1]["id"] == graphene.Node.to_global_id("AppProblem", p1.id)
+ assert problems[1]["message"] == p1.message
+ assert problems[1]["key"] == p1.key
+
+
+def test_app_problems_count_and_critical(app_api_client, app):
+ # given
+ AppProblem.objects.create(
+ app=app, message="Normal", key="k1", count=3, is_critical=False
+ )
+ AppProblem.objects.create(
+ app=app,
+ message="Critical",
+ key="k2",
+ count=10,
+ is_critical=True,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS, variables)
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ by_msg = {p["message"]: p for p in problems}
+ assert by_msg["Normal"]["count"] == 3
+ assert by_msg["Normal"]["isCritical"] is False
+ assert by_msg["Critical"]["count"] == 10
+ assert by_msg["Critical"]["isCritical"] is True
+
+
+def test_app_problems_dismissed_null_when_not_dismissed(app_api_client, app):
+ # given
+ AppProblem.objects.create(app=app, message="Active", key="k1", dismissed=False)
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"] is None
+
+
+def test_app_problems_dismissed_by_app(app_api_client, app):
+ # given
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by app",
+ key="k1",
+ dismissed=True,
+ # No dismissed_by_user_email means dismissed by app
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["by"] == "APP"
+
+
+def test_app_problems_dismissed_by_user(
+ staff_api_client, app, permission_manage_apps, permission_manage_staff
+):
+ # given
+ staff_api_client.user.user_permissions.add(
+ permission_manage_apps, permission_manage_staff
+ )
+ staff_user = staff_api_client.user
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY_AND_EMAIL, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["by"] == "USER"
+ assert problems[0]["dismissed"]["userEmail"] == staff_user.email
+
+
+def test_app_problems_dismissed_by_user_returns_null_when_user_deleted(
+ staff_api_client, app, permission_manage_apps, permission_manage_staff
+):
+ # given - a problem was dismissed by a user who was later deleted
+ staff_api_client.user.user_permissions.add(
+ permission_manage_apps, permission_manage_staff
+ )
+ staff_user = staff_api_client.user
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by deleted user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=None,
+ )
+
+ # when
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY_AND_EMAIL, variables
+ )
+ content = get_graphql_content(response)
+
+ # then - dismissed.by should still be USER (email is preserved)
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["by"] == "USER"
+ assert problems[0]["dismissed"]["userEmail"] == staff_user.email
+
+
+# Permission tests for dismissed.userEmail field
+
+
+def test_app_cannot_see_dismissed_user_email(
+ app_api_client, app, staff_user, permission_manage_apps
+):
+ # given
+ app_api_client.app.permissions.add(permission_manage_apps)
+ AppProblem.objects.create(
+ app=app,
+ message="Problem",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_EMAIL_ONLY, variables
+ )
+ content = get_graphql_content_from_response(response)
+
+ # then
+ assert "errors" in content
+ assert content["errors"][0]["extensions"]["exception"]["code"] == "PermissionDenied"
+
+
+def test_authenticated_user_can_see_dismissed_user_email(
+ staff_api_client, app, permission_manage_apps
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ staff_user = staff_api_client.user
+ AppProblem.objects.create(
+ app=app,
+ message="Problem",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_EMAIL_ONLY, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["userEmail"] == staff_user.email
+
+
+def test_app_without_manage_staff_cannot_see_dismissed_user_email(
+ app_api_client, app, staff_user, permission_manage_apps
+):
+ # given - app has MANAGE_APPS but not MANAGE_STAFF
+ app_api_client.app.permissions.add(permission_manage_apps)
+ AppProblem.objects.create(
+ app=app,
+ message="Problem",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_EMAIL_ONLY, variables
+ )
+ content = get_graphql_content_from_response(response)
+
+ # then
+ assert "errors" in content
+ assert content["errors"][0]["extensions"]["exception"]["code"] == "PermissionDenied"
+
+
+# Permission tests for dismissed.by field - when dismissed by App
+
+
+def test_app_can_see_dismissed_by_when_dismissed_by_app(app_api_client, app):
+ # given
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by app",
+ key="k1",
+ dismissed=True,
+ # No dismissed_by_user_email means dismissed by app
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["by"] == "APP"
+
+
+def test_authenticated_user_can_see_dismissed_by_when_dismissed_by_app(
+ staff_api_client, app, permission_manage_apps
+):
+ # given
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by app",
+ key="k1",
+ dismissed=True,
+ # No dismissed_by_user_email means dismissed by app
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["by"] == "APP"
+
+
+# Permission tests for dismissed.user field
+
+
+def test_by_field_accessible_to_app_when_dismissed_by_user(
+ app_api_client, app, staff_user
+):
+ # given - app can see `by` enum even when dismissed by user
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_BY, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["by"] == "USER"
+
+
+def test_user_with_manage_staff_can_see_dismissed_user(
+ staff_api_client, app, permission_manage_apps, permission_manage_staff
+):
+ # given
+ staff_api_client.user.user_permissions.add(
+ permission_manage_apps, permission_manage_staff
+ )
+ staff_user = staff_api_client.user
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_USER, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["user"]["email"] == staff_user.email
+
+
+def test_user_without_manage_staff_cannot_see_dismissed_user(
+ staff_api_client, app, staff_user, permission_manage_apps
+):
+ # given - user has MANAGE_APPS but not MANAGE_STAFF
+ staff_api_client.user.user_permissions.add(permission_manage_apps)
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_USER, variables
+ )
+ content = get_graphql_content_from_response(response)
+
+ # then
+ assert "errors" in content
+ assert content["errors"][0]["extensions"]["exception"]["code"] == "PermissionDenied"
+
+
+def test_app_cannot_see_dismissed_user(
+ app_api_client, app, staff_user, permission_manage_apps
+):
+ # given
+ app_api_client.app.permissions.add(permission_manage_apps)
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=staff_user,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = app_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_USER, variables
+ )
+ content = get_graphql_content_from_response(response)
+
+ # then
+ assert "errors" in content
+ assert content["errors"][0]["extensions"]["exception"]["code"] == "PermissionDenied"
+
+
+def test_dismissed_user_returns_null_when_dismissed_by_app(
+ staff_api_client, app, permission_manage_apps, permission_manage_staff
+):
+ # given
+ staff_api_client.user.user_permissions.add(
+ permission_manage_apps, permission_manage_staff
+ )
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by app",
+ key="k1",
+ dismissed=True,
+ )
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+
+ # when
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_USER, variables
+ )
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["user"] is None
+
+
+def test_dismissed_user_returns_null_when_user_deleted(
+ staff_api_client, app, permission_manage_apps, permission_manage_staff
+):
+ # given - dismissed_by_user is None (simulating SET_NULL after user deletion)
+ staff_api_client.user.user_permissions.add(
+ permission_manage_apps, permission_manage_staff
+ )
+ staff_user = staff_api_client.user
+ AppProblem.objects.create(
+ app=app,
+ message="Dismissed by deleted user",
+ key="k1",
+ dismissed=True,
+ dismissed_by_user_email=staff_user.email,
+ dismissed_by_user=None,
+ )
+
+ # when
+ variables = {"id": graphene.Node.to_global_id("App", app.id)}
+ response = staff_api_client.post_graphql(
+ QUERY_APP_PROBLEMS_WITH_DISMISSED_USER, variables
+ )
+ content = get_graphql_content(response)
+
+ # then - user is null after FK SET_NULL
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["dismissed"]["user"] is None
+
+
+def test_app_problems_limit_negative(app_api_client, app):
+ # given
+ AppProblem.objects.create(app=app, message="Issue 1", key="k1")
+ variables = {
+ "id": graphene.Node.to_global_id("App", app.id),
+ "limit": -1,
+ }
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS_WITH_LIMIT, variables)
+ content = get_graphql_content_from_response(response)
+
+ # then
+ assert len(content["errors"]) == 1
+ assert 'Expected type "PositiveInt", found -1.' in content["errors"][0]["message"]
+
+
+def test_app_problems_limit_zero(app_api_client, app):
+ # given
+ AppProblem.objects.create(app=app, message="Issue 1", key="k1")
+ variables = {
+ "id": graphene.Node.to_global_id("App", app.id),
+ "limit": 0,
+ }
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS_WITH_LIMIT, variables)
+ content = get_graphql_content_from_response(response)
+
+ # then
+ assert len(content["errors"]) == 1
+ assert 'Expected type "PositiveInt", found 0.' in content["errors"][0]["message"]
+
+
+def test_app_problems_limit_one(app_api_client, app):
+ # given
+ AppProblem.objects.create(app=app, message="Issue 1", key="k1")
+ p2 = AppProblem.objects.create(app=app, message="Issue 2", key="k2")
+ variables = {
+ "id": graphene.Node.to_global_id("App", app.id),
+ "limit": 1,
+ }
+
+ # when
+ response = app_api_client.post_graphql(QUERY_APP_PROBLEMS_WITH_LIMIT, variables)
+ content = get_graphql_content(response)
+
+ # then
+ problems = content["data"]["app"]["problems"]
+ assert len(problems) == 1
+ assert problems[0]["id"] == graphene.Node.to_global_id("AppProblem", p2.id)
+ assert problems[0]["message"] == p2.message
diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.py
index 61bdde76e2..0ffeff478b 100644
--- a/saleor/graphql/app/types.py
+++ b/saleor/graphql/app/types.py
@@ -2,6 +2,7 @@ import base64
import datetime
import graphene
+from graphql import GraphQLError
from ...app import models
from ...app.types import (
@@ -12,7 +13,7 @@ from ...core.exceptions import PermissionDenied
from ...core.jwt import JWT_THIRDPARTY_ACCESS_TYPE
from ...core.utils import build_absolute_uri
from ...permission.auth_filters import AuthorizationFilters, is_staff_user
-from ...permission.enums import AppPermission
+from ...permission.enums import AccountPermissions, AppPermission
from ...permission.utils import message_one_of_permissions_required
from ...thumbnail import PIL_IDENTIFIER_TO_MIME_TYPE
from ...thumbnail.utils import (
@@ -25,6 +26,7 @@ from ...thumbnail.utils import (
from ...webhook.circuit_breaker.breaker_board import (
initialize_breaker_board,
)
+from ..account.dataloaders import UserByUserIdLoader
from ..account.utils import is_owner_or_has_one_of_perms
from ..core import ResolveInfo, SaleorContext
from ..core.connection import CountableConnection
@@ -33,7 +35,8 @@ from ..core.dataloaders import DataLoader
from ..core.descriptions import ADDED_IN_319, ADDED_IN_321, ADDED_IN_322
from ..core.doc_category import DOC_CATEGORY_APPS
from ..core.federation import federated_entity, resolve_federation_references
-from ..core.scalars import JSON, DateTime
+from ..core.fields import PermissionsField
+from ..core.scalars import JSON, DateTime, PositiveInt
from ..core.types import (
BaseEnum,
BaseObjectType,
@@ -52,12 +55,15 @@ from ..webhook.types import Webhook
from .dataloaders import (
AppByIdLoader,
AppExtensionByAppIdLoader,
+ AppProblemsByAppIdLoader,
AppTokensByAppIdLoader,
ThumbnailByAppIdSizeAndFormatLoader,
ThumbnailByAppInstallationIdSizeAndFormatLoader,
app_promise_callback,
)
from .enums import (
+ AppProblemDismissedBy,
+ AppProblemDismissedByEnum,
AppTypeEnum,
CircuitBreakerState,
CircuitBreakerStateEnum,
@@ -534,6 +540,107 @@ class AppToken(BaseObjectType):
return root.token_last_4
+class AppProblemDismissed(graphene.ObjectType):
+ by = AppProblemDismissedByEnum(
+ required=True,
+ description=(
+ "Whether the problem was dismissed by an App or a User." + ADDED_IN_322
+ ),
+ )
+ user = PermissionsField(
+ "saleor.graphql.account.types.User",
+ description=(
+ "The user who dismissed this problem. "
+ "Null if dismissed by an app or the user was deleted." + ADDED_IN_322
+ ),
+ permissions=[AccountPermissions.MANAGE_STAFF],
+ )
+ user_email = PermissionsField(
+ graphene.String,
+ description=(
+ "Email of the user who dismissed this problem. "
+ "Preserved even if the user is deleted." + ADDED_IN_322
+ ),
+ permissions=[AuthorizationFilters.AUTHENTICATED_STAFF_USER],
+ )
+
+ class Meta:
+ description = "Dismissal information for an app problem." + ADDED_IN_322
+ doc_category = DOC_CATEGORY_APPS
+
+ @staticmethod
+ def resolve_by(root: models.AppProblem, _info: ResolveInfo):
+ if root.is_dismissed_by_user():
+ return AppProblemDismissedBy.USER
+ return AppProblemDismissedBy.APP
+
+ @staticmethod
+ def resolve_user(root: models.AppProblem, info: ResolveInfo):
+ # Even if use did dismiss, user can be removed, so solely rely on it's reference
+ if not root.dismissed_by_user_id:
+ return None
+
+ return UserByUserIdLoader(info.context).load(root.dismissed_by_user_id)
+
+ @staticmethod
+ def resolve_user_email(root: models.AppProblem, _info: ResolveInfo):
+ return root.dismissed_by_user_email
+
+
+class AppProblem(ModelObjectType[models.AppProblem]):
+ id = graphene.GlobalID(
+ required=True,
+ description="The ID of the app problem." + ADDED_IN_322,
+ )
+ created_at = DateTime(
+ required=True,
+ description="The date and time when the problem was created." + ADDED_IN_322,
+ )
+ updated_at = DateTime(
+ required=True,
+ description="The date and time when the problem was last updated."
+ + ADDED_IN_322,
+ )
+ count = graphene.Int(
+ required=True, description="Number of occurrences." + ADDED_IN_322
+ )
+ is_critical = graphene.Boolean(
+ required=True,
+ description="Whether the problem has reached critical threshold."
+ + ADDED_IN_322,
+ )
+ dismissed = PermissionsField(
+ AppProblemDismissed,
+ description=(
+ "Dismissal information. Null if the problem has not been dismissed."
+ + ADDED_IN_322
+ ),
+ permissions=[
+ AuthorizationFilters.AUTHENTICATED_APP,
+ AppPermission.MANAGE_APPS,
+ ],
+ )
+ message = graphene.String(
+ required=True, description="The problem message." + ADDED_IN_322
+ )
+ key = graphene.String(
+ required=True,
+ description="Key identifying the type of problem." + ADDED_IN_322,
+ )
+
+ class Meta:
+ description = "Represents a problem associated with an app." + ADDED_IN_322
+ doc_category = DOC_CATEGORY_APPS
+ interfaces = [graphene.relay.Node]
+ model = models.AppProblem
+
+ @staticmethod
+ def resolve_dismissed(root: models.AppProblem, _info: ResolveInfo):
+ if not root.dismissed:
+ return None
+ return root
+
+
@federated_entity("id")
class App(ModelObjectType[models.App]):
id = graphene.GlobalID(required=True, description="The ID of the app.")
@@ -595,6 +702,18 @@ class App(ModelObjectType[models.App]):
description="App's dashboard extensions.",
required=True,
)
+ problems = PermissionsField(
+ NonNullList(AppProblem),
+ description="List of problems associated with this app." + ADDED_IN_322,
+ permissions=[
+ AuthorizationFilters.AUTHENTICATED_APP,
+ AppPermission.MANAGE_APPS,
+ ],
+ limit=PositiveInt(
+ description="Limit number of returned problems. Must be between 1 and 100.",
+ required=False,
+ ),
+ )
brand = graphene.Field(AppBrand, description="App's brand data.")
breaker_state = CircuitBreakerStateEnum(
description="Circuit breaker state, if open, sync webhooks operation is disrupted."
@@ -642,6 +761,18 @@ class App(ModelObjectType[models.App]):
def resolve_extensions(root: models.App, info: ResolveInfo):
return AppExtensionByAppIdLoader(info.context).load(root.id)
+ @staticmethod
+ def resolve_problems(root: models.App, info: ResolveInfo, limit: int | None = None):
+ if limit is not None and limit > 100:
+ raise GraphQLError("Limit must be between 1 and 100.")
+
+ promise = AppProblemsByAppIdLoader(info.context).load(root.id)
+
+ if limit is not None:
+ return promise.then(lambda problems: problems[:limit])
+
+ return promise
+
@staticmethod
def __resolve_references(roots: list["App"], info: ResolveInfo):
from .resolvers import resolve_apps
diff --git a/saleor/graphql/error.py b/saleor/graphql/error.py
index 256df01f86..abe6bec49e 100644
--- a/saleor/graphql/error.py
+++ b/saleor/graphql/error.py
@@ -1,4 +1,21 @@
+from django.core.exceptions import ValidationError
from graphql.error import GraphQLError
+from pydantic import ValidationError as PydanticValidationError
+
+
+def pydantic_to_validation_error(
+ exc: PydanticValidationError, error_code: str = "invalid"
+) -> ValidationError:
+ """Convert Pydantic ValidationError to Django ValidationError."""
+ errors: dict[str, ValidationError] = {}
+
+ for error in exc.errors():
+ field = str(error["loc"][0]) if error["loc"] else "input"
+ errors[field] = ValidationError(
+ error["msg"],
+ code=error_code,
+ )
+ return ValidationError(errors)
def clear_traceback_locals(tb):
diff --git a/saleor/graphql/query_cost_map.py b/saleor/graphql/query_cost_map.py
index 64b578e5a3..14e5ec27dc 100644
--- a/saleor/graphql/query_cost_map.py
+++ b/saleor/graphql/query_cost_map.py
@@ -138,6 +138,7 @@ COST_MAP = {
},
"App": {
"extensions": {"complexity": 1},
+ "problems": {"complexity": 1, "multipliers": ["limit"]},
"tokens": {"complexity": 1},
"webhooks": {"complexity": 1},
},
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index f9a2cf7b87..f88dca2ba8 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -2900,6 +2900,18 @@ type App implements Node & ObjectWithMetadata @doc(category: "Apps") {
"""App's dashboard extensions."""
extensions: [AppExtension!]!
+ """
+ List of problems associated with this app.
+
+ Added in Saleor 3.22.
+
+ Requires one of the following permissions: AUTHENTICATED_APP, MANAGE_APPS.
+ """
+ problems(
+ """Limit number of returned problems. Must be between 1 and 100."""
+ limit: PositiveInt
+ ): [AppProblem!]
+
"""App's brand data."""
brand: AppBrand
@@ -3083,102 +3095,185 @@ type AppExtension implements Node @doc(category: "Apps") {
scalar JSON
-"""Represents the app's brand data."""
-type AppBrand @doc(category: "Apps") {
- """App's logos details."""
- logo: AppBrandLogo!
-}
+"""
+Represents a problem associated with an app.
-"""Represents the app's brand logo data."""
-type AppBrandLogo @doc(category: "Apps") {
- """URL to the default logo image."""
- default(
- """
- Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
- """
- size: Int
+Added in Saleor 3.22.
+"""
+type AppProblem implements Node @doc(category: "Apps") {
+ """
+ The ID of the app problem.
+
+ Added in Saleor 3.22.
+ """
+ id: ID!
- """
- The format of the image. When not provided, format of the original image will be used.
- """
- format: IconThumbnailFormatEnum = ORIGINAL
- ): String!
-}
+ """
+ The date and time when the problem was created.
+
+ Added in Saleor 3.22.
+ """
+ createdAt: DateTime!
-"""Thumbnail formats for icon images."""
-enum IconThumbnailFormatEnum {
- ORIGINAL
- WEBP
-}
+ """
+ The date and time when the problem was last updated.
+
+ Added in Saleor 3.22.
+ """
+ updatedAt: DateTime!
-"""Enum determining the state of a circuit breaker."""
-enum CircuitBreakerStateEnum @doc(category: "Apps") {
- """The breaker is conducting (requests are passing through)."""
- CLOSED
+ """
+ Number of occurrences.
+
+ Added in Saleor 3.22.
+ """
+ count: Int!
"""
- The breaker is in a trial period (to close or open). Note that unlike classic breaker patterns, this is not a state where we are throttling the number of requests, it's a state similar to CLOSED but with different thresholds.
+ Whether the problem has reached critical threshold.
+
+ Added in Saleor 3.22.
"""
- HALF_OPEN
+ isCritical: Boolean!
"""
- The breaker is tripped (no requests are passing). Breaker will enter half-open state after cooldown period.
+ Dismissal information. Null if the problem has not been dismissed.
+
+ Added in Saleor 3.22.
+
+ Requires one of the following permissions: AUTHENTICATED_APP, MANAGE_APPS.
"""
- OPEN
-}
+ dismissed: AppProblemDismissed
-type EventDeliveryCountableConnection {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [EventDeliveryCountableEdge!]!
+ """
+ The problem message.
+
+ Added in Saleor 3.22.
+ """
+ message: String!
- """A total count of items in the collection."""
- totalCount: Int
+ """
+ Key identifying the type of problem.
+
+ Added in Saleor 3.22.
+ """
+ key: String!
}
"""
-The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
-"""
-type PageInfo {
- """When paginating forwards, are there more items?"""
- hasNextPage: Boolean!
+Dismissal information for an app problem.
- """When paginating backwards, are there more items?"""
- hasPreviousPage: Boolean!
+Added in Saleor 3.22.
+"""
+type AppProblemDismissed {
+ """
+ Whether the problem was dismissed by an App or a User.
+
+ Added in Saleor 3.22.
+ """
+ by: AppProblemDismissedByEnum!
- """When paginating backwards, the cursor to continue."""
- startCursor: String
+ """
+ The user who dismissed this problem. Null if dismissed by an app or the user was deleted.
+
+ Added in Saleor 3.22.
+
+ Requires one of the following permissions: MANAGE_STAFF.
+ """
+ user: User
- """When paginating forwards, the cursor to continue."""
- endCursor: String
+ """
+ Email of the user who dismissed this problem. Preserved even if the user is deleted.
+
+ Added in Saleor 3.22.
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER.
+ """
+ userEmail: String
}
-type EventDeliveryCountableEdge {
- """The item at the end of the edge."""
- node: EventDelivery!
-
- """A cursor for use in pagination."""
- cursor: String!
+enum AppProblemDismissedByEnum @doc(category: "Apps") {
+ APP
+ USER
}
-"""Event delivery."""
-type EventDelivery implements Node {
- """The ID of an event delivery."""
+"""Represents user data."""
+type User implements Node & ObjectWithMetadata @doc(category: "Users") {
+ """The ID of the user."""
id: ID!
- """Creation time of an event delivery."""
- createdAt: DateTime!
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
- """Event delivery status."""
- status: EventDeliveryStatusEnum!
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
- """Webhook event type."""
- eventType: WebhookEventTypeEnum!
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
- """Event delivery attempts."""
- attempts(
- """Event delivery sorter"""
- sortBy: EventDeliveryAttemptSortingInput
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
+
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
+
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """The email address of the user."""
+ email: String!
+
+ """The given name of the address."""
+ firstName: String!
+
+ """The family name of the address."""
+ lastName: String!
+
+ """Determine if the user is a staff admin."""
+ isStaff: Boolean!
+
+ """Determine if the user is active."""
+ isActive: Boolean!
+
+ """Determines if user has confirmed email."""
+ isConfirmed: Boolean!
+
+ """List of all user's addresses."""
+ addresses: [Address!]!
+
+ """Returns the last open checkout of this user."""
+ checkout: Checkout @deprecated(reason: "Use the `checkoutTokens` field to fetch the user checkouts.")
+
+ """Returns the checkout UUID's assigned to this user."""
+ checkoutTokens(
+ """Slug of a channel for which the data should be returned."""
+ channel: String
+ ): [UUID!] @deprecated(reason: "Use `checkoutIds` instead.")
+
+ """Returns the checkout ID's assigned to this user."""
+ checkoutIds(
+ """Slug of a channel for which the data should be returned."""
+ channel: String
+ ): [ID!]
+
+ """
+ Returns checkouts assigned to this user. The query will not initiate any external requests, including fetching external shipping methods, filtering available shipping methods, or performing external tax calculations.
+ """
+ checkouts(
+ """Slug of a channel for which the data should be returned."""
+ channel: String
"""Return the elements in the list that come before the specified cursor."""
before: String
@@ -3195,255 +3290,243 @@ type EventDelivery implements Node {
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
"""
last: Int
- ): EventDeliveryAttemptCountableConnection
+ ): CheckoutCountableConnection
- """Event payload."""
- payload: String
-}
+ """List of the user gift cards."""
+ giftCards(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
-enum EventDeliveryStatusEnum @doc(category: "Webhooks") {
- PENDING
- SUCCESS
- FAILED
-}
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
-type EventDeliveryAttemptCountableConnection {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [EventDeliveryAttemptCountableEdge!]!
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): GiftCardCountableConnection
-type EventDeliveryAttemptCountableEdge {
- """The item at the end of the edge."""
- node: EventDeliveryAttempt!
+ """
+ A note about the customer.
+
+ Requires one of the following permissions: MANAGE_USERS, MANAGE_STAFF.
+ """
+ note: String
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """
+ List of user's orders. The query will not initiate any external requests, including filtering available shipping methods, or performing external tax calculations. Requires one of the following permissions: MANAGE_STAFF, OWNER.
+ """
+ orders(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
-"""Event delivery attempts."""
-type EventDeliveryAttempt implements Node @doc(category: "Webhooks") {
- """The ID of Event Delivery Attempt."""
- id: ID!
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """Event delivery creation date and time."""
- createdAt: DateTime!
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
- """Task id for delivery attempt."""
- taskId: String
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): OrderCountableConnection
- """Delivery attempt duration."""
- duration: Float
+ """List of user's permissions."""
+ userPermissions: [UserPermission!]
- """Delivery attempt response content."""
- response: String
+ """List of user's permission groups."""
+ permissionGroups: [Group!]
- """Response headers for delivery attempt."""
- responseHeaders: String
+ """List of user's permission groups which user can manage."""
+ editableGroups: [Group!]
- """Delivery attempt response status code."""
- responseStatusCode: Int
+ """
+ List of channels the user has access to. The sum of channels from all user groups. If at least one group has `restrictedAccessToChannels` set to False - all channels are returned.
+ """
+ accessibleChannels: [Channel!]
- """Request headers for delivery attempt."""
- requestHeaders: String
+ """
+ Determine if user have restricted access to channels. False if at least one user group has `restrictedAccessToChannels` set to False.
+ """
+ restrictedAccessToChannels: Boolean!
- """Event delivery status."""
- status: EventDeliveryStatusEnum!
-}
+ """The avatar of the user."""
+ avatar(
+ """
+ Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
+ """
+ size: Int
-input EventDeliveryAttemptSortingInput @doc(category: "Webhooks") {
- """Specifies the direction in which to sort attempts."""
- direction: OrderDirection!
+ """
+ The format of the image. When not provided, format of the original image will be used.
+ """
+ format: ThumbnailFormatEnum = ORIGINAL
+ ): Image
- """Sort attempts by the selected field."""
- field: EventDeliveryAttemptSortField!
-}
+ """
+ List of events associated with the user.
+
+ Requires one of the following permissions: MANAGE_USERS, MANAGE_STAFF.
+ """
+ events: [CustomerEvent!]
-enum OrderDirection {
- """Specifies an ascending sort order."""
- ASC
+ """
+ List of stored payment sources. The field returns a list of payment sources stored for payment plugins.
+ """
+ storedPaymentSources(
+ """Slug of a channel for which the data should be returned."""
+ channel: String
+ ): [PaymentSource!]
- """Specifies a descending sort order."""
- DESC
+ """User language code."""
+ languageCode: LanguageCodeEnum!
+
+ """The default shipping address of the user."""
+ defaultShippingAddress: Address
+
+ """The default billing address of the user."""
+ defaultBillingAddress: Address
+
+ """External ID of this user."""
+ externalReference: String
+
+ """The date when the user last time log in to the system."""
+ lastLogin: DateTime
+
+ """The data when the user create account."""
+ dateJoined: DateTime!
+
+ """The data when the user last update the account information."""
+ updatedAt: DateTime!
+
+ """
+ Returns a list of user's stored payment methods that can be used in provided channel. The field returns a list of stored payment methods by payment apps. When `amount` is not provided, 0 will be used as default value.
+ """
+ storedPaymentMethods(
+ """Slug of a channel for which the data should be returned."""
+ channel: String!
+ ): [StoredPaymentMethod!]
}
-enum EventDeliveryAttemptSortField @doc(category: "Webhooks") {
- """Sort event delivery attempts by created at."""
- CREATED_AT
+"""Represents user address data."""
+type Address implements Node & ObjectWithMetadata @doc(category: "Users") {
+ """The ID of the address."""
+ id: ID!
+
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
+
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
+
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
+
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
+
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """The given name of the address."""
+ firstName: String!
+
+ """The family name of the address."""
+ lastName: String!
+
+ """Company or organization name."""
+ companyName: String!
+
+ """The first line of the address."""
+ streetAddress1: String!
+
+ """The second line of the address."""
+ streetAddress2: String!
+
+ """The city of the address."""
+ city: String!
+
+ """The district of the address."""
+ cityArea: String!
+
+ """The postal code of the address."""
+ postalCode: String!
+
+ """The country of the address."""
+ country: CountryDisplay!
+
+ """The country area of the address."""
+ countryArea: String!
+
+ """The phone number assigned the address."""
+ phone: String
+
+ """Address is user's default shipping address."""
+ isDefaultShippingAddress: Boolean
+
+ """Address is user's default billing address."""
+ isDefaultBillingAddress: Boolean
}
-input EventDeliverySortingInput @doc(category: "Webhooks") {
- """Specifies the direction in which to sort deliveries."""
- direction: OrderDirection!
+type CountryDisplay {
+ """Country code."""
+ code: String!
- """Sort deliveries by the selected field."""
- field: EventDeliverySortField!
+ """Country name."""
+ country: String!
+
+ """Country tax."""
+ vat: VAT @deprecated(reason: "Always returns `null`. Use `TaxClassCountryRate` type to manage tax rates per country.")
}
-enum EventDeliverySortField @doc(category: "Webhooks") {
- """Sort event deliveries by created at."""
- CREATED_AT
+"""Represents a VAT rate for a country."""
+type VAT @doc(category: "Taxes") {
+ """Country code."""
+ countryCode: String!
+
+ """Standard VAT rate in percent."""
+ standardRate: Float
+
+ """Country's VAT rate exceptions for specific types of goods."""
+ reducedRates: [ReducedRate!]!
}
-input EventDeliveryFilterInput {
- status: EventDeliveryStatusEnum
- eventType: WebhookEventTypeEnum
+"""Represents a reduced VAT rate for a particular type of goods."""
+type ReducedRate @doc(category: "Taxes") {
+ """Reduced VAT rate in percent."""
+ rate: Float!
+
+ """A type of goods."""
+ rateType: String!
}
-scalar JSONString
-
-enum WebhookSampleEventTypeEnum @doc(category: "Webhooks") {
- ACCOUNT_CONFIRMATION_REQUESTED
- ACCOUNT_CHANGE_EMAIL_REQUESTED
- ACCOUNT_EMAIL_CHANGED
- ACCOUNT_SET_PASSWORD_REQUESTED
- ACCOUNT_CONFIRMED
- ACCOUNT_DELETE_REQUESTED
- ACCOUNT_DELETED
- ADDRESS_CREATED
- ADDRESS_UPDATED
- ADDRESS_DELETED
- APP_INSTALLED
- APP_UPDATED
- APP_DELETED
- APP_STATUS_CHANGED
- ATTRIBUTE_CREATED
- ATTRIBUTE_UPDATED
- ATTRIBUTE_DELETED
- ATTRIBUTE_VALUE_CREATED
- ATTRIBUTE_VALUE_UPDATED
- ATTRIBUTE_VALUE_DELETED
- CATEGORY_CREATED
- CATEGORY_UPDATED
- CATEGORY_DELETED
- CHANNEL_CREATED
- CHANNEL_UPDATED
- CHANNEL_DELETED
- CHANNEL_STATUS_CHANGED
- CHANNEL_METADATA_UPDATED
- GIFT_CARD_CREATED
- GIFT_CARD_UPDATED
- GIFT_CARD_DELETED
- GIFT_CARD_SENT
- GIFT_CARD_STATUS_CHANGED
- GIFT_CARD_METADATA_UPDATED
- GIFT_CARD_EXPORT_COMPLETED
- MENU_CREATED
- MENU_UPDATED
- MENU_DELETED
- MENU_ITEM_CREATED
- MENU_ITEM_UPDATED
- MENU_ITEM_DELETED
- ORDER_CREATED
- ORDER_CONFIRMED
- ORDER_PAID
- ORDER_FULLY_PAID
- ORDER_REFUNDED
- ORDER_FULLY_REFUNDED
- ORDER_UPDATED
- ORDER_CANCELLED
- ORDER_EXPIRED
- ORDER_FULFILLED
- ORDER_METADATA_UPDATED
- ORDER_BULK_CREATED
- FULFILLMENT_CREATED
- FULFILLMENT_CANCELED
- FULFILLMENT_APPROVED
- FULFILLMENT_METADATA_UPDATED
- FULFILLMENT_TRACKING_NUMBER_UPDATED
- DRAFT_ORDER_CREATED
- DRAFT_ORDER_UPDATED
- DRAFT_ORDER_DELETED
- SALE_CREATED
- SALE_UPDATED
- SALE_DELETED
- SALE_TOGGLE
- PROMOTION_CREATED
- PROMOTION_UPDATED
- PROMOTION_DELETED
- PROMOTION_STARTED
- PROMOTION_ENDED
- PROMOTION_RULE_CREATED
- PROMOTION_RULE_UPDATED
- PROMOTION_RULE_DELETED
- INVOICE_REQUESTED
- INVOICE_DELETED
- INVOICE_SENT
- CUSTOMER_CREATED
- CUSTOMER_UPDATED
- CUSTOMER_DELETED
- CUSTOMER_METADATA_UPDATED
- COLLECTION_CREATED
- COLLECTION_UPDATED
- COLLECTION_DELETED
- COLLECTION_METADATA_UPDATED
- PRODUCT_CREATED
- PRODUCT_UPDATED
- PRODUCT_DELETED
- PRODUCT_METADATA_UPDATED
- PRODUCT_EXPORT_COMPLETED
- PRODUCT_MEDIA_CREATED
- PRODUCT_MEDIA_UPDATED
- PRODUCT_MEDIA_DELETED
- PRODUCT_VARIANT_CREATED
- PRODUCT_VARIANT_UPDATED
- PRODUCT_VARIANT_DELETED
- PRODUCT_VARIANT_METADATA_UPDATED
- PRODUCT_VARIANT_OUT_OF_STOCK
- PRODUCT_VARIANT_BACK_IN_STOCK
- PRODUCT_VARIANT_STOCK_UPDATED
- CHECKOUT_CREATED
- CHECKOUT_UPDATED
- CHECKOUT_FULLY_AUTHORIZED
- CHECKOUT_FULLY_PAID
- CHECKOUT_METADATA_UPDATED
- NOTIFY_USER
- PAGE_CREATED
- PAGE_UPDATED
- PAGE_DELETED
- PAGE_TYPE_CREATED
- PAGE_TYPE_UPDATED
- PAGE_TYPE_DELETED
- PERMISSION_GROUP_CREATED
- PERMISSION_GROUP_UPDATED
- PERMISSION_GROUP_DELETED
- SHIPPING_PRICE_CREATED
- SHIPPING_PRICE_UPDATED
- SHIPPING_PRICE_DELETED
- SHIPPING_ZONE_CREATED
- SHIPPING_ZONE_UPDATED
- SHIPPING_ZONE_DELETED
- SHIPPING_ZONE_METADATA_UPDATED
- STAFF_CREATED
- STAFF_UPDATED
- STAFF_DELETED
- STAFF_SET_PASSWORD_REQUESTED
- TRANSACTION_ITEM_METADATA_UPDATED
- TRANSLATION_CREATED
- TRANSLATION_UPDATED
- WAREHOUSE_CREATED
- WAREHOUSE_UPDATED
- WAREHOUSE_DELETED
- WAREHOUSE_METADATA_UPDATED
- VOUCHER_CREATED
- VOUCHER_UPDATED
- VOUCHER_DELETED
- VOUCHER_CODES_CREATED
- VOUCHER_CODES_DELETED
- VOUCHER_METADATA_UPDATED
- VOUCHER_CODE_EXPORT_COMPLETED
- OBSERVABILITY
- THUMBNAIL_CREATED
- SHOP_METADATA_UPDATED
-}
-
-"""Represents warehouse."""
-type Warehouse implements Node & ObjectWithMetadata @doc(category: "Products") {
- """The ID of the warehouse."""
- id: ID!
+"""Checkout object."""
+type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
+ """The ID of the checkout."""
+ id: ID!
"""List of private metadata items. Requires staff permissions to access."""
privateMetadata: [MetadataItem!]!
@@ -3475,300 +3558,218 @@ type Warehouse implements Node & ObjectWithMetadata @doc(category: "Products") {
"""
metafields(keys: [String!]): Metadata
- """Warehouse name."""
- name: String!
+ """The date and time when the checkout was created."""
+ created: DateTime!
- """Warehouse slug."""
- slug: String!
+ """Time of last modification of the given checkout."""
+ updatedAt: DateTime!
+ lastChange: DateTime! @deprecated(reason: "Use `updatedAt` instead.")
- """Warehouse email."""
- email: String!
+ """
+ The user assigned to the checkout. Requires one of the following permissions: MANAGE_USERS, HANDLE_PAYMENTS, OWNER.
+ """
+ user: User
- """Determine if the warehouse is private."""
- isPrivate: Boolean!
+ """The channel for which checkout was created."""
+ channel: Channel!
- """Address of the warehouse."""
- address: Address!
+ """The billing address of the checkout."""
+ billingAddress: Address
- """Warehouse company name."""
- companyName: String! @deprecated(reason: "Use `Address.companyName` instead.")
+ """The shipping address of the checkout."""
+ shippingAddress: Address
- """Click and collect options: local, all or disabled."""
- clickAndCollectOption: WarehouseClickAndCollectOptionEnum!
+ """
+ The customer note for the checkout.
+
+ Added in Saleor 3.21.
+ """
+ customerNote: String!
- """Shipping zones supported by the warehouse."""
- shippingZones(
- """Return the elements in the list that come before the specified cursor."""
- before: String
+ """The note for the checkout."""
+ note: String! @deprecated(reason: "Use `customerNote` instead.")
- """Return the elements in the list that come after the specified cursor."""
- after: String
+ """
+ The total discount applied to the checkout. Note: Only discount created via voucher are included in this field.
+ """
+ discount: Money
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
+ """The name of voucher assigned to the checkout."""
+ discountName: String
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): ShippingZoneCountableConnection!
+ """
+ Translation of the discountName field in the language set in Checkout.languageCode field.Note: this field is set automatically when Checkout.languageCode is defined; otherwise it's null
+ """
+ translatedDiscountName: String
"""
- Stocks that belong to this warehouse.
+ The voucher assigned to the checkout.
- Added in Saleor 3.20.
+ Added in Saleor 3.18.
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
"""
- stocks(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): StockCountableConnection
-
- """External ID of this warehouse."""
- externalReference: String
-}
-
-"""Represents user address data."""
-type Address implements Node & ObjectWithMetadata @doc(category: "Users") {
- """The ID of the address."""
- id: ID!
+ voucher: Voucher
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """The code of voucher assigned to the checkout."""
+ voucherCode: String
"""
- A single key from private metadata. Requires staff permissions to access.
+ Shipping methods that can be used with this checkout.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
"""
- privateMetafield(key: String!): String
+ availableShippingMethods: [ShippingMethod!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "Use `shippingMethods` instead.")
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ Shipping methods that can be used with this checkout.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
"""
- privateMetafields(keys: [String!]): Metadata
+ shippingMethods: [ShippingMethod!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS])
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """Collection points that can be used for this order."""
+ availableCollectionPoints: [Warehouse!]!
"""
- A single key from public metadata.
+ List of available payment gateways.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Triggers the following webhook events:
+ - PAYMENT_LIST_GATEWAYS (sync): Fetch payment gateways available for checkout.
"""
- metafield(key: String!): String
+ availablePaymentGateways: [PaymentGateway!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [PAYMENT_LIST_GATEWAYS])
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
+ """Email of a customer."""
+ email: String
- """The given name of the address."""
- firstName: String!
+ """List of gift cards associated with this checkout."""
+ giftCards: [GiftCard!]!
- """The family name of the address."""
- lastName: String!
-
- """Company or organization name."""
- companyName: String!
-
- """The first line of the address."""
- streetAddress1: String!
-
- """The second line of the address."""
- streetAddress2: String!
-
- """The city of the address."""
- city: String!
-
- """The district of the address."""
- cityArea: String!
-
- """The postal code of the address."""
- postalCode: String!
-
- """The country of the address."""
- country: CountryDisplay!
-
- """The country area of the address."""
- countryArea: String!
-
- """The phone number assigned the address."""
- phone: String
-
- """Address is user's default shipping address."""
- isDefaultShippingAddress: Boolean
-
- """Address is user's default billing address."""
- isDefaultBillingAddress: Boolean
-}
-
-type CountryDisplay {
- """Country code."""
- code: String!
-
- """Country name."""
- country: String!
-
- """Country tax."""
- vat: VAT @deprecated(reason: "Always returns `null`. Use `TaxClassCountryRate` type to manage tax rates per country.")
-}
-
-"""Represents a VAT rate for a country."""
-type VAT @doc(category: "Taxes") {
- """Country code."""
- countryCode: String!
-
- """Standard VAT rate in percent."""
- standardRate: Float
-
- """Country's VAT rate exceptions for specific types of goods."""
- reducedRates: [ReducedRate!]!
-}
-
-"""Represents a reduced VAT rate for a particular type of goods."""
-type ReducedRate @doc(category: "Taxes") {
- """Reduced VAT rate in percent."""
- rate: Float!
-
- """A type of goods."""
- rateType: String!
-}
-
-enum WarehouseClickAndCollectOptionEnum @doc(category: "Products") {
- DISABLED
- LOCAL
- ALL
-}
-
-type ShippingZoneCountableConnection @doc(category: "Shipping") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [ShippingZoneCountableEdge!]!
-
- """A total count of items in the collection."""
- totalCount: Int
-}
-
-type ShippingZoneCountableEdge @doc(category: "Shipping") {
- """The item at the end of the edge."""
- node: ShippingZone!
+ """Returns True, if checkout requires shipping."""
+ isShippingRequired: Boolean!
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """The number of items purchased."""
+ quantity: Int!
-"""
-Represents a shipping zone in the shop. Zones are the concept used only for grouping shipping methods in the dashboard, and are never exposed to the customers directly.
-"""
-type ShippingZone implements Node & ObjectWithMetadata @doc(category: "Shipping") {
- """The ID of shipping zone."""
- id: ID!
+ """
+ Date when oldest stock reservation for this checkout expires or null if no stock is reserved.
+ """
+ stockReservationExpires: DateTime
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """
+ A list of checkout lines, each containing information about an item in the checkout.
+ """
+ lines: [CheckoutLine!]!
"""
- A single key from private metadata. Requires staff permissions to access.
+ The price of the shipping, with all the taxes included. Set to 0 when no delivery method is selected.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- privateMetafield(key: String!): String
+ shippingPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ The delivery method selected for this checkout.
+
+ Added in Saleor 3.23.
"""
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ delivery: Delivery
"""
- A single key from public metadata.
+ The shipping method related with checkout.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
"""
- metafield(key: String!): String
+ shippingMethod: ShippingMethod @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "Use `delivery` instead.")
"""
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ The delivery method selected for this checkout.
+
+ Triggers the following webhook events:
+ - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
+ - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
"""
- metafields(keys: [String!]): Metadata
-
- """Shipping zone name."""
- name: String!
+ deliveryMethod: DeliveryMethod @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "Use `delivery` instead.")
- """Indicates if the shipping zone is default one."""
- default: Boolean!
+ """
+ The price of the checkout before shipping, with taxes included.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ subtotalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """Lowest and highest prices for the shipping."""
- priceRange: MoneyRange
+ """Returns True if checkout has to be exempt from taxes."""
+ taxExemption: Boolean!
- """List of countries available for the method."""
- countries: [CountryDisplay!]!
+ """The checkout's token."""
+ token: UUID!
"""
- List of shipping methods available for orders shipped to countries within this shipping zone.
+ The sum of the checkout line prices, with all the taxes,shipping costs, and discounts included.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- shippingMethods: [ShippingMethodType!]
-
- """List of warehouses for shipping zone."""
- warehouses: [Warehouse!]!
+ totalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """List of channels for shipping zone."""
- channels: [Channel!]!
+ """
+ The difference between the paid and the checkout total amount.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ totalBalance: Money! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """Description of a shipping zone."""
- description: String
-}
+ """Checkout language code."""
+ languageCode: LanguageCodeEnum!
-"""Represents a range of amounts of money."""
-type MoneyRange {
- """Lower bound of a price range."""
- start: Money
+ """
+ List of transactions for the checkout. Requires one of the following permissions: MANAGE_CHECKOUTS, HANDLE_PAYMENTS.
+ """
+ transactions: [TransactionItem!]
- """Upper bound of a price range."""
- stop: Money
-}
+ """Determines whether displayed prices should include taxes."""
+ displayGrossPrices: Boolean!
-"""Represents amount of money in specific currency."""
-type Money {
- """Currency code."""
- currency: String!
+ """
+ The authorize status of the checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ authorizeStatus: CheckoutAuthorizeStatusEnum! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """Amount of money."""
- amount: Float!
+ """
+ The charge status of the checkout.
+
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ """
+ chargeStatus: CheckoutChargeStatusEnum! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
"""
- Amount of money represented as an integer in the smallest currency unit.
+ List of user's stored payment methods that can be used in this checkout session. It uses the channel that the checkout was created in. When `amount` is not provided, `checkout.total` will be used as a default value.
"""
- fractionalAmount: Int!
+ storedPaymentMethods(
+ """Amount that will be used to fetch stored payment methods."""
+ amount: PositiveDecimal
+ ): [StoredPaymentMethod!]
- """Number of digits after the decimal point in the currency."""
- fractionDigits: Int!
+ """List of problems with the checkout."""
+ problems: [CheckoutProblem!]
}
-"""
-Shipping method are the methods you'll use to get customer's orders to them. They are directly exposed to the customers.
-"""
-type ShippingMethodType implements Node & ObjectWithMetadata @doc(category: "Shipping") {
- """Shipping method ID."""
+"""Represents channel."""
+type Channel implements Node & ObjectWithMetadata @doc(category: "Channels") {
+ """The ID of the channel."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -3801,49 +3802,153 @@ type ShippingMethodType implements Node & ObjectWithMetadata @doc(category: "Shi
"""
metafields(keys: [String!]): Metadata
- """Shipping method name."""
- name: String!
+ """Slug of the channel."""
+ slug: String!
"""
- Shipping method description.
+ Name of the channel.
- Rich text format. For reference see https://editorjs.io/
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
"""
- description: JSONString
-
- """Type of the shipping method."""
- type: ShippingMethodTypeEnum
-
- """Returns translated shipping method fields for the given language code."""
- translation(
- """A language code to return the translation for shipping method."""
- languageCode: LanguageCodeEnum!
- ): ShippingMethodTranslation
+ name: String!
"""
- List of channels available for the method.
+ Whether the channel is active.
- Requires one of the following permissions: MANAGE_SHIPPING.
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
"""
- channelListings: [ShippingMethodChannelListing!]
+ isActive: Boolean!
- """The price of the cheapest variant (including discounts)."""
- maximumOrderPrice: Money
+ """
+ A currency that is assigned to the channel.
+
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
+ """
+ currencyCode: String!
- """The price of the cheapest variant (including discounts)."""
- minimumOrderPrice: Money
+ """
+ Whether a channel has associated orders.
+
+ Requires one of the following permissions: MANAGE_CHANNELS.
+ """
+ hasOrders: Boolean!
"""
- Postal code ranges rule of exclusion or inclusion of the shipping method.
+ Default country for the channel. Default country can be used in checkout to determine the stock quantities or calculate taxes when the country was not explicitly provided.
+
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
"""
- postalCodeRules: [ShippingMethodPostalCodeRule!]
+ defaultCountry: CountryDisplay!
"""
- List of excluded products for the shipping method.
+ List of warehouses assigned to this channel.
- Requires one of the following permissions: MANAGE_SHIPPING.
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
"""
- excludedProducts(
+ warehouses: [Warehouse!]!
+
+ """List of shippable countries for the channel."""
+ countries: [CountryDisplay!]
+
+ """Shipping methods that are available for the channel."""
+ availableShippingMethodsPerCountry(countries: [CountryCode!]): [ShippingMethodsPerCountry!]
+
+ """
+ Define the stock setting for this channel.
+
+ Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
+ """
+ stockSettings: StockSettings!
+
+ """
+ Channel-specific order settings.
+
+ Requires one of the following permissions: MANAGE_CHANNELS, MANAGE_ORDERS.
+ """
+ orderSettings: OrderSettings!
+
+ """
+ Channel-specific checkout settings.
+
+ Requires one of the following permissions: MANAGE_CHANNELS, MANAGE_CHECKOUTS.
+ """
+ checkoutSettings: CheckoutSettings!
+
+ """
+ Channel-specific payment settings.
+
+ Requires one of the following permissions: MANAGE_CHANNELS, HANDLE_PAYMENTS.
+ """
+ paymentSettings: PaymentSettings!
+
+ """
+ Channel specific tax configuration.
+
+ Added in Saleor 3.20.
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
+ """
+ taxConfiguration: TaxConfiguration!
+}
+
+"""Represents warehouse."""
+type Warehouse implements Node & ObjectWithMetadata @doc(category: "Products") {
+ """The ID of the warehouse."""
+ id: ID!
+
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
+
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
+
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
+
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
+
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """Warehouse name."""
+ name: String!
+
+ """Warehouse slug."""
+ slug: String!
+
+ """Warehouse email."""
+ email: String!
+
+ """Determine if the warehouse is private."""
+ isPrivate: Boolean!
+
+ """Address of the warehouse."""
+ address: Address!
+
+ """Warehouse company name."""
+ companyName: String! @deprecated(reason: "Use `Address.companyName` instead.")
+
+ """Click and collect options: local, all or disabled."""
+ clickAndCollectOption: WarehouseClickAndCollectOptionEnum!
+
+ """Shipping zones supported by the warehouse."""
+ shippingZones(
"""Return the elements in the list that come before the specified cursor."""
before: String
@@ -3859,1576 +3964,172 @@ type ShippingMethodType implements Node & ObjectWithMetadata @doc(category: "Shi
Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
"""
last: Int
- ): ProductCountableConnection
+ ): ShippingZoneCountableConnection!
- """Minimum order weight to use this shipping method."""
- minimumOrderWeight: Weight
+ """
+ Stocks that belong to this warehouse.
+
+ Added in Saleor 3.20.
+
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
+ """
+ stocks(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
- """Maximum order weight to use this shipping method."""
- maximumOrderWeight: Weight
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """Maximum number of days for delivery."""
- maximumDeliveryDays: Int
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
- """Minimal number of days for delivery."""
- minimumDeliveryDays: Int
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): StockCountableConnection
- """
- Tax class assigned to this shipping method.
-
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
- """
- taxClass: TaxClass
+ """External ID of this warehouse."""
+ externalReference: String
}
-enum ShippingMethodTypeEnum @doc(category: "Shipping") {
- PRICE
- WEIGHT
+enum WarehouseClickAndCollectOptionEnum @doc(category: "Products") {
+ DISABLED
+ LOCAL
+ ALL
}
-"""Represents shipping method translations."""
-type ShippingMethodTranslation implements Node @doc(category: "Shipping") {
- """The ID of the shipping method translation."""
- id: ID!
+type ShippingZoneCountableConnection @doc(category: "Shipping") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [ShippingZoneCountableEdge!]!
- """Translation language."""
- language: LanguageDisplay!
+ """A total count of items in the collection."""
+ totalCount: Int
+}
- """Translated shipping method name."""
- name: String
+"""
+The Relay compliant `PageInfo` type, containing data necessary to paginate this connection.
+"""
+type PageInfo {
+ """When paginating forwards, are there more items?"""
+ hasNextPage: Boolean!
- """
- Translated description of the shipping method.
-
- Rich text format. For reference see https://editorjs.io/
- """
- description: JSONString
+ """When paginating backwards, are there more items?"""
+ hasPreviousPage: Boolean!
- """Represents the shipping method fields to translate."""
- translatableContent: ShippingMethodTranslatableContent
+ """When paginating backwards, the cursor to continue."""
+ startCursor: String
+
+ """When paginating forwards, the cursor to continue."""
+ endCursor: String
}
-type LanguageDisplay {
- """ISO 639 representation of the language name."""
- code: LanguageCodeEnum!
+type ShippingZoneCountableEdge @doc(category: "Shipping") {
+ """The item at the end of the edge."""
+ node: ShippingZone!
- """Full name of the language."""
- language: String!
+ """A cursor for use in pagination."""
+ cursor: String!
}
-enum LanguageCodeEnum {
- AF
- AF_NA
- AF_ZA
- AGQ
- AGQ_CM
- AK
- AK_GH
- AM
- AM_ET
- AR
- AR_AE
- AR_BH
- AR_DJ
- AR_DZ
- AR_EG
- AR_EH
- AR_ER
- AR_IL
- AR_IQ
- AR_JO
- AR_KM
- AR_KW
- AR_LB
- AR_LY
- AR_MA
- AR_MR
- AR_OM
- AR_PS
- AR_QA
- AR_SA
- AR_SD
- AR_SO
- AR_SS
- AR_SY
- AR_TD
- AR_TN
- AR_YE
- AS
- AS_IN
- ASA
- ASA_TZ
- AST
- AST_ES
- AZ
- AZ_CYRL
- AZ_CYRL_AZ
- AZ_LATN
- AZ_LATN_AZ
- BAS
- BAS_CM
- BE
- BE_BY
- BEM
- BEM_ZM
- BEZ
- BEZ_TZ
- BG
- BG_BG
- BM
- BM_ML
- BN
- BN_BD
- BN_IN
- BO
- BO_CN
- BO_IN
- BR
- BR_FR
- BRX
- BRX_IN
- BS
- BS_CYRL
- BS_CYRL_BA
- BS_LATN
- BS_LATN_BA
- CA
- CA_AD
- CA_ES
- CA_ES_VALENCIA
- CA_FR
- CA_IT
- CCP
- CCP_BD
- CCP_IN
- CE
- CE_RU
- CEB
- CEB_PH
- CGG
- CGG_UG
- CHR
- CHR_US
- CKB
- CKB_IQ
- CKB_IR
- CS
- CS_CZ
- CU
- CU_RU
- CY
- CY_GB
- DA
- DA_DK
- DA_GL
- DAV
- DAV_KE
- DE
- DE_AT
- DE_BE
- DE_CH
- DE_DE
- DE_IT
- DE_LI
- DE_LU
- DJE
- DJE_NE
- DSB
- DSB_DE
- DUA
- DUA_CM
- DYO
- DYO_SN
- DZ
- DZ_BT
- EBU
- EBU_KE
- EE
- EE_GH
- EE_TG
- EL
- EL_CY
- EL_GR
- EN
- EN_AE
- EN_AG
- EN_AI
- EN_AS
- EN_AT
- EN_AU
- EN_BB
- EN_BE
- EN_BI
- EN_BM
- EN_BS
- EN_BW
- EN_BZ
- EN_CA
- EN_CC
- EN_CH
- EN_CK
- EN_CM
- EN_CX
- EN_CY
- EN_DE
- EN_DG
- EN_DK
- EN_DM
- EN_ER
- EN_FI
- EN_FJ
- EN_FK
- EN_FM
- EN_GB
- EN_GD
- EN_GG
- EN_GH
- EN_GI
- EN_GM
- EN_GU
- EN_GY
- EN_HK
- EN_IE
- EN_IL
- EN_IM
- EN_IN
- EN_IO
- EN_JE
- EN_JM
- EN_KE
- EN_KI
- EN_KN
- EN_KY
- EN_LC
- EN_LR
- EN_LS
- EN_MG
- EN_MH
- EN_MO
- EN_MP
- EN_MS
- EN_MT
- EN_MU
- EN_MW
- EN_MY
- EN_NA
- EN_NF
- EN_NG
- EN_NL
- EN_NR
- EN_NU
- EN_NZ
- EN_PG
- EN_PH
- EN_PK
- EN_PN
- EN_PR
- EN_PW
- EN_RW
- EN_SB
- EN_SC
- EN_SD
- EN_SE
- EN_SG
- EN_SH
- EN_SI
- EN_SL
- EN_SS
- EN_SX
- EN_SZ
- EN_TC
- EN_TK
- EN_TO
- EN_TT
- EN_TV
- EN_TZ
- EN_UG
- EN_UM
- EN_US
- EN_VC
- EN_VG
- EN_VI
- EN_VU
- EN_WS
- EN_ZA
- EN_ZM
- EN_ZW
- EO
- ES
- ES_AR
- ES_BO
- ES_BR
- ES_BZ
- ES_CL
- ES_CO
- ES_CR
- ES_CU
- ES_DO
- ES_EA
- ES_EC
- ES_ES
- ES_GQ
- ES_GT
- ES_HN
- ES_IC
- ES_MX
- ES_NI
- ES_PA
- ES_PE
- ES_PH
- ES_PR
- ES_PY
- ES_SV
- ES_US
- ES_UY
- ES_VE
- ET
- ET_EE
- EU
- EU_ES
- EWO
- EWO_CM
- FA
- FA_AF
- FA_IR
- FF
- FF_ADLM
- FF_ADLM_BF
- FF_ADLM_CM
- FF_ADLM_GH
- FF_ADLM_GM
- FF_ADLM_GN
- FF_ADLM_GW
- FF_ADLM_LR
- FF_ADLM_MR
- FF_ADLM_NE
- FF_ADLM_NG
- FF_ADLM_SL
- FF_ADLM_SN
- FF_LATN
- FF_LATN_BF
- FF_LATN_CM
- FF_LATN_GH
- FF_LATN_GM
- FF_LATN_GN
- FF_LATN_GW
- FF_LATN_LR
- FF_LATN_MR
- FF_LATN_NE
- FF_LATN_NG
- FF_LATN_SL
- FF_LATN_SN
- FI
- FI_FI
- FIL
- FIL_PH
- FO
- FO_DK
- FO_FO
- FR
- FR_BE
- FR_BF
- FR_BI
- FR_BJ
- FR_BL
- FR_CA
- FR_CD
- FR_CF
- FR_CG
- FR_CH
- FR_CI
- FR_CM
- FR_DJ
- FR_DZ
- FR_FR
- FR_GA
- FR_GF
- FR_GN
- FR_GP
- FR_GQ
- FR_HT
- FR_KM
- FR_LU
- FR_MA
- FR_MC
- FR_MF
- FR_MG
- FR_ML
- FR_MQ
- FR_MR
- FR_MU
- FR_NC
- FR_NE
- FR_PF
- FR_PM
- FR_RE
- FR_RW
- FR_SC
- FR_SN
- FR_SY
- FR_TD
- FR_TG
- FR_TN
- FR_VU
- FR_WF
- FR_YT
- FUR
- FUR_IT
- FY
- FY_NL
- GA
- GA_GB
- GA_IE
- GD
- GD_GB
- GL
- GL_ES
- GSW
- GSW_CH
- GSW_FR
- GSW_LI
- GU
- GU_IN
- GUZ
- GUZ_KE
- GV
- GV_IM
- HA
- HA_GH
- HA_NE
- HA_NG
- HAW
- HAW_US
- HE
- HE_IL
- HI
- HI_IN
- HR
- HR_BA
- HR_HR
- HSB
- HSB_DE
- HU
- HU_HU
- HY
- HY_AM
- IA
- ID
- ID_ID
- IG
- IG_NG
- II
- II_CN
- IS
- IS_IS
- IT
- IT_CH
- IT_IT
- IT_SM
- IT_VA
- JA
- JA_JP
- JGO
- JGO_CM
- JMC
- JMC_TZ
- JV
- JV_ID
- KA
- KA_GE
- KAB
- KAB_DZ
- KAM
- KAM_KE
- KDE
- KDE_TZ
- KEA
- KEA_CV
- KHQ
- KHQ_ML
- KI
- KI_KE
- KK
- KK_KZ
- KKJ
- KKJ_CM
- KL
- KL_GL
- KLN
- KLN_KE
- KM
- KM_KH
- KN
- KN_IN
- KO
- KO_KP
- KO_KR
- KOK
- KOK_IN
- KS
- KS_ARAB
- KS_ARAB_IN
- KSB
- KSB_TZ
- KSF
- KSF_CM
- KSH
- KSH_DE
- KU
- KU_TR
- KW
- KW_GB
- KY
- KY_KG
- LAG
- LAG_TZ
- LB
- LB_LU
- LG
- LG_UG
- LKT
- LKT_US
- LN
- LN_AO
- LN_CD
- LN_CF
- LN_CG
- LO
- LO_LA
- LRC
- LRC_IQ
- LRC_IR
- LT
- LT_LT
- LU
- LU_CD
- LUO
- LUO_KE
- LUY
- LUY_KE
- LV
- LV_LV
- MAI
- MAI_IN
- MAS
- MAS_KE
- MAS_TZ
- MER
- MER_KE
- MFE
- MFE_MU
- MG
- MG_MG
- MGH
- MGH_MZ
- MGO
- MGO_CM
- MI
- MI_NZ
- MK
- MK_MK
- ML
- ML_IN
- MN
- MN_MN
- MNI
- MNI_BENG
- MNI_BENG_IN
- MR
- MR_IN
- MS
- MS_BN
- MS_ID
- MS_MY
- MS_SG
- MT
- MT_MT
- MUA
- MUA_CM
- MY
- MY_MM
- MZN
- MZN_IR
- NAQ
- NAQ_NA
- NB
- NB_NO
- NB_SJ
- ND
- ND_ZW
- NDS
- NDS_DE
- NDS_NL
- NE
- NE_IN
- NE_NP
- NL
- NL_AW
- NL_BE
- NL_BQ
- NL_CW
- NL_NL
- NL_SR
- NL_SX
- NMG
- NMG_CM
- NN
- NN_NO
- NNH
- NNH_CM
- NUS
- NUS_SS
- NYN
- NYN_UG
- OM
- OM_ET
- OM_KE
- OR
- OR_IN
- OS
- OS_GE
- OS_RU
- PA
- PA_ARAB
- PA_ARAB_PK
- PA_GURU
- PA_GURU_IN
- PCM
- PCM_NG
- PL
- PL_PL
- PRG
- PS
- PS_AF
- PS_PK
- PT
- PT_AO
- PT_BR
- PT_CH
- PT_CV
- PT_GQ
- PT_GW
- PT_LU
- PT_MO
- PT_MZ
- PT_PT
- PT_ST
- PT_TL
- QU
- QU_BO
- QU_EC
- QU_PE
- RM
- RM_CH
- RN
- RN_BI
- RO
- RO_MD
- RO_RO
- ROF
- ROF_TZ
- RU
- RU_BY
- RU_KG
- RU_KZ
- RU_MD
- RU_RU
- RU_UA
- RW
- RW_RW
- RWK
- RWK_TZ
- SAH
- SAH_RU
- SAQ
- SAQ_KE
- SAT
- SAT_OLCK
- SAT_OLCK_IN
- SBP
- SBP_TZ
- SD
- SD_ARAB
- SD_ARAB_PK
- SD_DEVA
- SD_DEVA_IN
- SE
- SE_FI
- SE_NO
- SE_SE
- SEH
- SEH_MZ
- SES
- SES_ML
- SG
- SG_CF
- SHI
- SHI_LATN
- SHI_LATN_MA
- SHI_TFNG
- SHI_TFNG_MA
- SI
- SI_LK
- SK
- SK_SK
- SL
- SL_SI
- SMN
- SMN_FI
- SN
- SN_ZW
- SO
- SO_DJ
- SO_ET
- SO_KE
- SO_SO
- SQ
- SQ_AL
- SQ_MK
- SQ_XK
- SR
- SR_CYRL
- SR_CYRL_BA
- SR_CYRL_ME
- SR_CYRL_RS
- SR_CYRL_XK
- SR_LATN
- SR_LATN_BA
- SR_LATN_ME
- SR_LATN_RS
- SR_LATN_XK
- SU
- SU_LATN
- SU_LATN_ID
- SV
- SV_AX
- SV_FI
- SV_SE
- SW
- SW_CD
- SW_KE
- SW_TZ
- SW_UG
- TA
- TA_IN
- TA_LK
- TA_MY
- TA_SG
- TE
- TE_IN
- TEO
- TEO_KE
- TEO_UG
- TG
- TG_TJ
- TH
- TH_TH
- TI
- TI_ER
- TI_ET
- TK
- TK_TM
- TO
- TO_TO
- TR
- TR_CY
- TR_TR
- TT
- TT_RU
- TWQ
- TWQ_NE
- TZM
- TZM_MA
- UG
- UG_CN
- UK
- UK_UA
- UR
- UR_IN
- UR_PK
- UZ
- UZ_ARAB
- UZ_ARAB_AF
- UZ_CYRL
- UZ_CYRL_UZ
- UZ_LATN
- UZ_LATN_UZ
- VAI
- VAI_LATN
- VAI_LATN_LR
- VAI_VAII
- VAI_VAII_LR
- VI
- VI_VN
- VO
- VUN
- VUN_TZ
- WAE
- WAE_CH
- WO
- WO_SN
- XH
- XH_ZA
- XOG
- XOG_UG
- YAV
- YAV_CM
- YI
- YO
- YO_BJ
- YO_NG
- YUE
- YUE_HANS
- YUE_HANS_CN
- YUE_HANT
- YUE_HANT_HK
- ZGH
- ZGH_MA
- ZH
- ZH_HANS
- ZH_HANS_CN
- ZH_HANS_HK
- ZH_HANS_MO
- ZH_HANS_SG
- ZH_HANT
- ZH_HANT_HK
- ZH_HANT_MO
- ZH_HANT_TW
- ZU
- ZU_ZA
-}
-
-"""
-Represents shipping method's original translatable fields and related translations.
-"""
-type ShippingMethodTranslatableContent implements Node @doc(category: "Shipping") {
- """The ID of the shipping method translatable content."""
- id: ID!
-
- """The ID of the shipping method to translate."""
- shippingMethodId: ID!
-
- """Shipping method name to translate."""
- name: String!
-
- """
- Shipping method description to translate.
-
- Rich text format. For reference see https://editorjs.io/
- """
- description: JSONString
-
- """Returns translated shipping method fields for the given language code."""
- translation(
- """A language code to return the translation for shipping method."""
- languageCode: LanguageCodeEnum!
- ): ShippingMethodTranslation
-
- """
- Shipping method are the methods you'll use to get customer's orders to them. They are directly exposed to the customers.
-
- Requires one of the following permissions: MANAGE_SHIPPING.
- """
- shippingMethod: ShippingMethodType @deprecated(reason: "Get model fields from the root level queries.")
-}
-
-"""Represents shipping method channel listing."""
-type ShippingMethodChannelListing implements Node @doc(category: "Shipping") {
- """The ID of shipping method channel listing."""
- id: ID!
-
- """The channel associated with the shipping method channel listing."""
- channel: Channel!
-
- """Maximum order price."""
- maximumOrderPrice: Money
-
- """Minimum order price."""
- minimumOrderPrice: Money
-
- """Price of the shipping method in the associated channel."""
- price: Money
-}
-
-"""Represents channel."""
-type Channel implements Node & ObjectWithMetadata @doc(category: "Channels") {
- """The ID of the channel."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
-
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
-
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
-
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
-
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
-
- """Slug of the channel."""
- slug: String!
-
- """
- Name of the channel.
-
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
- """
- name: String!
-
- """
- Whether the channel is active.
-
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
- """
- isActive: Boolean!
-
- """
- A currency that is assigned to the channel.
-
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
- """
- currencyCode: String!
-
- """
- Whether a channel has associated orders.
-
- Requires one of the following permissions: MANAGE_CHANNELS.
- """
- hasOrders: Boolean!
-
- """
- Default country for the channel. Default country can be used in checkout to determine the stock quantities or calculate taxes when the country was not explicitly provided.
-
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
- """
- defaultCountry: CountryDisplay!
-
- """
- List of warehouses assigned to this channel.
-
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
- """
- warehouses: [Warehouse!]!
-
- """List of shippable countries for the channel."""
- countries: [CountryDisplay!]
-
- """Shipping methods that are available for the channel."""
- availableShippingMethodsPerCountry(countries: [CountryCode!]): [ShippingMethodsPerCountry!]
-
- """
- Define the stock setting for this channel.
-
- Requires one of the following permissions: AUTHENTICATED_APP, AUTHENTICATED_STAFF_USER.
- """
- stockSettings: StockSettings!
-
- """
- Channel-specific order settings.
-
- Requires one of the following permissions: MANAGE_CHANNELS, MANAGE_ORDERS.
- """
- orderSettings: OrderSettings!
-
- """
- Channel-specific checkout settings.
-
- Requires one of the following permissions: MANAGE_CHANNELS, MANAGE_CHECKOUTS.
- """
- checkoutSettings: CheckoutSettings!
-
- """
- Channel-specific payment settings.
-
- Requires one of the following permissions: MANAGE_CHANNELS, HANDLE_PAYMENTS.
- """
- paymentSettings: PaymentSettings!
-
- """
- Channel specific tax configuration.
-
- Added in Saleor 3.20.
-
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
- """
- taxConfiguration: TaxConfiguration!
-}
-
-"""List of shipping methods available for the country."""
-type ShippingMethodsPerCountry @doc(category: "Shipping") {
- """The country code."""
- countryCode: CountryCode!
-
- """List of available shipping methods."""
- shippingMethods: [ShippingMethod!]
-}
-
-"""
-Represents country codes defined by the ISO 3166-1 alpha-2 standard.
-
-The `EU` value is DEPRECATED and will be removed in Saleor 3.21.
-"""
-enum CountryCode {
- AF
- AX
- AL
- DZ
- AS
- AD
- AO
- AI
- AQ
- AG
- AR
- AM
- AW
- AU
- AT
- AZ
- BS
- BH
- BD
- BB
- BY
- BE
- BZ
- BJ
- BM
- BT
- BO
- BQ
- BA
- BW
- BV
- BR
- IO
- BN
- BG
- BF
- BI
- CV
- KH
- CM
- CA
- KY
- CF
- TD
- CL
- CN
- CX
- CC
- CO
- KM
- CG
- CD
- CK
- CR
- CI
- HR
- CU
- CW
- CY
- CZ
- DK
- DJ
- DM
- DO
- EC
- EG
- SV
- GQ
- ER
- EE
- SZ
- ET
- EU
- FK
- FO
- FJ
- FI
- FR
- GF
- PF
- TF
- GA
- GM
- GE
- DE
- GH
- GI
- GR
- GL
- GD
- GP
- GU
- GT
- GG
- GN
- GW
- GY
- HT
- HM
- VA
- HN
- HK
- HU
- IS
- IN
- ID
- IR
- IQ
- IE
- IM
- IL
- IT
- JM
- JP
- JE
- JO
- KZ
- KE
- KI
- XK
- KW
- KG
- LA
- LV
- LB
- LS
- LR
- LY
- LI
- LT
- LU
- MO
- MG
- MW
- MY
- MV
- ML
- MT
- MH
- MQ
- MR
- MU
- YT
- MX
- FM
- MD
- MC
- MN
- ME
- MS
- MA
- MZ
- MM
- NA
- NR
- NP
- NL
- NC
- NZ
- NI
- NE
- NG
- NU
- NF
- KP
- MK
- MP
- NO
- OM
- PK
- PW
- PS
- PA
- PG
- PY
- PE
- PH
- PN
- PL
- PT
- PR
- QA
- RE
- RO
- RU
- RW
- BL
- SH
- KN
- LC
- MF
- PM
- VC
- WS
- SM
- ST
- SA
- SN
- RS
- SC
- SL
- SG
- SX
- SK
- SI
- SB
- SO
- ZA
- GS
- KR
- SS
- ES
- LK
- SD
- SR
- SJ
- SE
- CH
- SY
- TW
- TJ
- TZ
- TH
- TL
- TG
- TK
- TO
- TT
- TN
- TR
- TM
- TC
- TV
- UG
- UA
- AE
- GB
- UM
- US
- UY
- UZ
- VU
- VE
- VN
- VG
- VI
- WF
- EH
- YE
- ZM
- ZW
-}
-
-"""
-Shipping methods that can be used as means of shipping for orders and checkouts.
-"""
-type ShippingMethod implements Node & ObjectWithMetadata @doc(category: "Shipping") {
- """Unique ID of ShippingMethod available for Order."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
-
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
-
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
-
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
-
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
-
- """Type of the shipping method."""
- type: ShippingMethodTypeEnum @deprecated
-
- """Shipping method name."""
- name: String!
-
- """
- Shipping method description.
-
- Rich text format. For reference see https://editorjs.io/
- """
- description: JSONString
-
- """Maximum delivery days for this shipping method."""
- maximumDeliveryDays: Int
-
- """Minimum delivery days for this shipping method."""
- minimumDeliveryDays: Int
-
- """Maximum order weight for this shipping method."""
- maximumOrderWeight: Weight @deprecated
-
- """Minimum order weight for this shipping method."""
- minimumOrderWeight: Weight @deprecated
-
- """Returns translated shipping method fields for the given language code."""
- translation(
- """A language code to return the translation for shipping method."""
- languageCode: LanguageCodeEnum!
- ): ShippingMethodTranslation
-
- """The price of selected shipping method."""
- price: Money!
-
- """Maximum order price for this shipping method."""
- maximumOrderPrice: Money @deprecated
-
- """Minimal order price for this shipping method."""
- minimumOrderPrice: Money @deprecated
-
- """Describes if this shipping method is active and can be selected."""
- active: Boolean!
-
- """Message connected to this shipping method."""
- message: String
-}
-
-"""Represents weight value in a specific weight unit."""
-type Weight {
- """Weight unit."""
- unit: WeightUnitsEnum!
-
- """Weight value. Returns a value with maximal three decimal places"""
- value: Float!
-}
-
-enum WeightUnitsEnum {
- G
- LB
- OZ
- KG
- TONNE
-}
-
-"""Represents the channel stock settings."""
-type StockSettings @doc(category: "Products") {
- """
- Allocation strategy defines the preference of warehouses for allocations and reservations.
- """
- allocationStrategy: AllocationStrategyEnum!
-}
-
-"""
-Determine the allocation strategy for the channel.
-
- PRIORITIZE_SORTING_ORDER - allocate stocks according to the warehouses' order
- within the channel
-
- PRIORITIZE_HIGH_STOCK - allocate stock in a warehouse with the most stock
-"""
-enum AllocationStrategyEnum @doc(category: "Products") {
- PRIORITIZE_SORTING_ORDER
- PRIORITIZE_HIGH_STOCK
-}
-
-"""Represents the channel-specific order settings."""
-type OrderSettings {
- """
- When disabled, all new orders from checkout will be marked as unconfirmed. When enabled orders from checkout will become unfulfilled immediately.
- """
- automaticallyConfirmAllNewOrders: Boolean!
-
- """
- When enabled, all non-shippable gift card orders will be fulfilled automatically.
- """
- automaticallyFulfillNonShippableGiftCard: Boolean!
-
- """
- Expiration time in minutes. Default null - means do not expire any orders.
- """
- expireOrdersAfter: Minute
-
- """
- Determine what strategy will be used to mark the order as paid. Based on the chosen option, the proper object will be created and attached to the order when it's manually marked as paid.
- `PAYMENT_FLOW` - [default option] creates the `Payment` object.
- `TRANSACTION_FLOW` - creates the `TransactionItem` object.
- """
- markAsPaidStrategy: MarkAsPaidStrategyEnum!
-
- """The time in days after expired orders will be deleted."""
- deleteExpiredOrdersAfter: Day!
-
- """
- Determine if it is possible to place unpaid order by calling `checkoutComplete` mutation.
- """
- allowUnpaidOrders: Boolean!
-
- """
- Determine if voucher applied on draft order should be count toward voucher usage.
-
- Added in Saleor 3.18.
-
- Note: this API is currently in Feature Preview and can be subject to changes at later point.
- """
- includeDraftOrderInVoucherUsage: Boolean!
-
- """
- Time in hours after which the draft order line price will be refreshed.
-
- Added in Saleor 3.21.
-
- Note: this API is currently in Feature Preview and can be subject to changes at later point.
- """
- draftOrderLinePriceFreezePeriod: Hour
-
- """
- This flag only affects orders created from checkout and applies specifically to vouchers of the types: `SPECIFIC_PRODUCT` and `ENTIRE_ORDER` with `applyOncePerOrder` enabled.
- - When legacy propagation is enabled, discounts from these vouchers are represented as `OrderDiscount` objects, attached to the order and returned in the `Order.discounts` field. Additionally, percentage-based vouchers are converted to fixed-value discounts.
- - When legacy propagation is disabled, discounts are represented as `OrderLineDiscount` objects, attached to individual lines and returned in the `OrderLine.discounts` field. In this case, percentage-based vouchers retain their original type.
- In future releases, `OrderLineDiscount` will become the default behavior, and this flag will be deprecated and removed.
-
- Added in Saleor 3.21.
- """
- useLegacyLineDiscountPropagation: Boolean!
-}
-
-"""
-The `Minute` scalar type represents number of minutes by integer value.
-"""
-scalar Minute
-
"""
-Determine the mark as paid strategy for the channel.
-
- TRANSACTION_FLOW - new orders marked as paid will receive a
- `TransactionItem` object, that will cover the `order.total`.
-
- PAYMENT_FLOW - new orders marked as paid will receive a
- `Payment` object, that will cover the `order.total`.
+Represents a shipping zone in the shop. Zones are the concept used only for grouping shipping methods in the dashboard, and are never exposed to the customers directly.
"""
-enum MarkAsPaidStrategyEnum @doc(category: "Channels") {
- TRANSACTION_FLOW
- PAYMENT_FLOW
-}
-
-"""The `Day` scalar type represents number of days by integer value."""
-scalar Day
+type ShippingZone implements Node & ObjectWithMetadata @doc(category: "Shipping") {
+ """The ID of shipping zone."""
+ id: ID!
-"""The `Hour` scalar type represents number of hours by integer value."""
-scalar Hour
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
-"""Represents the channel-specific checkout settings."""
-type CheckoutSettings {
"""
- Default `true`. Determines if the checkout mutations should use legacy error flow. In legacy flow, all mutations can raise an exception unrelated to the requested action - (e.g. out-of-stock exception when updating checkoutShippingAddress.) If `false`, the errors will be aggregated in `checkout.problems` field. Some of the `problems` can block the finalizing checkout process. The legacy flow will be removed in Saleor 4.0. The flow with `checkout.problems` will be the default one.
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- useLegacyErrorFlow: Boolean!
+ privateMetafield(key: String!): String
"""
- Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount.
-
- Added in Saleor 3.20.
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- automaticallyCompleteFullyPaidCheckouts: Boolean!
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
"""
- The time in minutes to wait after a checkout is fully paid before automatically completing it.
+ A single key from public metadata.
- Added in Saleor 3.22.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- automaticCompletionDelay: Minute
+ metafield(key: String!): String
"""
- The date time defines the earliest checkout creation date on which fully paid checkouts can begin to be automatically completed.
-
- Added in Saleor 3.22.
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- automaticCompletionCutOffDate: DateTime
+ metafields(keys: [String!]): Metadata
+
+ """Shipping zone name."""
+ name: String!
+
+ """Indicates if the shipping zone is default one."""
+ default: Boolean!
+
+ """Lowest and highest prices for the shipping."""
+ priceRange: MoneyRange
+
+ """List of countries available for the method."""
+ countries: [CountryDisplay!]!
"""
- Default to `true`. Determines whether gift cards can be attached to a Checkout via `addPromoCode` mutation. Usage of this mutation with gift cards is deprecated.
-
- Added in Saleor 3.23.
+ List of shipping methods available for orders shipped to countries within this shipping zone.
"""
- allowLegacyGiftCardUse: Boolean!
+ shippingMethods: [ShippingMethodType!]
+
+ """List of warehouses for shipping zone."""
+ warehouses: [Warehouse!]!
+
+ """List of channels for shipping zone."""
+ channels: [Channel!]!
+
+ """Description of a shipping zone."""
+ description: String
}
-"""Represents the channel-specific payment settings."""
-type PaymentSettings {
- """
- Determine the transaction flow strategy to be used. Include the selected option in the payload sent to the payment app, as a requested action for the transaction.
- """
- defaultTransactionFlowStrategy: TransactionFlowStrategyEnum!
+"""Represents a range of amounts of money."""
+type MoneyRange {
+ """Lower bound of a price range."""
+ start: Money
- """
- Determine if the funds for expired checkouts should be released automatically.
-
- Added in Saleor 3.20.
- """
- releaseFundsForExpiredCheckouts: Boolean
+ """Upper bound of a price range."""
+ stop: Money
+}
- """
- The time in hours after which funds for expired checkouts will be released.
-
- Added in Saleor 3.20.
- """
- checkoutTtlBeforeReleasingFunds: Hour
+"""Represents amount of money in specific currency."""
+type Money {
+ """Currency code."""
+ currency: String!
+
+ """Amount of money."""
+ amount: Float!
"""
- Specifies the earliest date on which funds for expired checkouts can begin to be released. Expired checkouts dated before this cut-off will not have their funds released. Additionally, no funds will be released for checkouts that are more than one year old, regardless of the cut-off date.
-
- Added in Saleor 3.20.
+ Amount of money represented as an integer in the smallest currency unit.
"""
- checkoutReleaseFundsCutOffDate: DateTime
+ fractionalAmount: Int!
+
+ """Number of digits after the decimal point in the currency."""
+ fractionDigits: Int!
}
"""
-Determine the transaction flow strategy.
-
- AUTHORIZATION - the processed transaction should be only authorized
- CHARGE - the processed transaction should be charged.
+Shipping method are the methods you'll use to get customer's orders to them. They are directly exposed to the customers.
"""
-enum TransactionFlowStrategyEnum @doc(category: "Payments") {
- AUTHORIZATION
- CHARGE
-}
-
-"""Channel-specific tax configuration."""
-type TaxConfiguration implements Node & ObjectWithMetadata @doc(category: "Taxes") {
- """The ID of the object."""
+type ShippingMethodType implements Node & ObjectWithMetadata @doc(category: "Shipping") {
+ """Shipping method ID."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -5461,77 +4162,955 @@ type TaxConfiguration implements Node & ObjectWithMetadata @doc(category: "Taxes
"""
metafields(keys: [String!]): Metadata
- """A channel to which the tax configuration applies to."""
- channel: Channel!
+ """Shipping method name."""
+ name: String!
- """Determines whether taxes are charged in the given channel."""
- chargeTaxes: Boolean!
+ """
+ Shipping method description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
+
+ """Type of the shipping method."""
+ type: ShippingMethodTypeEnum
+
+ """Returns translated shipping method fields for the given language code."""
+ translation(
+ """A language code to return the translation for shipping method."""
+ languageCode: LanguageCodeEnum!
+ ): ShippingMethodTranslation
"""
- The default strategy to use for tax calculation in the given channel. Taxes can be calculated either using user-defined flat rates or with a tax app. Empty value means that no method is selected and taxes are not calculated.
+ List of channels available for the method.
+
+ Requires one of the following permissions: MANAGE_SHIPPING.
"""
- taxCalculationStrategy: TaxCalculationStrategy
+ channelListings: [ShippingMethodChannelListing!]
+
+ """The price of the cheapest variant (including discounts)."""
+ maximumOrderPrice: Money
+
+ """The price of the cheapest variant (including discounts)."""
+ minimumOrderPrice: Money
+
+ """
+ Postal code ranges rule of exclusion or inclusion of the shipping method.
+ """
+ postalCodeRules: [ShippingMethodPostalCodeRule!]
+
+ """
+ List of excluded products for the shipping method.
+
+ Requires one of the following permissions: MANAGE_SHIPPING.
+ """
+ excludedProducts(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
+
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
+
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
+
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): ProductCountableConnection
+
+ """Minimum order weight to use this shipping method."""
+ minimumOrderWeight: Weight
+
+ """Maximum order weight to use this shipping method."""
+ maximumOrderWeight: Weight
+
+ """Maximum number of days for delivery."""
+ maximumDeliveryDays: Int
+
+ """Minimal number of days for delivery."""
+ minimumDeliveryDays: Int
+
+ """
+ Tax class assigned to this shipping method.
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
+ """
+ taxClass: TaxClass
+}
+
+scalar JSONString
+
+enum ShippingMethodTypeEnum @doc(category: "Shipping") {
+ PRICE
+ WEIGHT
+}
+
+"""Represents shipping method translations."""
+type ShippingMethodTranslation implements Node @doc(category: "Shipping") {
+ """The ID of the shipping method translation."""
+ id: ID!
+
+ """Translation language."""
+ language: LanguageDisplay!
+
+ """Translated shipping method name."""
+ name: String
+
+ """
+ Translated description of the shipping method.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
+
+ """Represents the shipping method fields to translate."""
+ translatableContent: ShippingMethodTranslatableContent
+}
+
+type LanguageDisplay {
+ """ISO 639 representation of the language name."""
+ code: LanguageCodeEnum!
+
+ """Full name of the language."""
+ language: String!
+}
+
+enum LanguageCodeEnum {
+ AF
+ AF_NA
+ AF_ZA
+ AGQ
+ AGQ_CM
+ AK
+ AK_GH
+ AM
+ AM_ET
+ AR
+ AR_AE
+ AR_BH
+ AR_DJ
+ AR_DZ
+ AR_EG
+ AR_EH
+ AR_ER
+ AR_IL
+ AR_IQ
+ AR_JO
+ AR_KM
+ AR_KW
+ AR_LB
+ AR_LY
+ AR_MA
+ AR_MR
+ AR_OM
+ AR_PS
+ AR_QA
+ AR_SA
+ AR_SD
+ AR_SO
+ AR_SS
+ AR_SY
+ AR_TD
+ AR_TN
+ AR_YE
+ AS
+ AS_IN
+ ASA
+ ASA_TZ
+ AST
+ AST_ES
+ AZ
+ AZ_CYRL
+ AZ_CYRL_AZ
+ AZ_LATN
+ AZ_LATN_AZ
+ BAS
+ BAS_CM
+ BE
+ BE_BY
+ BEM
+ BEM_ZM
+ BEZ
+ BEZ_TZ
+ BG
+ BG_BG
+ BM
+ BM_ML
+ BN
+ BN_BD
+ BN_IN
+ BO
+ BO_CN
+ BO_IN
+ BR
+ BR_FR
+ BRX
+ BRX_IN
+ BS
+ BS_CYRL
+ BS_CYRL_BA
+ BS_LATN
+ BS_LATN_BA
+ CA
+ CA_AD
+ CA_ES
+ CA_ES_VALENCIA
+ CA_FR
+ CA_IT
+ CCP
+ CCP_BD
+ CCP_IN
+ CE
+ CE_RU
+ CEB
+ CEB_PH
+ CGG
+ CGG_UG
+ CHR
+ CHR_US
+ CKB
+ CKB_IQ
+ CKB_IR
+ CS
+ CS_CZ
+ CU
+ CU_RU
+ CY
+ CY_GB
+ DA
+ DA_DK
+ DA_GL
+ DAV
+ DAV_KE
+ DE
+ DE_AT
+ DE_BE
+ DE_CH
+ DE_DE
+ DE_IT
+ DE_LI
+ DE_LU
+ DJE
+ DJE_NE
+ DSB
+ DSB_DE
+ DUA
+ DUA_CM
+ DYO
+ DYO_SN
+ DZ
+ DZ_BT
+ EBU
+ EBU_KE
+ EE
+ EE_GH
+ EE_TG
+ EL
+ EL_CY
+ EL_GR
+ EN
+ EN_AE
+ EN_AG
+ EN_AI
+ EN_AS
+ EN_AT
+ EN_AU
+ EN_BB
+ EN_BE
+ EN_BI
+ EN_BM
+ EN_BS
+ EN_BW
+ EN_BZ
+ EN_CA
+ EN_CC
+ EN_CH
+ EN_CK
+ EN_CM
+ EN_CX
+ EN_CY
+ EN_DE
+ EN_DG
+ EN_DK
+ EN_DM
+ EN_ER
+ EN_FI
+ EN_FJ
+ EN_FK
+ EN_FM
+ EN_GB
+ EN_GD
+ EN_GG
+ EN_GH
+ EN_GI
+ EN_GM
+ EN_GU
+ EN_GY
+ EN_HK
+ EN_IE
+ EN_IL
+ EN_IM
+ EN_IN
+ EN_IO
+ EN_JE
+ EN_JM
+ EN_KE
+ EN_KI
+ EN_KN
+ EN_KY
+ EN_LC
+ EN_LR
+ EN_LS
+ EN_MG
+ EN_MH
+ EN_MO
+ EN_MP
+ EN_MS
+ EN_MT
+ EN_MU
+ EN_MW
+ EN_MY
+ EN_NA
+ EN_NF
+ EN_NG
+ EN_NL
+ EN_NR
+ EN_NU
+ EN_NZ
+ EN_PG
+ EN_PH
+ EN_PK
+ EN_PN
+ EN_PR
+ EN_PW
+ EN_RW
+ EN_SB
+ EN_SC
+ EN_SD
+ EN_SE
+ EN_SG
+ EN_SH
+ EN_SI
+ EN_SL
+ EN_SS
+ EN_SX
+ EN_SZ
+ EN_TC
+ EN_TK
+ EN_TO
+ EN_TT
+ EN_TV
+ EN_TZ
+ EN_UG
+ EN_UM
+ EN_US
+ EN_VC
+ EN_VG
+ EN_VI
+ EN_VU
+ EN_WS
+ EN_ZA
+ EN_ZM
+ EN_ZW
+ EO
+ ES
+ ES_AR
+ ES_BO
+ ES_BR
+ ES_BZ
+ ES_CL
+ ES_CO
+ ES_CR
+ ES_CU
+ ES_DO
+ ES_EA
+ ES_EC
+ ES_ES
+ ES_GQ
+ ES_GT
+ ES_HN
+ ES_IC
+ ES_MX
+ ES_NI
+ ES_PA
+ ES_PE
+ ES_PH
+ ES_PR
+ ES_PY
+ ES_SV
+ ES_US
+ ES_UY
+ ES_VE
+ ET
+ ET_EE
+ EU
+ EU_ES
+ EWO
+ EWO_CM
+ FA
+ FA_AF
+ FA_IR
+ FF
+ FF_ADLM
+ FF_ADLM_BF
+ FF_ADLM_CM
+ FF_ADLM_GH
+ FF_ADLM_GM
+ FF_ADLM_GN
+ FF_ADLM_GW
+ FF_ADLM_LR
+ FF_ADLM_MR
+ FF_ADLM_NE
+ FF_ADLM_NG
+ FF_ADLM_SL
+ FF_ADLM_SN
+ FF_LATN
+ FF_LATN_BF
+ FF_LATN_CM
+ FF_LATN_GH
+ FF_LATN_GM
+ FF_LATN_GN
+ FF_LATN_GW
+ FF_LATN_LR
+ FF_LATN_MR
+ FF_LATN_NE
+ FF_LATN_NG
+ FF_LATN_SL
+ FF_LATN_SN
+ FI
+ FI_FI
+ FIL
+ FIL_PH
+ FO
+ FO_DK
+ FO_FO
+ FR
+ FR_BE
+ FR_BF
+ FR_BI
+ FR_BJ
+ FR_BL
+ FR_CA
+ FR_CD
+ FR_CF
+ FR_CG
+ FR_CH
+ FR_CI
+ FR_CM
+ FR_DJ
+ FR_DZ
+ FR_FR
+ FR_GA
+ FR_GF
+ FR_GN
+ FR_GP
+ FR_GQ
+ FR_HT
+ FR_KM
+ FR_LU
+ FR_MA
+ FR_MC
+ FR_MF
+ FR_MG
+ FR_ML
+ FR_MQ
+ FR_MR
+ FR_MU
+ FR_NC
+ FR_NE
+ FR_PF
+ FR_PM
+ FR_RE
+ FR_RW
+ FR_SC
+ FR_SN
+ FR_SY
+ FR_TD
+ FR_TG
+ FR_TN
+ FR_VU
+ FR_WF
+ FR_YT
+ FUR
+ FUR_IT
+ FY
+ FY_NL
+ GA
+ GA_GB
+ GA_IE
+ GD
+ GD_GB
+ GL
+ GL_ES
+ GSW
+ GSW_CH
+ GSW_FR
+ GSW_LI
+ GU
+ GU_IN
+ GUZ
+ GUZ_KE
+ GV
+ GV_IM
+ HA
+ HA_GH
+ HA_NE
+ HA_NG
+ HAW
+ HAW_US
+ HE
+ HE_IL
+ HI
+ HI_IN
+ HR
+ HR_BA
+ HR_HR
+ HSB
+ HSB_DE
+ HU
+ HU_HU
+ HY
+ HY_AM
+ IA
+ ID
+ ID_ID
+ IG
+ IG_NG
+ II
+ II_CN
+ IS
+ IS_IS
+ IT
+ IT_CH
+ IT_IT
+ IT_SM
+ IT_VA
+ JA
+ JA_JP
+ JGO
+ JGO_CM
+ JMC
+ JMC_TZ
+ JV
+ JV_ID
+ KA
+ KA_GE
+ KAB
+ KAB_DZ
+ KAM
+ KAM_KE
+ KDE
+ KDE_TZ
+ KEA
+ KEA_CV
+ KHQ
+ KHQ_ML
+ KI
+ KI_KE
+ KK
+ KK_KZ
+ KKJ
+ KKJ_CM
+ KL
+ KL_GL
+ KLN
+ KLN_KE
+ KM
+ KM_KH
+ KN
+ KN_IN
+ KO
+ KO_KP
+ KO_KR
+ KOK
+ KOK_IN
+ KS
+ KS_ARAB
+ KS_ARAB_IN
+ KSB
+ KSB_TZ
+ KSF
+ KSF_CM
+ KSH
+ KSH_DE
+ KU
+ KU_TR
+ KW
+ KW_GB
+ KY
+ KY_KG
+ LAG
+ LAG_TZ
+ LB
+ LB_LU
+ LG
+ LG_UG
+ LKT
+ LKT_US
+ LN
+ LN_AO
+ LN_CD
+ LN_CF
+ LN_CG
+ LO
+ LO_LA
+ LRC
+ LRC_IQ
+ LRC_IR
+ LT
+ LT_LT
+ LU
+ LU_CD
+ LUO
+ LUO_KE
+ LUY
+ LUY_KE
+ LV
+ LV_LV
+ MAI
+ MAI_IN
+ MAS
+ MAS_KE
+ MAS_TZ
+ MER
+ MER_KE
+ MFE
+ MFE_MU
+ MG
+ MG_MG
+ MGH
+ MGH_MZ
+ MGO
+ MGO_CM
+ MI
+ MI_NZ
+ MK
+ MK_MK
+ ML
+ ML_IN
+ MN
+ MN_MN
+ MNI
+ MNI_BENG
+ MNI_BENG_IN
+ MR
+ MR_IN
+ MS
+ MS_BN
+ MS_ID
+ MS_MY
+ MS_SG
+ MT
+ MT_MT
+ MUA
+ MUA_CM
+ MY
+ MY_MM
+ MZN
+ MZN_IR
+ NAQ
+ NAQ_NA
+ NB
+ NB_NO
+ NB_SJ
+ ND
+ ND_ZW
+ NDS
+ NDS_DE
+ NDS_NL
+ NE
+ NE_IN
+ NE_NP
+ NL
+ NL_AW
+ NL_BE
+ NL_BQ
+ NL_CW
+ NL_NL
+ NL_SR
+ NL_SX
+ NMG
+ NMG_CM
+ NN
+ NN_NO
+ NNH
+ NNH_CM
+ NUS
+ NUS_SS
+ NYN
+ NYN_UG
+ OM
+ OM_ET
+ OM_KE
+ OR
+ OR_IN
+ OS
+ OS_GE
+ OS_RU
+ PA
+ PA_ARAB
+ PA_ARAB_PK
+ PA_GURU
+ PA_GURU_IN
+ PCM
+ PCM_NG
+ PL
+ PL_PL
+ PRG
+ PS
+ PS_AF
+ PS_PK
+ PT
+ PT_AO
+ PT_BR
+ PT_CH
+ PT_CV
+ PT_GQ
+ PT_GW
+ PT_LU
+ PT_MO
+ PT_MZ
+ PT_PT
+ PT_ST
+ PT_TL
+ QU
+ QU_BO
+ QU_EC
+ QU_PE
+ RM
+ RM_CH
+ RN
+ RN_BI
+ RO
+ RO_MD
+ RO_RO
+ ROF
+ ROF_TZ
+ RU
+ RU_BY
+ RU_KG
+ RU_KZ
+ RU_MD
+ RU_RU
+ RU_UA
+ RW
+ RW_RW
+ RWK
+ RWK_TZ
+ SAH
+ SAH_RU
+ SAQ
+ SAQ_KE
+ SAT
+ SAT_OLCK
+ SAT_OLCK_IN
+ SBP
+ SBP_TZ
+ SD
+ SD_ARAB
+ SD_ARAB_PK
+ SD_DEVA
+ SD_DEVA_IN
+ SE
+ SE_FI
+ SE_NO
+ SE_SE
+ SEH
+ SEH_MZ
+ SES
+ SES_ML
+ SG
+ SG_CF
+ SHI
+ SHI_LATN
+ SHI_LATN_MA
+ SHI_TFNG
+ SHI_TFNG_MA
+ SI
+ SI_LK
+ SK
+ SK_SK
+ SL
+ SL_SI
+ SMN
+ SMN_FI
+ SN
+ SN_ZW
+ SO
+ SO_DJ
+ SO_ET
+ SO_KE
+ SO_SO
+ SQ
+ SQ_AL
+ SQ_MK
+ SQ_XK
+ SR
+ SR_CYRL
+ SR_CYRL_BA
+ SR_CYRL_ME
+ SR_CYRL_RS
+ SR_CYRL_XK
+ SR_LATN
+ SR_LATN_BA
+ SR_LATN_ME
+ SR_LATN_RS
+ SR_LATN_XK
+ SU
+ SU_LATN
+ SU_LATN_ID
+ SV
+ SV_AX
+ SV_FI
+ SV_SE
+ SW
+ SW_CD
+ SW_KE
+ SW_TZ
+ SW_UG
+ TA
+ TA_IN
+ TA_LK
+ TA_MY
+ TA_SG
+ TE
+ TE_IN
+ TEO
+ TEO_KE
+ TEO_UG
+ TG
+ TG_TJ
+ TH
+ TH_TH
+ TI
+ TI_ER
+ TI_ET
+ TK
+ TK_TM
+ TO
+ TO_TO
+ TR
+ TR_CY
+ TR_TR
+ TT
+ TT_RU
+ TWQ
+ TWQ_NE
+ TZM
+ TZM_MA
+ UG
+ UG_CN
+ UK
+ UK_UA
+ UR
+ UR_IN
+ UR_PK
+ UZ
+ UZ_ARAB
+ UZ_ARAB_AF
+ UZ_CYRL
+ UZ_CYRL_UZ
+ UZ_LATN
+ UZ_LATN_UZ
+ VAI
+ VAI_LATN
+ VAI_LATN_LR
+ VAI_VAII
+ VAI_VAII_LR
+ VI
+ VI_VN
+ VO
+ VUN
+ VUN_TZ
+ WAE
+ WAE_CH
+ WO
+ WO_SN
+ XH
+ XH_ZA
+ XOG
+ XOG_UG
+ YAV
+ YAV_CM
+ YI
+ YO
+ YO_BJ
+ YO_NG
+ YUE
+ YUE_HANS
+ YUE_HANS_CN
+ YUE_HANT
+ YUE_HANT_HK
+ ZGH
+ ZGH_MA
+ ZH
+ ZH_HANS
+ ZH_HANS_CN
+ ZH_HANS_HK
+ ZH_HANS_MO
+ ZH_HANS_SG
+ ZH_HANT
+ ZH_HANT_HK
+ ZH_HANT_MO
+ ZH_HANT_TW
+ ZU
+ ZU_ZA
+}
- """Determines whether displayed prices should include taxes."""
- displayGrossPrices: Boolean!
+"""
+Represents shipping method's original translatable fields and related translations.
+"""
+type ShippingMethodTranslatableContent implements Node @doc(category: "Shipping") {
+ """The ID of the shipping method translatable content."""
+ id: ID!
- """Determines whether prices are entered with the tax included."""
- pricesEnteredWithTax: Boolean!
+ """The ID of the shipping method to translate."""
+ shippingMethodId: ID!
- """List of country-specific exceptions in tax configuration."""
- countries: [TaxConfigurationPerCountry!]!
+ """Shipping method name to translate."""
+ name: String!
"""
- The tax app `App.identifier` that will be used to calculate the taxes for the given channel. Empty value for `TAX_APP` set as `taxCalculationStrategy` means that Saleor will iterate over all installed tax apps. If multiple tax apps exist with provided tax app id use the `App` with newest `created` date. Will become mandatory in 4.0 for `TAX_APP` `taxCalculationStrategy`.
+ Shipping method description to translate.
- Added in Saleor 3.19.
+ Rich text format. For reference see https://editorjs.io/
"""
- taxAppId: String
+ description: JSONString
+
+ """Returns translated shipping method fields for the given language code."""
+ translation(
+ """A language code to return the translation for shipping method."""
+ languageCode: LanguageCodeEnum!
+ ): ShippingMethodTranslation
"""
- Determines whether to use weighted tax for shipping. When set to true, the tax rate for shipping will be calculated based on the weighted average of tax rates from the order or checkout lines.
+ Shipping method are the methods you'll use to get customer's orders to them. They are directly exposed to the customers.
- Added in Saleor 3.21.
+ Requires one of the following permissions: MANAGE_SHIPPING.
"""
- useWeightedTaxForShipping: Boolean
-}
-
-enum TaxCalculationStrategy @doc(category: "Taxes") {
- FLAT_RATES
- TAX_APP
+ shippingMethod: ShippingMethodType @deprecated(reason: "Get model fields from the root level queries.")
}
-"""Country-specific exceptions of a channel's tax configuration."""
-type TaxConfigurationPerCountry @doc(category: "Taxes") {
- """Country in which this configuration applies."""
- country: CountryDisplay!
-
- """Determines whether taxes are charged in this country."""
- chargeTaxes: Boolean!
+"""Represents shipping method channel listing."""
+type ShippingMethodChannelListing implements Node @doc(category: "Shipping") {
+ """The ID of shipping method channel listing."""
+ id: ID!
- """
- A country-specific strategy to use for tax calculation. Taxes can be calculated either using user-defined flat rates or with a tax app. If not provided, use the value from the channel's tax configuration.
- """
- taxCalculationStrategy: TaxCalculationStrategy
+ """The channel associated with the shipping method channel listing."""
+ channel: Channel!
- """
- Determines whether displayed prices should include taxes for this country.
- """
- displayGrossPrices: Boolean!
+ """Maximum order price."""
+ maximumOrderPrice: Money
- """
- The tax app `App.identifier` that will be used to calculate the taxes for the given channel and country. If not provided, use the value from the channel's tax configuration.
-
- Added in Saleor 3.19.
- """
- taxAppId: String
+ """Minimum order price."""
+ minimumOrderPrice: Money
- """
- Determines whether to use weighted tax for shipping. When set to true, the tax rate for shipping will be calculated based on the weighted average of tax rates from the order or checkout lines.
-
- Added in Saleor 3.21.
- """
- useWeightedTaxForShipping: Boolean
+ """Price of the shipping method in the associated channel."""
+ price: Money
}
"""Represents shipping method postal code rule."""
@@ -6229,6 +5808,23 @@ type ProductType implements Node & ObjectWithMetadata @doc(category: "Products")
): AttributeCountableConnection
}
+"""Represents weight value in a specific weight unit."""
+type Weight {
+ """Weight unit."""
+ unit: WeightUnitsEnum!
+
+ """Weight value. Returns a value with maximal three decimal places"""
+ value: Float!
+}
+
+enum WeightUnitsEnum {
+ G
+ LB
+ OZ
+ KG
+ TONNE
+}
+
enum ProductTypeKindEnum @doc(category: "Products") {
NORMAL
GIFT_CARD
@@ -6759,6 +6355,14 @@ input AttributeChoicesSortingInput @doc(category: "Attributes") {
field: AttributeChoicesSortField!
}
+enum OrderDirection {
+ """Specifies an ascending sort order."""
+ ASC
+
+ """Specifies a descending sort order."""
+ DESC
+}
+
enum AttributeChoicesSortField @doc(category: "Attributes") {
"""Sort attribute choice by name."""
NAME
@@ -7813,6 +7417,265 @@ input AddressInput {
skipValidation: Boolean = false
}
+"""
+Represents country codes defined by the ISO 3166-1 alpha-2 standard.
+
+The `EU` value is DEPRECATED and will be removed in Saleor 3.21.
+"""
+enum CountryCode {
+ AF
+ AX
+ AL
+ DZ
+ AS
+ AD
+ AO
+ AI
+ AQ
+ AG
+ AR
+ AM
+ AW
+ AU
+ AT
+ AZ
+ BS
+ BH
+ BD
+ BB
+ BY
+ BE
+ BZ
+ BJ
+ BM
+ BT
+ BO
+ BQ
+ BA
+ BW
+ BV
+ BR
+ IO
+ BN
+ BG
+ BF
+ BI
+ CV
+ KH
+ CM
+ CA
+ KY
+ CF
+ TD
+ CL
+ CN
+ CX
+ CC
+ CO
+ KM
+ CG
+ CD
+ CK
+ CR
+ CI
+ HR
+ CU
+ CW
+ CY
+ CZ
+ DK
+ DJ
+ DM
+ DO
+ EC
+ EG
+ SV
+ GQ
+ ER
+ EE
+ SZ
+ ET
+ EU
+ FK
+ FO
+ FJ
+ FI
+ FR
+ GF
+ PF
+ TF
+ GA
+ GM
+ GE
+ DE
+ GH
+ GI
+ GR
+ GL
+ GD
+ GP
+ GU
+ GT
+ GG
+ GN
+ GW
+ GY
+ HT
+ HM
+ VA
+ HN
+ HK
+ HU
+ IS
+ IN
+ ID
+ IR
+ IQ
+ IE
+ IM
+ IL
+ IT
+ JM
+ JP
+ JE
+ JO
+ KZ
+ KE
+ KI
+ XK
+ KW
+ KG
+ LA
+ LV
+ LB
+ LS
+ LR
+ LY
+ LI
+ LT
+ LU
+ MO
+ MG
+ MW
+ MY
+ MV
+ ML
+ MT
+ MH
+ MQ
+ MR
+ MU
+ YT
+ MX
+ FM
+ MD
+ MC
+ MN
+ ME
+ MS
+ MA
+ MZ
+ MM
+ NA
+ NR
+ NP
+ NL
+ NC
+ NZ
+ NI
+ NE
+ NG
+ NU
+ NF
+ KP
+ MK
+ MP
+ NO
+ OM
+ PK
+ PW
+ PS
+ PA
+ PG
+ PY
+ PE
+ PH
+ PN
+ PL
+ PT
+ PR
+ QA
+ RE
+ RO
+ RU
+ RW
+ BL
+ SH
+ KN
+ LC
+ MF
+ PM
+ VC
+ WS
+ SM
+ ST
+ SA
+ SN
+ RS
+ SC
+ SL
+ SG
+ SX
+ SK
+ SI
+ SB
+ SO
+ ZA
+ GS
+ KR
+ SS
+ ES
+ LK
+ SD
+ SR
+ SJ
+ SE
+ CH
+ SY
+ TW
+ TJ
+ TZ
+ TH
+ TL
+ TG
+ TK
+ TO
+ TT
+ TN
+ TR
+ TM
+ TC
+ TV
+ UG
+ UA
+ AE
+ GB
+ UM
+ US
+ UY
+ UZ
+ VU
+ VE
+ VN
+ VG
+ VI
+ WF
+ EH
+ YE
+ ZM
+ ZW
+}
+
input MetadataInput {
"""Key of a metadata item."""
key: String!
@@ -8647,167 +8510,285 @@ type StockCountableEdge @doc(category: "Products") {
cursor: String!
}
-type WarehouseCountableConnection @doc(category: "Products") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [WarehouseCountableEdge!]!
+"""List of shipping methods available for the country."""
+type ShippingMethodsPerCountry @doc(category: "Shipping") {
+ """The country code."""
+ countryCode: CountryCode!
- """A total count of items in the collection."""
- totalCount: Int
+ """List of available shipping methods."""
+ shippingMethods: [ShippingMethod!]
}
-type WarehouseCountableEdge @doc(category: "Products") {
- """The item at the end of the edge."""
- node: Warehouse!
+"""
+Shipping methods that can be used as means of shipping for orders and checkouts.
+"""
+type ShippingMethod implements Node & ObjectWithMetadata @doc(category: "Shipping") {
+ """Unique ID of ShippingMethod available for Order."""
+ id: ID!
- """A cursor for use in pagination."""
- cursor: String!
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
+
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
+
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
+
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
+
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """Type of the shipping method."""
+ type: ShippingMethodTypeEnum @deprecated
+
+ """Shipping method name."""
+ name: String!
+
+ """
+ Shipping method description.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
+
+ """Maximum delivery days for this shipping method."""
+ maximumDeliveryDays: Int
+
+ """Minimum delivery days for this shipping method."""
+ minimumDeliveryDays: Int
+
+ """Maximum order weight for this shipping method."""
+ maximumOrderWeight: Weight @deprecated
+
+ """Minimum order weight for this shipping method."""
+ minimumOrderWeight: Weight @deprecated
+
+ """Returns translated shipping method fields for the given language code."""
+ translation(
+ """A language code to return the translation for shipping method."""
+ languageCode: LanguageCodeEnum!
+ ): ShippingMethodTranslation
+
+ """The price of selected shipping method."""
+ price: Money!
+
+ """Maximum order price for this shipping method."""
+ maximumOrderPrice: Money @deprecated
+
+ """Minimal order price for this shipping method."""
+ minimumOrderPrice: Money @deprecated
+
+ """Describes if this shipping method is active and can be selected."""
+ active: Boolean!
+
+ """Message connected to this shipping method."""
+ message: String
}
-input WarehouseFilterInput @doc(category: "Products") {
- clickAndCollectOption: WarehouseClickAndCollectOptionEnum
- metadata: [MetadataFilter!]
- search: String
- ids: [ID!]
- isPrivate: Boolean
- channels: [ID!]
- slugs: [String!]
+"""Represents the channel stock settings."""
+type StockSettings @doc(category: "Products") {
+ """
+ Allocation strategy defines the preference of warehouses for allocations and reservations.
+ """
+ allocationStrategy: AllocationStrategyEnum!
}
-input WarehouseSortingInput @doc(category: "Products") {
- """Specifies the direction in which to sort warehouses."""
- direction: OrderDirection!
+"""
+Determine the allocation strategy for the channel.
- """Sort warehouses by the selected field."""
- field: WarehouseSortField!
+ PRIORITIZE_SORTING_ORDER - allocate stocks according to the warehouses' order
+ within the channel
+
+ PRIORITIZE_HIGH_STOCK - allocate stock in a warehouse with the most stock
+"""
+enum AllocationStrategyEnum @doc(category: "Products") {
+ PRIORITIZE_SORTING_ORDER
+ PRIORITIZE_HIGH_STOCK
}
-enum WarehouseSortField @doc(category: "Products") {
- """Sort warehouses by name."""
- NAME
-}
+"""Represents the channel-specific order settings."""
+type OrderSettings {
+ """
+ When disabled, all new orders from checkout will be marked as unconfirmed. When enabled orders from checkout will become unfulfilled immediately.
+ """
+ automaticallyConfirmAllNewOrders: Boolean!
+
+ """
+ When enabled, all non-shippable gift card orders will be fulfilled automatically.
+ """
+ automaticallyFulfillNonShippableGiftCard: Boolean!
+
+ """
+ Expiration time in minutes. Default null - means do not expire any orders.
+ """
+ expireOrdersAfter: Minute
+
+ """
+ Determine what strategy will be used to mark the order as paid. Based on the chosen option, the proper object will be created and attached to the order when it's manually marked as paid.
+ `PAYMENT_FLOW` - [default option] creates the `Payment` object.
+ `TRANSACTION_FLOW` - creates the `TransactionItem` object.
+ """
+ markAsPaidStrategy: MarkAsPaidStrategyEnum!
+
+ """The time in days after expired orders will be deleted."""
+ deleteExpiredOrdersAfter: Day!
-type TranslatableItemConnection {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [TranslatableItemEdge!]!
+ """
+ Determine if it is possible to place unpaid order by calling `checkoutComplete` mutation.
+ """
+ allowUnpaidOrders: Boolean!
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """
+ Determine if voucher applied on draft order should be count toward voucher usage.
+
+ Added in Saleor 3.18.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ """
+ includeDraftOrderInVoucherUsage: Boolean!
-type TranslatableItemEdge {
- """The item at the end of the edge."""
- node: TranslatableItem!
+ """
+ Time in hours after which the draft order line price will be refreshed.
+
+ Added in Saleor 3.21.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ """
+ draftOrderLinePriceFreezePeriod: Hour
- """A cursor for use in pagination."""
- cursor: String!
+ """
+ This flag only affects orders created from checkout and applies specifically to vouchers of the types: `SPECIFIC_PRODUCT` and `ENTIRE_ORDER` with `applyOncePerOrder` enabled.
+ - When legacy propagation is enabled, discounts from these vouchers are represented as `OrderDiscount` objects, attached to the order and returned in the `Order.discounts` field. Additionally, percentage-based vouchers are converted to fixed-value discounts.
+ - When legacy propagation is disabled, discounts are represented as `OrderLineDiscount` objects, attached to individual lines and returned in the `OrderLine.discounts` field. In this case, percentage-based vouchers retain their original type.
+ In future releases, `OrderLineDiscount` will become the default behavior, and this flag will be deprecated and removed.
+
+ Added in Saleor 3.21.
+ """
+ useLegacyLineDiscountPropagation: Boolean!
}
-union TranslatableItem = ProductTranslatableContent | CollectionTranslatableContent | CategoryTranslatableContent | AttributeTranslatableContent | AttributeValueTranslatableContent | ProductVariantTranslatableContent | PageTranslatableContent | ShippingMethodTranslatableContent | VoucherTranslatableContent | MenuItemTranslatableContent | PromotionTranslatableContent | PromotionRuleTranslatableContent | SaleTranslatableContent
+"""
+The `Minute` scalar type represents number of minutes by integer value.
+"""
+scalar Minute
"""
-Represents page's original translatable fields and related translations.
+Determine the mark as paid strategy for the channel.
+
+ TRANSACTION_FLOW - new orders marked as paid will receive a
+ `TransactionItem` object, that will cover the `order.total`.
+
+ PAYMENT_FLOW - new orders marked as paid will receive a
+ `Payment` object, that will cover the `order.total`.
"""
-type PageTranslatableContent implements Node @doc(category: "Pages") {
- """The ID of the page translatable content."""
- id: ID!
+enum MarkAsPaidStrategyEnum @doc(category: "Channels") {
+ TRANSACTION_FLOW
+ PAYMENT_FLOW
+}
- """The ID of the page to translate."""
- pageId: ID!
+"""The `Day` scalar type represents number of days by integer value."""
+scalar Day
- """SEO title to translate."""
- seoTitle: String
+"""The `Hour` scalar type represents number of hours by integer value."""
+scalar Hour
- """SEO description to translate."""
- seoDescription: String
+"""Represents the channel-specific checkout settings."""
+type CheckoutSettings {
+ """
+ Default `true`. Determines if the checkout mutations should use legacy error flow. In legacy flow, all mutations can raise an exception unrelated to the requested action - (e.g. out-of-stock exception when updating checkoutShippingAddress.) If `false`, the errors will be aggregated in `checkout.problems` field. Some of the `problems` can block the finalizing checkout process. The legacy flow will be removed in Saleor 4.0. The flow with `checkout.problems` will be the default one.
+ """
+ useLegacyErrorFlow: Boolean!
"""
- Slug to translate.
+ Default `false`. Determines if the paid checkouts should be automatically completed. This setting applies only to checkouts where payment was processed through transactions.When enabled, the checkout will be automatically completed once the checkout `charge_status` reaches `FULL`. This occurs when the total sum of charged and authorized transaction amounts equals or exceeds the checkout's total amount.
- Added in Saleor 3.21.
+ Added in Saleor 3.20.
"""
- slug: String
-
- """Page title to translate."""
- title: String!
+ automaticallyCompleteFullyPaidCheckouts: Boolean!
"""
- Content of the page to translate.
+ The time in minutes to wait after a checkout is fully paid before automatically completing it.
- Rich text format. For reference see https://editorjs.io/
+ Added in Saleor 3.22.
"""
- content: JSONString
+ automaticCompletionDelay: Minute
"""
- Content of the page.
+ The date time defines the earliest checkout creation date on which fully paid checkouts can begin to be automatically completed.
- Rich text format. For reference see https://editorjs.io/
+ Added in Saleor 3.22.
"""
- contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
-
- """Returns translated page fields for the given language code."""
- translation(
- """A language code to return the translation for page."""
- languageCode: LanguageCodeEnum!
- ): PageTranslation
+ automaticCompletionCutOffDate: DateTime
"""
- A static page that can be manually added by a shop operator through the dashboard.
+ Default to `true`. Determines whether gift cards can be attached to a Checkout via `addPromoCode` mutation. Usage of this mutation with gift cards is deprecated.
+
+ Added in Saleor 3.23.
"""
- page: Page @deprecated(reason: "Get model fields from the root level queries.")
-
- """List of page content attribute values that can be translated."""
- attributeValues: [AttributeValueTranslatableContent!]!
+ allowLegacyGiftCardUse: Boolean!
}
-"""Represents page translations."""
-type PageTranslation implements Node @doc(category: "Pages") {
- """The ID of the page translation."""
- id: ID!
-
- """Translation language."""
- language: LanguageDisplay!
-
- """Translated SEO title."""
- seoTitle: String
-
- """Translated SEO description."""
- seoDescription: String
+"""Represents the channel-specific payment settings."""
+type PaymentSettings {
+ """
+ Determine the transaction flow strategy to be used. Include the selected option in the payload sent to the payment app, as a requested action for the transaction.
+ """
+ defaultTransactionFlowStrategy: TransactionFlowStrategyEnum!
"""
- Translated page slug.
+ Determine if the funds for expired checkouts should be released automatically.
- Added in Saleor 3.21.
+ Added in Saleor 3.20.
"""
- slug: String
-
- """Translated page title."""
- title: String
+ releaseFundsForExpiredCheckouts: Boolean
"""
- Translated content of the page.
+ The time in hours after which funds for expired checkouts will be released.
- Rich text format. For reference see https://editorjs.io/
+ Added in Saleor 3.20.
"""
- content: JSONString
+ checkoutTtlBeforeReleasingFunds: Hour
"""
- Translated description of the page.
+ Specifies the earliest date on which funds for expired checkouts can begin to be released. Expired checkouts dated before this cut-off will not have their funds released. Additionally, no funds will be released for checkouts that are more than one year old, regardless of the cut-off date.
- Rich text format. For reference see https://editorjs.io/
+ Added in Saleor 3.20.
"""
- contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
-
- """Represents the page fields to translate."""
- translatableContent: PageTranslatableContent
+ checkoutReleaseFundsCutOffDate: DateTime
}
"""
-A static page that can be manually added by a shop operator through the dashboard.
+Determine the transaction flow strategy.
+
+ AUTHORIZATION - the processed transaction should be only authorized
+ CHARGE - the processed transaction should be charged.
"""
-type Page implements Node & ObjectWithMetadata & ObjectWithAttributes @doc(category: "Pages") {
- """ID of the page."""
+enum TransactionFlowStrategyEnum @doc(category: "Payments") {
+ AUTHORIZATION
+ CHARGE
+}
+
+"""Channel-specific tax configuration."""
+type TaxConfiguration implements Node & ObjectWithMetadata @doc(category: "Taxes") {
+ """The ID of the object."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -8840,121 +8821,77 @@ type Page implements Node & ObjectWithMetadata & ObjectWithAttributes @doc(categ
"""
metafields(keys: [String!]): Metadata
- """
- Get a single attribute attached to page by attribute slug.
-
- Added in Saleor 3.22.
- """
- assignedAttribute(
- """Slug of the attribute"""
- slug: String!
- ): AssignedAttribute
-
- """
- List of attributes assigned to this page.
-
- Added in Saleor 3.22.
- """
- assignedAttributes(
- """Maximum number of attributes to return. Default is 100."""
- limit: PositiveInt = 100
- ): [AssignedAttribute!]!
-
- """Title of the page for SEO."""
- seoTitle: String
-
- """Description of the page for SEO."""
- seoDescription: String
-
- """Title of the page."""
- title: String!
-
- """
- Content of the page.
-
- Rich text format. For reference see https://editorjs.io/
- """
- content: JSONString
- publicationDate: Date @deprecated(reason: "Use the `publishedAt` field to fetch the publication date.")
-
- """The page publication date."""
- publishedAt: DateTime
-
- """Determines if the page is published."""
- isPublished: Boolean!
-
- """Slug of the page."""
- slug: String!
-
- """Determines the type of page"""
- pageType: PageType!
+ """A channel to which the tax configuration applies to."""
+ channel: Channel!
- """Date and time at which page was created."""
- created: DateTime!
+ """Determines whether taxes are charged in the given channel."""
+ chargeTaxes: Boolean!
"""
- Content of the page.
-
- Rich text format. For reference see https://editorjs.io/
+ The default strategy to use for tax calculation in the given channel. Taxes can be calculated either using user-defined flat rates or with a tax app. Empty value means that no method is selected and taxes are not calculated.
"""
- contentJson: JSONString! @deprecated(reason: "Use the `content` field instead.")
-
- """Returns translated page fields for the given language code."""
- translation(
- """A language code to return the translation for page."""
- languageCode: LanguageCodeEnum!
- ): PageTranslation
-
- """Get a single attribute attached to page by attribute slug."""
- attribute(
- """Slug of the attribute"""
- slug: String!
- ): SelectedAttribute @deprecated(reason: "Use `assignedAttribute` field instead.")
-
- """List of attributes assigned to this page."""
- attributes: [SelectedAttribute!]! @deprecated(reason: "Use `assignedAttributes` field instead.")
-}
+ taxCalculationStrategy: TaxCalculationStrategy
-"""
-Represents voucher's original translatable fields and related translations.
-"""
-type VoucherTranslatableContent implements Node @doc(category: "Discounts") {
- """The ID of the voucher translatable content."""
- id: ID!
+ """Determines whether displayed prices should include taxes."""
+ displayGrossPrices: Boolean!
- """The ID of the voucher to translate."""
- voucherId: ID!
+ """Determines whether prices are entered with the tax included."""
+ pricesEnteredWithTax: Boolean!
- """Voucher name to translate."""
- name: String
+ """List of country-specific exceptions in tax configuration."""
+ countries: [TaxConfigurationPerCountry!]!
- """Returns translated voucher fields for the given language code."""
- translation(
- """A language code to return the translation for voucher."""
- languageCode: LanguageCodeEnum!
- ): VoucherTranslation
+ """
+ The tax app `App.identifier` that will be used to calculate the taxes for the given channel. Empty value for `TAX_APP` set as `taxCalculationStrategy` means that Saleor will iterate over all installed tax apps. If multiple tax apps exist with provided tax app id use the `App` with newest `created` date. Will become mandatory in 4.0 for `TAX_APP` `taxCalculationStrategy`.
+
+ Added in Saleor 3.19.
+ """
+ taxAppId: String
"""
- Vouchers allow giving discounts to particular customers on categories, collections or specific products. They can be used during checkout by providing valid voucher codes.
+ Determines whether to use weighted tax for shipping. When set to true, the tax rate for shipping will be calculated based on the weighted average of tax rates from the order or checkout lines.
- Requires one of the following permissions: MANAGE_DISCOUNTS.
+ Added in Saleor 3.21.
"""
- voucher: Voucher @deprecated(reason: "Get model fields from the root level queries.")
+ useWeightedTaxForShipping: Boolean
}
-"""Represents voucher translations."""
-type VoucherTranslation implements Node @doc(category: "Discounts") {
- """The ID of the voucher translation."""
- id: ID!
+enum TaxCalculationStrategy @doc(category: "Taxes") {
+ FLAT_RATES
+ TAX_APP
+}
- """Translation language."""
- language: LanguageDisplay!
+"""Country-specific exceptions of a channel's tax configuration."""
+type TaxConfigurationPerCountry @doc(category: "Taxes") {
+ """Country in which this configuration applies."""
+ country: CountryDisplay!
- """Translated voucher name."""
- name: String
+ """Determines whether taxes are charged in this country."""
+ chargeTaxes: Boolean!
- """Represents the voucher fields to translate."""
- translatableContent: VoucherTranslatableContent
+ """
+ A country-specific strategy to use for tax calculation. Taxes can be calculated either using user-defined flat rates or with a tax app. If not provided, use the value from the channel's tax configuration.
+ """
+ taxCalculationStrategy: TaxCalculationStrategy
+
+ """
+ Determines whether displayed prices should include taxes for this country.
+ """
+ displayGrossPrices: Boolean!
+
+ """
+ The tax app `App.identifier` that will be used to calculate the taxes for the given channel and country. If not provided, use the value from the channel's tax configuration.
+
+ Added in Saleor 3.19.
+ """
+ taxAppId: String
+
+ """
+ Determines whether to use weighted tax for shipping. When set to true, the tax rate for shipping will be calculated based on the weighted average of tax rates from the order or checkout lines.
+
+ Added in Saleor 3.21.
+ """
+ useWeightedTaxForShipping: Boolean
}
"""
@@ -9239,6 +9176,48 @@ type CollectionCountableEdge @doc(category: "Products") {
cursor: String!
}
+"""Represents voucher translations."""
+type VoucherTranslation implements Node @doc(category: "Discounts") {
+ """The ID of the voucher translation."""
+ id: ID!
+
+ """Translation language."""
+ language: LanguageDisplay!
+
+ """Translated voucher name."""
+ name: String
+
+ """Represents the voucher fields to translate."""
+ translatableContent: VoucherTranslatableContent
+}
+
+"""
+Represents voucher's original translatable fields and related translations.
+"""
+type VoucherTranslatableContent implements Node @doc(category: "Discounts") {
+ """The ID of the voucher translatable content."""
+ id: ID!
+
+ """The ID of the voucher to translate."""
+ voucherId: ID!
+
+ """Voucher name to translate."""
+ name: String
+
+ """Returns translated voucher fields for the given language code."""
+ translation(
+ """A language code to return the translation for voucher."""
+ languageCode: LanguageCodeEnum!
+ ): VoucherTranslation
+
+ """
+ Vouchers allow giving discounts to particular customers on categories, collections or specific products. They can be used during checkout by providing valid voucher codes.
+
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
+ """
+ voucher: Voucher @deprecated(reason: "Get model fields from the root level queries.")
+}
+
enum DiscountValueTypeEnum @doc(category: "Discounts") {
FIXED
PERCENTAGE
@@ -9269,125 +9248,244 @@ type VoucherChannelListing implements Node @doc(category: "Discounts") {
}
"""
-Represents menu item's original translatable fields and related translations.
+Available payment gateway backend with configuration necessary to setup client.
"""
-type MenuItemTranslatableContent implements Node @doc(category: "Menu") {
- """The ID of the menu item translatable content."""
+type PaymentGateway @doc(category: "Payments") {
+ """Payment gateway name."""
+ name: String!
+
+ """Payment gateway ID."""
id: ID!
- """The ID of the menu item to translate."""
- menuItemId: ID!
+ """Payment gateway client configuration."""
+ config: [GatewayConfigLine!]!
- """Name of the menu item to translate."""
- name: String!
+ """Payment gateway supported currencies."""
+ currencies: [String!]!
+}
- """Returns translated menu item fields for the given language code."""
- translation(
- """A language code to return the translation for menu item."""
- languageCode: LanguageCodeEnum!
- ): MenuItemTranslation
+"""Payment gateway client configuration key and value pair."""
+type GatewayConfigLine @doc(category: "Payments") {
+ """Gateway config key."""
+ field: String!
- """
- Represents a single item of the related menu. Can store categories, collection or pages.
- """
- menuItem: MenuItem @deprecated(reason: "Get model fields from the root level queries.")
+ """Gateway config value for key."""
+ value: String
}
-"""Represents menu item translations."""
-type MenuItemTranslation implements Node @doc(category: "Menu") {
- """The ID of the menu item translation."""
+"""
+A gift card is a prepaid electronic payment card accepted in stores. They can be used during checkout by providing a valid gift card codes.
+"""
+type GiftCard implements Node & ObjectWithMetadata @doc(category: "Gift cards") {
+ """ID of the gift card."""
id: ID!
- """Translation language."""
- language: LanguageDisplay!
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
+
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
+
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
+
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
+
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """Code in format which allows displaying in a user interface."""
+ displayCode: String!
+
+ """Last 4 characters of gift card code."""
+ last4CodeChars: String!
+
+ """
+ Gift card code. It can be fetched both by a staff member with 'MANAGE_GIFT_CARD' when gift card hasn't been used yet or a user who bought or issued the gift card.
+
+ Requires one of the following permissions: MANAGE_GIFT_CARD, OWNER.
+ """
+ code: String!
+
+ """Date and time when gift card was created."""
+ created: DateTime!
+
+ """The user who bought or issued a gift card."""
+ createdBy: User
+
+ """The customer who used a gift card."""
+ usedBy: User @deprecated
+
+ """
+ Email address of the user who bought or issued gift card.
+
+ Requires one of the following permissions: MANAGE_USERS, OWNER.
+ """
+ createdByEmail: String
+
+ """Email address of the customer who used a gift card."""
+ usedByEmail: String @deprecated
+
+ """Date and time when gift card was last used."""
+ lastUsedOn: DateTime
+
+ """Expiry date of the gift card."""
+ expiryDate: Date
+
+ """
+ App which created the gift card.
+
+ Requires one of the following permissions: MANAGE_APPS, OWNER.
+ """
+ app: App
+
+ """Related gift card product."""
+ product: Product
+
+ """
+ List of events associated with the gift card.
+
+ Requires one of the following permissions: MANAGE_GIFT_CARD.
+ """
+ events(
+ """Filtering options for gift card events."""
+ filter: GiftCardEventFilterInput
+ ): [GiftCardEvent!]!
+
+ """
+ The gift card tag.
+
+ Requires one of the following permissions: MANAGE_GIFT_CARD.
+ """
+ tags: [GiftCardTag!]!
+
+ """Slug of the channel where the gift card was bought."""
+ boughtInChannel: String
+ isActive: Boolean!
+ initialBalance: Money!
+ currentBalance: Money!
+
+ """The customer who bought a gift card."""
+ user: User @deprecated(reason: "Use `createdBy` field instead.")
- """Translated menu item name."""
- name: String!
+ """End date of gift card."""
+ endDate: DateTime @deprecated(reason: "Use `expiryDate` field instead.")
- """Represents the menu item fields to translate."""
- translatableContent: MenuItemTranslatableContent
+ """Start date of gift card."""
+ startDate: DateTime @deprecated
}
-"""
-Represents a single item of the related menu. Can store categories, collection or pages.
-"""
-type MenuItem implements Node & ObjectWithMetadata @doc(category: "Menu") {
- """The ID of the menu item."""
+"""History log of the gift card."""
+type GiftCardEvent implements Node @doc(category: "Gift cards") {
+ """ID of the event associated with a gift card."""
id: ID!
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """Date when event happened at in ISO 8601 format."""
+ date: DateTime
+
+ """Gift card event type."""
+ type: GiftCardEventsEnum
"""
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
+ User who performed the action. Requires one of the following permissions: MANAGE_USERS, MANAGE_STAFF, OWNER.
"""
- privateMetafield(key: String!): String
+ user: User
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ App that performed the action. Requires one of the following permissions: MANAGE_APPS, OWNER.
"""
- privateMetafields(keys: [String!]): Metadata
+ app: App
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """Content of the event."""
+ message: String
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
+ """Email of the customer."""
+ email: String
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
+ """The order ID where gift card was used or bought."""
+ orderId: ID
- """The name of the menu item."""
- name: String!
+ """User-friendly number of an order where gift card was used or bought."""
+ orderNumber: String
- """Represents the menu to which the menu item belongs."""
- menu: Menu!
+ """The list of gift card tags."""
+ tags: [String!]
- """ID of parent menu item. If empty, menu will be top level menu."""
- parent: MenuItem
+ """The list of old gift card tags."""
+ oldTags: [String!]
- """Category associated with the menu item."""
- category: Category
+ """The gift card balance."""
+ balance: GiftCardEventBalance
- """
- A collection associated with this menu item. Requires one of the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.
- """
- collection: Collection
+ """The gift card expiry date."""
+ expiryDate: Date
- """
- A page associated with this menu item. Requires one of the following permissions to include unpublished items: MANAGE_PAGES.
- """
- page: Page
+ """Previous gift card expiry date."""
+ oldExpiryDate: Date
+}
- """Indicates the position of the menu item within the menu structure."""
- level: Int!
+enum GiftCardEventsEnum @doc(category: "Gift cards") {
+ ISSUED
+ BOUGHT
+ UPDATED
+ ACTIVATED
+ DEACTIVATED
+ BALANCE_RESET
+ EXPIRY_DATE_UPDATED
+ TAGS_UPDATED
+ SENT_TO_CUSTOMER
+ RESENT
+ NOTE_ADDED
+ USED_IN_ORDER
+}
- """Represents the child items of the current menu item."""
- children: [MenuItem!]
+type GiftCardEventBalance @doc(category: "Gift cards") {
+ """Initial balance of the gift card."""
+ initialBalance: Money
- """URL to the menu item."""
- url: String
+ """Current balance of the gift card."""
+ currentBalance: Money!
- """Returns translated menu item fields for the given language code."""
- translation(
- """A language code to return the translation for menu item."""
- languageCode: LanguageCodeEnum!
- ): MenuItemTranslation
+ """Previous initial balance of the gift card."""
+ oldInitialBalance: Money
+
+ """Previous current balance of the gift card."""
+ oldCurrentBalance: Money
}
-"""
-Represents a single menu - an object that is used to help navigate through the store.
-"""
-type Menu implements Node & ObjectWithMetadata @doc(category: "Menu") {
- """The ID of the menu."""
+input GiftCardEventFilterInput @doc(category: "Gift cards") {
+ type: GiftCardEventsEnum
+ orders: [ID!]
+}
+
+"""The gift card tag."""
+type GiftCardTag implements Node @doc(category: "Gift cards") {
+ """ID of the tag associated with a gift card."""
+ id: ID!
+
+ """Name of the tag associated with a gift card."""
+ name: String!
+}
+
+"""Represents an item in the checkout."""
+type CheckoutLine implements Node & ObjectWithMetadata @doc(category: "Checkout") {
+ """The ID of the checkout line."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -9420,169 +9518,110 @@ type Menu implements Node & ObjectWithMetadata @doc(category: "Menu") {
"""
metafields(keys: [String!]): Metadata
- """The name of the menu."""
- name: String!
-
- """Slug of the menu."""
- slug: String!
-
- """Menu items associated with this menu."""
- items: [MenuItem!]
-}
-
-"""
-Represents promotion's original translatable fields and related translations.
-"""
-type PromotionTranslatableContent implements Node @doc(category: "Discounts") {
- """ID of the promotion translatable content."""
- id: ID!
-
- """ID of the promotion to translate."""
- promotionId: ID!
+ """The product variant from which the checkout line was created."""
+ variant: ProductVariant!
- """Name of the promotion."""
- name: String!
+ """The quantity of product variant assigned to the checkout line."""
+ quantity: Int!
"""
- Description of the promotion.
+ The unit price of the checkout line, with taxes and discounts.
- Rich text format. For reference see https://editorjs.io/
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- description: JSONString
-
- """Returns translated promotion fields for the given language code."""
- translation(
- """A language code to return the translation for promotion."""
- languageCode: LanguageCodeEnum!
- ): PromotionTranslation
-}
-
-"""Represents promotion translations."""
-type PromotionTranslation implements Node @doc(category: "Discounts") {
- """ID of the promotion translation."""
- id: ID!
-
- """Translation language."""
- language: LanguageDisplay!
+ unitPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """Translated name of the promotion."""
- name: String
+ """The unit price of the checkout line, without discounts."""
+ undiscountedUnitPrice: Money!
"""
- Translated description of the promotion.
+ The unit price of the checkout line prior to promotion.
- Rich text format. For reference see https://editorjs.io/
+ Added in Saleor 3.21.
"""
- description: JSONString
-
- """Represents the promotion fields to translate."""
- translatableContent: PromotionTranslatableContent
-}
-
-"""
-Represents promotion rule's original translatable fields and related translations.
-"""
-type PromotionRuleTranslatableContent implements Node @doc(category: "Discounts") {
- """ID of the promotion rule translatable content."""
- id: ID!
-
- """ID of the promotion rule to translate."""
- promotionRuleId: ID!
-
- """Name of the promotion rule."""
- name: String
+ priorUnitPrice: Money
"""
- Description of the promotion rule.
+ The sum of the checkout line price, taxes and discounts.
- Rich text format. For reference see https://editorjs.io/
+ Triggers the following webhook events:
+ - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
"""
- description: JSONString
+ totalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
- """Returns translated promotion rule fields for the given language code."""
- translation(
- """A language code to return the translation for promotion rule."""
- languageCode: LanguageCodeEnum!
- ): PromotionRuleTranslation
-}
+ """The sum of the checkout line price, without discounts."""
+ undiscountedTotalPrice: Money!
-"""Represents promotion rule translations."""
-type PromotionRuleTranslation implements Node @doc(category: "Discounts") {
- """ID of the promotion rule translation."""
- id: ID!
+ """
+ The sum of the checkout line price prior to promotion.
+
+ Added in Saleor 3.21.
+ """
+ priorTotalPrice: Money
- """Translation language."""
- language: LanguageDisplay!
+ """Indicates whether the item need to be delivered."""
+ requiresShipping: Boolean!
- """Translated name of the promotion rule."""
- name: String
+ """List of problems with the checkout line."""
+ problems: [CheckoutLineProblem!]
"""
- Translated description of the promotion rule.
+ Determine if the line is a gift.
+
+ Added in Saleor 3.19.
- Rich text format. For reference see https://editorjs.io/
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
"""
- description: JSONString
-
- """Represents the promotion rule fields to translate."""
- translatableContent: PromotionRuleTranslatableContent
+ isGift: Boolean
}
-"""
-Represents sale's original translatable fields and related translations.
+"""Represents an problem in the checkout line."""
+union CheckoutLineProblem = CheckoutLineProblemInsufficientStock | CheckoutLineProblemVariantNotAvailable
-DEPRECATED: this type will be removed. Use `PromotionTranslatableContent` instead.
"""
-type SaleTranslatableContent implements Node @doc(category: "Discounts") {
- """The ID of the sale translatable content."""
- id: ID!
-
- """The ID of the sale to translate."""
- saleId: ID!
+Indicates insufficient stock for a given checkout line.Placing the order will not be possible until solving this problem.
+"""
+type CheckoutLineProblemInsufficientStock @doc(category: "Checkout") {
+ """Available quantity of a variant."""
+ availableQuantity: Int
- """Name of the sale to translate."""
- name: String!
+ """The line that has variant with insufficient stock."""
+ line: CheckoutLine!
- """Returns translated sale fields for the given language code."""
- translation(
- """A language code to return the translation for sale."""
- languageCode: LanguageCodeEnum!
- ): SaleTranslation
+ """The variant with insufficient stock."""
+ variant: ProductVariant!
+}
- """
- Sales allow creating discounts for categories, collections or products and are visible to all the customers.
-
- Requires one of the following permissions: MANAGE_DISCOUNTS.
- """
- sale: Sale @deprecated(reason: "Get model fields from the root level queries.")
+"""
+The variant assigned to the checkout line is not available.Placing the order will not be possible until solving this problem.
+"""
+type CheckoutLineProblemVariantNotAvailable @doc(category: "Checkout") {
+ """The line that has variant that is not available."""
+ line: CheckoutLine!
}
"""
-Represents sale translations.
+Represents a delivery option for the checkout.
-DEPRECATED: this type will be removed. Use `PromotionTranslation` instead.
+Added in Saleor 3.23.
"""
-type SaleTranslation implements Node @doc(category: "Discounts") {
- """The ID of the sale translation."""
+type Delivery {
+ """The ID of the delivery."""
id: ID!
- """Translation language."""
- language: LanguageDisplay!
-
- """Translated name of sale."""
- name: String
-
- """Represents the sale fields to translate."""
- translatableContent: SaleTranslatableContent
+ """Shipping method represented by the delivery."""
+ shippingMethod: ShippingMethod
}
"""
-Sales allow creating discounts for categories, collections or products and are visible to all the customers.
-
-DEPRECATED: this type will be removed. Use `Promotion` type instead.
+Represents a delivery method chosen for the checkout. `Warehouse` type is used when checkout is marked as "click and collect" and `ShippingMethod` otherwise.
"""
-type Sale implements Node & ObjectWithMetadata @doc(category: "Discounts") {
- """The ID of the sale."""
+union DeliveryMethod = Warehouse | ShippingMethod
+
+"""Represents a payment transaction."""
+type TransactionItem implements Node & ObjectWithMetadata @doc(category: "Payments") {
+ """The ID of the object."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -9615,248 +9654,111 @@ type Sale implements Node & ObjectWithMetadata @doc(category: "Discounts") {
"""
metafields(keys: [String!]): Metadata
- """The name of the sale."""
- name: String!
-
- """Type of the sale, fixed or percentage."""
- type: SaleType!
-
- """The start date and time of the sale."""
- startDate: DateTime!
-
- """The end date and time of the sale."""
- endDate: DateTime
-
- """The date and time when the sale was created."""
- created: DateTime!
-
- """The date and time when the sale was updated."""
- updatedAt: DateTime!
-
- """List of categories this sale applies to."""
- categories(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): CategoryCountableConnection
-
- """
- List of collections this sale applies to.
-
- Requires one of the following permissions: MANAGE_DISCOUNTS.
- """
- collections(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): CollectionCountableConnection
-
- """
- List of products this sale applies to.
-
- Requires one of the following permissions: MANAGE_DISCOUNTS.
- """
- products(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
-
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): ProductCountableConnection
-
- """
- List of product variants this sale applies to.
-
- Requires one of the following permissions: MANAGE_DISCOUNTS.
- """
- variants(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
-
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
+ """The transaction token."""
+ token: UUID!
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): ProductVariantCountableConnection
+ """Date and time at which payment transaction was created."""
+ createdAt: DateTime!
- """Returns translated sale fields for the given language code."""
- translation(
- """A language code to return the translation for sale."""
- languageCode: LanguageCodeEnum!
- ): SaleTranslation
+ """Date and time at which payment transaction was modified."""
+ modifiedAt: DateTime!
"""
- List of channels available for the sale.
-
- Requires one of the following permissions: MANAGE_DISCOUNTS.
+ List of actions that can be performed in the current state of a payment.
"""
- channelListings: [SaleChannelListing!]
-
- """Sale value."""
- discountValue: Float
-
- """Currency code for sale."""
- currency: String
-}
-
-enum SaleType @doc(category: "Discounts") {
- FIXED
- PERCENTAGE
-}
+ actions: [TransactionActionEnum!]!
-"""
-Represents sale channel listing.
+ """Total amount authorized for this payment."""
+ authorizedAmount: Money!
-DEPRECATED: this type will be removed. Use `PromotionRule` type instead.
-"""
-type SaleChannelListing implements Node @doc(category: "Discounts") {
- """The ID of the channel listing."""
- id: ID!
+ """Total amount of ongoing authorization requests for the transaction."""
+ authorizePendingAmount: Money!
- """The channel in which the sale is available."""
- channel: Channel!
+ """Total amount refunded for this payment."""
+ refundedAmount: Money!
- """The value of the discount applied to the sale in the channel."""
- discountValue: Float!
+ """Total amount of ongoing refund requests for the transaction."""
+ refundPendingAmount: Money!
- """The currency in which the discount value is specified."""
- currency: String!
-}
+ """Total amount canceled for this payment."""
+ canceledAmount: Money!
-enum TranslatableKinds {
- ATTRIBUTE
- ATTRIBUTE_VALUE
- CATEGORY
- COLLECTION
- MENU_ITEM
- PAGE
- PRODUCT
- PROMOTION
- PROMOTION_RULE
- SALE
- SHIPPING_METHOD
- VARIANT
- VOUCHER
-}
+ """Total amount of ongoing cancel requests for the transaction."""
+ cancelPendingAmount: Money!
-type TaxConfigurationCountableConnection @doc(category: "Taxes") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [TaxConfigurationCountableEdge!]!
+ """Total amount charged for this payment."""
+ chargedAmount: Money!
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """Total amount of ongoing charge requests for the transaction."""
+ chargePendingAmount: Money!
-type TaxConfigurationCountableEdge @doc(category: "Taxes") {
- """The item at the end of the edge."""
- node: TaxConfiguration!
+ """Name of the transaction."""
+ name: String!
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """Message related to the transaction."""
+ message: String!
-input TaxConfigurationFilterInput @doc(category: "Taxes") {
- metadata: [MetadataFilter!]
- ids: [ID!]
-}
+ """PSP reference of transaction."""
+ pspReference: String!
-type TaxClassCountableConnection @doc(category: "Taxes") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [TaxClassCountableEdge!]!
+ """The related order."""
+ order: Order
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """The related checkout."""
+ checkout: Checkout
-type TaxClassCountableEdge @doc(category: "Taxes") {
- """The item at the end of the edge."""
- node: TaxClass!
+ """List of all transaction's events."""
+ events: [TransactionEvent!]!
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """User or App that created the transaction."""
+ createdBy: UserOrApp
-input TaxClassSortingInput @doc(category: "Taxes") {
- """Specifies the direction in which to sort tax classes."""
- direction: OrderDirection!
+ """
+ The url that will allow to redirect user to payment provider page with transaction details.
+ """
+ externalUrl: String!
- """Sort tax classes by the selected field."""
- field: TaxClassSortField!
-}
+ """
+ The payment method used for this transaction.
+
+ Added in Saleor 3.22.
+ """
+ paymentMethodDetails: PaymentMethodDetails
-enum TaxClassSortField @doc(category: "Taxes") {
- """Sort tax classes by name."""
- NAME
-}
+ """
+ Reason of the refund.
+
+ Added in Saleor 3.22.
+ """
+ reason: String
-input TaxClassFilterInput @doc(category: "Taxes") {
- metadata: [MetadataFilter!]
- ids: [ID!]
- countries: [CountryCode!]
+ """
+ Reason `Page` (Model) for refund.
+
+ Added in Saleor 3.22.
+ """
+ reasonReference: Page
}
-"""Tax class rates grouped by country."""
-type TaxCountryConfiguration @doc(category: "Taxes") {
- """A country for which tax class rates are grouped."""
- country: CountryDisplay!
+"""
+Represents possible actions on payment transaction.
- """List of tax class rates."""
- taxClassCountryRates: [TaxClassCountryRate!]!
+ The following actions are possible:
+ CHARGE - Represents the charge action.
+ REFUND - Represents a refund action.
+ CANCEL - Represents a cancel action. Added in Saleor 3.12.
+"""
+enum TransactionActionEnum @doc(category: "Payments") {
+ CHARGE
+ REFUND
+ CANCEL
}
-input StockFilterInput @doc(category: "Products") {
- quantity: Float
- search: String
-}
+"""Represents an order in the shop."""
+type Order implements Node & ObjectWithMetadata @doc(category: "Orders") {
+ """ID of the order."""
+ id: ID!
-"""
-Represents a shop resource containing general shop data and configuration.
-"""
-type Shop implements ObjectWithMetadata {
"""List of private metadata items. Requires staff permissions to access."""
privateMetadata: [MetadataItem!]!
@@ -9887,305 +9789,307 @@ type Shop implements ObjectWithMetadata {
"""
metafields(keys: [String!]): Metadata
- """ID of the shop."""
- id: ID!
-
- """List of available payment gateways."""
- availablePaymentGateways(
- """A currency for which gateways will be returned."""
- currency: String @deprecated(reason: "Use `channel` argument instead.")
-
- """Slug of a channel for which the data should be returned."""
- channel: String
- ): [PaymentGateway!]!
-
- """List of available external authentications."""
- availableExternalAuthentications: [ExternalAuthentication!]!
+ """Date and time when the order was created."""
+ created: DateTime!
- """Shipping methods that are available for the shop."""
- availableShippingMethods(
- """Slug of a channel for which the data should be returned."""
- channel: String!
+ """Date and time when the order was created."""
+ updatedAt: DateTime!
- """Address for which available shipping methods should be returned."""
- address: AddressInput
- ): [ShippingMethod!]
+ """Status of the order."""
+ status: OrderStatus!
"""
- List of all currencies supported by shop's channels.
-
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
+ User who placed the order. This field is set only for orders placed by authenticated users. Can be fetched for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_USERS, MANAGE_ORDERS, HANDLE_PAYMENTS, OWNER.
"""
- channelCurrencies: [String!]!
-
- """List of countries available in the shop."""
- countries(
- """A language code to return the translation for."""
- languageCode: LanguageCodeEnum @deprecated
-
- """Filtering options for countries"""
- filter: CountryFilterInput
- ): [CountryDisplay!]!
+ user: User
- """Shop's default country."""
- defaultCountry: CountryDisplay
+ """Google Analytics tracking client ID."""
+ trackingClientId: String!
"""
- Default shop's email sender's name.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
+ Billing address. The full data can be access for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
"""
- defaultMailSenderName: String
+ billingAddress: Address
"""
- Default shop's email sender's address.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
+ Shipping address. The full data can be access for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
"""
- defaultMailSenderAddress: String
+ shippingAddress: Address
- """Shop's description."""
- description: String
+ """Method used for shipping."""
+ shippingMethodName: String
- """Shop's domain data."""
- domain: Domain!
+ """
+ Name of the collection point where the order should be picked up by the customer.
+ """
+ collectionPointName: String
- """List of the shops's supported languages."""
- languages: [LanguageDisplay!]!
+ """Channel through which the order was placed."""
+ channel: Channel!
- """Shop's name."""
- name: String!
+ """List of shipments for the order."""
+ fulfillments: [Fulfillment!]!
- """List of available permissions."""
- permissions: [Permission!]!
+ """List of order lines."""
+ lines: [OrderLine!]!
- """List of possible phone prefixes."""
- phonePrefixes: [String!]!
+ """
+ List of actions that can be performed in the current state of an order.
+ """
+ actions: [OrderAction!]!
- """Header text."""
- headerText: String
+ """Shipping methods that can be used with this order."""
+ availableShippingMethods: [ShippingMethod!] @deprecated(reason: "Use `shippingMethods`, this field will be removed in 4.0")
- """Automatically approve all new fulfillments."""
- fulfillmentAutoApprove: Boolean!
+ """Shipping methods related to this order."""
+ shippingMethods: [ShippingMethod!]!
- """Allow to approve fulfillments which are unpaid."""
- fulfillmentAllowUnpaid: Boolean!
+ """Collection points that can be used for this order."""
+ availableCollectionPoints: [Warehouse!]!
"""
- This field is used as a default value for `ProductVariant.trackInventory`.
+ List of order invoices. Can be fetched for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
"""
- trackInventoryByDefault: Boolean
+ invoices: [Invoice!]!
- """Default weight unit."""
- defaultWeightUnit: WeightUnitsEnum
+ """User-friendly number of an order."""
+ number: String!
- """Returns translated shop fields for the given language code."""
- translation(
- """A language code to return the translation for shop."""
- languageCode: LanguageCodeEnum!
- ): ShopTranslation
+ """The ID of the order that was the base for this order."""
+ original: ID
- """
- Enable automatic fulfillment for all digital products.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- automaticFulfillmentDigitalProducts: Boolean
+ """The order origin."""
+ origin: OrderOriginEnum!
- """
- Default number of minutes stock will be reserved for anonymous checkout or null when stock reservation is disabled.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- reserveStockDurationAnonymousUser: Int
+ """Informs if an order is fully paid."""
+ isPaid: Boolean!
- """
- Default number of minutes stock will be reserved for authenticated checkout or null when stock reservation is disabled.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- reserveStockDurationAuthenticatedUser: Int
+ """Internal payment status."""
+ paymentStatus: PaymentChargeStatusEnum!
+
+ """User-friendly payment status."""
+ paymentStatusDisplay: String!
+
+ """The authorize status of the order."""
+ authorizeStatus: OrderAuthorizeStatusEnum!
+
+ """The charge status of the order."""
+ chargeStatus: OrderChargeStatusEnum!
+
+ """Returns True if order has to be exempt from taxes."""
+ taxExemption: Boolean!
"""
- Default number of maximum line quantity in single checkout (per single checkout line).
-
- Requires one of the following permissions: MANAGE_SETTINGS.
+ List of transactions for the order. Requires one of the following permissions: MANAGE_ORDERS, HANDLE_PAYMENTS.
"""
- limitQuantityPerCheckout: Int
+ transactions: [TransactionItem!]!
- """
- Default number of max downloads per digital content URL.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- defaultDigitalMaxDownloads: Int
+ """List of payments for the order."""
+ payments: [Payment!]!
- """
- Default number of days which digital content URL will be valid.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- defaultDigitalUrlValidDays: Int
+ """Total amount of the order."""
+ total: TaxedMoney!
- """Company address."""
- companyAddress: Address
+ """Undiscounted total amount of the order."""
+ undiscountedTotal: TaxedMoney!
- """URL of a view where customers can set their password."""
- customerSetPasswordUrl: String
+ """Shipping method for this order."""
+ shippingMethod: ShippingMethod @deprecated(reason: "Use `deliveryMethod` instead.")
"""
- List of staff notification recipients.
+ Undiscounted total price of shipping.
- Requires one of the following permissions: MANAGE_SETTINGS.
+ Added in Saleor 3.19.
"""
- staffNotificationRecipients: [StaffNotificationRecipient!]
+ undiscountedShippingPrice: Money!
- """
- Determines if account confirmation by email is enabled.
-
- Requires one of the following permissions: MANAGE_SETTINGS.
- """
- enableAccountConfirmationByEmail: Boolean
+ """Total price of shipping."""
+ shippingPrice: TaxedMoney!
+
+ """The shipping tax rate value."""
+ shippingTaxRate: Float!
"""
- Determines if user can login without confirmation when `enableAccountConfirmation` is enabled.
+ Denormalized tax class assigned to the shipping method.
- Requires one of the following permissions: MANAGE_SETTINGS.
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
"""
- allowLoginWithoutConfirmation: Boolean
+ shippingTaxClass: TaxClass
+
+ """Denormalized name of the tax class assigned to the shipping method."""
+ shippingTaxClassName: String
+
+ """Denormalized public metadata of the shipping method's tax class."""
+ shippingTaxClassMetadata: [MetadataItem!]!
"""
- Resource limitations and current usage if any set for a shop
-
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER.
+ Denormalized private metadata of the shipping method's tax class. Requires staff permissions to access.
"""
- limits: LimitInfo! @deprecated
+ shippingTaxClassPrivateMetadata: [MetadataItem!]!
+ token: String! @deprecated(reason: "Use `id` instead.")
+
+ """Voucher linked to the order."""
+ voucher: Voucher
"""
- Saleor API version.
+ Voucher code that was used for Order.
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
+ Added in Saleor 3.18.
"""
- version: String!
+ voucherCode: String
- """Minor Saleor API version."""
- schemaVersion: String!
+ """List of user gift cards."""
+ giftCards: [GiftCard!]!
+
+ """Additional information provided by the customer about the order."""
+ customerNote: String!
+
+ """Weight of the order."""
+ weight: Weight!
+
+ """URL to which user should be redirected after order is placed."""
+ redirectUrl: String
+
+ """The sum of line prices not including shipping."""
+ subtotal: TaxedMoney!
+
+ """User-friendly order status."""
+ statusDisplay: String!
"""
- List of tax apps that can be assigned to the channel. The list will be calculated by Saleor based on the apps that are subscribed to webhooks related to tax calculations: CHECKOUT_CALCULATE_TAXES
-
- Added in Saleor 3.19.
-
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, MANAGE_APPS.
+ Informs whether a draft order can be finalized(turned into a regular order).
"""
- availableTaxApps: [App!]!
+ canFinalize: Boolean!
- """Include taxes in prices."""
- includeTaxesInPrices: Boolean! @deprecated(reason: "Use `Channel.taxConfiguration.pricesEnteredWithTax` to determine whether prices are entered with tax.")
+ """Amount authorized for the order."""
+ totalAuthorized: Money!
- """Display prices with tax in store."""
- displayGrossPrices: Boolean! @deprecated(reason: "Use `Channel.taxConfiguration` to determine whether to display gross or net prices.")
+ """Amount captured for the order."""
+ totalCaptured: Money! @deprecated(reason: "Use `totalCharged` instead.")
- """Charge taxes on shipping."""
- chargeTaxesOnShipping: Boolean! @deprecated(reason: "Use `ShippingMethodType.taxClass` to determine whether taxes are calculated for shipping methods; if a tax class is set, the taxes will be calculated, otherwise no tax rate will be applied.")
+ """Amount charged for the order."""
+ totalCharged: Money!
+
+ """Amount canceled for the order."""
+ totalCanceled: Money!
"""
- Use legacy update webhook emission. When enabled, update webhooks (e.g. `customerUpdated`,`productVariantUpdated`) are sent even when only metadata changes. When disabled, update webhooks are not sent for metadata-only changes; only metadata-specific webhooks (e.g., `customerMetadataUpdated`, `productVariantMetadataUpdated`) are sent.
+ List of events associated with the order.
- Added in Saleor 3.22.
+ Requires one of the following permissions: MANAGE_ORDERS.
"""
- useLegacyUpdateWebhookEmission: Boolean @deprecated
-}
+ events: [OrderEvent!]!
-"""
-Available payment gateway backend with configuration necessary to setup client.
-"""
-type PaymentGateway @doc(category: "Payments") {
- """Payment gateway name."""
- name: String!
+ """The difference between the paid and the order total amount."""
+ totalBalance: Money!
- """Payment gateway ID."""
- id: ID!
+ """
+ Email address of the customer. The full data can be access for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
+ """
+ userEmail: String
- """Payment gateway client configuration."""
- config: [GatewayConfigLine!]!
+ """Returns True, if order requires shipping."""
+ isShippingRequired: Boolean!
- """Payment gateway supported currencies."""
- currencies: [String!]!
-}
+ """The delivery method selected for this order."""
+ deliveryMethod: DeliveryMethod
+ languageCode: String! @deprecated(reason: "Use the `languageCodeEnum` field to fetch the language code.")
-"""Payment gateway client configuration key and value pair."""
-type GatewayConfigLine @doc(category: "Payments") {
- """Gateway config key."""
- field: String!
+ """Order language code."""
+ languageCodeEnum: LanguageCodeEnum!
- """Gateway config value for key."""
- value: String
-}
+ """Returns applied discount."""
+ discount: Money @deprecated(reason: "Use the `discounts` field instead.")
-"""External authentication plugin."""
-type ExternalAuthentication @doc(category: "Authentication") {
- """ID of external authentication plugin."""
- id: String!
+ """Discount name."""
+ discountName: String @deprecated(reason: "Use the `discounts` field instead.")
- """Name of external authentication plugin."""
- name: String
-}
+ """Translated discount name."""
+ translatedDiscountName: String @deprecated(reason: "Use the `discounts` field instead.")
-input CountryFilterInput {
- """
- Boolean for filtering countries by having shipping zone assigned.If 'true', return countries with shipping zone assigned.If 'false', return countries without any shipping zone assigned.If the argument is not provided (null), return all countries.
- """
- attachedToShippingZones: Boolean
-}
+ """List of all discounts assigned to the order."""
+ discounts: [OrderDiscount!]!
-"""Represents API domain."""
-type Domain {
- """The host name of the domain."""
- host: String!
+ """List of errors that occurred during order validation."""
+ errors: [OrderError!]!
- """Inform if SSL is enabled."""
- sslEnabled: Boolean!
+ """Determines whether displayed prices should include taxes."""
+ displayGrossPrices: Boolean!
- """The absolute URL of the API."""
- url: String!
-}
+ """External ID of this order."""
+ externalReference: String
-"""Represents shop translations."""
-type ShopTranslation implements Node @doc(category: "Shop") {
- """The ID of the shop translation."""
- id: ID!
+ """ID of the checkout that the order was created from."""
+ checkoutId: ID
- """Translation language."""
- language: LanguageDisplay!
+ """
+ List of granted refunds.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ grantedRefunds: [OrderGrantedRefund!]!
- """Translated header text of sale."""
- headerText: String!
+ """
+ Total amount of granted refund.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ totalGrantedRefund: Money!
- """Translated description of sale."""
- description: String!
-}
+ """Total refund amount for the order."""
+ totalRefunded: Money!
-"""
-Represents a recipient of email notifications send by Saleor, such as notifications about new orders. Notifications can be assigned to staff users or arbitrary email addresses.
-"""
-type StaffNotificationRecipient implements Node {
- """The ID of the staff notification recipient."""
- id: ID!
+ """
+ Total amount of ongoing refund requests for the order's transactions.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ totalRefundPending: Money!
- """Returns a user subscribed to email notifications."""
- user: User
+ """
+ Total amount of ongoing authorize requests for the order's transactions.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ totalAuthorizePending: Money!
- """Returns email address of a user subscribed to email notifications."""
- email: String
+ """
+ Total amount of ongoing charge requests for the order's transactions.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ totalChargePending: Money!
+
+ """
+ Total amount of ongoing cancel requests for the order's transactions.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ totalCancelPending: Money!
+
+ """
+ The difference amount between granted refund and the amounts that are pending and refunded.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ totalRemainingGrant: Money!
+}
- """Determines if a notification active."""
- active: Boolean
+enum OrderStatus @doc(category: "Orders") {
+ DRAFT
+ UNCONFIRMED
+ UNFULFILLED
+ PARTIALLY_FULFILLED
+ PARTIALLY_RETURNED
+ RETURNED
+ FULFILLED
+ CANCELED
+ EXPIRED
}
-"""Represents user data."""
-type User implements Node & ObjectWithMetadata @doc(category: "Users") {
- """The ID of the user."""
+"""Represents order fulfillment."""
+type Fulfillment implements Node & ObjectWithMetadata @doc(category: "Orders") {
+ """ID of the fulfillment."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -10218,134 +10122,116 @@ type User implements Node & ObjectWithMetadata @doc(category: "Users") {
"""
metafields(keys: [String!]): Metadata
- """The email address of the user."""
- email: String!
-
- """The given name of the address."""
- firstName: String!
+ """Sequence in which the fulfillments were created for an order."""
+ fulfillmentOrder: Int!
- """The family name of the address."""
- lastName: String!
+ """Status of fulfillment."""
+ status: FulfillmentStatus!
- """Determine if the user is a staff admin."""
- isStaff: Boolean!
+ """Fulfillment tracking number."""
+ trackingNumber: String!
- """Determine if the user is active."""
- isActive: Boolean!
+ """Date and time when fulfillment was created."""
+ created: DateTime!
- """Determines if user has confirmed email."""
- isConfirmed: Boolean!
+ """List of lines for the fulfillment."""
+ lines: [FulfillmentLine!]
- """List of all user's addresses."""
- addresses: [Address!]!
+ """User-friendly fulfillment status."""
+ statusDisplay: String
- """Returns the last open checkout of this user."""
- checkout: Checkout @deprecated(reason: "Use the `checkoutTokens` field to fetch the user checkouts.")
+ """Warehouse from fulfillment was fulfilled."""
+ warehouse: Warehouse
- """Returns the checkout UUID's assigned to this user."""
- checkoutTokens(
- """Slug of a channel for which the data should be returned."""
- channel: String
- ): [UUID!] @deprecated(reason: "Use `checkoutIds` instead.")
+ """Amount of refunded shipping price."""
+ shippingRefundedAmount: Money
- """Returns the checkout ID's assigned to this user."""
- checkoutIds(
- """Slug of a channel for which the data should be returned."""
- channel: String
- ): [ID!]
+ """Total refunded amount assigned to this fulfillment."""
+ totalRefundedAmount: Money
+}
- """
- Returns checkouts assigned to this user. The query will not initiate any external requests, including fetching external shipping methods, filtering available shipping methods, or performing external tax calculations.
- """
- checkouts(
- """Slug of a channel for which the data should be returned."""
- channel: String
+enum FulfillmentStatus @doc(category: "Orders") {
+ FULFILLED
+ REFUNDED
+ RETURNED
+ REPLACED
+ REFUNDED_AND_RETURNED
+ CANCELED
+ WAITING_FOR_APPROVAL
+}
- """Return the elements in the list that come before the specified cursor."""
- before: String
+"""Represents line of the fulfillment."""
+type FulfillmentLine implements Node @doc(category: "Orders") {
+ """ID of the fulfillment line."""
+ id: ID!
- """Return the elements in the list that come after the specified cursor."""
- after: String
+ """The number of items included in the fulfillment line."""
+ quantity: Int!
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
+ """The order line to which the fulfillment line is related."""
+ orderLine: OrderLine
+}
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): CheckoutCountableConnection
+"""Represents order line of particular order."""
+type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
+ """ID of the order line."""
+ id: ID!
- """List of the user gift cards."""
- giftCards(
- """Return the elements in the list that come before the specified cursor."""
- before: String
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
- """Return the elements in the list that come after the specified cursor."""
- after: String
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): GiftCardCountableConnection
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
"""
- A note about the customer.
+ A single key from public metadata.
- Requires one of the following permissions: MANAGE_USERS, MANAGE_STAFF.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- note: String
+ metafield(key: String!): String
"""
- List of user's orders. The query will not initiate any external requests, including filtering available shipping methods, or performing external tax calculations. Requires one of the following permissions: MANAGE_STAFF, OWNER.
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- orders(
- """Return the elements in the list that come before the specified cursor."""
- before: String
-
- """Return the elements in the list that come after the specified cursor."""
- after: String
+ metafields(keys: [String!]): Metadata
- """
- Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- first: Int
+ """Name of the product in order line."""
+ productName: String!
- """
- Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
- """
- last: Int
- ): OrderCountableConnection
+ """Name of the variant of product in order line."""
+ variantName: String!
- """List of user's permissions."""
- userPermissions: [UserPermission!]
+ """SKU of the product variant."""
+ productSku: String
- """List of user's permission groups."""
- permissionGroups: [Group!]
+ """The ID of the product variant."""
+ productVariantId: String
- """List of user's permission groups which user can manage."""
- editableGroups: [Group!]
+ """Whether the product variant requires shipping."""
+ isShippingRequired: Boolean!
- """
- List of channels the user has access to. The sum of channels from all user groups. If at least one group has `restrictedAccessToChannels` set to False - all channels are returned.
- """
- accessibleChannels: [Channel!]
+ """Number of variant items ordered."""
+ quantity: Int!
- """
- Determine if user have restricted access to channels. False if at least one user group has `restrictedAccessToChannels` set to False.
- """
- restrictedAccessToChannels: Boolean!
+ """Number of variant items fulfilled."""
+ quantityFulfilled: Int!
- """The avatar of the user."""
- avatar(
+ """Rate of tax applied on product variant."""
+ taxRate: Float!
+ digitalContentUrl: DigitalContentUrl
+ thumbnail(
"""
Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
"""
@@ -10358,299 +10244,342 @@ type User implements Node & ObjectWithMetadata @doc(category: "Users") {
): Image
"""
- List of events associated with the user.
-
- Requires one of the following permissions: MANAGE_USERS, MANAGE_STAFF.
- """
- events: [CustomerEvent!]
-
- """
- List of stored payment sources. The field returns a list of payment sources stored for payment plugins.
+ Price of the single item in the order line with all the line-level discounts and order-level discount portions applied.
"""
- storedPaymentSources(
- """Slug of a channel for which the data should be returned."""
- channel: String
- ): [PaymentSource!]
-
- """User language code."""
- languageCode: LanguageCodeEnum!
-
- """The default shipping address of the user."""
- defaultShippingAddress: Address
-
- """The default billing address of the user."""
- defaultBillingAddress: Address
-
- """External ID of this user."""
- externalReference: String
-
- """The date when the user last time log in to the system."""
- lastLogin: DateTime
-
- """The data when the user create account."""
- dateJoined: DateTime!
-
- """The data when the user last update the account information."""
- updatedAt: DateTime!
+ unitPrice: TaxedMoney!
"""
- Returns a list of user's stored payment methods that can be used in provided channel. The field returns a list of stored payment methods by payment apps. When `amount` is not provided, 0 will be used as default value.
+ Price of the single item in the order line without any discount applied.
"""
- storedPaymentMethods(
- """Slug of a channel for which the data should be returned."""
- channel: String!
- ): [StoredPaymentMethod!]
-}
-
-"""Checkout object."""
-type Checkout implements Node & ObjectWithMetadata @doc(category: "Checkout") {
- """The ID of the checkout."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ undiscountedUnitPrice: TaxedMoney!
"""
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Sum of the line-level discounts applied to the order line. Order-level discounts which affect the line are not visible in this field. For order-level discount portion (if any), please query `order.discounts` field.
"""
- privateMetafield(key: String!): String
+ unitDiscount: Money!
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ Reason for line-level discounts applied on the order line. Order-level discounts which affect the line are not visible in this field. For order-level discount reason (if any), please query `order.discounts` field.
"""
- privateMetafields(keys: [String!]): Metadata
-
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ unitDiscountReason: String
"""
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Value of the discount. Can store fixed value or percent value. This field shouldn't be used when multiple discounts affect the line. There is a limitation, that after running `checkoutComplete` mutation the field always stores fixed value.
"""
- metafield(key: String!): String
+ unitDiscountValue: PositiveDecimal!
"""
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ Type of the discount: `fixed` or `percent`. This field shouldn't be used when multiple discounts affect the line. There is a limitation, that after running `checkoutComplete` mutation the field is always set to `fixed`.
"""
- metafields(keys: [String!]): Metadata
+ unitDiscountType: DiscountValueTypeEnum
- """The date and time when the checkout was created."""
- created: DateTime!
+ """Price of the order line."""
+ totalPrice: TaxedMoney!
- """Time of last modification of the given checkout."""
- updatedAt: DateTime!
- lastChange: DateTime! @deprecated(reason: "Use `updatedAt` instead.")
+ """Price of the order line without discounts."""
+ undiscountedTotalPrice: TaxedMoney!
+
+ """Returns True, if the line unit price was overridden."""
+ isPriceOverridden: Boolean
"""
- The user assigned to the checkout. Requires one of the following permissions: MANAGE_USERS, HANDLE_PAYMENTS, OWNER.
+ A purchased product variant. Note: this field may be null if the variant has been removed from stock at all. Requires one of the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.
"""
- user: User
-
- """The channel for which checkout was created."""
- channel: Channel!
+ variant: ProductVariant
- """The billing address of the checkout."""
- billingAddress: Address
+ """Product name in the customer's language"""
+ translatedProductName: String!
- """The shipping address of the checkout."""
- shippingAddress: Address
+ """Variant name in the customer's language"""
+ translatedVariantName: String!
"""
- The customer note for the checkout.
+ List of allocations across warehouses.
- Added in Saleor 3.21.
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
"""
- customerNote: String!
-
- """The note for the checkout."""
- note: String! @deprecated(reason: "Use `customerNote` instead.")
+ allocations: [Allocation!]
"""
- The total discount applied to the checkout. Note: Only discount created via voucher are included in this field.
+ Denormalized sale ID, set when order line is created for a product variant that is on sale.
"""
- discount: Money
+ saleId: ID
- """The name of voucher assigned to the checkout."""
- discountName: String
+ """A quantity of items remaining to be fulfilled."""
+ quantityToFulfill: Int!
"""
- Translation of the discountName field in the language set in Checkout.languageCode field.Note: this field is set automatically when Checkout.languageCode is defined; otherwise it's null
+ Denormalized tax class of the product in this order line.
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
"""
- translatedDiscountName: String
+ taxClass: TaxClass
+
+ """Denormalized name of the tax class."""
+ taxClassName: String
+
+ """Denormalized public metadata of the tax class."""
+ taxClassMetadata: [MetadataItem!]!
"""
- The voucher assigned to the checkout.
-
- Added in Saleor 3.18.
-
- Requires one of the following permissions: MANAGE_DISCOUNTS.
+ Denormalized private metadata of the tax class. Requires staff permissions to access.
"""
- voucher: Voucher
+ taxClassPrivateMetadata: [MetadataItem!]!
- """The code of voucher assigned to the checkout."""
+ """Voucher code that was used for this order line."""
voucherCode: String
"""
- Shipping methods that can be used with this checkout.
+ Determine if the line is a gift.
- Triggers the following webhook events:
- - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
- - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ Added in Saleor 3.19.
+
+ Note: this API is currently in Feature Preview and can be subject to changes at later point.
"""
- availableShippingMethods: [ShippingMethod!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "Use `shippingMethods` instead.")
+ isGift: Boolean
"""
- Shipping methods that can be used with this checkout.
+ List of applied discounts
- Triggers the following webhook events:
- - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
- - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ Added in Saleor 3.21.
"""
- shippingMethods: [ShippingMethod!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS])
+ discounts: [OrderLineDiscount!]
+}
- """Collection points that can be used for this order."""
- availableCollectionPoints: [Warehouse!]!
+"""
+Nonnegative Decimal scalar implementation.
+
+Should be used in places where value must be nonnegative (0 or greater).
+"""
+scalar PositiveDecimal
+
+"""Represents allocation."""
+type Allocation implements Node @doc(category: "Products") {
+ """The ID of allocation."""
+ id: ID!
"""
- List of available payment gateways.
+ Quantity allocated for orders.
- Triggers the following webhook events:
- - PAYMENT_LIST_GATEWAYS (sync): Fetch payment gateways available for checkout.
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
"""
- availablePaymentGateways: [PaymentGateway!]! @webhookEventsInfo(asyncEvents: [], syncEvents: [PAYMENT_LIST_GATEWAYS])
+ quantity: Int!
- """Email of a customer."""
- email: String
+ """
+ The warehouse were items were allocated.
+
+ Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
+ """
+ warehouse: Warehouse!
+}
- """List of gift cards associated with this checkout."""
- giftCards: [GiftCard!]!
+"""Represent the discount applied to order line."""
+type OrderLineDiscount @doc(category: "Orders") {
+ """The ID of discount applied."""
+ id: ID!
- """Returns True, if checkout requires shipping."""
- isShippingRequired: Boolean!
+ """The type of applied discount: Sale, Voucher or Manual."""
+ type: OrderDiscountType!
- """The number of items purchased."""
- quantity: Int!
+ """The name of applied discount."""
+ name: String
- """
- Date when oldest stock reservation for this checkout expires or null if no stock is reserved.
- """
- stockReservationExpires: DateTime
+ """Translated name of the applied discount."""
+ translatedName: String
- """
- A list of checkout lines, each containing information about an item in the checkout.
- """
- lines: [CheckoutLine!]!
+ """Type of the discount: fixed or percent"""
+ valueType: DiscountValueTypeEnum!
+
+ """Value of the discount. Can store fixed value or percent value"""
+ value: PositiveDecimal!
"""
- The price of the shipping, with all the taxes included. Set to 0 when no delivery method is selected.
+ Explanation for the applied discount.
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ Requires one of the following permissions: MANAGE_ORDERS.
"""
- shippingPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+ reason: String
+
+ """The discount amount applied to the line item."""
+ total: Money!
+
+ """The discount amount applied to the single line unit."""
+ unit: Money!
+}
+
+enum OrderDiscountType @doc(category: "Discounts") {
+ SALE
+ VOUCHER
+ MANUAL
+ PROMOTION
+ ORDER_PROMOTION
+}
+
+enum OrderAction @doc(category: "Payments") {
+ """Represents the capture action."""
+ CAPTURE
+
+ """Represents a mark-as-paid action."""
+ MARK_AS_PAID
+
+ """Represents a refund action."""
+ REFUND
+
+ """Represents a void action."""
+ VOID
+}
+
+"""Represents an Invoice."""
+type Invoice implements ObjectWithMetadata & Job & Node @doc(category: "Orders") {
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
"""
- The delivery method selected for this checkout.
+ A single key from private metadata. Requires staff permissions to access.
- Added in Saleor 3.23.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- delivery: Delivery
+ privateMetafield(key: String!): String
"""
- The shipping method related with checkout.
-
- Triggers the following webhook events:
- - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
- - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- shippingMethod: ShippingMethod @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "Use `delivery` instead.")
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
"""
- The delivery method selected for this checkout.
+ A single key from public metadata.
- Triggers the following webhook events:
- - SHIPPING_LIST_METHODS_FOR_CHECKOUT (sync): Optionally triggered when cached external shipping methods are invalid.
- - CHECKOUT_FILTER_SHIPPING_METHODS (sync): Optionally triggered when cached filtered shipping methods are invalid.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- deliveryMethod: DeliveryMethod @webhookEventsInfo(asyncEvents: [], syncEvents: [SHIPPING_LIST_METHODS_FOR_CHECKOUT, CHECKOUT_FILTER_SHIPPING_METHODS]) @deprecated(reason: "Use `delivery` instead.")
+ metafield(key: String!): String
"""
- The price of the checkout before shipping, with taxes included.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- subtotalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+ metafields(keys: [String!]): Metadata
+
+ """Job status."""
+ status: JobStatusEnum!
+
+ """Date and time at which invoice was created."""
+ createdAt: DateTime!
+
+ """Date and time at which invoice was updated."""
+ updatedAt: DateTime!
+
+ """Message associated with an invoice."""
+ message: String
+
+ """The ID of the object."""
+ id: ID!
+
+ """Invoice number."""
+ number: String
+
+ """URL to view an invoice."""
+ externalUrl: String @deprecated(reason: "Use `url` field.")
+
+ """URL to view/download an invoice."""
+ url: String
- """Returns True if checkout has to be exempt from taxes."""
- taxExemption: Boolean!
+ """Order related to the invoice."""
+ order: Order
+}
- """The checkout's token."""
- token: UUID!
+interface Job {
+ """Job status."""
+ status: JobStatusEnum!
- """
- The sum of the checkout line prices, with all the taxes,shipping costs, and discounts included.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
- """
- totalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+ """Created date time of job in ISO 8601 format."""
+ createdAt: DateTime!
- """
- The difference between the paid and the checkout total amount.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
- """
- totalBalance: Money! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+ """Date time of job last update in ISO 8601 format."""
+ updatedAt: DateTime!
- """Checkout language code."""
- languageCode: LanguageCodeEnum!
+ """Job message."""
+ message: String
+}
- """
- List of transactions for the checkout. Requires one of the following permissions: MANAGE_CHECKOUTS, HANDLE_PAYMENTS.
- """
- transactions: [TransactionItem!]
+enum JobStatusEnum {
+ PENDING
+ SUCCESS
+ FAILED
+ DELETED
+}
- """Determines whether displayed prices should include taxes."""
- displayGrossPrices: Boolean!
+enum OrderOriginEnum @doc(category: "Orders") {
+ CHECKOUT
+ DRAFT
+ REISSUE
+ BULK_CREATE
+}
- """
- The authorize status of the checkout.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
- """
- authorizeStatus: CheckoutAuthorizeStatusEnum! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+enum PaymentChargeStatusEnum @doc(category: "Payments") {
+ NOT_CHARGED
+ PENDING
+ PARTIALLY_CHARGED
+ FULLY_CHARGED
+ PARTIALLY_REFUNDED
+ FULLY_REFUNDED
+ REFUSED
+ CANCELLED
+}
- """
- The charge status of the checkout.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
- """
- chargeStatus: CheckoutChargeStatusEnum! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+"""
+Determine a current authorize status for order.
- """
- List of user's stored payment methods that can be used in this checkout session. It uses the channel that the checkout was created in. When `amount` is not provided, `checkout.total` will be used as a default value.
- """
- storedPaymentMethods(
- """Amount that will be used to fetch stored payment methods."""
- amount: PositiveDecimal
- ): [StoredPaymentMethod!]
+ We treat the order as fully authorized when the sum of authorized and charged funds
+ cover the `order.total`-`order.totalGrantedRefund`.
+ We treat the order as partially authorized when the sum of authorized and charged
+ funds covers only part of the `order.total`-`order.totalGrantedRefund`.
+ We treat the order as not authorized when the sum of authorized and charged funds is
+ 0.
- """List of problems with the checkout."""
- problems: [CheckoutProblem!]
+ NONE - the funds are not authorized
+ PARTIAL - the funds that are authorized and charged don't cover fully the
+ `order.total`-`order.totalGrantedRefund`
+ FULL - the funds that are authorized and charged fully cover the
+ `order.total`-`order.totalGrantedRefund`
+"""
+enum OrderAuthorizeStatusEnum @doc(category: "Orders") {
+ NONE
+ PARTIAL
+ FULL
}
"""
-A gift card is a prepaid electronic payment card accepted in stores. They can be used during checkout by providing a valid gift card codes.
+Determine the current charge status for the order.
+
+ An order is considered overcharged when the sum of the
+ transactionItem's charge amounts exceeds the value of
+ `order.total` - `order.totalGrantedRefund`.
+ If the sum of the transactionItem's charge amounts equals
+ `order.total` - `order.totalGrantedRefund`, we consider the order to be fully
+ charged.
+ If the sum of the transactionItem's charge amounts covers a part of the
+ `order.total` - `order.totalGrantedRefund`, we treat the order as partially charged.
+
+ NONE - the funds are not charged.
+ PARTIAL - the funds that are charged don't cover the
+ `order.total`-`order.totalGrantedRefund`
+ FULL - the funds that are charged fully cover the
+ `order.total`-`order.totalGrantedRefund`
+ OVERCHARGED - the charged funds are bigger than the
+ `order.total`-`order.totalGrantedRefund`
"""
-type GiftCard implements Node & ObjectWithMetadata @doc(category: "Gift cards") {
- """ID of the gift card."""
+enum OrderChargeStatusEnum @doc(category: "Orders") {
+ NONE
+ PARTIAL
+ FULL
+ OVERCHARGED
+}
+
+"""Represents a payment of a given type."""
+type Payment implements Node & ObjectWithMetadata @doc(category: "Payments") {
+ """ID of the payment."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -10683,105 +10612,160 @@ type GiftCard implements Node & ObjectWithMetadata @doc(category: "Gift cards")
"""
metafields(keys: [String!]): Metadata
- """Code in format which allows displaying in a user interface."""
- displayCode: String!
-
- """Last 4 characters of gift card code."""
- last4CodeChars: String!
+ """Payment gateway used for payment."""
+ gateway: String!
- """
- Gift card code. It can be fetched both by a staff member with 'MANAGE_GIFT_CARD' when gift card hasn't been used yet or a user who bought or issued the gift card.
-
- Requires one of the following permissions: MANAGE_GIFT_CARD, OWNER.
- """
- code: String!
+ """Determines if the payment is active or not."""
+ isActive: Boolean!
- """Date and time when gift card was created."""
+ """Date and time at which payment was created."""
created: DateTime!
- """The user who bought or issued a gift card."""
- createdBy: User
+ """Date and time at which payment was modified."""
+ modified: DateTime!
- """The customer who used a gift card."""
- usedBy: User @deprecated
+ """Unique token associated with a payment."""
+ token: String!
+
+ """Checkout associated with a payment."""
+ checkout: Checkout
+
+ """Order associated with a payment."""
+ order: Order
+
+ """Type of method used for payment."""
+ paymentMethodType: String!
"""
- Email address of the user who bought or issued gift card.
+ IP address of the user who created the payment.
- Requires one of the following permissions: MANAGE_USERS, OWNER.
+ Requires one of the following permissions: MANAGE_ORDERS.
"""
- createdByEmail: String
+ customerIpAddress: String
- """Email address of the customer who used a gift card."""
- usedByEmail: String @deprecated
+ """Internal payment status."""
+ chargeStatus: PaymentChargeStatusEnum!
- """Date and time when gift card was last used."""
- lastUsedOn: DateTime
+ """
+ List of actions that can be performed in the current state of a payment.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ actions: [OrderAction!]!
- """Expiry date of the gift card."""
- expiryDate: Date
+ """Total amount of the payment."""
+ total: Money
+
+ """Total amount captured for this payment."""
+ capturedAmount: Money
"""
- App which created the gift card.
+ List of all transactions within this payment.
- Requires one of the following permissions: MANAGE_APPS, OWNER.
+ Requires one of the following permissions: MANAGE_ORDERS.
"""
- app: App
+ transactions: [Transaction!]
- """Related gift card product."""
- product: Product
+ """
+ Maximum amount of money that can be captured.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
+ """
+ availableCaptureAmount: Money
"""
- List of events associated with the gift card.
+ Maximum amount of money that can be refunded.
- Requires one of the following permissions: MANAGE_GIFT_CARD.
+ Requires one of the following permissions: MANAGE_ORDERS.
"""
- events(
- """Filtering options for gift card events."""
- filter: GiftCardEventFilterInput
- ): [GiftCardEvent!]!
+ availableRefundAmount: Money
+
+ """The details of the card used for this payment."""
+ creditCard: CreditCard
+
+ """Informs whether this is a partial payment."""
+ partial: Boolean!
+
+ """PSP reference of the payment."""
+ pspReference: String
+}
+
+"""An object representing a single payment."""
+type Transaction implements Node @doc(category: "Payments") {
+ """ID of the transaction."""
+ id: ID!
+
+ """Date and time at which transaction was created."""
+ created: DateTime!
+
+ """Determines the payment associated with a transaction."""
+ payment: Payment!
+
+ """Unique token associated with a transaction."""
+ token: String!
+
+ """Determines the type of transaction."""
+ kind: TransactionKind!
+
+ """Determines if the transaction was successful."""
+ isSuccess: Boolean!
+
+ """Error associated with transaction, if any."""
+ error: String
+
+ """Response returned by payment gateway."""
+ gatewayResponse: JSONString! @deprecated(reason: "This field is a part of a legacy Payments API. Please use apps instead.")
+
+ """Total amount of the transaction."""
+ amount: Money
+}
- """
- The gift card tag.
-
- Requires one of the following permissions: MANAGE_GIFT_CARD.
- """
- tags: [GiftCardTag!]!
+enum TransactionKind @doc(category: "Payments") {
+ EXTERNAL
+ AUTH
+ PENDING
+ ACTION_TO_CONFIRM
+ REFUND
+ REFUND_ONGOING
+ CAPTURE
+ VOID
+ CONFIRM
+ CANCEL
+}
- """Slug of the channel where the gift card was bought."""
- boughtInChannel: String
- isActive: Boolean!
- initialBalance: Money!
- currentBalance: Money!
+type CreditCard @doc(category: "Payments") {
+ """Card brand."""
+ brand: String!
- """The customer who bought a gift card."""
- user: User @deprecated(reason: "Use `createdBy` field instead.")
+ """First 4 digits of the card number."""
+ firstDigits: String
- """End date of gift card."""
- endDate: DateTime @deprecated(reason: "Use `expiryDate` field instead.")
+ """Last 4 digits of the card number."""
+ lastDigits: String!
- """Start date of gift card."""
- startDate: DateTime @deprecated
+ """Two-digit number representing the card’s expiration month."""
+ expMonth: Int
+
+ """Four-digit number representing the card’s expiration year."""
+ expYear: Int
}
-"""History log of the gift card."""
-type GiftCardEvent implements Node @doc(category: "Gift cards") {
- """ID of the event associated with a gift card."""
+"""History log of the order."""
+type OrderEvent implements Node @doc(category: "Orders") {
+ """ID of the event associated with an order."""
id: ID!
"""Date when event happened at in ISO 8601 format."""
date: DateTime
- """Gift card event type."""
- type: GiftCardEventsEnum
+ """Order event type."""
+ type: OrderEventsEnum
- """
- User who performed the action. Requires one of the following permissions: MANAGE_USERS, MANAGE_STAFF, OWNER.
- """
+ """User who performed the action."""
user: User
"""
- App that performed the action. Requires one of the following permissions: MANAGE_APPS, OWNER.
+ App that performed the action. Requires of of the following permissions: MANAGE_APPS, MANAGE_ORDERS, OWNER.
"""
app: App
@@ -10791,345 +10775,342 @@ type GiftCardEvent implements Node @doc(category: "Gift cards") {
"""Email of the customer."""
email: String
- """The order ID where gift card was used or bought."""
- orderId: ID
-
- """User-friendly number of an order where gift card was used or bought."""
- orderNumber: String
-
- """The list of gift card tags."""
- tags: [String!]
-
- """The list of old gift card tags."""
- oldTags: [String!]
-
- """The gift card balance."""
- balance: GiftCardEventBalance
-
- """The gift card expiry date."""
- expiryDate: Date
-
- """Previous gift card expiry date."""
- oldExpiryDate: Date
-}
-
-enum GiftCardEventsEnum @doc(category: "Gift cards") {
- ISSUED
- BOUGHT
- UPDATED
- ACTIVATED
- DEACTIVATED
- BALANCE_RESET
- EXPIRY_DATE_UPDATED
- TAGS_UPDATED
- SENT_TO_CUSTOMER
- RESENT
- NOTE_ADDED
- USED_IN_ORDER
-}
-
-type GiftCardEventBalance @doc(category: "Gift cards") {
- """Initial balance of the gift card."""
- initialBalance: Money
-
- """Current balance of the gift card."""
- currentBalance: Money!
+ """Type of an email sent to the customer."""
+ emailType: OrderEventsEmailsEnum
- """Previous initial balance of the gift card."""
- oldInitialBalance: Money
+ """Amount of money."""
+ amount: Float
- """Previous current balance of the gift card."""
- oldCurrentBalance: Money
-}
+ """The payment reference from the payment provider."""
+ paymentId: String
-input GiftCardEventFilterInput @doc(category: "Gift cards") {
- type: GiftCardEventsEnum
- orders: [ID!]
-}
+ """The payment gateway of the payment."""
+ paymentGateway: String
-"""The gift card tag."""
-type GiftCardTag implements Node @doc(category: "Gift cards") {
- """ID of the tag associated with a gift card."""
- id: ID!
+ """Number of items."""
+ quantity: Int
- """Name of the tag associated with a gift card."""
- name: String!
-}
+ """Composed ID of the Fulfillment."""
+ composedId: String
-"""Represents an item in the checkout."""
-type CheckoutLine implements Node & ObjectWithMetadata @doc(category: "Checkout") {
- """The ID of the checkout line."""
- id: ID!
+ """User-friendly number of an order."""
+ orderNumber: String
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """Number of an invoice related to the order."""
+ invoiceNumber: String
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
+ """List of oversold lines names."""
+ oversoldItems: [String!]
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
+ """The concerned lines."""
+ lines: [OrderEventOrderLineObject!]
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """The lines fulfilled."""
+ fulfilledItems: [FulfillmentLine!]
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
+ """The warehouse were items were restocked."""
+ warehouse: Warehouse
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
+ """The transaction reference of captured payment."""
+ transactionReference: String
- """The product variant from which the checkout line was created."""
- variant: ProductVariant!
+ """Define if shipping costs were included to the refund."""
+ shippingCostsIncluded: Boolean
- """The quantity of product variant assigned to the checkout line."""
- quantity: Int!
+ """The order which is related to this order."""
+ relatedOrder: Order
- """
- The unit price of the checkout line, with taxes and discounts.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
- """
- unitPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+ """The order event which is related to this event."""
+ related: OrderEvent
- """The unit price of the checkout line, without discounts."""
- undiscountedUnitPrice: Money!
+ """The discount applied to the order."""
+ discount: OrderEventDiscountObject
- """
- The unit price of the checkout line prior to promotion.
-
- Added in Saleor 3.21.
- """
- priorUnitPrice: Money
+ """The reference of payment's transaction."""
+ reference: String
+}
- """
- The sum of the checkout line price, taxes and discounts.
-
- Triggers the following webhook events:
- - CHECKOUT_CALCULATE_TAXES (sync): Optionally triggered when checkout prices are expired.
- """
- totalPrice: TaxedMoney! @webhookEventsInfo(asyncEvents: [], syncEvents: [CHECKOUT_CALCULATE_TAXES])
+"""The different order event types."""
+enum OrderEventsEnum @doc(category: "Orders") {
+ DRAFT_CREATED
+ DRAFT_CREATED_FROM_REPLACE
+ ADDED_PRODUCTS
+ REMOVED_PRODUCTS
+ PLACED
+ PLACED_FROM_DRAFT
+ PLACED_AUTOMATICALLY_FROM_PAID_CHECKOUT
+ OVERSOLD_ITEMS
+ CANCELED
+ EXPIRED
+ ORDER_MARKED_AS_PAID
+ ORDER_FULLY_PAID
+ ORDER_REPLACEMENT_CREATED
+ ORDER_DISCOUNT_ADDED
+ ORDER_DISCOUNT_AUTOMATICALLY_UPDATED
+ ORDER_DISCOUNT_UPDATED
+ ORDER_DISCOUNT_DELETED
+ ORDER_LINE_DISCOUNT_UPDATED
+ ORDER_LINE_DISCOUNT_REMOVED
+ ORDER_LINE_PRODUCT_DELETED
+ ORDER_LINE_VARIANT_DELETED
+ UPDATED_ADDRESS
+ EMAIL_SENT
+ CONFIRMED
+ PAYMENT_AUTHORIZED
+ PAYMENT_CAPTURED
+ EXTERNAL_SERVICE_NOTIFICATION
+ PAYMENT_REFUNDED
+ PAYMENT_VOIDED
+ PAYMENT_FAILED
+ TRANSACTION_EVENT
+ TRANSACTION_CHARGE_REQUESTED
+ TRANSACTION_REFUND_REQUESTED
+ TRANSACTION_CANCEL_REQUESTED
+ TRANSACTION_MARK_AS_PAID_FAILED
+ INVOICE_REQUESTED
+ INVOICE_GENERATED
+ INVOICE_UPDATED
+ INVOICE_SENT
+ FULFILLMENT_CANCELED
+ FULFILLMENT_RESTOCKED_ITEMS
+ FULFILLMENT_FULFILLED_ITEMS
+ FULFILLMENT_REFUNDED
+ FULFILLMENT_RETURNED
+ FULFILLMENT_REPLACED
+ FULFILLMENT_AWAITS_APPROVAL
+ TRACKING_UPDATED
+ NOTE_ADDED
+ NOTE_UPDATED
+ OTHER
+}
- """The sum of the checkout line price, without discounts."""
- undiscountedTotalPrice: Money!
+enum OrderEventsEmailsEnum @doc(category: "Orders") {
+ PAYMENT_CONFIRMATION
+ CONFIRMED
+ SHIPPING_CONFIRMATION
+ TRACKING_UPDATED
+ ORDER_CONFIRMATION
+ ORDER_CANCEL
+ ORDER_REFUND
+ FULFILLMENT_CONFIRMATION
+ DIGITAL_LINKS
+}
- """
- The sum of the checkout line price prior to promotion.
-
- Added in Saleor 3.21.
- """
- priorTotalPrice: Money
+type OrderEventOrderLineObject @doc(category: "Orders") {
+ """The variant quantity."""
+ quantity: Int
- """Indicates whether the item need to be delivered."""
- requiresShipping: Boolean!
+ """The order line."""
+ orderLine: OrderLine
- """List of problems with the checkout line."""
- problems: [CheckoutLineProblem!]
+ """The variant name."""
+ itemName: String
- """
- Determine if the line is a gift.
-
- Added in Saleor 3.19.
-
- Note: this API is currently in Feature Preview and can be subject to changes at later point.
- """
- isGift: Boolean
+ """The discount applied to the order line."""
+ discount: OrderEventDiscountObject
}
-"""Represents an problem in the checkout line."""
-union CheckoutLineProblem = CheckoutLineProblemInsufficientStock | CheckoutLineProblemVariantNotAvailable
+type OrderEventDiscountObject @doc(category: "Orders") {
+ """Type of the discount: fixed or percent."""
+ valueType: DiscountValueTypeEnum!
-"""
-Indicates insufficient stock for a given checkout line.Placing the order will not be possible until solving this problem.
-"""
-type CheckoutLineProblemInsufficientStock @doc(category: "Checkout") {
- """Available quantity of a variant."""
- availableQuantity: Int
+ """Value of the discount. Can store fixed value or percent value."""
+ value: PositiveDecimal!
- """The line that has variant with insufficient stock."""
- line: CheckoutLine!
+ """Explanation for the applied discount."""
+ reason: String
- """The variant with insufficient stock."""
- variant: ProductVariant!
-}
+ """Returns amount of discount."""
+ amount: Money
-"""
-The variant assigned to the checkout line is not available.Placing the order will not be possible until solving this problem.
-"""
-type CheckoutLineProblemVariantNotAvailable @doc(category: "Checkout") {
- """The line that has variant that is not available."""
- line: CheckoutLine!
-}
+ """Type of the discount: fixed or percent."""
+ oldValueType: DiscountValueTypeEnum
-"""
-Represents a delivery option for the checkout.
+ """Value of the discount. Can store fixed value or percent value."""
+ oldValue: PositiveDecimal
-Added in Saleor 3.23.
-"""
-type Delivery {
- """The ID of the delivery."""
+ """Returns amount of discount."""
+ oldAmount: Money
+}
+
+"""Contains all details related to the applied discount to the order."""
+type OrderDiscount implements Node @doc(category: "Discounts") {
+ """The ID of discount applied."""
id: ID!
- """Shipping method represented by the delivery."""
- shippingMethod: ShippingMethod
-}
+ """The type of applied discount: Sale, Voucher or Manual."""
+ type: OrderDiscountType!
-"""
-Represents a delivery method chosen for the checkout. `Warehouse` type is used when checkout is marked as "click and collect" and `ShippingMethod` otherwise.
-"""
-union DeliveryMethod = Warehouse | ShippingMethod
+ """The name of applied discount."""
+ name: String
-"""Represents a payment transaction."""
-type TransactionItem implements Node & ObjectWithMetadata @doc(category: "Payments") {
- """The ID of the object."""
- id: ID!
+ """Translated name of the applied discount."""
+ translatedName: String
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """Type of the discount: fixed or percent"""
+ valueType: DiscountValueTypeEnum!
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
+ """Value of the discount. Can store fixed value or percent value"""
+ value: PositiveDecimal!
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ Explanation for the applied discount.
+
+ Requires one of the following permissions: MANAGE_ORDERS.
"""
- privateMetafields(keys: [String!]): Metadata
+ reason: String
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """Returns amount of discount."""
+ amount: Money! @deprecated(reason: "Use `total` instead.")
"""
- A single key from public metadata.
+ The amount of discount applied to the order.
- Tip: Use GraphQL aliases to fetch multiple keys.
+ Added in Saleor 3.21.
"""
- metafield(key: String!): String
+ total: Money!
+}
+type OrderError @doc(category: "Orders") {
"""
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ Name of a field that caused the error. A value of `null` indicates that the error isn't associated with a particular field.
"""
- metafields(keys: [String!]): Metadata
-
- """The transaction token."""
- token: UUID!
-
- """Date and time at which payment transaction was created."""
- createdAt: DateTime!
-
- """Date and time at which payment transaction was modified."""
- modifiedAt: DateTime!
+ field: String
- """
- List of actions that can be performed in the current state of a payment.
- """
- actions: [TransactionActionEnum!]!
+ """The error message."""
+ message: String
- """Total amount authorized for this payment."""
- authorizedAmount: Money!
+ """The error code."""
+ code: OrderErrorCode!
- """Total amount of ongoing authorization requests for the transaction."""
- authorizePendingAmount: Money!
+ """Warehouse ID which causes the error."""
+ warehouse: ID
- """Total amount refunded for this payment."""
- refundedAmount: Money!
+ """List of order line IDs that cause the error."""
+ orderLines: [ID!]
- """Total amount of ongoing refund requests for the transaction."""
- refundPendingAmount: Money!
+ """List of product variants that are associated with the error"""
+ variants: [ID!]
- """Total amount canceled for this payment."""
- canceledAmount: Money!
+ """A type of address that causes the error."""
+ addressType: AddressTypeEnum
+}
- """Total amount of ongoing cancel requests for the transaction."""
- cancelPendingAmount: Money!
+enum OrderErrorCode @doc(category: "Orders") {
+ BILLING_ADDRESS_NOT_SET
+ CANNOT_CANCEL_FULFILLMENT
+ CANNOT_CANCEL_ORDER
+ CANNOT_DELETE
+ CANNOT_DISCOUNT
+ CANNOT_REFUND
+ CANNOT_FULFILL_UNPAID_ORDER
+ CAPTURE_INACTIVE_PAYMENT
+ GIFT_CARD_LINE
+ NOT_EDITABLE
+ FULFILL_ORDER_LINE
+ GRAPHQL_ERROR
+ INVALID
+ PRODUCT_NOT_PUBLISHED
+ PRODUCT_UNAVAILABLE_FOR_PURCHASE
+ NOT_FOUND
+ ORDER_NO_SHIPPING_ADDRESS
+ PAYMENT_ERROR
+ PAYMENT_MISSING
+ TRANSACTION_ERROR
+ REQUIRED
+ SHIPPING_METHOD_NOT_APPLICABLE
+ SHIPPING_METHOD_REQUIRED
+ TAX_ERROR
+ UNIQUE
+ VOID_INACTIVE_PAYMENT
+ ZERO_QUANTITY
+ INVALID_QUANTITY
+ INSUFFICIENT_STOCK
+ DUPLICATED_INPUT_ITEM
+ NOT_AVAILABLE_IN_CHANNEL
+ CHANNEL_INACTIVE
+ INVALID_VOUCHER
+ INVALID_VOUCHER_CODE
+ NON_EDITABLE_GIFT_LINE
+ NON_REMOVABLE_GIFT_LINE
+ MISSING_ADDRESS_DATA
+}
- """Total amount charged for this payment."""
- chargedAmount: Money!
+enum AddressTypeEnum {
+ BILLING
+ SHIPPING
+}
- """Total amount of ongoing charge requests for the transaction."""
- chargePendingAmount: Money!
+"""The details of granted refund."""
+type OrderGrantedRefund @doc(category: "Orders") {
+ id: ID!
- """Name of the transaction."""
- name: String!
+ """Time of creation."""
+ createdAt: DateTime!
- """Message related to the transaction."""
- message: String!
+ """Time of last update."""
+ updatedAt: DateTime!
- """PSP reference of transaction."""
- pspReference: String!
+ """Refund amount."""
+ amount: Money!
- """The related order."""
- order: Order
+ """
+ Reason of the refund.
+
+ Added in Saleor 3.22.
+ """
+ reason: String
- """The related checkout."""
- checkout: Checkout
+ """
+ Reason Model (Page) reference for refund.
+
+ Added in Saleor 3.22.
+ """
+ reasonReference: Page
- """List of all transaction's events."""
- events: [TransactionEvent!]!
+ """
+ User who performed the action. Requires of of the following permissions: MANAGE_USERS, MANAGE_STAFF, OWNER.
+ """
+ user: User
- """User or App that created the transaction."""
- createdBy: UserOrApp
+ """App that performed the action."""
+ app: App
"""
- The url that will allow to redirect user to payment provider page with transaction details.
+ If true, the refunded amount includes the shipping price.If false, the refunded amount does not include the shipping price.
"""
- externalUrl: String!
+ shippingCostsIncluded: Boolean!
+
+ """Lines assigned to the granted refund."""
+ lines: [OrderGrantedRefundLine!]
"""
- The payment method used for this transaction.
+ Status of the granted refund calculated based on transactionItem assigned to granted refund.
- Added in Saleor 3.22.
+ Added in Saleor 3.20.
"""
- paymentMethodDetails: PaymentMethodDetails
+ status: OrderGrantedRefundStatusEnum!
"""
- Reason of the refund.
+ List of refund events associated with the granted refund.
- Added in Saleor 3.22.
+ Added in Saleor 3.20.
"""
- reason: String
+ transactionEvents: [TransactionEvent!]
"""
- Reason `Page` (Model) for refund.
+ The transaction assigned to the granted refund.
- Added in Saleor 3.22.
+ Added in Saleor 3.20.
"""
- reasonReference: Page
+ transaction: TransactionItem
}
"""
-Represents possible actions on payment transaction.
-
- The following actions are possible:
- CHARGE - Represents the charge action.
- REFUND - Represents a refund action.
- CANCEL - Represents a cancel action. Added in Saleor 3.12.
+A static page that can be manually added by a shop operator through the dashboard.
"""
-enum TransactionActionEnum @doc(category: "Payments") {
- CHARGE
- REFUND
- CANCEL
-}
-
-"""Represents an order in the shop."""
-type Order implements Node & ObjectWithMetadata @doc(category: "Orders") {
- """ID of the order."""
+type Page implements Node & ObjectWithMetadata & ObjectWithAttributes @doc(category: "Pages") {
+ """ID of the page."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -11162,797 +11143,1011 @@ type Order implements Node & ObjectWithMetadata @doc(category: "Orders") {
"""
metafields(keys: [String!]): Metadata
- """Date and time when the order was created."""
- created: DateTime!
-
- """Date and time when the order was created."""
- updatedAt: DateTime!
-
- """Status of the order."""
- status: OrderStatus!
-
- """
- User who placed the order. This field is set only for orders placed by authenticated users. Can be fetched for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_USERS, MANAGE_ORDERS, HANDLE_PAYMENTS, OWNER.
- """
- user: User
-
- """Google Analytics tracking client ID."""
- trackingClientId: String!
-
- """
- Billing address. The full data can be access for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
- """
- billingAddress: Address
-
- """
- Shipping address. The full data can be access for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
- """
- shippingAddress: Address
-
- """Method used for shipping."""
- shippingMethodName: String
-
"""
- Name of the collection point where the order should be picked up by the customer.
+ Get a single attribute attached to page by attribute slug.
+
+ Added in Saleor 3.22.
"""
- collectionPointName: String
-
- """Channel through which the order was placed."""
- channel: Channel!
-
- """List of shipments for the order."""
- fulfillments: [Fulfillment!]!
-
- """List of order lines."""
- lines: [OrderLine!]!
+ assignedAttribute(
+ """Slug of the attribute"""
+ slug: String!
+ ): AssignedAttribute
"""
- List of actions that can be performed in the current state of an order.
+ List of attributes assigned to this page.
+
+ Added in Saleor 3.22.
"""
- actions: [OrderAction!]!
+ assignedAttributes(
+ """Maximum number of attributes to return. Default is 100."""
+ limit: PositiveInt = 100
+ ): [AssignedAttribute!]!
- """Shipping methods that can be used with this order."""
- availableShippingMethods: [ShippingMethod!] @deprecated(reason: "Use `shippingMethods`, this field will be removed in 4.0")
+ """Title of the page for SEO."""
+ seoTitle: String
- """Shipping methods related to this order."""
- shippingMethods: [ShippingMethod!]!
+ """Description of the page for SEO."""
+ seoDescription: String
- """Collection points that can be used for this order."""
- availableCollectionPoints: [Warehouse!]!
+ """Title of the page."""
+ title: String!
"""
- List of order invoices. Can be fetched for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
"""
- invoices: [Invoice!]!
-
- """User-friendly number of an order."""
- number: String!
-
- """The ID of the order that was the base for this order."""
- original: ID
-
- """The order origin."""
- origin: OrderOriginEnum!
-
- """Informs if an order is fully paid."""
- isPaid: Boolean!
+ content: JSONString
+ publicationDate: Date @deprecated(reason: "Use the `publishedAt` field to fetch the publication date.")
- """Internal payment status."""
- paymentStatus: PaymentChargeStatusEnum!
+ """The page publication date."""
+ publishedAt: DateTime
- """User-friendly payment status."""
- paymentStatusDisplay: String!
+ """Determines if the page is published."""
+ isPublished: Boolean!
- """The authorize status of the order."""
- authorizeStatus: OrderAuthorizeStatusEnum!
+ """Slug of the page."""
+ slug: String!
- """The charge status of the order."""
- chargeStatus: OrderChargeStatusEnum!
+ """Determines the type of page"""
+ pageType: PageType!
- """Returns True if order has to be exempt from taxes."""
- taxExemption: Boolean!
+ """Date and time at which page was created."""
+ created: DateTime!
"""
- List of transactions for the order. Requires one of the following permissions: MANAGE_ORDERS, HANDLE_PAYMENTS.
+ Content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
"""
- transactions: [TransactionItem!]!
+ contentJson: JSONString! @deprecated(reason: "Use the `content` field instead.")
- """List of payments for the order."""
- payments: [Payment!]!
+ """Returns translated page fields for the given language code."""
+ translation(
+ """A language code to return the translation for page."""
+ languageCode: LanguageCodeEnum!
+ ): PageTranslation
- """Total amount of the order."""
- total: TaxedMoney!
+ """Get a single attribute attached to page by attribute slug."""
+ attribute(
+ """Slug of the attribute"""
+ slug: String!
+ ): SelectedAttribute @deprecated(reason: "Use `assignedAttribute` field instead.")
- """Undiscounted total amount of the order."""
- undiscountedTotal: TaxedMoney!
+ """List of attributes assigned to this page."""
+ attributes: [SelectedAttribute!]! @deprecated(reason: "Use `assignedAttributes` field instead.")
+}
- """Shipping method for this order."""
- shippingMethod: ShippingMethod @deprecated(reason: "Use `deliveryMethod` instead.")
+"""Represents page translations."""
+type PageTranslation implements Node @doc(category: "Pages") {
+ """The ID of the page translation."""
+ id: ID!
- """
- Undiscounted total price of shipping.
-
- Added in Saleor 3.19.
- """
- undiscountedShippingPrice: Money!
+ """Translation language."""
+ language: LanguageDisplay!
- """Total price of shipping."""
- shippingPrice: TaxedMoney!
+ """Translated SEO title."""
+ seoTitle: String
- """The shipping tax rate value."""
- shippingTaxRate: Float!
+ """Translated SEO description."""
+ seoDescription: String
"""
- Denormalized tax class assigned to the shipping method.
+ Translated page slug.
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
+ Added in Saleor 3.21.
"""
- shippingTaxClass: TaxClass
-
- """Denormalized name of the tax class assigned to the shipping method."""
- shippingTaxClassName: String
+ slug: String
- """Denormalized public metadata of the shipping method's tax class."""
- shippingTaxClassMetadata: [MetadataItem!]!
+ """Translated page title."""
+ title: String
"""
- Denormalized private metadata of the shipping method's tax class. Requires staff permissions to access.
+ Translated content of the page.
+
+ Rich text format. For reference see https://editorjs.io/
"""
- shippingTaxClassPrivateMetadata: [MetadataItem!]!
- token: String! @deprecated(reason: "Use `id` instead.")
-
- """Voucher linked to the order."""
- voucher: Voucher
+ content: JSONString
"""
- Voucher code that was used for Order.
+ Translated description of the page.
- Added in Saleor 3.18.
+ Rich text format. For reference see https://editorjs.io/
"""
- voucherCode: String
-
- """List of user gift cards."""
- giftCards: [GiftCard!]!
+ contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
- """Additional information provided by the customer about the order."""
- customerNote: String!
+ """Represents the page fields to translate."""
+ translatableContent: PageTranslatableContent
+}
- """Weight of the order."""
- weight: Weight!
+"""
+Represents page's original translatable fields and related translations.
+"""
+type PageTranslatableContent implements Node @doc(category: "Pages") {
+ """The ID of the page translatable content."""
+ id: ID!
- """URL to which user should be redirected after order is placed."""
- redirectUrl: String
+ """The ID of the page to translate."""
+ pageId: ID!
- """The sum of line prices not including shipping."""
- subtotal: TaxedMoney!
+ """SEO title to translate."""
+ seoTitle: String
- """User-friendly order status."""
- statusDisplay: String!
+ """SEO description to translate."""
+ seoDescription: String
"""
- Informs whether a draft order can be finalized(turned into a regular order).
+ Slug to translate.
+
+ Added in Saleor 3.21.
"""
- canFinalize: Boolean!
-
- """Amount authorized for the order."""
- totalAuthorized: Money!
-
- """Amount captured for the order."""
- totalCaptured: Money! @deprecated(reason: "Use `totalCharged` instead.")
+ slug: String
- """Amount charged for the order."""
- totalCharged: Money!
+ """Page title to translate."""
+ title: String!
- """Amount canceled for the order."""
- totalCanceled: Money!
+ """
+ Content of the page to translate.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ content: JSONString
"""
- List of events associated with the order.
+ Content of the page.
- Requires one of the following permissions: MANAGE_ORDERS.
+ Rich text format. For reference see https://editorjs.io/
"""
- events: [OrderEvent!]!
+ contentJson: JSONString @deprecated(reason: "Use the `content` field instead.")
- """The difference between the paid and the order total amount."""
- totalBalance: Money!
+ """Returns translated page fields for the given language code."""
+ translation(
+ """A language code to return the translation for page."""
+ languageCode: LanguageCodeEnum!
+ ): PageTranslation
"""
- Email address of the customer. The full data can be access for orders created in Saleor 3.2 and later, for other orders requires one of the following permissions: MANAGE_ORDERS, OWNER.
+ A static page that can be manually added by a shop operator through the dashboard.
"""
- userEmail: String
+ page: Page @deprecated(reason: "Get model fields from the root level queries.")
- """Returns True, if order requires shipping."""
- isShippingRequired: Boolean!
+ """List of page content attribute values that can be translated."""
+ attributeValues: [AttributeValueTranslatableContent!]!
+}
- """The delivery method selected for this order."""
- deliveryMethod: DeliveryMethod
- languageCode: String! @deprecated(reason: "Use the `languageCodeEnum` field to fetch the language code.")
+"""Represents granted refund line."""
+type OrderGrantedRefundLine {
+ id: ID!
- """Order language code."""
- languageCodeEnum: LanguageCodeEnum!
+ """Number of items to refund."""
+ quantity: Int!
- """Returns applied discount."""
- discount: Money @deprecated(reason: "Use the `discounts` field instead.")
+ """Line of the order associated with this granted refund."""
+ orderLine: OrderLine!
- """Discount name."""
- discountName: String @deprecated(reason: "Use the `discounts` field instead.")
+ """Reason for refunding the line."""
+ reason: String
+}
- """Translated discount name."""
- translatedDiscountName: String @deprecated(reason: "Use the `discounts` field instead.")
+"""
+Represents the status of a granted refund.
- """List of all discounts assigned to the order."""
- discounts: [OrderDiscount!]!
+ NONE - the refund on related transactionItem is not processed
+ PENDING - the refund on related transactionItem is pending
+ FULL - the refund on related transactionItem is fully processed
+ FAIL - the refund on related transactionItem failed
+"""
+enum OrderGrantedRefundStatusEnum @doc(category: "Orders") {
+ NONE
+ PENDING
+ SUCCESS
+ FAILURE
+}
- """List of errors that occurred during order validation."""
- errors: [OrderError!]!
+"""Represents transaction's event."""
+type TransactionEvent implements Node @doc(category: "Payments") {
+ """The ID of the object."""
+ id: ID!
- """Determines whether displayed prices should include taxes."""
- displayGrossPrices: Boolean!
+ """Date and time at which a transaction event was created."""
+ createdAt: DateTime!
- """External ID of this order."""
- externalReference: String
+ """PSP reference of transaction."""
+ pspReference: String!
- """ID of the checkout that the order was created from."""
- checkoutId: ID
+ """Message related to the transaction's event."""
+ message: String!
"""
- List of granted refunds.
+ Reason model of the transaction refund.
- Requires one of the following permissions: MANAGE_ORDERS.
+ Added in Saleor 3.22.
"""
- grantedRefunds: [OrderGrantedRefund!]!
+ reasonReference: Page
"""
- Total amount of granted refund.
-
- Requires one of the following permissions: MANAGE_ORDERS.
+ The url that will allow to redirect user to payment provider page with transaction details.
"""
- totalGrantedRefund: Money!
+ externalUrl: String!
- """Total refund amount for the order."""
- totalRefunded: Money!
+ """The amount related to this event."""
+ amount: Money!
- """
- Total amount of ongoing refund requests for the order's transactions.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- totalRefundPending: Money!
+ """The type of action related to this event."""
+ type: TransactionEventTypeEnum
- """
- Total amount of ongoing authorize requests for the order's transactions.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- totalAuthorizePending: Money!
+ """User or App that created the transaction event."""
+ createdBy: UserOrApp
- """
- Total amount of ongoing charge requests for the order's transactions.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- totalChargePending: Money!
+ """Idempotency key assigned to the event."""
+ idempotencyKey: String
+}
- """
- Total amount of ongoing cancel requests for the order's transactions.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- totalCancelPending: Money!
+"""
+Represents possible event types.
- """
- The difference amount between granted refund and the amounts that are pending and refunded.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- totalRemainingGrant: Money!
+ Added in Saleor 3.12.
+
+ The following types are possible:
+ AUTHORIZATION_SUCCESS - represents success authorization.
+ AUTHORIZATION_FAILURE - represents failure authorization.
+ AUTHORIZATION_ADJUSTMENT - represents authorization adjustment.
+ AUTHORIZATION_REQUEST - represents authorization request.
+ AUTHORIZATION_ACTION_REQUIRED - represents authorization that needs
+ additional actions from the customer.
+ CHARGE_ACTION_REQUIRED - represents charge that needs
+ additional actions from the customer.
+ CHARGE_SUCCESS - represents success charge.
+ CHARGE_FAILURE - represents failure charge.
+ CHARGE_BACK - represents chargeback.
+ CHARGE_REQUEST - represents charge request.
+ REFUND_SUCCESS - represents success refund.
+ REFUND_FAILURE - represents failure refund.
+ REFUND_REVERSE - represents reverse refund.
+ REFUND_REQUEST - represents refund request.
+ CANCEL_SUCCESS - represents success cancel.
+ CANCEL_FAILURE - represents failure cancel.
+ CANCEL_REQUEST - represents cancel request.
+ INFO - represents info event.
+"""
+enum TransactionEventTypeEnum @doc(category: "Payments") {
+ AUTHORIZATION_SUCCESS
+ AUTHORIZATION_FAILURE
+ AUTHORIZATION_ADJUSTMENT
+ AUTHORIZATION_REQUEST
+ AUTHORIZATION_ACTION_REQUIRED
+ CHARGE_ACTION_REQUIRED
+ CHARGE_SUCCESS
+ CHARGE_FAILURE
+ CHARGE_BACK
+ CHARGE_REQUEST
+ REFUND_SUCCESS
+ REFUND_FAILURE
+ REFUND_REVERSE
+ REFUND_REQUEST
+ CANCEL_SUCCESS
+ CANCEL_FAILURE
+ CANCEL_REQUEST
+ INFO
}
-enum OrderStatus @doc(category: "Orders") {
- DRAFT
- UNCONFIRMED
- UNFULFILLED
- PARTIALLY_FULFILLED
- PARTIALLY_RETURNED
- RETURNED
- FULFILLED
- CANCELED
- EXPIRED
+union UserOrApp = User | App
+
+"""
+Represents a payment method used for a transaction.
+
+Added in Saleor 3.22.
+"""
+interface PaymentMethodDetails {
+ """Name of the payment method."""
+ name: String!
+}
+
+"""
+Determine a current authorize status for checkout.
+
+ We treat the checkout as fully authorized when the sum of authorized and charged
+ funds cover the checkout.total.
+ We treat the checkout as partially authorized when the sum of authorized and charged
+ funds covers only part of the checkout.total
+ We treat the checkout as not authorized when the sum of authorized and charged funds
+ is 0.
+
+ NONE - the funds are not authorized
+ PARTIAL - the cover funds don't cover fully the checkout's total
+ FULL - the cover funds covers the checkout's total
+"""
+enum CheckoutAuthorizeStatusEnum @doc(category: "Checkout") {
+ NONE
+ PARTIAL
+ FULL
+}
+
+"""
+Determine the current charge status for the checkout.
+
+ The checkout is considered overcharged when the sum of the transactionItem's charge
+ amounts exceeds the value of `checkout.total`.
+ If the sum of the transactionItem's charge amounts equals
+ `checkout.total`, we consider the checkout to be fully charged.
+ If the sum of the transactionItem's charge amounts covers a part of the
+ `checkout.total`, we treat the checkout as partially charged.
+
+
+ NONE - the funds are not charged.
+ PARTIAL - the funds that are charged don't cover the checkout's total
+ FULL - the funds that are charged fully cover the checkout's total
+ OVERCHARGED - the charged funds are bigger than checkout's total
+"""
+enum CheckoutChargeStatusEnum @doc(category: "Checkout") {
+ NONE
+ PARTIAL
+ FULL
+ OVERCHARGED
}
-"""Represents order fulfillment."""
-type Fulfillment implements Node & ObjectWithMetadata @doc(category: "Orders") {
- """ID of the fulfillment."""
+"""
+Represents a payment method stored for user (tokenized) in payment gateway.
+"""
+type StoredPaymentMethod @doc(category: "Payments") {
+ """Stored payment method ID."""
id: ID!
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
-
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
+ """Payment gateway that stores this payment method."""
+ gateway: PaymentGateway!
"""
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ ID of stored payment method used to make payment actions. Note: method ID is unique only within the payment gateway.
"""
- privateMetafields(keys: [String!]): Metadata
+ paymentMethodId: String!
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """Stored credit card details if available."""
+ creditCardInfo: CreditCard
+ supportedPaymentFlows: [TokenizedPaymentFlowEnum!]
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
+ """Type of the payment method. Example: credit card, wallet, etc."""
+ type: String!
"""
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ Payment method name. Example: last 4 digits of credit card, obfuscated email, etc.
"""
- metafields(keys: [String!]): Metadata
-
- """Sequence in which the fulfillments were created for an order."""
- fulfillmentOrder: Int!
-
- """Status of fulfillment."""
- status: FulfillmentStatus!
-
- """Fulfillment tracking number."""
- trackingNumber: String!
+ name: String
- """Date and time when fulfillment was created."""
- created: DateTime!
+ """JSON data returned by Payment Provider app for this payment method."""
+ data: JSON
+}
- """List of lines for the fulfillment."""
- lines: [FulfillmentLine!]
+"""
+Represents possible tokenized payment flows that can be used to process payment.
- """User-friendly fulfillment status."""
- statusDisplay: String
+ The following flows are possible:
+ INTERACTIVE - Payment method can be used for 1 click checkout - it's prefilled in
+ checkout form (might require additional authentication from user)
+"""
+enum TokenizedPaymentFlowEnum @doc(category: "Payments") {
+ INTERACTIVE
+}
- """Warehouse from fulfillment was fulfilled."""
- warehouse: Warehouse
+"""Represents an problem in the checkout."""
+union CheckoutProblem = CheckoutProblemDeliveryMethodStale | CheckoutProblemDeliveryMethodInvalid | CheckoutLineProblemInsufficientStock | CheckoutLineProblemVariantNotAvailable
- """Amount of refunded shipping price."""
- shippingRefundedAmount: Money
+"""
+Indicates that the delivery methods are stale.
- """Total refunded amount assigned to this fulfillment."""
- totalRefundedAmount: Money
+Added in Saleor 3.23.
+"""
+type CheckoutProblemDeliveryMethodStale @doc(category: "Checkout") {
+ delivery: Delivery!
}
-enum FulfillmentStatus @doc(category: "Orders") {
- FULFILLED
- REFUNDED
- RETURNED
- REPLACED
- REFUNDED_AND_RETURNED
- CANCELED
- WAITING_FOR_APPROVAL
-}
+"""
+Indicates that the selected delivery method is invalid.
-"""Represents line of the fulfillment."""
-type FulfillmentLine implements Node @doc(category: "Orders") {
- """ID of the fulfillment line."""
- id: ID!
+Added in Saleor 3.23.
+"""
+type CheckoutProblemDeliveryMethodInvalid @doc(category: "Checkout") {
+ delivery: Delivery!
+}
- """The number of items included in the fulfillment line."""
- quantity: Int!
+type CheckoutCountableConnection @doc(category: "Checkout") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [CheckoutCountableEdge!]!
- """The order line to which the fulfillment line is related."""
- orderLine: OrderLine
+ """A total count of items in the collection."""
+ totalCount: Int
}
-"""Represents order line of particular order."""
-type OrderLine implements Node & ObjectWithMetadata @doc(category: "Orders") {
- """ID of the order line."""
- id: ID!
-
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+type CheckoutCountableEdge @doc(category: "Checkout") {
+ """The item at the end of the edge."""
+ node: Checkout!
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
+ """A cursor for use in pagination."""
+ cursor: String!
+}
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
+type GiftCardCountableConnection @doc(category: "Gift cards") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [GiftCardCountableEdge!]!
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """A total count of items in the collection."""
+ totalCount: Int
+}
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
+type GiftCardCountableEdge @doc(category: "Gift cards") {
+ """The item at the end of the edge."""
+ node: GiftCard!
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
+ """A cursor for use in pagination."""
+ cursor: String!
+}
- """Name of the product in order line."""
- productName: String!
+type OrderCountableConnection @doc(category: "Orders") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [OrderCountableEdge!]!
- """Name of the variant of product in order line."""
- variantName: String!
+ """A total count of items in the collection."""
+ totalCount: Int
+}
- """SKU of the product variant."""
- productSku: String
+type OrderCountableEdge @doc(category: "Orders") {
+ """The item at the end of the edge."""
+ node: Order!
- """The ID of the product variant."""
- productVariantId: String
+ """A cursor for use in pagination."""
+ cursor: String!
+}
- """Whether the product variant requires shipping."""
- isShippingRequired: Boolean!
+"""Represents user's permissions."""
+type UserPermission @doc(category: "Users") {
+ """Internal code for permission."""
+ code: PermissionEnum!
- """Number of variant items ordered."""
- quantity: Int!
+ """Describe action(s) allowed to do by permission."""
+ name: String!
- """Number of variant items fulfilled."""
- quantityFulfilled: Int!
+ """List of user permission groups which contains this permission."""
+ sourcePermissionGroups(
+ """ID of user whose groups should be returned."""
+ userId: ID!
+ ): [Group!]
+}
- """Rate of tax applied on product variant."""
- taxRate: Float!
- digitalContentUrl: DigitalContentUrl
- thumbnail(
- """
- Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
- """
- size: Int
+"""Represents permission group data."""
+type Group implements Node @doc(category: "Users") {
+ """The ID of the group."""
+ id: ID!
- """
- The format of the image. When not provided, format of the original image will be used.
- """
- format: ThumbnailFormatEnum = ORIGINAL
- ): Image
+ """The name of the group."""
+ name: String!
"""
- Price of the single item in the order line with all the line-level discounts and order-level discount portions applied.
+ List of group users
+
+ Requires one of the following permissions: MANAGE_STAFF.
"""
- unitPrice: TaxedMoney!
+ users: [User!]
- """
- Price of the single item in the order line without any discount applied.
- """
- undiscountedUnitPrice: TaxedMoney!
+ """List of group permissions"""
+ permissions: [Permission!]
"""
- Sum of the line-level discounts applied to the order line. Order-level discounts which affect the line are not visible in this field. For order-level discount portion (if any), please query `order.discounts` field.
+ True, if the currently authenticated user has rights to manage a group.
"""
- unitDiscount: Money!
+ userCanManage: Boolean!
+
+ """List of channels the group has access to."""
+ accessibleChannels: [Channel!]
+
+ """Determine if the group have restricted access to channels."""
+ restrictedAccessToChannels: Boolean!
+}
+
+"""History log of the customer."""
+type CustomerEvent implements Node @doc(category: "Users") {
+ """The ID of the customer event."""
+ id: ID!
- """
- Reason for line-level discounts applied on the order line. Order-level discounts which affect the line are not visible in this field. For order-level discount reason (if any), please query `order.discounts` field.
- """
- unitDiscountReason: String
+ """Date when event happened at in ISO 8601 format."""
+ date: DateTime
- """
- Value of the discount. Can store fixed value or percent value. This field shouldn't be used when multiple discounts affect the line. There is a limitation, that after running `checkoutComplete` mutation the field always stores fixed value.
- """
- unitDiscountValue: PositiveDecimal!
+ """Customer event type."""
+ type: CustomerEventsEnum
- """
- Type of the discount: `fixed` or `percent`. This field shouldn't be used when multiple discounts affect the line. There is a limitation, that after running `checkoutComplete` mutation the field is always set to `fixed`.
- """
- unitDiscountType: DiscountValueTypeEnum
+ """User who performed the action."""
+ user: User
- """Price of the order line."""
- totalPrice: TaxedMoney!
+ """App that performed the action."""
+ app: App
- """Price of the order line without discounts."""
- undiscountedTotalPrice: TaxedMoney!
+ """Content of the event."""
+ message: String
- """Returns True, if the line unit price was overridden."""
- isPriceOverridden: Boolean
+ """Number of objects concerned by the event."""
+ count: Int
- """
- A purchased product variant. Note: this field may be null if the variant has been removed from stock at all. Requires one of the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.
- """
- variant: ProductVariant
+ """The concerned order."""
+ order: Order
- """Product name in the customer's language"""
- translatedProductName: String!
+ """The concerned order line."""
+ orderLine: OrderLine
+}
- """Variant name in the customer's language"""
- translatedVariantName: String!
+enum CustomerEventsEnum @doc(category: "Users") {
+ ACCOUNT_CREATED
+ ACCOUNT_ACTIVATED
+ ACCOUNT_DEACTIVATED
+ PASSWORD_RESET_LINK_SENT
+ PASSWORD_RESET
+ EMAIL_CHANGED_REQUEST
+ PASSWORD_CHANGED
+ EMAIL_CHANGED
+ PLACED_ORDER
+ NOTE_ADDED_TO_ORDER
+ DIGITAL_LINK_DOWNLOADED
+ CUSTOMER_DELETED
+ NAME_ASSIGNED
+ EMAIL_ASSIGNED
+ NOTE_ADDED
+}
- """
- List of allocations across warehouses.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- allocations: [Allocation!]
+"""
+Represents a payment source stored for user in payment gateway, such as credit card.
+"""
+type PaymentSource @doc(category: "Payments") {
+ """Payment gateway name."""
+ gateway: String!
- """
- Denormalized sale ID, set when order line is created for a product variant that is on sale.
- """
- saleId: ID
+ """ID of stored payment method."""
+ paymentMethodId: String
- """A quantity of items remaining to be fulfilled."""
- quantityToFulfill: Int!
+ """Stored credit card details if available."""
+ creditCardInfo: CreditCard
"""
- Denormalized tax class of the product in this order line.
+ List of public metadata items.
- Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
+ Can be accessed without permissions.
"""
- taxClass: TaxClass
+ metadata: [MetadataItem!]!
+}
- """Denormalized name of the tax class."""
- taxClassName: String
+"""Represents the app's brand data."""
+type AppBrand @doc(category: "Apps") {
+ """App's logos details."""
+ logo: AppBrandLogo!
+}
- """Denormalized public metadata of the tax class."""
- taxClassMetadata: [MetadataItem!]!
+"""Represents the app's brand logo data."""
+type AppBrandLogo @doc(category: "Apps") {
+ """URL to the default logo image."""
+ default(
+ """
+ Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended).
+ """
+ size: Int
- """
- Denormalized private metadata of the tax class. Requires staff permissions to access.
- """
- taxClassPrivateMetadata: [MetadataItem!]!
+ """
+ The format of the image. When not provided, format of the original image will be used.
+ """
+ format: IconThumbnailFormatEnum = ORIGINAL
+ ): String!
+}
- """Voucher code that was used for this order line."""
- voucherCode: String
+"""Thumbnail formats for icon images."""
+enum IconThumbnailFormatEnum {
+ ORIGINAL
+ WEBP
+}
+
+"""Enum determining the state of a circuit breaker."""
+enum CircuitBreakerStateEnum @doc(category: "Apps") {
+ """The breaker is conducting (requests are passing through)."""
+ CLOSED
"""
- Determine if the line is a gift.
-
- Added in Saleor 3.19.
-
- Note: this API is currently in Feature Preview and can be subject to changes at later point.
+ The breaker is in a trial period (to close or open). Note that unlike classic breaker patterns, this is not a state where we are throttling the number of requests, it's a state similar to CLOSED but with different thresholds.
"""
- isGift: Boolean
+ HALF_OPEN
"""
- List of applied discounts
-
- Added in Saleor 3.21.
+ The breaker is tripped (no requests are passing). Breaker will enter half-open state after cooldown period.
"""
- discounts: [OrderLineDiscount!]
+ OPEN
}
-"""
-Nonnegative Decimal scalar implementation.
-
-Should be used in places where value must be nonnegative (0 or greater).
-"""
-scalar PositiveDecimal
+type EventDeliveryCountableConnection {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [EventDeliveryCountableEdge!]!
-"""Represents allocation."""
-type Allocation implements Node @doc(category: "Products") {
- """The ID of allocation."""
- id: ID!
+ """A total count of items in the collection."""
+ totalCount: Int
+}
- """
- Quantity allocated for orders.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- quantity: Int!
+type EventDeliveryCountableEdge {
+ """The item at the end of the edge."""
+ node: EventDelivery!
- """
- The warehouse were items were allocated.
-
- Requires one of the following permissions: MANAGE_PRODUCTS, MANAGE_ORDERS.
- """
- warehouse: Warehouse!
+ """A cursor for use in pagination."""
+ cursor: String!
}
-"""Represent the discount applied to order line."""
-type OrderLineDiscount @doc(category: "Orders") {
- """The ID of discount applied."""
+"""Event delivery."""
+type EventDelivery implements Node {
+ """The ID of an event delivery."""
id: ID!
- """The type of applied discount: Sale, Voucher or Manual."""
- type: OrderDiscountType!
+ """Creation time of an event delivery."""
+ createdAt: DateTime!
- """The name of applied discount."""
- name: String
+ """Event delivery status."""
+ status: EventDeliveryStatusEnum!
- """Translated name of the applied discount."""
- translatedName: String
+ """Webhook event type."""
+ eventType: WebhookEventTypeEnum!
- """Type of the discount: fixed or percent"""
- valueType: DiscountValueTypeEnum!
+ """Event delivery attempts."""
+ attempts(
+ """Event delivery sorter"""
+ sortBy: EventDeliveryAttemptSortingInput
- """Value of the discount. Can store fixed value or percent value"""
- value: PositiveDecimal!
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
- """
- Explanation for the applied discount.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- reason: String
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """The discount amount applied to the line item."""
- total: Money!
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
- """The discount amount applied to the single line unit."""
- unit: Money!
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): EventDeliveryAttemptCountableConnection
+
+ """Event payload."""
+ payload: String
}
-enum OrderDiscountType @doc(category: "Discounts") {
- SALE
- VOUCHER
- MANUAL
- PROMOTION
- ORDER_PROMOTION
+enum EventDeliveryStatusEnum @doc(category: "Webhooks") {
+ PENDING
+ SUCCESS
+ FAILED
+}
+
+type EventDeliveryAttemptCountableConnection {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [EventDeliveryAttemptCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type EventDeliveryAttemptCountableEdge {
+ """The item at the end of the edge."""
+ node: EventDeliveryAttempt!
+
+ """A cursor for use in pagination."""
+ cursor: String!
}
-enum OrderAction @doc(category: "Payments") {
- """Represents the capture action."""
- CAPTURE
+"""Event delivery attempts."""
+type EventDeliveryAttempt implements Node @doc(category: "Webhooks") {
+ """The ID of Event Delivery Attempt."""
+ id: ID!
- """Represents a mark-as-paid action."""
- MARK_AS_PAID
+ """Event delivery creation date and time."""
+ createdAt: DateTime!
- """Represents a refund action."""
- REFUND
+ """Task id for delivery attempt."""
+ taskId: String
- """Represents a void action."""
- VOID
-}
+ """Delivery attempt duration."""
+ duration: Float
-"""Represents an Invoice."""
-type Invoice implements ObjectWithMetadata & Job & Node @doc(category: "Orders") {
- """List of private metadata items. Requires staff permissions to access."""
- privateMetadata: [MetadataItem!]!
+ """Delivery attempt response content."""
+ response: String
- """
- A single key from private metadata. Requires staff permissions to access.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- privateMetafield(key: String!): String
+ """Response headers for delivery attempt."""
+ responseHeaders: String
- """
- Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- privateMetafields(keys: [String!]): Metadata
+ """Delivery attempt response status code."""
+ responseStatusCode: Int
- """List of public metadata items. Can be accessed without permissions."""
- metadata: [MetadataItem!]!
+ """Request headers for delivery attempt."""
+ requestHeaders: String
- """
- A single key from public metadata.
-
- Tip: Use GraphQL aliases to fetch multiple keys.
- """
- metafield(key: String!): String
+ """Event delivery status."""
+ status: EventDeliveryStatusEnum!
+}
- """
- Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
- """
- metafields(keys: [String!]): Metadata
+input EventDeliveryAttemptSortingInput @doc(category: "Webhooks") {
+ """Specifies the direction in which to sort attempts."""
+ direction: OrderDirection!
- """Job status."""
- status: JobStatusEnum!
+ """Sort attempts by the selected field."""
+ field: EventDeliveryAttemptSortField!
+}
- """Date and time at which invoice was created."""
- createdAt: DateTime!
+enum EventDeliveryAttemptSortField @doc(category: "Webhooks") {
+ """Sort event delivery attempts by created at."""
+ CREATED_AT
+}
- """Date and time at which invoice was updated."""
- updatedAt: DateTime!
+input EventDeliverySortingInput @doc(category: "Webhooks") {
+ """Specifies the direction in which to sort deliveries."""
+ direction: OrderDirection!
- """Message associated with an invoice."""
- message: String
+ """Sort deliveries by the selected field."""
+ field: EventDeliverySortField!
+}
- """The ID of the object."""
- id: ID!
+enum EventDeliverySortField @doc(category: "Webhooks") {
+ """Sort event deliveries by created at."""
+ CREATED_AT
+}
- """Invoice number."""
- number: String
+input EventDeliveryFilterInput {
+ status: EventDeliveryStatusEnum
+ eventType: WebhookEventTypeEnum
+}
- """URL to view an invoice."""
- externalUrl: String @deprecated(reason: "Use `url` field.")
+enum WebhookSampleEventTypeEnum @doc(category: "Webhooks") {
+ ACCOUNT_CONFIRMATION_REQUESTED
+ ACCOUNT_CHANGE_EMAIL_REQUESTED
+ ACCOUNT_EMAIL_CHANGED
+ ACCOUNT_SET_PASSWORD_REQUESTED
+ ACCOUNT_CONFIRMED
+ ACCOUNT_DELETE_REQUESTED
+ ACCOUNT_DELETED
+ ADDRESS_CREATED
+ ADDRESS_UPDATED
+ ADDRESS_DELETED
+ APP_INSTALLED
+ APP_UPDATED
+ APP_DELETED
+ APP_STATUS_CHANGED
+ ATTRIBUTE_CREATED
+ ATTRIBUTE_UPDATED
+ ATTRIBUTE_DELETED
+ ATTRIBUTE_VALUE_CREATED
+ ATTRIBUTE_VALUE_UPDATED
+ ATTRIBUTE_VALUE_DELETED
+ CATEGORY_CREATED
+ CATEGORY_UPDATED
+ CATEGORY_DELETED
+ CHANNEL_CREATED
+ CHANNEL_UPDATED
+ CHANNEL_DELETED
+ CHANNEL_STATUS_CHANGED
+ CHANNEL_METADATA_UPDATED
+ GIFT_CARD_CREATED
+ GIFT_CARD_UPDATED
+ GIFT_CARD_DELETED
+ GIFT_CARD_SENT
+ GIFT_CARD_STATUS_CHANGED
+ GIFT_CARD_METADATA_UPDATED
+ GIFT_CARD_EXPORT_COMPLETED
+ MENU_CREATED
+ MENU_UPDATED
+ MENU_DELETED
+ MENU_ITEM_CREATED
+ MENU_ITEM_UPDATED
+ MENU_ITEM_DELETED
+ ORDER_CREATED
+ ORDER_CONFIRMED
+ ORDER_PAID
+ ORDER_FULLY_PAID
+ ORDER_REFUNDED
+ ORDER_FULLY_REFUNDED
+ ORDER_UPDATED
+ ORDER_CANCELLED
+ ORDER_EXPIRED
+ ORDER_FULFILLED
+ ORDER_METADATA_UPDATED
+ ORDER_BULK_CREATED
+ FULFILLMENT_CREATED
+ FULFILLMENT_CANCELED
+ FULFILLMENT_APPROVED
+ FULFILLMENT_METADATA_UPDATED
+ FULFILLMENT_TRACKING_NUMBER_UPDATED
+ DRAFT_ORDER_CREATED
+ DRAFT_ORDER_UPDATED
+ DRAFT_ORDER_DELETED
+ SALE_CREATED
+ SALE_UPDATED
+ SALE_DELETED
+ SALE_TOGGLE
+ PROMOTION_CREATED
+ PROMOTION_UPDATED
+ PROMOTION_DELETED
+ PROMOTION_STARTED
+ PROMOTION_ENDED
+ PROMOTION_RULE_CREATED
+ PROMOTION_RULE_UPDATED
+ PROMOTION_RULE_DELETED
+ INVOICE_REQUESTED
+ INVOICE_DELETED
+ INVOICE_SENT
+ CUSTOMER_CREATED
+ CUSTOMER_UPDATED
+ CUSTOMER_DELETED
+ CUSTOMER_METADATA_UPDATED
+ COLLECTION_CREATED
+ COLLECTION_UPDATED
+ COLLECTION_DELETED
+ COLLECTION_METADATA_UPDATED
+ PRODUCT_CREATED
+ PRODUCT_UPDATED
+ PRODUCT_DELETED
+ PRODUCT_METADATA_UPDATED
+ PRODUCT_EXPORT_COMPLETED
+ PRODUCT_MEDIA_CREATED
+ PRODUCT_MEDIA_UPDATED
+ PRODUCT_MEDIA_DELETED
+ PRODUCT_VARIANT_CREATED
+ PRODUCT_VARIANT_UPDATED
+ PRODUCT_VARIANT_DELETED
+ PRODUCT_VARIANT_METADATA_UPDATED
+ PRODUCT_VARIANT_OUT_OF_STOCK
+ PRODUCT_VARIANT_BACK_IN_STOCK
+ PRODUCT_VARIANT_STOCK_UPDATED
+ CHECKOUT_CREATED
+ CHECKOUT_UPDATED
+ CHECKOUT_FULLY_AUTHORIZED
+ CHECKOUT_FULLY_PAID
+ CHECKOUT_METADATA_UPDATED
+ NOTIFY_USER
+ PAGE_CREATED
+ PAGE_UPDATED
+ PAGE_DELETED
+ PAGE_TYPE_CREATED
+ PAGE_TYPE_UPDATED
+ PAGE_TYPE_DELETED
+ PERMISSION_GROUP_CREATED
+ PERMISSION_GROUP_UPDATED
+ PERMISSION_GROUP_DELETED
+ SHIPPING_PRICE_CREATED
+ SHIPPING_PRICE_UPDATED
+ SHIPPING_PRICE_DELETED
+ SHIPPING_ZONE_CREATED
+ SHIPPING_ZONE_UPDATED
+ SHIPPING_ZONE_DELETED
+ SHIPPING_ZONE_METADATA_UPDATED
+ STAFF_CREATED
+ STAFF_UPDATED
+ STAFF_DELETED
+ STAFF_SET_PASSWORD_REQUESTED
+ TRANSACTION_ITEM_METADATA_UPDATED
+ TRANSLATION_CREATED
+ TRANSLATION_UPDATED
+ WAREHOUSE_CREATED
+ WAREHOUSE_UPDATED
+ WAREHOUSE_DELETED
+ WAREHOUSE_METADATA_UPDATED
+ VOUCHER_CREATED
+ VOUCHER_UPDATED
+ VOUCHER_DELETED
+ VOUCHER_CODES_CREATED
+ VOUCHER_CODES_DELETED
+ VOUCHER_METADATA_UPDATED
+ VOUCHER_CODE_EXPORT_COMPLETED
+ OBSERVABILITY
+ THUMBNAIL_CREATED
+ SHOP_METADATA_UPDATED
+}
- """URL to view/download an invoice."""
- url: String
+type WarehouseCountableConnection @doc(category: "Products") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [WarehouseCountableEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
+}
+
+type WarehouseCountableEdge @doc(category: "Products") {
+ """The item at the end of the edge."""
+ node: Warehouse!
- """Order related to the invoice."""
- order: Order
+ """A cursor for use in pagination."""
+ cursor: String!
}
-interface Job {
- """Job status."""
- status: JobStatusEnum!
-
- """Created date time of job in ISO 8601 format."""
- createdAt: DateTime!
+input WarehouseFilterInput @doc(category: "Products") {
+ clickAndCollectOption: WarehouseClickAndCollectOptionEnum
+ metadata: [MetadataFilter!]
+ search: String
+ ids: [ID!]
+ isPrivate: Boolean
+ channels: [ID!]
+ slugs: [String!]
+}
- """Date time of job last update in ISO 8601 format."""
- updatedAt: DateTime!
+input WarehouseSortingInput @doc(category: "Products") {
+ """Specifies the direction in which to sort warehouses."""
+ direction: OrderDirection!
- """Job message."""
- message: String
+ """Sort warehouses by the selected field."""
+ field: WarehouseSortField!
}
-enum JobStatusEnum {
- PENDING
- SUCCESS
- FAILED
- DELETED
+enum WarehouseSortField @doc(category: "Products") {
+ """Sort warehouses by name."""
+ NAME
}
-enum OrderOriginEnum @doc(category: "Orders") {
- CHECKOUT
- DRAFT
- REISSUE
- BULK_CREATE
+type TranslatableItemConnection {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [TranslatableItemEdge!]!
+
+ """A total count of items in the collection."""
+ totalCount: Int
}
-enum PaymentChargeStatusEnum @doc(category: "Payments") {
- NOT_CHARGED
- PENDING
- PARTIALLY_CHARGED
- FULLY_CHARGED
- PARTIALLY_REFUNDED
- FULLY_REFUNDED
- REFUSED
- CANCELLED
+type TranslatableItemEdge {
+ """The item at the end of the edge."""
+ node: TranslatableItem!
+
+ """A cursor for use in pagination."""
+ cursor: String!
}
+union TranslatableItem = ProductTranslatableContent | CollectionTranslatableContent | CategoryTranslatableContent | AttributeTranslatableContent | AttributeValueTranslatableContent | ProductVariantTranslatableContent | PageTranslatableContent | ShippingMethodTranslatableContent | VoucherTranslatableContent | MenuItemTranslatableContent | PromotionTranslatableContent | PromotionRuleTranslatableContent | SaleTranslatableContent
+
"""
-Determine a current authorize status for order.
+Represents menu item's original translatable fields and related translations.
+"""
+type MenuItemTranslatableContent implements Node @doc(category: "Menu") {
+ """The ID of the menu item translatable content."""
+ id: ID!
- We treat the order as fully authorized when the sum of authorized and charged funds
- cover the `order.total`-`order.totalGrantedRefund`.
- We treat the order as partially authorized when the sum of authorized and charged
- funds covers only part of the `order.total`-`order.totalGrantedRefund`.
- We treat the order as not authorized when the sum of authorized and charged funds is
- 0.
+ """The ID of the menu item to translate."""
+ menuItemId: ID!
- NONE - the funds are not authorized
- PARTIAL - the funds that are authorized and charged don't cover fully the
- `order.total`-`order.totalGrantedRefund`
- FULL - the funds that are authorized and charged fully cover the
- `order.total`-`order.totalGrantedRefund`
-"""
-enum OrderAuthorizeStatusEnum @doc(category: "Orders") {
- NONE
- PARTIAL
- FULL
+ """Name of the menu item to translate."""
+ name: String!
+
+ """Returns translated menu item fields for the given language code."""
+ translation(
+ """A language code to return the translation for menu item."""
+ languageCode: LanguageCodeEnum!
+ ): MenuItemTranslation
+
+ """
+ Represents a single item of the related menu. Can store categories, collection or pages.
+ """
+ menuItem: MenuItem @deprecated(reason: "Get model fields from the root level queries.")
}
-"""
-Determine the current charge status for the order.
+"""Represents menu item translations."""
+type MenuItemTranslation implements Node @doc(category: "Menu") {
+ """The ID of the menu item translation."""
+ id: ID!
- An order is considered overcharged when the sum of the
- transactionItem's charge amounts exceeds the value of
- `order.total` - `order.totalGrantedRefund`.
- If the sum of the transactionItem's charge amounts equals
- `order.total` - `order.totalGrantedRefund`, we consider the order to be fully
- charged.
- If the sum of the transactionItem's charge amounts covers a part of the
- `order.total` - `order.totalGrantedRefund`, we treat the order as partially charged.
+ """Translation language."""
+ language: LanguageDisplay!
- NONE - the funds are not charged.
- PARTIAL - the funds that are charged don't cover the
- `order.total`-`order.totalGrantedRefund`
- FULL - the funds that are charged fully cover the
- `order.total`-`order.totalGrantedRefund`
- OVERCHARGED - the charged funds are bigger than the
- `order.total`-`order.totalGrantedRefund`
-"""
-enum OrderChargeStatusEnum @doc(category: "Orders") {
- NONE
- PARTIAL
- FULL
- OVERCHARGED
+ """Translated menu item name."""
+ name: String!
+
+ """Represents the menu item fields to translate."""
+ translatableContent: MenuItemTranslatableContent
}
-"""Represents a payment of a given type."""
-type Payment implements Node & ObjectWithMetadata @doc(category: "Payments") {
- """ID of the payment."""
+"""
+Represents a single item of the related menu. Can store categories, collection or pages.
+"""
+type MenuItem implements Node & ObjectWithMetadata @doc(category: "Menu") {
+ """The ID of the menu item."""
id: ID!
"""List of private metadata items. Requires staff permissions to access."""
@@ -11985,897 +12180,816 @@ type Payment implements Node & ObjectWithMetadata @doc(category: "Payments") {
"""
metafields(keys: [String!]): Metadata
- """Payment gateway used for payment."""
- gateway: String!
-
- """Determines if the payment is active or not."""
- isActive: Boolean!
-
- """Date and time at which payment was created."""
- created: DateTime!
-
- """Date and time at which payment was modified."""
- modified: DateTime!
-
- """Unique token associated with a payment."""
- token: String!
-
- """Checkout associated with a payment."""
- checkout: Checkout
-
- """Order associated with a payment."""
- order: Order
-
- """Type of method used for payment."""
- paymentMethodType: String!
-
- """
- IP address of the user who created the payment.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- customerIpAddress: String
-
- """Internal payment status."""
- chargeStatus: PaymentChargeStatusEnum!
-
- """
- List of actions that can be performed in the current state of a payment.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- actions: [OrderAction!]!
-
- """Total amount of the payment."""
- total: Money
-
- """Total amount captured for this payment."""
- capturedAmount: Money
-
- """
- List of all transactions within this payment.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- transactions: [Transaction!]
-
- """
- Maximum amount of money that can be captured.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- availableCaptureAmount: Money
-
- """
- Maximum amount of money that can be refunded.
-
- Requires one of the following permissions: MANAGE_ORDERS.
- """
- availableRefundAmount: Money
-
- """The details of the card used for this payment."""
- creditCard: CreditCard
-
- """Informs whether this is a partial payment."""
- partial: Boolean!
-
- """PSP reference of the payment."""
- pspReference: String
-}
-
-"""An object representing a single payment."""
-type Transaction implements Node @doc(category: "Payments") {
- """ID of the transaction."""
- id: ID!
-
- """Date and time at which transaction was created."""
- created: DateTime!
-
- """Determines the payment associated with a transaction."""
- payment: Payment!
-
- """Unique token associated with a transaction."""
- token: String!
-
- """Determines the type of transaction."""
- kind: TransactionKind!
-
- """Determines if the transaction was successful."""
- isSuccess: Boolean!
+ """The name of the menu item."""
+ name: String!
- """Error associated with transaction, if any."""
- error: String
+ """Represents the menu to which the menu item belongs."""
+ menu: Menu!
- """Response returned by payment gateway."""
- gatewayResponse: JSONString! @deprecated(reason: "This field is a part of a legacy Payments API. Please use apps instead.")
+ """ID of parent menu item. If empty, menu will be top level menu."""
+ parent: MenuItem
- """Total amount of the transaction."""
- amount: Money
-}
+ """Category associated with the menu item."""
+ category: Category
-enum TransactionKind @doc(category: "Payments") {
- EXTERNAL
- AUTH
- PENDING
- ACTION_TO_CONFIRM
- REFUND
- REFUND_ONGOING
- CAPTURE
- VOID
- CONFIRM
- CANCEL
-}
+ """
+ A collection associated with this menu item. Requires one of the following permissions to include the unpublished items: MANAGE_ORDERS, MANAGE_DISCOUNTS, MANAGE_PRODUCTS.
+ """
+ collection: Collection
-type CreditCard @doc(category: "Payments") {
- """Card brand."""
- brand: String!
+ """
+ A page associated with this menu item. Requires one of the following permissions to include unpublished items: MANAGE_PAGES.
+ """
+ page: Page
- """First 4 digits of the card number."""
- firstDigits: String
+ """Indicates the position of the menu item within the menu structure."""
+ level: Int!
- """Last 4 digits of the card number."""
- lastDigits: String!
+ """Represents the child items of the current menu item."""
+ children: [MenuItem!]
- """Two-digit number representing the card’s expiration month."""
- expMonth: Int
+ """URL to the menu item."""
+ url: String
- """Four-digit number representing the card’s expiration year."""
- expYear: Int
+ """Returns translated menu item fields for the given language code."""
+ translation(
+ """A language code to return the translation for menu item."""
+ languageCode: LanguageCodeEnum!
+ ): MenuItemTranslation
}
-"""History log of the order."""
-type OrderEvent implements Node @doc(category: "Orders") {
- """ID of the event associated with an order."""
+"""
+Represents a single menu - an object that is used to help navigate through the store.
+"""
+type Menu implements Node & ObjectWithMetadata @doc(category: "Menu") {
+ """The ID of the menu."""
id: ID!
- """Date when event happened at in ISO 8601 format."""
- date: DateTime
-
- """Order event type."""
- type: OrderEventsEnum
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
- """User who performed the action."""
- user: User
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
"""
- App that performed the action. Requires of of the following permissions: MANAGE_APPS, MANAGE_ORDERS, OWNER.
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- app: App
+ privateMetafields(keys: [String!]): Metadata
- """Content of the event."""
- message: String
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
- """Email of the customer."""
- email: String
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
- """Type of an email sent to the customer."""
- emailType: OrderEventsEmailsEnum
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
- """Amount of money."""
- amount: Float
+ """The name of the menu."""
+ name: String!
- """The payment reference from the payment provider."""
- paymentId: String
+ """Slug of the menu."""
+ slug: String!
- """The payment gateway of the payment."""
- paymentGateway: String
+ """Menu items associated with this menu."""
+ items: [MenuItem!]
+}
- """Number of items."""
- quantity: Int
+"""
+Represents promotion's original translatable fields and related translations.
+"""
+type PromotionTranslatableContent implements Node @doc(category: "Discounts") {
+ """ID of the promotion translatable content."""
+ id: ID!
- """Composed ID of the Fulfillment."""
- composedId: String
+ """ID of the promotion to translate."""
+ promotionId: ID!
- """User-friendly number of an order."""
- orderNumber: String
+ """Name of the promotion."""
+ name: String!
- """Number of an invoice related to the order."""
- invoiceNumber: String
+ """
+ Description of the promotion.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
- """List of oversold lines names."""
- oversoldItems: [String!]
+ """Returns translated promotion fields for the given language code."""
+ translation(
+ """A language code to return the translation for promotion."""
+ languageCode: LanguageCodeEnum!
+ ): PromotionTranslation
+}
- """The concerned lines."""
- lines: [OrderEventOrderLineObject!]
+"""Represents promotion translations."""
+type PromotionTranslation implements Node @doc(category: "Discounts") {
+ """ID of the promotion translation."""
+ id: ID!
- """The lines fulfilled."""
- fulfilledItems: [FulfillmentLine!]
+ """Translation language."""
+ language: LanguageDisplay!
- """The warehouse were items were restocked."""
- warehouse: Warehouse
+ """Translated name of the promotion."""
+ name: String
- """The transaction reference of captured payment."""
- transactionReference: String
+ """
+ Translated description of the promotion.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
- """Define if shipping costs were included to the refund."""
- shippingCostsIncluded: Boolean
+ """Represents the promotion fields to translate."""
+ translatableContent: PromotionTranslatableContent
+}
- """The order which is related to this order."""
- relatedOrder: Order
+"""
+Represents promotion rule's original translatable fields and related translations.
+"""
+type PromotionRuleTranslatableContent implements Node @doc(category: "Discounts") {
+ """ID of the promotion rule translatable content."""
+ id: ID!
- """The order event which is related to this event."""
- related: OrderEvent
+ """ID of the promotion rule to translate."""
+ promotionRuleId: ID!
- """The discount applied to the order."""
- discount: OrderEventDiscountObject
+ """Name of the promotion rule."""
+ name: String
- """The reference of payment's transaction."""
- reference: String
-}
+ """
+ Description of the promotion rule.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
-"""The different order event types."""
-enum OrderEventsEnum @doc(category: "Orders") {
- DRAFT_CREATED
- DRAFT_CREATED_FROM_REPLACE
- ADDED_PRODUCTS
- REMOVED_PRODUCTS
- PLACED
- PLACED_FROM_DRAFT
- PLACED_AUTOMATICALLY_FROM_PAID_CHECKOUT
- OVERSOLD_ITEMS
- CANCELED
- EXPIRED
- ORDER_MARKED_AS_PAID
- ORDER_FULLY_PAID
- ORDER_REPLACEMENT_CREATED
- ORDER_DISCOUNT_ADDED
- ORDER_DISCOUNT_AUTOMATICALLY_UPDATED
- ORDER_DISCOUNT_UPDATED
- ORDER_DISCOUNT_DELETED
- ORDER_LINE_DISCOUNT_UPDATED
- ORDER_LINE_DISCOUNT_REMOVED
- ORDER_LINE_PRODUCT_DELETED
- ORDER_LINE_VARIANT_DELETED
- UPDATED_ADDRESS
- EMAIL_SENT
- CONFIRMED
- PAYMENT_AUTHORIZED
- PAYMENT_CAPTURED
- EXTERNAL_SERVICE_NOTIFICATION
- PAYMENT_REFUNDED
- PAYMENT_VOIDED
- PAYMENT_FAILED
- TRANSACTION_EVENT
- TRANSACTION_CHARGE_REQUESTED
- TRANSACTION_REFUND_REQUESTED
- TRANSACTION_CANCEL_REQUESTED
- TRANSACTION_MARK_AS_PAID_FAILED
- INVOICE_REQUESTED
- INVOICE_GENERATED
- INVOICE_UPDATED
- INVOICE_SENT
- FULFILLMENT_CANCELED
- FULFILLMENT_RESTOCKED_ITEMS
- FULFILLMENT_FULFILLED_ITEMS
- FULFILLMENT_REFUNDED
- FULFILLMENT_RETURNED
- FULFILLMENT_REPLACED
- FULFILLMENT_AWAITS_APPROVAL
- TRACKING_UPDATED
- NOTE_ADDED
- NOTE_UPDATED
- OTHER
+ """Returns translated promotion rule fields for the given language code."""
+ translation(
+ """A language code to return the translation for promotion rule."""
+ languageCode: LanguageCodeEnum!
+ ): PromotionRuleTranslation
}
-enum OrderEventsEmailsEnum @doc(category: "Orders") {
- PAYMENT_CONFIRMATION
- CONFIRMED
- SHIPPING_CONFIRMATION
- TRACKING_UPDATED
- ORDER_CONFIRMATION
- ORDER_CANCEL
- ORDER_REFUND
- FULFILLMENT_CONFIRMATION
- DIGITAL_LINKS
-}
+"""Represents promotion rule translations."""
+type PromotionRuleTranslation implements Node @doc(category: "Discounts") {
+ """ID of the promotion rule translation."""
+ id: ID!
-type OrderEventOrderLineObject @doc(category: "Orders") {
- """The variant quantity."""
- quantity: Int
+ """Translation language."""
+ language: LanguageDisplay!
- """The order line."""
- orderLine: OrderLine
+ """Translated name of the promotion rule."""
+ name: String
- """The variant name."""
- itemName: String
+ """
+ Translated description of the promotion rule.
+
+ Rich text format. For reference see https://editorjs.io/
+ """
+ description: JSONString
- """The discount applied to the order line."""
- discount: OrderEventDiscountObject
+ """Represents the promotion rule fields to translate."""
+ translatableContent: PromotionRuleTranslatableContent
}
-type OrderEventDiscountObject @doc(category: "Orders") {
- """Type of the discount: fixed or percent."""
- valueType: DiscountValueTypeEnum!
-
- """Value of the discount. Can store fixed value or percent value."""
- value: PositiveDecimal!
+"""
+Represents sale's original translatable fields and related translations.
- """Explanation for the applied discount."""
- reason: String
+DEPRECATED: this type will be removed. Use `PromotionTranslatableContent` instead.
+"""
+type SaleTranslatableContent implements Node @doc(category: "Discounts") {
+ """The ID of the sale translatable content."""
+ id: ID!
- """Returns amount of discount."""
- amount: Money
+ """The ID of the sale to translate."""
+ saleId: ID!
- """Type of the discount: fixed or percent."""
- oldValueType: DiscountValueTypeEnum
+ """Name of the sale to translate."""
+ name: String!
- """Value of the discount. Can store fixed value or percent value."""
- oldValue: PositiveDecimal
+ """Returns translated sale fields for the given language code."""
+ translation(
+ """A language code to return the translation for sale."""
+ languageCode: LanguageCodeEnum!
+ ): SaleTranslation
- """Returns amount of discount."""
- oldAmount: Money
+ """
+ Sales allow creating discounts for categories, collections or products and are visible to all the customers.
+
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
+ """
+ sale: Sale @deprecated(reason: "Get model fields from the root level queries.")
}
-"""Contains all details related to the applied discount to the order."""
-type OrderDiscount implements Node @doc(category: "Discounts") {
- """The ID of discount applied."""
+"""
+Represents sale translations.
+
+DEPRECATED: this type will be removed. Use `PromotionTranslation` instead.
+"""
+type SaleTranslation implements Node @doc(category: "Discounts") {
+ """The ID of the sale translation."""
id: ID!
- """The type of applied discount: Sale, Voucher or Manual."""
- type: OrderDiscountType!
+ """Translation language."""
+ language: LanguageDisplay!
- """The name of applied discount."""
+ """Translated name of sale."""
name: String
- """Translated name of the applied discount."""
- translatedName: String
+ """Represents the sale fields to translate."""
+ translatableContent: SaleTranslatableContent
+}
- """Type of the discount: fixed or percent"""
- valueType: DiscountValueTypeEnum!
+"""
+Sales allow creating discounts for categories, collections or products and are visible to all the customers.
- """Value of the discount. Can store fixed value or percent value"""
- value: PositiveDecimal!
+DEPRECATED: this type will be removed. Use `Promotion` type instead.
+"""
+type Sale implements Node & ObjectWithMetadata @doc(category: "Discounts") {
+ """The ID of the sale."""
+ id: ID!
+
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
"""
- Explanation for the applied discount.
+ A single key from private metadata. Requires staff permissions to access.
- Requires one of the following permissions: MANAGE_ORDERS.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- reason: String
+ privateMetafield(key: String!): String
- """Returns amount of discount."""
- amount: Money! @deprecated(reason: "Use `total` instead.")
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
+
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
"""
- The amount of discount applied to the order.
+ A single key from public metadata.
- Added in Saleor 3.21.
+ Tip: Use GraphQL aliases to fetch multiple keys.
"""
- total: Money!
-}
+ metafield(key: String!): String
-type OrderError @doc(category: "Orders") {
"""
- Name of a field that caused the error. A value of `null` indicates that the error isn't associated with a particular field.
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
"""
- field: String
+ metafields(keys: [String!]): Metadata
- """The error message."""
- message: String
+ """The name of the sale."""
+ name: String!
- """The error code."""
- code: OrderErrorCode!
+ """Type of the sale, fixed or percentage."""
+ type: SaleType!
- """Warehouse ID which causes the error."""
- warehouse: ID
+ """The start date and time of the sale."""
+ startDate: DateTime!
- """List of order line IDs that cause the error."""
- orderLines: [ID!]
+ """The end date and time of the sale."""
+ endDate: DateTime
- """List of product variants that are associated with the error"""
- variants: [ID!]
+ """The date and time when the sale was created."""
+ created: DateTime!
- """A type of address that causes the error."""
- addressType: AddressTypeEnum
-}
+ """The date and time when the sale was updated."""
+ updatedAt: DateTime!
-enum OrderErrorCode @doc(category: "Orders") {
- BILLING_ADDRESS_NOT_SET
- CANNOT_CANCEL_FULFILLMENT
- CANNOT_CANCEL_ORDER
- CANNOT_DELETE
- CANNOT_DISCOUNT
- CANNOT_REFUND
- CANNOT_FULFILL_UNPAID_ORDER
- CAPTURE_INACTIVE_PAYMENT
- GIFT_CARD_LINE
- NOT_EDITABLE
- FULFILL_ORDER_LINE
- GRAPHQL_ERROR
- INVALID
- PRODUCT_NOT_PUBLISHED
- PRODUCT_UNAVAILABLE_FOR_PURCHASE
- NOT_FOUND
- ORDER_NO_SHIPPING_ADDRESS
- PAYMENT_ERROR
- PAYMENT_MISSING
- TRANSACTION_ERROR
- REQUIRED
- SHIPPING_METHOD_NOT_APPLICABLE
- SHIPPING_METHOD_REQUIRED
- TAX_ERROR
- UNIQUE
- VOID_INACTIVE_PAYMENT
- ZERO_QUANTITY
- INVALID_QUANTITY
- INSUFFICIENT_STOCK
- DUPLICATED_INPUT_ITEM
- NOT_AVAILABLE_IN_CHANNEL
- CHANNEL_INACTIVE
- INVALID_VOUCHER
- INVALID_VOUCHER_CODE
- NON_EDITABLE_GIFT_LINE
- NON_REMOVABLE_GIFT_LINE
- MISSING_ADDRESS_DATA
-}
+ """List of categories this sale applies to."""
+ categories(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
-enum AddressTypeEnum {
- BILLING
- SHIPPING
-}
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
-"""The details of granted refund."""
-type OrderGrantedRefund @doc(category: "Orders") {
- id: ID!
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
- """Time of creation."""
- createdAt: DateTime!
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): CategoryCountableConnection
- """Time of last update."""
- updatedAt: DateTime!
+ """
+ List of collections this sale applies to.
+
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
+ """
+ collections(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
- """Refund amount."""
- amount: Money!
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
+
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
+
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): CollectionCountableConnection
"""
- Reason of the refund.
+ List of products this sale applies to.
- Added in Saleor 3.22.
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
"""
- reason: String
+ products(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
+
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
+
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
+
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): ProductCountableConnection
"""
- Reason Model (Page) reference for refund.
+ List of product variants this sale applies to.
- Added in Saleor 3.22.
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
"""
- reasonReference: Page
+ variants(
+ """Return the elements in the list that come before the specified cursor."""
+ before: String
- """
- User who performed the action. Requires of of the following permissions: MANAGE_USERS, MANAGE_STAFF, OWNER.
- """
- user: User
+ """Return the elements in the list that come after the specified cursor."""
+ after: String
- """App that performed the action."""
- app: App
+ """
+ Retrieve the first n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ first: Int
- """
- If true, the refunded amount includes the shipping price.If false, the refunded amount does not include the shipping price.
- """
- shippingCostsIncluded: Boolean!
+ """
+ Retrieve the last n elements from the list. Note that the system only allows fetching a maximum of 100 objects in a single query.
+ """
+ last: Int
+ ): ProductVariantCountableConnection
- """Lines assigned to the granted refund."""
- lines: [OrderGrantedRefundLine!]
+ """Returns translated sale fields for the given language code."""
+ translation(
+ """A language code to return the translation for sale."""
+ languageCode: LanguageCodeEnum!
+ ): SaleTranslation
"""
- Status of the granted refund calculated based on transactionItem assigned to granted refund.
+ List of channels available for the sale.
- Added in Saleor 3.20.
+ Requires one of the following permissions: MANAGE_DISCOUNTS.
"""
- status: OrderGrantedRefundStatusEnum!
+ channelListings: [SaleChannelListing!]
- """
- List of refund events associated with the granted refund.
-
- Added in Saleor 3.20.
- """
- transactionEvents: [TransactionEvent!]
+ """Sale value."""
+ discountValue: Float
- """
- The transaction assigned to the granted refund.
-
- Added in Saleor 3.20.
- """
- transaction: TransactionItem
+ """Currency code for sale."""
+ currency: String
}
-"""Represents granted refund line."""
-type OrderGrantedRefundLine {
- id: ID!
-
- """Number of items to refund."""
- quantity: Int!
-
- """Line of the order associated with this granted refund."""
- orderLine: OrderLine!
-
- """Reason for refunding the line."""
- reason: String
+enum SaleType @doc(category: "Discounts") {
+ FIXED
+ PERCENTAGE
}
"""
-Represents the status of a granted refund.
+Represents sale channel listing.
- NONE - the refund on related transactionItem is not processed
- PENDING - the refund on related transactionItem is pending
- FULL - the refund on related transactionItem is fully processed
- FAIL - the refund on related transactionItem failed
+DEPRECATED: this type will be removed. Use `PromotionRule` type instead.
"""
-enum OrderGrantedRefundStatusEnum @doc(category: "Orders") {
- NONE
- PENDING
- SUCCESS
- FAILURE
-}
-
-"""Represents transaction's event."""
-type TransactionEvent implements Node @doc(category: "Payments") {
- """The ID of the object."""
+type SaleChannelListing implements Node @doc(category: "Discounts") {
+ """The ID of the channel listing."""
id: ID!
- """Date and time at which a transaction event was created."""
- createdAt: DateTime!
+ """The channel in which the sale is available."""
+ channel: Channel!
- """PSP reference of transaction."""
- pspReference: String!
+ """The value of the discount applied to the sale in the channel."""
+ discountValue: Float!
- """Message related to the transaction's event."""
- message: String!
+ """The currency in which the discount value is specified."""
+ currency: String!
+}
- """
- Reason model of the transaction refund.
-
- Added in Saleor 3.22.
- """
- reasonReference: Page
+enum TranslatableKinds {
+ ATTRIBUTE
+ ATTRIBUTE_VALUE
+ CATEGORY
+ COLLECTION
+ MENU_ITEM
+ PAGE
+ PRODUCT
+ PROMOTION
+ PROMOTION_RULE
+ SALE
+ SHIPPING_METHOD
+ VARIANT
+ VOUCHER
+}
- """
- The url that will allow to redirect user to payment provider page with transaction details.
- """
- externalUrl: String!
+type TaxConfigurationCountableConnection @doc(category: "Taxes") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [TaxConfigurationCountableEdge!]!
- """The amount related to this event."""
- amount: Money!
+ """A total count of items in the collection."""
+ totalCount: Int
+}
- """The type of action related to this event."""
- type: TransactionEventTypeEnum
+type TaxConfigurationCountableEdge @doc(category: "Taxes") {
+ """The item at the end of the edge."""
+ node: TaxConfiguration!
- """User or App that created the transaction event."""
- createdBy: UserOrApp
+ """A cursor for use in pagination."""
+ cursor: String!
+}
- """Idempotency key assigned to the event."""
- idempotencyKey: String
+input TaxConfigurationFilterInput @doc(category: "Taxes") {
+ metadata: [MetadataFilter!]
+ ids: [ID!]
}
-"""
-Represents possible event types.
+type TaxClassCountableConnection @doc(category: "Taxes") {
+ """Pagination data for this connection."""
+ pageInfo: PageInfo!
+ edges: [TaxClassCountableEdge!]!
- Added in Saleor 3.12.
+ """A total count of items in the collection."""
+ totalCount: Int
+}
- The following types are possible:
- AUTHORIZATION_SUCCESS - represents success authorization.
- AUTHORIZATION_FAILURE - represents failure authorization.
- AUTHORIZATION_ADJUSTMENT - represents authorization adjustment.
- AUTHORIZATION_REQUEST - represents authorization request.
- AUTHORIZATION_ACTION_REQUIRED - represents authorization that needs
- additional actions from the customer.
- CHARGE_ACTION_REQUIRED - represents charge that needs
- additional actions from the customer.
- CHARGE_SUCCESS - represents success charge.
- CHARGE_FAILURE - represents failure charge.
- CHARGE_BACK - represents chargeback.
- CHARGE_REQUEST - represents charge request.
- REFUND_SUCCESS - represents success refund.
- REFUND_FAILURE - represents failure refund.
- REFUND_REVERSE - represents reverse refund.
- REFUND_REQUEST - represents refund request.
- CANCEL_SUCCESS - represents success cancel.
- CANCEL_FAILURE - represents failure cancel.
- CANCEL_REQUEST - represents cancel request.
- INFO - represents info event.
-"""
-enum TransactionEventTypeEnum @doc(category: "Payments") {
- AUTHORIZATION_SUCCESS
- AUTHORIZATION_FAILURE
- AUTHORIZATION_ADJUSTMENT
- AUTHORIZATION_REQUEST
- AUTHORIZATION_ACTION_REQUIRED
- CHARGE_ACTION_REQUIRED
- CHARGE_SUCCESS
- CHARGE_FAILURE
- CHARGE_BACK
- CHARGE_REQUEST
- REFUND_SUCCESS
- REFUND_FAILURE
- REFUND_REVERSE
- REFUND_REQUEST
- CANCEL_SUCCESS
- CANCEL_FAILURE
- CANCEL_REQUEST
- INFO
+type TaxClassCountableEdge @doc(category: "Taxes") {
+ """The item at the end of the edge."""
+ node: TaxClass!
+
+ """A cursor for use in pagination."""
+ cursor: String!
}
-union UserOrApp = User | App
+input TaxClassSortingInput @doc(category: "Taxes") {
+ """Specifies the direction in which to sort tax classes."""
+ direction: OrderDirection!
-"""
-Represents a payment method used for a transaction.
+ """Sort tax classes by the selected field."""
+ field: TaxClassSortField!
+}
-Added in Saleor 3.22.
-"""
-interface PaymentMethodDetails {
- """Name of the payment method."""
- name: String!
+enum TaxClassSortField @doc(category: "Taxes") {
+ """Sort tax classes by name."""
+ NAME
}
-"""
-Determine a current authorize status for checkout.
+input TaxClassFilterInput @doc(category: "Taxes") {
+ metadata: [MetadataFilter!]
+ ids: [ID!]
+ countries: [CountryCode!]
+}
- We treat the checkout as fully authorized when the sum of authorized and charged
- funds cover the checkout.total.
- We treat the checkout as partially authorized when the sum of authorized and charged
- funds covers only part of the checkout.total
- We treat the checkout as not authorized when the sum of authorized and charged funds
- is 0.
+"""Tax class rates grouped by country."""
+type TaxCountryConfiguration @doc(category: "Taxes") {
+ """A country for which tax class rates are grouped."""
+ country: CountryDisplay!
- NONE - the funds are not authorized
- PARTIAL - the cover funds don't cover fully the checkout's total
- FULL - the cover funds covers the checkout's total
-"""
-enum CheckoutAuthorizeStatusEnum @doc(category: "Checkout") {
- NONE
- PARTIAL
- FULL
+ """List of tax class rates."""
+ taxClassCountryRates: [TaxClassCountryRate!]!
+}
+
+input StockFilterInput @doc(category: "Products") {
+ quantity: Float
+ search: String
}
"""
-Determine the current charge status for the checkout.
+Represents a shop resource containing general shop data and configuration.
+"""
+type Shop implements ObjectWithMetadata {
+ """List of private metadata items. Requires staff permissions to access."""
+ privateMetadata: [MetadataItem!]!
- The checkout is considered overcharged when the sum of the transactionItem's charge
- amounts exceeds the value of `checkout.total`.
- If the sum of the transactionItem's charge amounts equals
- `checkout.total`, we consider the checkout to be fully charged.
- If the sum of the transactionItem's charge amounts covers a part of the
- `checkout.total`, we treat the checkout as partially charged.
+ """
+ A single key from private metadata. Requires staff permissions to access.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ privateMetafield(key: String!): String
+ """
+ Private metadata. Requires staff permissions to access. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ privateMetafields(keys: [String!]): Metadata
- NONE - the funds are not charged.
- PARTIAL - the funds that are charged don't cover the checkout's total
- FULL - the funds that are charged fully cover the checkout's total
- OVERCHARGED - the charged funds are bigger than checkout's total
-"""
-enum CheckoutChargeStatusEnum @doc(category: "Checkout") {
- NONE
- PARTIAL
- FULL
- OVERCHARGED
-}
+ """List of public metadata items. Can be accessed without permissions."""
+ metadata: [MetadataItem!]!
-"""
-Represents a payment method stored for user (tokenized) in payment gateway.
-"""
-type StoredPaymentMethod @doc(category: "Payments") {
- """Stored payment method ID."""
+ """
+ A single key from public metadata.
+
+ Tip: Use GraphQL aliases to fetch multiple keys.
+ """
+ metafield(key: String!): String
+
+ """
+ Public metadata. Use `keys` to control which fields you want to include. The default is to include everything.
+ """
+ metafields(keys: [String!]): Metadata
+
+ """ID of the shop."""
id: ID!
- """Payment gateway that stores this payment method."""
- gateway: PaymentGateway!
+ """List of available payment gateways."""
+ availablePaymentGateways(
+ """A currency for which gateways will be returned."""
+ currency: String @deprecated(reason: "Use `channel` argument instead.")
+
+ """Slug of a channel for which the data should be returned."""
+ channel: String
+ ): [PaymentGateway!]!
+
+ """List of available external authentications."""
+ availableExternalAuthentications: [ExternalAuthentication!]!
+
+ """Shipping methods that are available for the shop."""
+ availableShippingMethods(
+ """Slug of a channel for which the data should be returned."""
+ channel: String!
+
+ """Address for which available shipping methods should be returned."""
+ address: AddressInput
+ ): [ShippingMethod!]
"""
- ID of stored payment method used to make payment actions. Note: method ID is unique only within the payment gateway.
+ List of all currencies supported by shop's channels.
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
"""
- paymentMethodId: String!
+ channelCurrencies: [String!]!
- """Stored credit card details if available."""
- creditCardInfo: CreditCard
- supportedPaymentFlows: [TokenizedPaymentFlowEnum!]
+ """List of countries available in the shop."""
+ countries(
+ """A language code to return the translation for."""
+ languageCode: LanguageCodeEnum @deprecated
- """Type of the payment method. Example: credit card, wallet, etc."""
- type: String!
+ """Filtering options for countries"""
+ filter: CountryFilterInput
+ ): [CountryDisplay!]!
+
+ """Shop's default country."""
+ defaultCountry: CountryDisplay
"""
- Payment method name. Example: last 4 digits of credit card, obfuscated email, etc.
+ Default shop's email sender's name.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
"""
- name: String
+ defaultMailSenderName: String
- """JSON data returned by Payment Provider app for this payment method."""
- data: JSON
-}
+ """
+ Default shop's email sender's address.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ defaultMailSenderAddress: String
-"""
-Represents possible tokenized payment flows that can be used to process payment.
+ """Shop's description."""
+ description: String
- The following flows are possible:
- INTERACTIVE - Payment method can be used for 1 click checkout - it's prefilled in
- checkout form (might require additional authentication from user)
-"""
-enum TokenizedPaymentFlowEnum @doc(category: "Payments") {
- INTERACTIVE
-}
+ """Shop's domain data."""
+ domain: Domain!
-"""Represents an problem in the checkout."""
-union CheckoutProblem = CheckoutProblemDeliveryMethodStale | CheckoutProblemDeliveryMethodInvalid | CheckoutLineProblemInsufficientStock | CheckoutLineProblemVariantNotAvailable
+ """List of the shops's supported languages."""
+ languages: [LanguageDisplay!]!
-"""
-Indicates that the delivery methods are stale.
+ """Shop's name."""
+ name: String!
-Added in Saleor 3.23.
-"""
-type CheckoutProblemDeliveryMethodStale @doc(category: "Checkout") {
- delivery: Delivery!
-}
+ """List of available permissions."""
+ permissions: [Permission!]!
-"""
-Indicates that the selected delivery method is invalid.
+ """List of possible phone prefixes."""
+ phonePrefixes: [String!]!
-Added in Saleor 3.23.
-"""
-type CheckoutProblemDeliveryMethodInvalid @doc(category: "Checkout") {
- delivery: Delivery!
-}
+ """Header text."""
+ headerText: String
-type CheckoutCountableConnection @doc(category: "Checkout") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [CheckoutCountableEdge!]!
+ """Automatically approve all new fulfillments."""
+ fulfillmentAutoApprove: Boolean!
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """Allow to approve fulfillments which are unpaid."""
+ fulfillmentAllowUnpaid: Boolean!
-type CheckoutCountableEdge @doc(category: "Checkout") {
- """The item at the end of the edge."""
- node: Checkout!
+ """
+ This field is used as a default value for `ProductVariant.trackInventory`.
+ """
+ trackInventoryByDefault: Boolean
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """Default weight unit."""
+ defaultWeightUnit: WeightUnitsEnum
-type GiftCardCountableConnection @doc(category: "Gift cards") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [GiftCardCountableEdge!]!
+ """Returns translated shop fields for the given language code."""
+ translation(
+ """A language code to return the translation for shop."""
+ languageCode: LanguageCodeEnum!
+ ): ShopTranslation
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """
+ Enable automatic fulfillment for all digital products.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ automaticFulfillmentDigitalProducts: Boolean
-type GiftCardCountableEdge @doc(category: "Gift cards") {
- """The item at the end of the edge."""
- node: GiftCard!
+ """
+ Default number of minutes stock will be reserved for anonymous checkout or null when stock reservation is disabled.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ reserveStockDurationAnonymousUser: Int
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """
+ Default number of minutes stock will be reserved for authenticated checkout or null when stock reservation is disabled.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ reserveStockDurationAuthenticatedUser: Int
-type OrderCountableConnection @doc(category: "Orders") {
- """Pagination data for this connection."""
- pageInfo: PageInfo!
- edges: [OrderCountableEdge!]!
+ """
+ Default number of maximum line quantity in single checkout (per single checkout line).
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ limitQuantityPerCheckout: Int
- """A total count of items in the collection."""
- totalCount: Int
-}
+ """
+ Default number of max downloads per digital content URL.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ defaultDigitalMaxDownloads: Int
-type OrderCountableEdge @doc(category: "Orders") {
- """The item at the end of the edge."""
- node: Order!
+ """
+ Default number of days which digital content URL will be valid.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ defaultDigitalUrlValidDays: Int
- """A cursor for use in pagination."""
- cursor: String!
-}
+ """Company address."""
+ companyAddress: Address
-"""Represents user's permissions."""
-type UserPermission @doc(category: "Users") {
- """Internal code for permission."""
- code: PermissionEnum!
+ """URL of a view where customers can set their password."""
+ customerSetPasswordUrl: String
- """Describe action(s) allowed to do by permission."""
- name: String!
+ """
+ List of staff notification recipients.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ staffNotificationRecipients: [StaffNotificationRecipient!]
- """List of user permission groups which contains this permission."""
- sourcePermissionGroups(
- """ID of user whose groups should be returned."""
- userId: ID!
- ): [Group!]
-}
+ """
+ Determines if account confirmation by email is enabled.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ enableAccountConfirmationByEmail: Boolean
-"""Represents permission group data."""
-type Group implements Node @doc(category: "Users") {
- """The ID of the group."""
- id: ID!
+ """
+ Determines if user can login without confirmation when `enableAccountConfirmation` is enabled.
+
+ Requires one of the following permissions: MANAGE_SETTINGS.
+ """
+ allowLoginWithoutConfirmation: Boolean
- """The name of the group."""
- name: String!
+ """
+ Resource limitations and current usage if any set for a shop
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER.
+ """
+ limits: LimitInfo! @deprecated
"""
- List of group users
+ Saleor API version.
- Requires one of the following permissions: MANAGE_STAFF.
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, AUTHENTICATED_APP.
"""
- users: [User!]
+ version: String!
- """List of group permissions"""
- permissions: [Permission!]
+ """Minor Saleor API version."""
+ schemaVersion: String!
"""
- True, if the currently authenticated user has rights to manage a group.
+ List of tax apps that can be assigned to the channel. The list will be calculated by Saleor based on the apps that are subscribed to webhooks related to tax calculations: CHECKOUT_CALCULATE_TAXES
+
+ Added in Saleor 3.19.
+
+ Requires one of the following permissions: AUTHENTICATED_STAFF_USER, MANAGE_APPS.
"""
- userCanManage: Boolean!
+ availableTaxApps: [App!]!
- """List of channels the group has access to."""
- accessibleChannels: [Channel!]
+ """Include taxes in prices."""
+ includeTaxesInPrices: Boolean! @deprecated(reason: "Use `Channel.taxConfiguration.pricesEnteredWithTax` to determine whether prices are entered with tax.")
- """Determine if the group have restricted access to channels."""
- restrictedAccessToChannels: Boolean!
+ """Display prices with tax in store."""
+ displayGrossPrices: Boolean! @deprecated(reason: "Use `Channel.taxConfiguration` to determine whether to display gross or net prices.")
+
+ """Charge taxes on shipping."""
+ chargeTaxesOnShipping: Boolean! @deprecated(reason: "Use `ShippingMethodType.taxClass` to determine whether taxes are calculated for shipping methods; if a tax class is set, the taxes will be calculated, otherwise no tax rate will be applied.")
+
+ """
+ Use legacy update webhook emission. When enabled, update webhooks (e.g. `customerUpdated`,`productVariantUpdated`) are sent even when only metadata changes. When disabled, update webhooks are not sent for metadata-only changes; only metadata-specific webhooks (e.g., `customerMetadataUpdated`, `productVariantMetadataUpdated`) are sent.
+
+ Added in Saleor 3.22.
+ """
+ useLegacyUpdateWebhookEmission: Boolean @deprecated
}
-"""History log of the customer."""
-type CustomerEvent implements Node @doc(category: "Users") {
- """The ID of the customer event."""
- id: ID!
+"""External authentication plugin."""
+type ExternalAuthentication @doc(category: "Authentication") {
+ """ID of external authentication plugin."""
+ id: String!
- """Date when event happened at in ISO 8601 format."""
- date: DateTime
+ """Name of external authentication plugin."""
+ name: String
+}
- """Customer event type."""
- type: CustomerEventsEnum
+input CountryFilterInput {
+ """
+ Boolean for filtering countries by having shipping zone assigned.If 'true', return countries with shipping zone assigned.If 'false', return countries without any shipping zone assigned.If the argument is not provided (null), return all countries.
+ """
+ attachedToShippingZones: Boolean
+}
- """User who performed the action."""
- user: User
+"""Represents API domain."""
+type Domain {
+ """The host name of the domain."""
+ host: String!
- """App that performed the action."""
- app: App
+ """Inform if SSL is enabled."""
+ sslEnabled: Boolean!
- """Content of the event."""
- message: String
+ """The absolute URL of the API."""
+ url: String!
+}
- """Number of objects concerned by the event."""
- count: Int
+"""Represents shop translations."""
+type ShopTranslation implements Node @doc(category: "Shop") {
+ """The ID of the shop translation."""
+ id: ID!
- """The concerned order."""
- order: Order
+ """Translation language."""
+ language: LanguageDisplay!
- """The concerned order line."""
- orderLine: OrderLine
-}
+ """Translated header text of sale."""
+ headerText: String!
-enum CustomerEventsEnum @doc(category: "Users") {
- ACCOUNT_CREATED
- ACCOUNT_ACTIVATED
- ACCOUNT_DEACTIVATED
- PASSWORD_RESET_LINK_SENT
- PASSWORD_RESET
- EMAIL_CHANGED_REQUEST
- PASSWORD_CHANGED
- EMAIL_CHANGED
- PLACED_ORDER
- NOTE_ADDED_TO_ORDER
- DIGITAL_LINK_DOWNLOADED
- CUSTOMER_DELETED
- NAME_ASSIGNED
- EMAIL_ASSIGNED
- NOTE_ADDED
+ """Translated description of sale."""
+ description: String!
}
"""
-Represents a payment source stored for user in payment gateway, such as credit card.
+Represents a recipient of email notifications send by Saleor, such as notifications about new orders. Notifications can be assigned to staff users or arbitrary email addresses.
"""
-type PaymentSource @doc(category: "Payments") {
- """Payment gateway name."""
- gateway: String!
+type StaffNotificationRecipient implements Node {
+ """The ID of the staff notification recipient."""
+ id: ID!
- """ID of stored payment method."""
- paymentMethodId: String
+ """Returns a user subscribed to email notifications."""
+ user: User
- """Stored credit card details if available."""
- creditCardInfo: CreditCard
+ """Returns email address of a user subscribed to email notifications."""
+ email: String
- """
- List of public metadata items.
-
- Can be accessed without permissions.
- """
- metadata: [MetadataItem!]!
+ """Determines if a notification active."""
+ active: Boolean
}
"""Store the current and allowed usage."""
@@ -19179,6 +19293,30 @@ type Mutation {
id: ID!
): AppDeactivate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_STATUS_CHANGED], syncEvents: [])
+ """
+ Add a problem to the calling app.
+
+ Added in Saleor 3.22.
+
+ Requires one of the following permissions: AUTHENTICATED_APP.
+ """
+ appProblemCreate(
+ """Fields required to create an app problem."""
+ input: AppProblemCreateInput!
+ ): AppProblemCreate @doc(category: "Apps")
+
+ """
+ Dismiss problems for an app.
+
+ Added in Saleor 3.22.
+
+ Requires one of the following permissions: MANAGE_APPS, AUTHENTICATED_APP.
+ """
+ appProblemDismiss(
+ """Input for dismissing app problems."""
+ input: AppProblemDismissInput!
+ ): AppProblemDismiss @doc(category: "Apps")
+
"""
Re-enable sync webhooks for provided app. Can be used to manually re-enable sync webhooks for the app before the cooldown period ends.
@@ -30037,6 +30175,129 @@ type AppDeactivate @doc(category: "Apps") @webhookEventsInfo(asyncEvents: [APP_S
app: App
}
+"""
+Add a problem to the calling app.
+
+Added in Saleor 3.22.
+
+Requires one of the following permissions: AUTHENTICATED_APP.
+"""
+type AppProblemCreate @doc(category: "Apps") {
+ """The created or updated app problem."""
+ appProblem: AppProblem
+ errors: [AppProblemCreateError!]!
+}
+
+type AppProblemCreateError {
+ """
+ Name of a field that caused the error. A value of `null` indicates that the error isn't associated with a particular field.
+ """
+ field: String
+
+ """The error message."""
+ message: String
+
+ """The error code."""
+ code: AppProblemCreateErrorCode!
+}
+
+enum AppProblemCreateErrorCode {
+ GRAPHQL_ERROR
+ INVALID
+ REQUIRED
+ NOT_FOUND
+}
+
+input AppProblemCreateInput {
+ """
+ The problem message to display. Must be at least 3 characters. Messages longer than 2048 characters will be truncated to 2048 characters with '...' suffix.
+ """
+ message: String!
+
+ """
+ Key identifying the type of problem. App can add multiple problems under the same key, to merge them together or delete them in batch. Must be between 3 and 128 characters.
+ """
+ key: String!
+
+ """
+ If set, the problem becomes critical when count reaches this value. If sent again with higher value than already counted, problem can be de-escalated.
+ """
+ criticalThreshold: PositiveInt
+
+ """
+ Time window in minutes for aggregating problems with the same key. Defaults to 60. If 0, a new problem is always created.
+ """
+ aggregationPeriod: Minute = 60
+}
+
+"""
+Dismiss problems for an app.
+
+Added in Saleor 3.22.
+
+Requires one of the following permissions: MANAGE_APPS, AUTHENTICATED_APP.
+"""
+type AppProblemDismiss @doc(category: "Apps") {
+ errors: [AppProblemDismissError!]!
+}
+
+type AppProblemDismissError {
+ """
+ Name of a field that caused the error. A value of `null` indicates that the error isn't associated with a particular field.
+ """
+ field: String
+
+ """The error message."""
+ message: String
+
+ """The error code."""
+ code: AppProblemDismissErrorCode!
+}
+
+enum AppProblemDismissErrorCode {
+ GRAPHQL_ERROR
+ INVALID
+ REQUIRED
+ NOT_FOUND
+ OUT_OF_SCOPE_APP
+}
+
+"""Input for dismissing app problems. Only one can be specified."""
+input AppProblemDismissInput @doc(category: "Apps") {
+ """For app callers only - dismiss own problems."""
+ byApp: AppProblemDismissByAppInput
+
+ """For staff callers - dismiss problems by IDs."""
+ byStaffWithIds: AppProblemDismissByStaffWithIdsInput
+
+ """For staff callers - dismiss problems by keys for specified app."""
+ byStaffWithKeys: AppProblemDismissByStaffWithKeysInput
+}
+
+"""Input for app callers to dismiss their own problems."""
+input AppProblemDismissByAppInput @doc(category: "Apps") {
+ """List of problem IDs to dismiss. Cannot be combined with keys. Max 100."""
+ ids: [ID!]
+
+ """List of problem keys to dismiss. Cannot be combined with ids. Max 100."""
+ keys: [String!]
+}
+
+"""Input for staff callers to dismiss problems by IDs."""
+input AppProblemDismissByStaffWithIdsInput @doc(category: "Apps") {
+ """List of problem IDs to dismiss. Max 100."""
+ ids: [ID!]!
+}
+
+"""Input for staff callers to dismiss problems by keys."""
+input AppProblemDismissByStaffWithKeysInput @doc(category: "Apps") {
+ """List of problem keys to dismiss. Max 100."""
+ keys: [String!]!
+
+ """ID of the app whose problems to dismiss."""
+ app: ID!
+}
+
"""
Re-enable sync webhooks for provided app. Can be used to manually re-enable sync webhooks for the app before the cooldown period ends.
diff --git a/saleor/graphql/tests/test_error.py b/saleor/graphql/tests/test_error.py
new file mode 100644
index 0000000000..865ed0eb62
--- /dev/null
+++ b/saleor/graphql/tests/test_error.py
@@ -0,0 +1,74 @@
+from typing import Annotated
+
+import pytest
+from pydantic import BaseModel, Field, StringConstraints
+from pydantic import ValidationError as PydanticValidationError
+
+from ..error import pydantic_to_validation_error
+
+
+class SampleModel(BaseModel):
+ name: Annotated[str, StringConstraints(min_length=3)]
+ age: Annotated[int, Field(ge=0)]
+
+
+def test_pydantic_to_validation_error_single_field():
+ # given
+ with pytest.raises(PydanticValidationError) as exc_info:
+ SampleModel(name="ab", age=5)
+
+ # when
+ error = pydantic_to_validation_error(exc_info.value)
+
+ # then
+ assert error.message_dict == {
+ "name": ["String should have at least 3 characters"],
+ }
+ assert error.error_dict["name"][0].code == "invalid"
+
+
+def test_pydantic_to_validation_error_multiple_fields():
+ # given
+ with pytest.raises(PydanticValidationError) as exc_info:
+ SampleModel(name="ab", age=-1)
+
+ # when
+ error = pydantic_to_validation_error(exc_info.value)
+
+ # then
+ assert error.message_dict == {
+ "name": ["String should have at least 3 characters"],
+ "age": ["Input should be greater than or equal to 0"],
+ }
+ assert error.error_dict["name"][0].code == "invalid"
+ assert error.error_dict["age"][0].code == "invalid"
+
+
+def test_pydantic_to_validation_error_uses_default_error_code():
+ # given
+ with pytest.raises(PydanticValidationError) as exc_info:
+ SampleModel(name="ab", age=5)
+
+ # when
+ error = pydantic_to_validation_error(exc_info.value)
+
+ # then
+ assert error.message_dict == {
+ "name": ["String should have at least 3 characters"],
+ }
+ assert error.error_dict["name"][0].code == "invalid"
+
+
+def test_pydantic_to_validation_error_uses_custom_error_code():
+ # given
+ with pytest.raises(PydanticValidationError) as exc_info:
+ SampleModel(name="ab", age=5)
+
+ # when
+ error = pydantic_to_validation_error(exc_info.value, error_code="custom_code")
+
+ # then
+ assert error.message_dict == {
+ "name": ["String should have at least 3 characters"],
+ }
+ assert error.error_dict["name"][0].code == "custom_code"