Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add `GIFT_CARD_EXPORT_COMPLETED` webhook. (#13765)
Arturb9e35aa57547
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 942406477e..461352d947 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -21,6 +21,8 @@ in 3.17. Use `PaymentSettings.defaultTransactionFlowStrategy` instead.- Inform apps if customer should be notified when fulfillment is created.- Add `NOTIFY_CUSTOMER` flag to `FulfillmentApproved` type - #13637, by @Air-t- Inform apps if customer should be notified when fulfillment is approved.+- Add `GIFT_CARD_EXPORT_COMPLETED` webhook - #13765, by @Air-t+ - Event sent when CSV export is completed.### Other changes- Fix error in variant available stock calculation - 13593 by @awaisdar001diff --git a/saleor/csv/notifications.py b/saleor/csv/notifications.pyindex de81139ee5..66b5ed8314 100644--- a/saleor/csv/notifications.py+++ b/saleor/csv/notifications.py@@ -38,6 +38,8 @@ def send_export_download_link_notification(export_file: "ExportFile", data_type:manager = get_plugins_manager()manager.notify(NotifyEventType.CSV_EXPORT_SUCCESS, payload)+ if data_type == "gift cards":+ manager.gift_card_export_completed(export_file)def send_export_failed_info(export_file: "ExportFile", data_type: str):@@ -50,3 +52,5 @@ def send_export_failed_info(export_file: "ExportFile", data_type: str):}manager = get_plugins_manager()manager.notify(NotifyEventType.CSV_EXPORT_FAILED, payload)+ if data_type == "gift cards":+ manager.gift_card_export_completed(export_file)diff --git a/saleor/csv/tests/export/test_export.py b/saleor/csv/tests/export/test_export.pyindex d9424bc6a0..ab83de9bfd 100644--- a/saleor/csv/tests/export/test_export.py+++ b/saleor/csv/tests/export/test_export.py@@ -293,6 +293,7 @@ def test_export_products_by_app(save_file_mock.assert_called_once_with(app_export_file, mock_file, ANY)+@patch("saleor.plugins.manager.PluginsManager.gift_card_export_completed")@patch("saleor.csv.utils.export.create_file_with_headers")@patch("saleor.csv.utils.export.export_gift_cards_in_batches")@patch("saleor.csv.utils.export.send_export_download_link_notification")@@ -302,6 +303,7 @@ def test_export_gift_cards(send_email_mock,export_in_batches_mock,create_file_with_headers_mock,+ mocked_gift_card_export_completed,user_export_file,gift_card,gift_card_expiry_date,@@ -334,6 +336,8 @@ def test_export_gift_cards(save_file_mock.assert_called_once_with(user_export_file, mock_file, ANY)+ mocked_gift_card_export_completed.assert_called_once_with(user_export_file)+@patch("saleor.csv.utils.export.create_file_with_headers")@patch("saleor.csv.utils.export.export_gift_cards_in_batches")diff --git a/saleor/csv/tests/test_notifications.py b/saleor/csv/tests/test_notifications.pyindex 87a6a59309..917dd655b2 100644--- a/saleor/csv/tests/test_notifications.py+++ b/saleor/csv/tests/test_notifications.py@@ -11,9 +11,15 @@ from ..notifications import get_default_export_payload@freeze_time("2018-05-31 12:00:01")[email protected]("saleor.plugins.manager.PluginsManager.gift_card_export_completed")@mock.patch("saleor.plugins.manager.PluginsManager.notify")def test_send_export_download_link_notification(- mocked_notify, site_settings, user_export_file, tmpdir, media_root+ mocked_notify,+ mocked_gift_card_export_completed,+ site_settings,+ user_export_file,+ tmpdir,+ media_root,):# givenfile_mock = mock.MagicMock(spec=File)@@ -25,7 +31,6 @@ def test_send_export_download_link_notification(# whennotifications.send_export_download_link_notification(user_export_file, data_type)-# thenexpected_payload = {"export": get_default_export_payload(user_export_file),@@ -34,16 +39,22 @@ def test_send_export_download_link_notification("data_type": data_type,**get_site_context(),}-mocked_notify.assert_called_once_with(AdminNotifyEvent.CSV_EXPORT_SUCCESS, expected_payload)+ mocked_gift_card_export_completed.assert_not_called()@freeze_time("2018-05-31 12:00:01")[email protected]("saleor.plugins.manager.PluginsManager.gift_card_export_completed")@mock.patch("saleor.plugins.manager.PluginsManager.notify")def test_send_export_failed_info(- mocked_notify, site_settings, user_export_file, tmpdir, media_root+ mocked_notify,+ mocked_gift_card_export_completed,+ site_settings,+ user_export_file,+ tmpdir,+ media_root,):# givenfile_mock = mock.MagicMock(spec=File)@@ -67,3 +78,4 @@ def test_send_export_failed_info(mocked_notify.assert_called_once_with(AdminNotifyEvent.CSV_EXPORT_FAILED, expected_payload)+ mocked_gift_card_export_completed.assert_called_once_with(user_export_file)diff --git a/saleor/csv/utils/export.py b/saleor/csv/utils/export.pyindex 52cf0eea15..905c6172c4 100644--- a/saleor/csv/utils/export.py+++ b/saleor/csv/utils/export.py@@ -7,6 +7,7 @@ import petl as etlfrom django.utils import timezonefrom ...giftcard.models import GiftCard+from ...plugins.manager import get_plugins_managerfrom ...product.models import Productfrom .. import FileTypesfrom ..notifications import send_export_download_link_notification@@ -87,6 +88,8 @@ def export_gift_cards(temporary_file.close()send_export_download_link_notification(export_file, "gift cards")+ manager = get_plugins_manager()+ manager.gift_card_export_completed(export_file)def get_filename(model_name: str, file_type: str) -> str:diff --git a/saleor/graphql/csv/mutations/export_gift_cards.py b/saleor/graphql/csv/mutations/export_gift_cards.pyindex 38226411bc..aed3c664c3 100644--- a/saleor/graphql/csv/mutations/export_gift_cards.py+++ b/saleor/graphql/csv/mutations/export_gift_cards.py@@ -51,6 +51,10 @@ class ExportGiftCards(BaseExportMutation):type=WebhookEventAsyncType.NOTIFY_USER,description="A notification for the exported file.",),+ WebhookEventInfo(+ type=WebhookEventAsyncType.GIFT_CARD_EXPORT_COMPLETED,+ description="A notification for the exported file.",+ ),]@classmethoddiff --git a/saleor/graphql/csv/tests/mutations/test_export_gift_cards.py b/saleor/graphql/csv/tests/mutations/test_export_gift_cards.pyindex ecb0ed984f..3c3ceab51a 100644--- a/saleor/graphql/csv/tests/mutations/test_export_gift_cards.py+++ b/saleor/graphql/csv/tests/mutations/test_export_gift_cards.py@@ -69,7 +69,6 @@ def test_export_gift_cards_mutation(query = EXPORT_GIFT_CARDS_MUTATIONuser = staff_api_client.uservariables = {"input": input}-response = staff_api_client.post_graphql(query,variables=variables,diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 8ca724c393..4109a1561a 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1831,6 +1831,13 @@ enum WebhookEventTypeEnum @doc(category: "Webhooks") {"""GIFT_CARD_METADATA_UPDATED+ """+ A gift card export is completed.++ Added in Saleor 3.16.+ """+ GIFT_CARD_EXPORT_COMPLETED+"""A new menu created."""MENU_CREATED@@ -2497,6 +2504,13 @@ enum WebhookEventTypeAsyncEnum @doc(category: "Webhooks") {"""GIFT_CARD_METADATA_UPDATED+ """+ A gift card export is completed.++ Added in Saleor 3.16.+ """+ GIFT_CARD_EXPORT_COMPLETED+"""A new menu created."""MENU_CREATED@@ -3440,6 +3454,7 @@ enum WebhookSampleEventTypeEnum @doc(category: "Webhooks") {GIFT_CARD_SENTGIFT_CARD_STATUS_CHANGEDGIFT_CARD_METADATA_UPDATED+ GIFT_CARD_EXPORT_COMPLETEDMENU_CREATEDMENU_UPDATEDMENU_DELETED@@ -16993,11 +17008,12 @@ type Mutation {Triggers the following webhook events:- NOTIFY_USER (async): A notification for the exported file.+ - GIFT_CARD_EXPORT_COMPLETED (async): A notification for the exported file."""exportGiftCards("""Fields required to export gift cards data."""input: ExportGiftCardsInput!- ): ExportGiftCards @doc(category: "Gift cards") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: [])+ ): ExportGiftCards @doc(category: "Gift cards") @webhookEventsInfo(asyncEvents: [NOTIFY_USER, GIFT_CARD_EXPORT_COMPLETED], syncEvents: [])"""Upload a file. This mutation must be sent as a `multipart` request. More detailed specs of the upload format can be found here: https://github.com/jaydenseric/graphql-multipart-request-spec@@ -26293,8 +26309,9 @@ Requires one of the following permissions: MANAGE_GIFT_CARD.Triggers the following webhook events:- NOTIFY_USER (async): A notification for the exported file.+- GIFT_CARD_EXPORT_COMPLETED (async): A notification for the exported file."""-type ExportGiftCards @doc(category: "Gift cards") @webhookEventsInfo(asyncEvents: [NOTIFY_USER], syncEvents: []) {+type ExportGiftCards @doc(category: "Gift cards") @webhookEventsInfo(asyncEvents: [NOTIFY_USER, GIFT_CARD_EXPORT_COMPLETED], syncEvents: []) {"""The newly created export file job which is responsible for export data."""@@ -30407,6 +30424,28 @@ type GiftCardMetadataUpdated implements Event @doc(category: "Gift cards") {giftCard: GiftCard}+"""+Event sent when gift card export is completed.++Added in Saleor 3.16.+"""+type GiftCardExportCompleted implements Event @doc(category: "Gift cards") {+ """Time of the event."""+ issuedAt: DateTime++ """Saleor version that triggered the event."""+ version: String++ """The user or application that triggered the event."""+ issuingPrincipal: IssuingPrincipal++ """The application receiving the webhook."""+ recipient: App++ """The export file for gift cards."""+ export: ExportFile+}+"""Event sent when new menu is created.diff --git a/saleor/graphql/tests/queries/fragments.py b/saleor/graphql/tests/queries/fragments.pyindex 95b633fa19..01515a7e9d 100644--- a/saleor/graphql/tests/queries/fragments.py+++ b/saleor/graphql/tests/queries/fragments.py@@ -374,6 +374,17 @@ fragment GiftCardDetails on GiftCard{}"""+GIFT_CARD_EXPORT_DETAILS = """+fragment GiftCardExportDetails on ExportFile{+ id+ createdAt+ updatedAt+ status+ url+ message+}+"""+VOUCHER_DETAILS = """fragment VoucherDetails on Voucher{diff --git a/saleor/graphql/webhook/enums.py b/saleor/graphql/webhook/enums.pyindex a3a73b5749..f59cb59a21 100644--- a/saleor/graphql/webhook/enums.py+++ b/saleor/graphql/webhook/enums.py@@ -8,6 +8,7 @@ from ..core.descriptions import (ADDED_IN_313,ADDED_IN_314,ADDED_IN_315,+ ADDED_IN_316,DEPRECATED_IN_3X_ENUM_VALUE,PREVIEW_FEATURE,)@@ -96,6 +97,9 @@ WEBHOOK_EVENT_DESCRIPTION = {WebhookEventAsyncType.GIFT_CARD_METADATA_UPDATED: ("A gift card metadata is updated." + ADDED_IN_38),+ WebhookEventAsyncType.GIFT_CARD_EXPORT_COMPLETED: (+ "A gift card export is completed." + ADDED_IN_316+ ),WebhookEventAsyncType.INVOICE_REQUESTED: "An invoice for order requested.",WebhookEventAsyncType.INVOICE_DELETED: "An invoice is deleted.",WebhookEventAsyncType.INVOICE_SENT: "Invoice has been sent.",diff --git a/saleor/graphql/webhook/subscription_types.py b/saleor/graphql/webhook/subscription_types.pyindex d822363de9..ea58550e2f 100644--- a/saleor/graphql/webhook/subscription_types.py+++ b/saleor/graphql/webhook/subscription_types.py@@ -737,6 +737,25 @@ class GiftCardMetadataUpdated(SubscriptionObjectType, GiftCardBase):description = "Event sent when gift card metadata is updated." + ADDED_IN_38+class GiftCardExportCompleted(SubscriptionObjectType):+ export = graphene.Field(+ "saleor.graphql.csv.types.ExportFile",+ description="The export file for gift cards.",+ )++ class Meta:+ root_type = "ExportFile"+ enable_dry_run = True+ interfaces = (Event,)+ description = "Event sent when gift card export is completed." + ADDED_IN_316+ doc_category = DOC_CATEGORY_GIFT_CARDS++ @staticmethod+ def resolve_export(root, info: ResolveInfo):+ _, export_file = root+ return export_file++class MenuBase(AbstractType):menu = graphene.Field("saleor.graphql.menu.types.Menu",@@ -2364,6 +2383,7 @@ WEBHOOK_TYPES_MAP = {WebhookEventAsyncType.GIFT_CARD_SENT: GiftCardSent,WebhookEventAsyncType.GIFT_CARD_STATUS_CHANGED: GiftCardStatusChanged,WebhookEventAsyncType.GIFT_CARD_METADATA_UPDATED: GiftCardMetadataUpdated,+ WebhookEventAsyncType.GIFT_CARD_EXPORT_COMPLETED: GiftCardExportCompleted,WebhookEventAsyncType.MENU_CREATED: MenuCreated,WebhookEventAsyncType.MENU_UPDATED: MenuUpdated,WebhookEventAsyncType.MENU_DELETED: MenuDeleted,diff --git a/saleor/graphql/webhook/tests/mutations/test_webhook_dry_run.py b/saleor/graphql/webhook/tests/mutations/test_webhook_dry_run.pyindex dc09a2169a..4f522c2e98 100644--- a/saleor/graphql/webhook/tests/mutations/test_webhook_dry_run.py+++ b/saleor/graphql/webhook/tests/mutations/test_webhook_dry_run.py@@ -224,6 +224,7 @@ def async_subscription_webhooks_with_root_objects(subscription_gift_card_sent_webhook,subscription_gift_card_status_changed_webhook,subscription_gift_card_metadata_updated_webhook,+ subscription_gift_card_export_completed_webhook,subscription_menu_created_webhook,subscription_menu_updated_webhook,subscription_menu_deleted_webhook,@@ -336,6 +337,7 @@ def async_subscription_webhooks_with_root_objects(translated_attribute,transaction_item_created_by_app,product_media_image,+ user_export_file,):events = WebhookEventAsyncTypeattr = numeric_attribute@@ -392,6 +394,10 @@ def async_subscription_webhooks_with_root_objects(subscription_gift_card_metadata_updated_webhook,gift_card,],+ events.GIFT_CARD_EXPORT_COMPLETED: [+ subscription_gift_card_export_completed_webhook,+ user_export_file,+ ],events.MENU_CREATED: [subscription_menu_created_webhook, menu],events.MENU_UPDATED: [subscription_menu_updated_webhook, menu],events.MENU_DELETED: [subscription_menu_deleted_webhook, menu],diff --git a/saleor/plugins/base_plugin.py b/saleor/plugins/base_plugin.pyindex a9c6f152e8..8b11f021af 100644--- a/saleor/plugins/base_plugin.py+++ b/saleor/plugins/base_plugin.py@@ -51,6 +51,7 @@ if TYPE_CHECKING:from ..core.middleware import Requestorfrom ..core.notify_events import NotifyEventTypefrom ..core.taxes import TaxData, TaxType+ from ..csv.models import ExportFilefrom ..discount.models import Sale, Voucherfrom ..giftcard.models import GiftCardfrom ..invoice.models import Invoice@@ -663,6 +664,12 @@ class BasePlugin:# status is changed.gift_card_status_changed: Callable[["GiftCard", None], None]+ # Trigger when gift cards export is completed.+ #+ # Overwrite this method if you need to trigger specific logic after a gift cards+ # export is completed.+ gift_card_export_completed: Callable[["ExportFile", None], None]+initialize_payment: Callable[[dict, Optional[InitializedPaymentResponse]], InitializedPaymentResponse]diff --git a/saleor/plugins/manager.py b/saleor/plugins/manager.pyindex f329562456..468e822ad8 100644--- a/saleor/plugins/manager.py+++ b/saleor/plugins/manager.py@@ -59,6 +59,7 @@ if TYPE_CHECKING:from ..checkout.fetch import CheckoutInfo, CheckoutLineInfofrom ..checkout.models import Checkoutfrom ..core.middleware import Requestor+ from ..csv.models import ExportFilefrom ..discount.models import Sale, Voucherfrom ..giftcard.models import GiftCardfrom ..invoice.models import Invoice@@ -1283,6 +1284,12 @@ class PluginsManager(PaymentInterface):"gift_card_metadata_updated", default_value, gift_card)+ def gift_card_export_completed(self, export: "ExportFile"):+ default_value = None+ return self.__run_method_on_plugins(+ "gift_card_export_completed", default_value, export+ )+def menu_created(self, menu: "Menu"):default_value = Nonereturn self.__run_method_on_plugins("menu_created", default_value, menu)diff --git a/saleor/plugins/webhook/plugin.py b/saleor/plugins/webhook/plugin.pyindex 2c7d084701..c7a72464f0 100644--- a/saleor/plugins/webhook/plugin.py+++ b/saleor/plugins/webhook/plugin.py@@ -22,7 +22,9 @@ from ...core import EventDeliveryStatusfrom ...core.models import EventDeliveryfrom ...core.notify_events import NotifyEventTypefrom ...core.taxes import TaxData, TaxType+from ...core.utils import build_absolute_urifrom ...core.utils.json_serializer import CustomJsonEncoder+from ...csv.notifications import get_default_export_payloadfrom ...graphql.core.context import SaleorContextfrom ...graphql.webhook.subscription_payload import initialize_requestfrom ...payment import PaymentError, TransactionKind@@ -110,6 +112,7 @@ if TYPE_CHECKING:from ...account.models import Address, Group, Userfrom ...attribute.models import Attribute, AttributeValuefrom ...channel.models import Channel+ from ...csv.models import ExportFilefrom ...discount.models import Sale, Voucherfrom ...giftcard.models import GiftCardfrom ...invoice.models import Invoice@@ -617,6 +620,34 @@ class WebhookPlugin(BasePlugin):WebhookEventAsyncType.GIFT_CARD_STATUS_CHANGED, gift_card)+ def _trigger_export_gift_cards_event(self, event_type, export: "ExportFile"):+ if webhooks := get_webhooks_for_event(event_type):+ payload = self._serialize_payload(+ {+ "id": graphene.Node.to_global_id("ExportFile", export.id),+ "export": get_default_export_payload(export),+ "csv_link": build_absolute_uri(export.content_file.url),+ "recipient_email": export.user.email if export.user else None,+ }+ )+ trigger_webhooks_async(+ payload,+ event_type,+ webhooks,+ export,+ self.requestor,+ )++ def gift_card_export_completed(+ self, export: "ExportFile", previous_value: None+ ) -> None:+ if not self.active:+ return previous_value+ self._trigger_export_gift_cards_event(+ WebhookEventAsyncType.GIFT_CARD_EXPORT_COMPLETED,+ export,+ )+def order_created(self, order: "Order", previous_value: Any) -> Any:if not self.active:return previous_valuediff --git a/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py b/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.pyindex 2053da3b5e..b2da3eef1f 100644--- a/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py+++ b/saleor/plugins/webhook/tests/subscription_webhooks/fixtures.py@@ -261,6 +261,14 @@ def subscription_gift_card_metadata_updated_webhook(subscription_webhook):)+def subscription_gift_card_export_completed_webhook(subscription_webhook):+ return subscription_webhook(+ queries.GIFT_CARD_EXPORT_COMPLETED,+ WebhookEventAsyncType.GIFT_CARD_EXPORT_COMPLETED,+ )++@pytest.fixturedef subscription_menu_created_webhook(subscription_webhook):return subscription_webhook(diff --git a/saleor/plugins/webhook/tests/subscription_webhooks/payloads.py b/saleor/plugins/webhook/tests/subscription_webhooks/payloads.pyindex ac6a13e6b5..3156f29ed9 100644--- a/saleor/plugins/webhook/tests/subscription_webhooks/payloads.py+++ b/saleor/plugins/webhook/tests/subscription_webhooks/payloads.py@@ -4,6 +4,7 @@ import graphenefrom django.utils import timezonefrom ..... import __version__+from .....core.utils import build_absolute_urifrom .....graphql.attribute.enums import AttributeInputTypeEnum, AttributeTypeEnumfrom .....graphql.shop.types import SHOP_IDfrom .....product.models import Product@@ -427,6 +428,21 @@ def generate_gift_card_payload(gift_card, card_global_id):)+def generate_gift_card_export_payload(export_file, export_global_id):+ return json.dumps(+ {+ "export": {+ "id": export_global_id,+ "createdAt": export_file.created_at.isoformat(),+ "updatedAt": export_file.updated_at.isoformat(),+ "status": export_file.status.upper(),+ "url": build_absolute_uri(export_file.content_file.url),+ "message": export_file.message,+ }+ }+ )++def generate_menu_payload(menu, menu_global_id):menu_items = sorted(menu.items.all(), key=lambda key: key.pk)return {diff --git a/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py b/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.pyindex a0697cad26..ec4e7025d7 100644--- a/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py+++ b/saleor/plugins/webhook/tests/subscription_webhooks/subscription_queries.py@@ -459,6 +459,21 @@ GIFT_CARD_METADATA_UPDATED = (""")+GIFT_CARD_EXPORT_COMPLETED = (+ fragments.GIFT_CARD_EXPORT_DETAILS+ + """+ subscription{+ event{+ ...on GiftCardExportCompleted{+ export{+ ...GiftCardExportDetails+ }+ }+ }+ }+"""+)+VOUCHER_CREATED = (fragments.VOUCHER_DETAILS+ """diff --git a/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py b/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.pyindex e8b8f0832f..89c73df368 100644--- a/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py+++ b/saleor/plugins/webhook/tests/subscription_webhooks/test_create_deliveries_for_subscription.py@@ -1,8 +1,9 @@import json-from unittest.mock import patch+from unittest.mock import MagicMock, patchimport grapheneimport pytest+from django.core.files import Filefrom freezegun import freeze_timefrom .....channel.models import Channel@@ -26,6 +27,7 @@ from .payloads import (generate_collection_payload,generate_customer_payload,generate_fulfillment_payload,+ generate_gift_card_export_payload,generate_gift_card_payload,generate_invoice_payload,generate_menu_item_payload,@@ -773,6 +775,32 @@ def test_gift_card_metadata_updated(assert deliveries[0].webhook == webhooks[0]+def test_gift_card_export_completed(+ user_export_file, tmpdir, subscription_gift_card_export_completed_webhook+):+ # given+ file_mock = MagicMock(spec=File)+ file_mock.name = "temp_file.csv"++ user_export_file.content_file = file_mock+ user_export_file.save()++ webhooks = [subscription_gift_card_export_completed_webhook]+ event_type = WebhookEventAsyncType.GIFT_CARD_EXPORT_COMPLETED+ gift_card_id = graphene.Node.to_global_id("ExportFile", user_export_file.id)++ # when+ deliveries = create_deliveries_for_subscriptions(+ event_type, user_export_file, webhooks+ )++ # then+ expected_payload = generate_gift_card_export_payload(user_export_file, gift_card_id)+ assert deliveries[0].payload.payload == expected_payload+ assert len(deliveries) == len(webhooks)+ assert deliveries[0].webhook == webhooks[0]++def test_menu_created(menu, subscription_menu_created_webhook):# givenwebhooks = [subscription_menu_created_webhook]diff --git a/saleor/webhook/event_types.py b/saleor/webhook/event_types.pyindex 5a4b32a57b..2c82a03235 100644--- a/saleor/webhook/event_types.py+++ b/saleor/webhook/event_types.py@@ -63,6 +63,7 @@ class WebhookEventAsyncType:GIFT_CARD_SENT = "gift_card_sent"GIFT_CARD_STATUS_CHANGED = "gift_card_status_changed"GIFT_CARD_METADATA_UPDATED = "gift_card_metadata_updated"+ GIFT_CARD_EXPORT_COMPLETED = "gift_card_export_completed"MENU_CREATED = "menu_created"MENU_UPDATED = "menu_updated"@@ -321,6 +322,10 @@ class WebhookEventAsyncType:"name": "Gift card metadata updated","permission": GiftcardPermissions.MANAGE_GIFT_CARD,},+ GIFT_CARD_EXPORT_COMPLETED: {+ "name": "Gift card export completed",+ "permission": GiftcardPermissions.MANAGE_GIFT_CARD,+ },MENU_CREATED: {"name": "Menu created","permission": MenuPermissions.MANAGE_MENUS,