Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Deprecate external_url in Invoice in favour of url
Ania Warzecha506cd1157e9c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ed228d58fb..0ecf4a0ad1 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -77,6 +77,7 @@ All notable, unreleased changes to this project will be documented in this file.- `SaleToggle` - Use `PromotionStarted` and `PromotionEnded` instead.### Breaking changes+- Deprecate `external_url` on `Invoice` GraphQL type in favour of `url`. No matter if the invoice is stored on Saleor or is a link to an external invoice it will get returned in the `url` field.### GraphQL APIdiff --git a/saleor/graphql/invoice/types.py b/saleor/graphql/invoice/types.pyindex 1121b961f9..ac8da50516 100644--- a/saleor/graphql/invoice/types.py+++ b/saleor/graphql/invoice/types.py@@ -1,7 +1,7 @@import graphenefrom ...invoice import models-from ..core.descriptions import ADDED_IN_310+from ..core.descriptions import ADDED_IN_310, DEPRECATED_IN_3X_FIELDfrom ..core.types import Job, ModelObjectTypefrom ..meta.types import ObjectWithMetadatafrom ..order.dataloaders import OrderByIdLoader@@ -9,7 +9,14 @@ from ..order.dataloaders import OrderByIdLoaderclass Invoice(ModelObjectType[models.Invoice]):number = graphene.String(description="Invoice number.")- external_url = graphene.String(description="URL to view an invoice.")+ external_url = graphene.String(+ description="URL to view an invoice.",+ required=False,+ deprecation_reason=(+ f"{DEPRECATED_IN_3X_FIELD} Use `url` field."+ "This field will be removed in 4.0"+ ),+ )created_at = graphene.DateTime(required=True, description="Date and time at which invoice was created.")@@ -17,7 +24,13 @@ class Invoice(ModelObjectType[models.Invoice]):required=True, description="Date and time at which invoice was updated.")message = graphene.String(description="Message associated with an invoice.")- url = graphene.String(description="URL to download an invoice.")+ url = graphene.String(+ description=(+ "URL to view/download an invoice. "+ "This can be an internal URL if the Invoicing Plugin was used "+ "or an external URL if it has been provided."+ )+ )order = graphene.Field("saleor.graphql.order.types.Order",description="Order related to the invoice." + ADDED_IN_310,diff --git a/saleor/graphql/order/tests/mutations/test_order_bulk_create.py b/saleor/graphql/order/tests/mutations/test_order_bulk_create.pyindex 34336b149f..2b6182351e 100644--- a/saleor/graphql/order/tests/mutations/test_order_bulk_create.py+++ b/saleor/graphql/order/tests/mutations/test_order_bulk_create.py@@ -716,6 +716,7 @@ def test_order_bulk_create(db_invoice = Invoice.objects.get()assert db_invoice.number == "01/12/2020/TEST"assert db_invoice.external_url == "http://www.example.com"+ assert db_invoice.url == "http://www.example.com"assert db_invoice.private_metadata["pmd key"] == "pmd value"assert db_invoice.metadata["md key"] == "md value"assert db_invoice.order_id == db_order.iddiff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 72ac04a0d7..ce93b4779d 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -11973,9 +11973,11 @@ type Invoice implements ObjectWithMetadata & Job & Node @doc(category: "Orders")number: String"""URL to view an invoice."""- externalUrl: String+ externalUrl: String @deprecated(reason: "This field will be removed in Saleor 4.0. Use `url` field.This field will be removed in 4.0")- """URL to download an invoice."""+ """+ URL to view/download an invoice. This can be an internal URL if the Invoicing Plugin was used or an external URL if it has been provided.+ """url: String"""