repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
saleor | saleor/graphql/checkout/utils.py | .py | import graphene
from django.core.exceptions import ValidationError
from ...core.exceptions import CircularSubscriptionSyncEvent
from ...webhook.event_types import WebhookEventSyncType
def prepare_insufficient_stock_checkout_validation_error(exc):
variants = [str(item.variant) for item in exc.items]
variant_i... | 47 | 1,724 |
saleor | saleor/graphql/checkout/resolvers.py | .py | from uuid import UUID
from ...checkout import models
from ...core.exceptions import PermissionDenied
from ...permission.enums import (
AccountPermissions,
CheckoutPermissions,
PaymentPermissions,
)
from ..channel.dataloaders.by_self import ChannelByIdLoader
from ..core.context import SyncWebhookControlCont... | 84 | 2,867 |
saleor | saleor/graphql/checkout/filters.py | .py | from uuid import UUID
import django_filters
from django.core.exceptions import ValidationError
from django.db.models import Exists, OuterRef, Q
from ...account.models import User
from ...checkout.models import Checkout
from ...core.search import prefix_search
from ...payment.models import Payment
from ..channel.filte... | 170 | 5,289 |
saleor | saleor/graphql/checkout/enums.py | .py | from typing import Final
import graphene
from ...checkout import CheckoutAuthorizeStatus, CheckoutChargeStatus, error_codes
from ..core.doc_category import DOC_CATEGORY_CHECKOUT, DOC_CATEGORY_ORDERS
from ..core.enums import to_enum
OrderCreateFromCheckoutErrorCode: Final[graphene.Enum] = graphene.Enum.from_enum(
... | 35 | 1,306 |
saleor | saleor/graphql/checkout/schema.py | .py | import graphene
from ...permission.enums import (
AccountPermissions,
CheckoutPermissions,
PaymentPermissions,
)
from ..core import ResolveInfo
from ..core.connection import (
create_connection_slice_for_sync_webhook_control_context,
filter_connection_queryset,
)
from ..core.descriptions import DEP... | 152 | 6,046 |
saleor | saleor/graphql/checkout/sorters.py | .py | from django.db.models import CharField, ExpressionWrapper, OuterRef, QuerySet, Subquery
from ...payment.models import Payment
from ..core.descriptions import DEPRECATED_LEGACY_PAYMENTS
from ..core.doc_category import DOC_CATEGORY_CHECKOUT
from ..core.types import BaseEnum, SortInputObjectType
class CheckoutSortField... | 55 | 1,973 |
saleor | saleor/graphql/checkout/tests/test_checkouts_query.py | .py | from decimal import Decimal
from unittest.mock import patch
from django.utils import timezone
from ....webhook.event_types import WebhookEventSyncType
from ...tests.utils import get_graphql_content
CHECKOUTS_QUERY = """
query CheckoutsQuery {
checkouts(first: 1) {
edges {
node {
deliveryMethod {
... | 293 | 8,887 |
saleor | saleor/graphql/checkout/tests/test_checkout_price_expiration.py | .py | import datetime
from unittest import mock
from unittest.mock import patch
import graphene
from django.utils import timezone
from freezegun import freeze_time
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import invalidate_checkout
from ....plugins.manager import get_... | 374 | 10,824 |
saleor | saleor/graphql/checkout/tests/utils.py | .py | def assert_address_data(address, address_data, validation_skipped=False):
if metadata := address_data.get("metadata"):
assert address.metadata == {data["key"]: data["value"] for data in metadata}
assert address is not None
assert address.first_name == address_data["firstName"]
assert address.la... | 14 | 727 |
saleor | saleor/graphql/checkout/tests/test_checkout_line_problems.py | .py | import datetime
from unittest import mock
import pytest
from django.utils import timezone
from ....checkout.calculations import _fetch_checkout_prices_if_expired
from ....checkout.fetch import fetch_checkout_lines
from ....product.models import ProductChannelListing, ProductVariantChannelListing
from ...core.utils im... | 775 | 23,754 |
saleor | saleor/graphql/checkout/tests/test_checkout.py | .py | import datetime
import json
from decimal import Decimal
from unittest import mock
import freezegun
import graphene
import pytest
from django.core.exceptions import ValidationError
from django.db.models import F
from django.test import override_settings
from django.utils import timezone
from django.utils.dateparse impo... | 5,407 | 170,600 |
saleor | saleor/graphql/checkout/tests/test_checkout_filters.py | .py | import datetime
import uuid
from decimal import Decimal
import graphene
import pytest
from django.core.exceptions import ValidationError
from freezegun import freeze_time
from prices import Money
from ....account.models import User
from ....checkout.models import Checkout
from ....checkout.payment_utils import update... | 1,040 | 29,291 |
saleor | saleor/graphql/checkout/tests/test_checkout_discount_expiration.py | .py | from datetime import timedelta
from unittest import mock
import graphene
import pytest
from django.utils import timezone
from freezegun import freeze_time
from ....discount.utils.checkout import (
create_or_update_discount_objects_from_promotion_for_checkout,
)
from ...tests.utils import get_graphql_content
QUER... | 659 | 23,984 |
saleor | saleor/graphql/checkout/tests/test_checkout_no_shipping_needed.py | .py | """Test the API's checkout process over fully non-shippable orders."""
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....plugins.manager import get_plugins_manager
from ...core.utils import to_global_id_or_none
from ...tests.utils import get_graphql_content
from ..mutations.utils import... | 60 | 2,011 |
saleor | saleor/graphql/checkout/tests/test_checkout_promo_codes.py | .py | from ....checkout import calculations
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....plugins.manager import get_plugins_manager
from ...core.utils import to_global_id_or_none
from ...tests.utils import get_graphql_content
def test_checkout_totals_use_discounts(api_client, checkout_w... | 139 | 4,246 |
saleor | saleor/graphql/checkout/tests/test_checkout_problems.py | .py | import datetime
from django.utils import timezone
from freezegun import freeze_time
from ....product.models import ProductChannelListing, ProductVariantChannelListing
from ....warehouse.models import Allocation, Reservation, Warehouse
from ...core.utils import to_global_id_or_none
from ...tests.utils import get_graph... | 616 | 21,357 |
saleor | saleor/graphql/checkout/tests/test_utils.py | .py | from ..mutations.utils import apply_gift_reward_if_applicable_on_checkout_creation
def test_apply_gift_reward_if_applicable(
checkout_with_item, gift_promotion_rule, order_promotion_rule, promotion_rule
):
# given
checkout = checkout_with_item
lines_count = checkout.lines.count()
# when
apply... | 51 | 1,479 |
saleor | saleor/graphql/checkout/tests/benchmark/test_homepage.py | .py | from decimal import Decimal
from unittest.mock import patch
import pytest
from django.utils import timezone
from .....checkout.delivery_context import assign_shipping_method_to_checkout
from .....checkout.models import CheckoutDelivery
from .....webhook.transport.shipping_helpers import to_shipping_app_id
from ....te... | 291 | 6,780 |
saleor | saleor/graphql/checkout/tests/benchmark/test_checkouts.py | .py | import pytest
from ....tests.utils import get_graphql_content
MULTIPLE_CHECKOUT_DETAILS_QUERY = """
query multipleCheckouts {
checkouts(first: 100){
edges {
node {
id
channel {
id
slug
}
}
}
}
}
"""
@pytest.mark.django_db
@pytest.mark.count_queries... | 43 | 832 |
saleor | saleor/graphql/checkout/tests/benchmark/test_checkout.py | .py | import pytest
from ....core.utils import to_global_id_or_none
from ....tests.utils import get_graphql_content
CHECKOUT_DETAILS_QUERY = """
query checkout($id: ID){
checkout(
id:$id
) {
shippingMethods{
active
message
}
lines{
id
variant{
product{
name
}
}
totalPrice{
gros... | 75 | 1,056 |
saleor | saleor/graphql/checkout/tests/benchmark/test_checkout_mutations.py | .py | from decimal import Decimal
from unittest.mock import patch
import graphene
import pytest
from graphene import Node
from .....checkout import calculations
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from .....checkout.models import Checkout, CheckoutDelivery
from .....checkout.utils impo... | 1,834 | 50,609 |
saleor | saleor/graphql/checkout/tests/deprecated/test_customer_detach_mutation.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
MUTATION_CHECKOUT_CUSTOMER_DETACH = """
mutation checkoutCustomerDetach($checkoutId: ID, $token: UUID) {
checkoutCustomerDetach(checkoutId: $checkoutId, token: $token) {
chec... | 98 | 3,186 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_billing_address_update.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
MUTATION_CHECKOUT_BILLING_ADDRESS_UPDATE = """
mutation checkoutBillingAddressUpdate(
$token: UUID, $id: ID, $billingAddress: AddressInput!) {
checkoutBillingAddressUpdate(
... | 201 | 7,124 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_shipping_method_update.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
MUTATION_UPDATE_SHIPPING_METHOD = """
mutation checkoutShippingMethodUpdate(
$checkoutId: ID, $token: UUID, $shippingMethodId: ID!){
checkoutShippingMethodUpdate(
... | 146 | 4,581 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout.py | .py | from saleor.graphql.core.utils import to_global_id_or_none
from saleor.graphql.tests.utils import get_graphql_content
CHECKOUT_QUERY = """
query getCheckout($token: UUID) {
checkout(token: $token) {
id
}
}
"""
def test_checkout_by_token(checkout, user_api_client, customer_user):
# given
check... | 26 | 641 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_lines_update.py | .py | from unittest import mock
import graphene
from .....checkout.error_codes import CheckoutErrorCode
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from .....checkout.utils import calculate_checkout_quantity
from .....plugins.manager import get_plugins_manager
from ....tests.utils import get_g... | 163 | 5,584 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_create.py | .py | import graphene
from .....checkout.models import Checkout
from ....tests.utils import get_graphql_content
def test_checkout_create(api_client, stock, graphql_address_data, channel_USD):
"""Create checkout object using GraphQL API."""
query = """
mutation createCheckout($checkoutInput: CheckoutCreateI... | 81 | 2,265 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_complete.py | .py | from unittest.mock import patch
import graphene
import pytest
from .....checkout import calculations
from .....checkout.error_codes import CheckoutErrorCode
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from .....checkout.models import Checkout
from .....core.taxes import zero_money
from .... | 324 | 10,971 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_email_update.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
CHECKOUT_EMAIL_UPDATE_MUTATION = """
mutation checkoutEmailUpdate($checkoutId: ID, $token: UUID, $email: String!) {
checkoutEmailUpdate(checkoutId: $checkoutId, token: $token, email: $em... | 96 | 3,101 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_language_code_update.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
MUTATION_CHECKOUT_UPDATE_LANGUAGE_CODE = """
mutation checkoutLanguageCodeUpdate(
$checkoutId: ID, $token: UUID, $languageCode: LanguageCodeEnum!
){
checkoutLanguageCodeUpdate(
checkoutI... | 111 | 3,130 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_shipping_address_update.py | .py | from unittest import mock
import graphene
from .....checkout.error_codes import CheckoutErrorCode
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from .....plugins.manager import get_plugins_manager
from ....tests.utils import get_graphql_content
from ...mutations.utils import mark_checkout_... | 166 | 5,995 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_promo_codes.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import get_graphql_content
MUTATION_CHECKOUT_ADD_PROMO_CODE = """
mutation($checkoutId: ID, $token: UUID, $promoCode: String!) {
checkoutAddPromoCode(
checkoutId: $checkoutId, token: $token, promoCode:... | 167 | 5,394 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_customer_attach.py | .py | import graphene
from .....checkout.error_codes import CheckoutErrorCode
from ....tests.utils import assert_no_permission, get_graphql_content
CHECKOUT_CUSTOMER_ATTACH_MUTATION = """
mutation checkoutCustomerAttach($checkoutId: ID, $token: UUID) {
checkoutCustomerAttach(checkoutId: $checkoutId, token: $tok... | 120 | 4,158 |
saleor | saleor/graphql/checkout/tests/deprecated/test_checkout_lines_add.py | .py | from unittest import mock
import graphene
from .....checkout.error_codes import CheckoutErrorCode
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from .....checkout.utils import calculate_checkout_quantity
from .....plugins.manager import get_plugins_manager
from ....tests.utils import get_g... | 156 | 5,507 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_shipping_method_update_nullable_shipping_method_id.py | .py | import graphene
import pytest
from ....core.utils import to_global_id_or_none
from ....tests.utils import get_graphql_content
MUTATION_UPDATE_SHIPPING_METHOD = """
mutation checkoutShippingMethodUpdate(
$id: ID, $shippingMethodId: ID
) {
checkoutShippingMethodUpdate(
id: $id, shipp... | 91 | 2,808 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_complete_price_override.py | .py | from decimal import Decimal
import pytest
from .....checkout import calculations
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from .....checkout.utils import add_voucher_code_to_checkout
from .....discount import DiscountValueType, RewardValueType
from .....discount.models import Promotio... | 752 | 28,147 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_billing_address_update.py | .py | from unittest import mock
from unittest.mock import ANY, patch
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_info_event
from .....checkout.utils import invalidate_checkout
from .....core.model... | 991 | 31,093 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_shipping_method_update.py | .py | from datetime import timedelta
from decimal import Decimal
from unittest import mock
from unittest.mock import ANY, patch
import graphene
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from promise import Promise
from .....account.models import Address
fr... | 1,134 | 37,738 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_add_promo_code.py | .py | import datetime
from decimal import Decimal
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from prices import Money
from .....checkout import base_calculations, calculations
from .....chec... | 1,467 | 48,955 |
saleor | saleor/graphql/checkout/tests/mutations/test_price_override_reason.py | .py | """Tests for the `priceOverrideReason` field on checkout / order lines.
Feature spec: .context/price-override-reason-scenarios.md
An app with HANDLE_CHECKOUTS may record *why* it set a custom price on a checkout
line. The reason is stored natively, carried onto the order line at completion, and
readable by staff/app ... | 698 | 21,377 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_create_from_order.py | .py | import datetime
import graphene
import pytest
from .....checkout.error_codes import CheckoutCreateFromOrderUnavailableVariantErrorCode
from .....checkout.models import Checkout
from .....product.models import ProductChannelListing, ProductVariantChannelListing
from .....warehouse.models import Stock
from ....tests.ut... | 903 | 32,782 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_customer_note_update.py | .py | from unittest.mock import ANY, patch
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_event
from .....core.models import EventDelivery
from .....product.models import ProductChannelListing, Produ... | 243 | 7,886 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_lines_update.py | .py | import datetime
from decimal import Decimal
from unittest import mock
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_info_event
from .....ch... | 2,108 | 68,799 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_create.py | .py | import datetime
import warnings
from unittest import mock
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from .....channel.utils import DEPRECATION_WARNING_MESSAGE
from .....checkout import AddressType
from .....checkout.a... | 3,222 | 108,992 |
saleor | saleor/graphql/checkout/tests/mutations/test_order_create_from_checkout.py | .py | import datetime
from decimal import Decimal
from unittest.mock import ANY, patch
import graphene
import pytest
from django.db import transaction
from django.db.models.aggregates import Sum
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from prices import M... | 3,382 | 110,877 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_delete.py | .py | import graphene
import pytest
from .....checkout.error_codes import CheckoutErrorCode
from .....checkout.models import Checkout
from .....payment.models import TransactionItem
from ....core.utils import to_global_id_or_none
from ....tests.utils import assert_no_permission, get_graphql_content
MUTATION_CHECKOUT_DELETE... | 200 | 5,868 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_remove_promo_code.py | .py | import datetime
from decimal import Decimal
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from prices import Money
from .....checkout import base_calculations
from .....checkout.actions i... | 988 | 33,550 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_transactions.py | .py | import datetime
from decimal import Decimal
from unittest.mock import ANY, patch
import graphene
import pytest
from django.contrib.sites.models import Site
from django.db import transaction
from django.db.models.aggregates import Sum
from django.test import override_settings
from django.utils import timezone
from pric... | 6,110 | 196,260 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_complete.py | .py | from datetime import timedelta
from unittest import mock
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from prices import Money, TaxedMoney
from .....checkout import calculations
from .....checkout.error_codes import Checkou... | 839 | 27,811 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_email_update.py | .py | from unittest.mock import ANY, patch
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_event
from .....checkout.error_codes import CheckoutErrorCode
from .....core.models import EventDelivery
from... | 284 | 9,437 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_language_code_update.py | .py | from unittest.mock import ANY, patch
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_event
from .....core.models import EventDelivery
from .....product.models import ProductChannelListing, Produ... | 238 | 7,532 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_complete_with_payment.py | .py | import datetime
from decimal import Decimal
from unittest.mock import ANY, patch
import graphene
import pytest
from django.conf import settings
from django.contrib.sites.models import Site
from django.db.models.aggregates import Sum
from django.test import override_settings
from django.utils import timezone
from sale... | 6,390 | 214,225 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_shipping_address_update.py | .py | import datetime
from unittest import mock
from unittest.mock import ANY, patch
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....checkout.actions import call_checkout_info_event
from .....checkout.error_codes import CheckoutErrorCode
... | 1,481 | 48,337 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_lines_delete.py | .py | from unittest import mock
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from .....checkout.actions import call_checkout_info_event
from .....checkout.error_codes import CheckoutErrorCode
from .....checkout.fetch import fetch_checkout_info, fetch_checkout_... | 432 | 15,067 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_customer_attach.py | .py | from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....account.tests.fixtures.user import dangerously_create_test_user
from .....checkout.actions import call_checkout_event
from .....che... | 426 | 14,092 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_delivery_method_update.py | .py | from datetime import timedelta
from decimal import Decimal
from unittest import mock
from unittest.mock import ANY, patch
from uuid import uuid4
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from .....account.models import Address
from .....checkout.actions ... | 2,210 | 71,649 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_customer_detach.py | .py | from unittest.mock import ANY, patch
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from .....account.tests.fixtures.user import dangerously_create_test_user
from .....checkout.actions import call_checkout_event
from .....core.models import ... | 285 | 9,332 |
saleor | saleor/graphql/checkout/tests/mutations/test_checkout_lines_add.py | .py | import datetime
from decimal import Decimal
from unittest import mock
from unittest.mock import ANY, patch
import graphene
import pytest
from django.test import override_settings
from django.utils import timezone
from freezegun import freeze_time
from promise import Promise
from .....checkout.actions import call_chec... | 2,320 | 76,747 |
saleor | saleor/graphql/checkout/tests/mutations/test_utils.py | .py | import graphene
from .....checkout.fetch import fetch_checkout_lines
from ...mutations.utils import (
CheckoutLineData,
group_lines_input_data_on_update,
group_lines_input_on_add,
)
def test_group_on_add_when_same_variants_in_multiple_lines():
variant_1_id = graphene.Node.to_global_id("ProductVariant... | 189 | 6,175 |
saleor | saleor/graphql/checkout/dataloaders/checkout_infos.py | .py | from collections import defaultdict
from collections.abc import Sequence
from promise import Promise
from ....checkout.fetch import CheckoutInfo, CheckoutLineInfo
from ....core.db.connection import allow_writer_in_context
from ....discount import VoucherType
from ....discount.utils.voucher import attach_voucher_to_li... | 353 | 14,667 |
saleor | saleor/graphql/checkout/dataloaders/models.py | .py | from collections import defaultdict
from collections.abc import Iterable
from django.db.models import F
from ....checkout.models import Checkout, CheckoutLine, CheckoutMetadata
from ....payment.models import TransactionItem
from ...core.dataloaders import DataLoader
class CheckoutByTokenLoader(DataLoader[str, Check... | 101 | 3,771 |
saleor | saleor/graphql/checkout/dataloaders/__init__.py | .py | from .checkout_infos import (
CheckoutInfoByCheckoutTokenLoader,
CheckoutLinesInfoByCheckoutTokenLoader,
)
from .models import (
CheckoutByTokenLoader,
CheckoutByUserAndChannelLoader,
CheckoutByUserLoader,
CheckoutLineByIdLoader,
CheckoutLinesByCheckoutTokenLoader,
CheckoutMetadataByChec... | 34 | 1,072 |
saleor | saleor/graphql/checkout/dataloaders/calculations.py | .py | from collections.abc import Iterable
from uuid import UUID
from promise import Promise
from ....app.models import App
from ....checkout.calculations import fetch_checkout_data
from ....checkout.fetch import CheckoutInfo, CheckoutLineInfo
from ...app.dataloaders.utils import get_app_promise
from ...core.dataloaders im... | 65 | 2,587 |
saleor | saleor/graphql/checkout/dataloaders/problems.py | .py | from collections import defaultdict
from collections.abc import Iterable
from promise import Promise
from ....checkout.models import CheckoutDelivery
from ....checkout.problems import (
CHANNEL_SLUG,
CHECKOUT_LINE_PROBLEM_TYPE,
CHECKOUT_PROBLEM_TYPE,
COUNTRY_CODE,
PRODUCT_ID,
VARIANT_ID,
g... | 212 | 7,730 |
saleor | saleor/graphql/checkout/dataloaders/checkout_delivery.py | .py | from itertools import chain
from uuid import UUID
from promise import Promise
from ....checkout.delivery_context import get_or_fetch_checkout_deliveries
from ....checkout.models import CheckoutDelivery
from ....core.db.connection import allow_writer_in_context
from ...core.dataloaders import DataLoader
from ...utils ... | 61 | 2,344 |
saleor | saleor/graphql/checkout/dataloaders/promotion_rule_infos.py | .py | from collections import defaultdict
from uuid import UUID
from promise import Promise
from ....discount.interface import VariantPromotionRuleInfo
from ...core.dataloaders import DataLoader
from ...discount.dataloaders import (
PromotionByRuleIdLoader,
PromotionRuleByIdLoader,
)
from ...product.dataloaders imp... | 196 | 9,154 |
saleor | saleor/graphql/checkout/mutations/checkout_lines_update.py | .py | import graphene
from django.forms import ValidationError
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import CheckoutLineInfo
from ....core.exceptions import NonExistingCheckoutLines
from ....warehouse.reservations import is_reservation_enabled
from ....webhook.event_types import Webh... | 301 | 10,073 |
saleor | saleor/graphql/checkout/mutations/checkout_customer_detach.py | .py | import graphene
from ....checkout.actions import call_checkout_event
from ....core.exceptions import PermissionDenied
from ....permission.auth_filters import AuthorizationFilters
from ....permission.enums import AccountPermissions
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInf... | 81 | 3,109 |
saleor | saleor/graphql/checkout/mutations/order_create_from_checkout.py | .py | from typing import Union
import graphene
from django.core.exceptions import ValidationError
from ....account.models import User
from ....app.models import App
from ....checkout.checkout_cleaner import validate_checkout
from ....checkout.complete_checkout import create_order_from_checkout
from ....checkout.delivery_co... | 262 | 9,592 |
saleor | saleor/graphql/checkout/mutations/checkout_customer_note_update.py | .py | import graphene
from ....checkout.actions import call_checkout_event
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.context import SyncWebhookControlContext
from ...core.doc_category import DOC_CATEGORY_CHECKOUT
from ...core.mutations import BaseMutation
from ...... | 62 | 2,032 |
saleor | saleor/graphql/checkout/mutations/checkout_customer_attach.py | .py | import graphene
from django.forms import ValidationError
from ....checkout.actions import call_checkout_event
from ....checkout.error_codes import CheckoutErrorCode
from ....core.exceptions import PermissionDenied
from ....permission.auth_filters import AuthorizationFilters
from ....permission.enums import AccountPerm... | 131 | 4,623 |
saleor | saleor/graphql/checkout/mutations/utils.py | .py | import datetime
import uuid
from collections import defaultdict
from collections.abc import Iterable
from dataclasses import asdict, dataclass, field
from decimal import Decimal
from typing import TYPE_CHECKING, Any, cast
import graphene
from django.conf import settings
from django.core.exceptions import ObjectDoesNot... | 637 | 23,407 |
saleor | saleor/graphql/checkout/mutations/checkout_create.py | .py | from typing import TYPE_CHECKING, Optional
import graphene
from django.conf import settings
from django.core.exceptions import ValidationError
from ....checkout import AddressType, models
from ....checkout.actions import call_checkout_event
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.util... | 565 | 21,279 |
saleor | saleor/graphql/checkout/mutations/checkout_add_promo_code.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....checkout.actions import call_checkout_info_event
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import (
fetch_checkout_info,
fetch_checkout_lines,
)
from ....checkout.utils import (
add_promo_code_t... | 130 | 4,203 |
saleor | saleor/graphql/checkout/mutations/__init__.py | .py | from .checkout_add_promo_code import CheckoutAddPromoCode
from .checkout_billing_address_update import CheckoutBillingAddressUpdate
from .checkout_complete import CheckoutComplete
from .checkout_create import CheckoutCreate
from .checkout_create_from_order import CheckoutCreateFromOrder
from .checkout_customer_attach i... | 42 | 1,742 |
saleor | saleor/graphql/checkout/mutations/checkout_shipping_address_update.py | .py | from typing import TYPE_CHECKING
import graphene
from django.core.exceptions import ValidationError
from ....checkout import AddressType, models
from ....checkout.actions import call_checkout_info_event
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import (
CheckoutLineInfo,
f... | 221 | 7,720 |
saleor | saleor/graphql/checkout/mutations/checkout_shipping_method_update.py | .py | from typing import Union
import graphene
from django.core.exceptions import ValidationError
from ....account.models import User
from ....app.models import App
from ....checkout.delivery_context import (
assign_delivery_method_to_checkout,
get_or_fetch_checkout_deliveries,
is_shipping_required,
)
from ....... | 200 | 6,801 |
saleor | saleor/graphql/checkout/mutations/checkout_create_from_order.py | .py | from typing import Any, cast
import graphene
from django.contrib.sites.models import Site
from ....checkout import models as checkout_models
from ....checkout.utils import add_variants_to_checkout
from ....core.exceptions import InsufficientStock
from ....core.utils.country import get_active_country
from ....order im... | 430 | 16,005 |
saleor | saleor/graphql/checkout/mutations/checkout_delete.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.models import Checkout as CheckoutModel
from ....checkout.utils import delete_checkouts
from ....permission.enums import CheckoutPermissions
from ...core import ResolveInfo
from .... | 59 | 1,929 |
saleor | saleor/graphql/checkout/mutations/checkout_lines_delete.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....checkout.actions import call_checkout_info_event
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import invalidate_checkout
from ....webhoo... | 123 | 4,732 |
saleor | saleor/graphql/checkout/mutations/checkout_remove_promo_code.py | .py | import graphene
from django.core.exceptions import ValidationError
from graphql.error import GraphQLError
from ....checkout import models
from ....checkout.actions import call_checkout_info_event
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_l... | 191 | 6,664 |
saleor | saleor/graphql/checkout/mutations/checkout_billing_address_update.py | .py | import graphene
from ....checkout import AddressType
from ....checkout.actions import call_checkout_info_event
from ....checkout.fetch import fetch_checkout_info, fetch_checkout_lines
from ....checkout.utils import change_billing_address_in_checkout, invalidate_checkout
from ....core.tracing import traced_atomic_trans... | 125 | 4,687 |
saleor | saleor/graphql/checkout/mutations/checkout_complete.py | .py | from typing import Union
import graphene
from django.core.exceptions import ValidationError
from ....account.models import User
from ....app.models import App
from ....checkout import AddressType, models
from ....checkout.checkout_cleaner import (
clean_checkout_shipping,
validate_checkout_email,
)
from ....c... | 384 | 14,811 |
saleor | saleor/graphql/checkout/mutations/checkout_lines_add.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....checkout.actions import call_checkout_info_event
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import (
fetch_checkout_info,
fetch_checkout_lines,
)
from ....checkout.utils import add_variants_to_checko... | 292 | 10,386 |
saleor | saleor/graphql/checkout/mutations/checkout_language_code_update.py | .py | import graphene
from saleor.checkout.actions import call_checkout_event
from saleor.webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.context import SyncWebhookControlContext
from ...core.descriptions import DEPRECATED_IN_3X_INPUT
from ...core.doc_category import DOC_CATEGO... | 79 | 2,594 |
saleor | saleor/graphql/checkout/mutations/checkout_delivery_method_update.py | .py | from typing import TYPE_CHECKING, Union
import graphene
from django.core.exceptions import ValidationError
from ....checkout.delivery_context import (
assign_delivery_method_to_checkout,
get_or_fetch_checkout_deliveries,
is_shipping_required,
)
from ....checkout.error_codes import CheckoutErrorCode
from .... | 263 | 8,982 |
saleor | saleor/graphql/checkout/mutations/checkout_email_update.py | .py | import graphene
from django.core.exceptions import ValidationError
from ....checkout.actions import call_checkout_event
from ....checkout.error_codes import CheckoutErrorCode
from ....webhook.event_types import WebhookEventAsyncType
from ...core import ResolveInfo
from ...core.context import SyncWebhookControlContext
... | 91 | 3,007 |
saleor | saleor/graphql/webhook/types.py | .py | import graphene
from ...core import models as core_models
from ...webhook import models
from ...webhook.deprecated_event_types import WebhookEventType
from ...webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ..core import ResolveInfo
from ..core.connection import (
CountableConnection,
... | 258 | 9,427 |
saleor | saleor/graphql/webhook/subscription_query.py | .py | from enum import Flag
from typing import cast
from django.core.exceptions import ValidationError
from graphene.utils.str_converters import to_snake_case
from graphql import get_default_backend, validate
from graphql.error import GraphQLSyntaxError
from graphql.language.ast import (
Document,
Field,
Fragmen... | 212 | 7,697 |
saleor | saleor/graphql/webhook/resolvers.py | .py | from django.db.models import Exists, OuterRef, Q
from ...app.models import App
from ...core.exceptions import PermissionDenied
from ...permission.enums import AppPermission
from ...webhook import models, payloads
from ...webhook.deprecated_event_types import WebhookEventType
from ...webhook.event_types import WebhookE... | 56 | 2,087 |
saleor | saleor/graphql/webhook/filters.py | .py | import django_filters
from ..core.filters import EnumFilter, FilterInputObjectType
from .enums import EventDeliveryStatusEnum, WebhookEventTypeEnum
def filter_status(qs, _, value):
if value:
qs = qs.filter(status=value)
return qs
def filter_event_type(qs, _, value):
if value:
qs = qs.fi... | 27 | 702 |
saleor | saleor/graphql/webhook/subscription_payload.py | .py | import datetime
import logging
from collections.abc import Iterable
from typing import Any
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.functional import SimpleLazyObject
from graphql import get_default_backend, parse
from graphql.error import GraphQ... | 310 | 10,366 |
saleor | saleor/graphql/webhook/enums.py | .py | import graphene
from ...webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ..core.descriptions import (
ADDED_IN_323,
DEFAULT_DEPRECATION_REASON,
DEPRECATED_LEGACY_PAYMENTS,
)
from ..core.doc_category import DOC_CATEGORY_WEBHOOKS
from ..core.types import BaseEnum
from ..core.utils ... | 354 | 18,592 |
saleor | saleor/graphql/webhook/subscription_types.py | .py | from typing import TYPE_CHECKING
import graphene
from django.conf import settings
from graphene import AbstractType, Union
from prices import Money
from promise import Promise
from rx import Observable
from ... import __version__
from ...account.models import User
from ...attribute.models import AttributeTranslation,... | 3,375 | 112,090 |
saleor | saleor/graphql/webhook/schema.py | .py | import graphene
from ...permission.auth_filters import AuthorizationFilters
from ...permission.enums import AppPermission
from ..app.dataloaders import app_promise_callback
from ..core import ResolveInfo
from ..core.doc_category import DOC_CATEGORY_WEBHOOKS
from ..core.fields import BaseField, JSONString, PermissionsF... | 78 | 2,778 |
saleor | saleor/graphql/webhook/mixins.py | .py | from django.core.exceptions import ValidationError
from ...webhook.error_codes import WebhookErrorCode
from ...webhook.event_types import WebhookEventAsyncType
class NotifyUserEventValidationMixin:
@classmethod
def validate_events(cls, events):
# NOTIFY_USER needs to be the only one event registered ... | 22 | 853 |
saleor | saleor/graphql/webhook/sorters.py | .py | from ..core.doc_category import DOC_CATEGORY_WEBHOOKS
from ..core.types import BaseEnum, SortInputObjectType
class EventDeliverySortField(BaseEnum):
CREATED_AT = ["created_at"]
class Meta:
doc_category = DOC_CATEGORY_WEBHOOKS
@property
def description(self):
if self.name in EventDeli... | 45 | 1,400 |
saleor | saleor/graphql/webhook/tests/test_subscription_query.py | .py | import pytest
from django.core.exceptions import ValidationError
from graphql import GraphQLError
from graphql.error import GraphQLSyntaxError
from saleor.webhook.error_codes import WebhookErrorCode
from ..subscription_query import IsFragment, SubscriptionQuery
def test_subscription_query():
# given
query =... | 722 | 14,380 |
saleor | saleor/graphql/webhook/tests/test_pagination.py | .py | import pytest
from ....app.models import App
from ....webhook.models import Webhook
@pytest.fixture
def webhooks_for_pagination(db):
apps = App.objects.bulk_create(
[App(name="App1", is_active=True), App(name="App2", is_active=True)]
)
return Webhook.objects.bulk_create(
[
We... | 44 | 1,186 |
saleor | saleor/graphql/webhook/tests/test_subscription_payload.py | .py | import graphene
from django.test import override_settings
from django.utils import timezone
from ....webhook.event_types import WebhookEventAsyncType, WebhookEventSyncType
from ....webhook.models import Webhook
from ..subscription_payload import (
generate_payload_from_subscription,
generate_payload_promise_fr... | 438 | 11,448 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.