Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Merge branch 'master' of github.com:mirumee/saleor into feature/unconfirmed-order-line-manipulation
Tomasz Szymanski86a0685b38f6
diff --cc .isort.cfgindex 07a165dee8,1cdc05d770..832d561519--- a/.isort.cfg+++ b/.isort.cfg@@@ -1,2 -1,2 +1,2 @@@[settings]- known_third_party = Adyen,PIL,authorizenet,babel,boto3,braintree,celery,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sentry_sdk,storages,stripe,templated_email,tqdm,urllib3,versatileimagefield,weasyprint-known_third_party = Adyen,PIL,authorizenet,babel,boto3,braintree,celery,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,tqdm,urllib3,versatileimagefield,weasyprint++known_third_party = Adyen,PIL,authorizenet,babel,boto3,braintree,celery,dateutil,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html2text,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,micawber,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pybars,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sendgrid,sentry_sdk,storages,stripe,templated_email,tqdm,urllib3,versatileimagefield,weasyprintdiff --cc CHANGELOG.mdindex 88c80ecba9,7af11c5c5f..84469018f8--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -45,7 -47,7 +47,8 @@@ All notable, unreleased changes to thi- Drop `apply_taxes_to_shipping_price_range` plugin hook - #6746 by @maarcingebala- Drop `CHECKOUT_QUANTITY_CHANGED` webhook - #6797 by @d-wysocki- Drop deprecated `taxRate` field from `ProductType` - #6795 by @d-wysocki+- Unconfirmed order manipulation - #6829 by @tomaszszymanski129+ - Email interface as a plugin - #6301 by @korycins- Remove resolving user's location from GeoIP; drop `PaymentInput.billingAddress` input field - #6784 by @maarcingebala- Change the payload of the order webhook to handle discounts list, added fields: `Order.discounts`,`OrderLine.unit_discount_amount`,`OrderLine.unit_discount_type`, `OrderLine.unit_discount_reason` , remove fields:diff --cc saleor/graphql/invoice/mutations.pyindex d451840be4,5b12fd3e11..70a0959745--- a/saleor/graphql/invoice/mutations.py+++ b/saleor/graphql/invoice/mutations.py@@@ -4,8 -4,9 +4,8 @@@ from django.core.exceptions import Valifrom ...core import JobStatusfrom ...core.permissions import OrderPermissionsfrom ...invoice import events, models- from ...invoice.emails import send_invoicefrom ...invoice.error_codes import InvoiceErrorCode+ from ...invoice.notifications import send_invoice-from ...order import OrderStatusfrom ...order import events as order_eventsfrom ..core.mutations import ModelDeleteMutation, ModelMutationfrom ..core.types.common import InvoiceErrordiff --cc saleor/order/migrations/0103_auto_20210401_1105.pyindex 71faee5eb7,0000000000..e90ba20f36mode 100644,000000..100644--- a/saleor/order/migrations/0103_auto_20210401_1105.py+++ b/saleor/order/migrations/0103_auto_20210401_1105.py@@@ -1,64 -1,0 +1,64 @@@- # Generated by Django 3.1.7 on 2021-03-16 09:19++# Generated by Django 3.1.7 on 2021-04-01 11:05++from django.db import migrations, models+++class Migration(migrations.Migration):++ dependencies = [- ("order", "0101_auto_20210308_1213"),++ ("order", "0102_auto_20210310_1552"),+ ]++ operations = [+ migrations.AlterField(+ model_name="orderevent",+ name="type",+ field=models.CharField(+ choices=[+ ("DRAFT_CREATED", "draft_created"),+ ("DRAFT_CREATED_FROM_REPLACE", "draft_created_from_replace"),+ ("ADDED_PRODUCTS", "added_products"),+ ("REMOVED_PRODUCTS", "removed_products"),+ ("PLACED", "placed"),+ ("PLACED_FROM_DRAFT", "placed_from_draft"),+ ("OVERSOLD_ITEMS", "oversold_items"),+ ("CANCELED", "canceled"),+ ("ORDER_MARKED_AS_PAID", "order_marked_as_paid"),+ ("ORDER_FULLY_PAID", "order_fully_paid"),+ ("ORDER_REPLACEMENT_CREATED", "order_replacement_created"),+ ("ORDER_DISCOUNT_ADDED", "order_discount_added"),+ (+ "ORDER_DISCOUNT_AUTOMATICALLY_UPDATED",+ "order_discount_automatically_updated",+ ),+ ("ORDER_DISCOUNT_UPDATED", "order_discount_updated"),+ ("ORDER_DISCOUNT_DELETED", "order_discount_deleted"),+ ("ORDER_LINE_DISCOUNT_UPDATED", "order_line_discount_updated"),+ ("ORDER_LINE_DISCOUNT_REMOVED", "order_line_discount_removed"),+ ("UPDATED_ADDRESS", "updated_address"),+ ("EMAIL_SENT", "email_sent"),+ ("CONFIRMED", "confirmed"),+ ("PAYMENT_AUTHORIZED", "payment_authorized"),+ ("PAYMENT_CAPTURED", "payment_captured"),+ ("EXTERNAL_SERVICE_NOTIFICATION", "external_service_notification"),+ ("PAYMENT_REFUNDED", "payment_refunded"),+ ("PAYMENT_VOIDED", "payment_voided"),+ ("PAYMENT_FAILED", "payment_failed"),+ ("INVOICE_REQUESTED", "invoice_requested"),+ ("INVOICE_GENERATED", "invoice_generated"),+ ("INVOICE_UPDATED", "invoice_updated"),+ ("INVOICE_SENT", "invoice_sent"),+ ("FULFILLMENT_CANCELED", "fulfillment_canceled"),+ ("FULFILLMENT_RESTOCKED_ITEMS", "fulfillment_restocked_items"),+ ("FULFILLMENT_FULFILLED_ITEMS", "fulfillment_fulfilled_items"),+ ("FULFILLMENT_REFUNDED", "fulfillment_refunded"),+ ("FULFILLMENT_RETURNED", "fulfillment_returned"),+ ("FULFILLMENT_REPLACED", "fulfillment_replaced"),+ ("TRACKING_UPDATED", "tracking_updated"),+ ("NOTE_ADDED", "note_added"),+ ("OTHER", "other"),+ ],+ max_length=255,+ ),+ ),+ ]diff --cc saleor/order/tests/test_order.pyindex 7310a40099,dff31cd609..2688fd5ebc--- a/saleor/order/tests/test_order.py+++ b/saleor/order/tests/test_order.py@@@ -20,13 -20,24 +20,24 @@@ from ...plugins.manager import get_plugfrom ...product.models import Collectionfrom ...warehouse.models import Stockfrom ...warehouse.tests.utils import get_quantity_allocated_for_stock- from .. import FulfillmentStatus, OrderEvents, OrderStatus, models- from ..emails import send_fulfillment_confirmation_to_customer- from ..events import OrderEvent, OrderEventsEmails, email_sent_event+ from .. import FulfillmentStatus, OrderEvents, OrderStatus+ from ..events import (+ OrderEventsEmails,+ event_fulfillment_confirmed_notification,+ event_fulfillment_digital_links_notification,+ event_order_cancelled_notification,+ event_order_confirmation_notification,+ event_order_refunded_notification,+ event_payment_confirmed_notification,+ )from ..models import Order+ from ..notifications import (+ get_default_fulfillment_payload,+ send_fulfillment_confirmation_to_customer,+ )from ..templatetags.order_lines import display_translated_order_line_namefrom ..utils import (- add_variant_to_draft_order,+ add_variant_to_order,change_order_line_quantity,delete_order_line,get_voucher_discount_for_order,@@@ -886,17 -900,17 +897,17 @@@ def test_ordered_item_change_quantity(sdef test_change_order_line_quantity_changes_total_prices(- transactional_db, order_with_lines+ staff_user, transactional_db, lines_info):- assert not order_with_lines.events.count()- line = order_with_lines.lines.all()[0]- new_quantity = line.quantity + 1- change_order_line_quantity(None, line, line.quantity, new_quantity)- line.refresh_from_db()- assert line.total_price == line.unit_price * new_quantity+ order = lines_info[0].line.order+ assert not order.events.count()+ line_info = lines_info[0]+ new_quantity = line_info.quantity + 1+ change_order_line_quantity(staff_user, line_info, line_info.quantity, new_quantity)+ assert line_info.line.total_price == line_info.line.unit_price * new_quantity- @patch("saleor.order.actions.emails.send_fulfillment_confirmation")+ @patch("saleor.plugins.manager.PluginsManager.notify")@pytest.mark.parametrize("has_standard,has_digital", ((True, True), (True, False), (False, True)))