parent
bda814b7b3
commit
78670ce712
22 changed files with 73 additions and 79 deletions
5
.changeset/witty-plants-stare.md
Normal file
5
.changeset/witty-plants-stare.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"saleor-app-emails-and-messages": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Changed formatting in the debugging logs to be more concise.
|
|
@ -29,7 +29,7 @@ export const sendEventMessages = async ({
|
||||||
client,
|
client,
|
||||||
}: SendEventMessagesArgs) => {
|
}: SendEventMessagesArgs) => {
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "sendEventMessages",
|
name: "sendEventMessages",
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.debug("Function called");
|
logger.debug("Function called");
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { sendgridTransformV1toV2 } from "./sendgrid-transform-v1-to-v2";
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "sendgridConfigMigrationV1ToV2",
|
name: "sendgridConfigMigrationV1ToV2",
|
||||||
});
|
});
|
||||||
|
|
||||||
interface SendgridConfigMigrationV1ToV1Args {
|
interface SendgridConfigMigrationV1ToV1Args {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { SendgridPrivateMetadataManager } from "./sendgrid-metadata-manager";
|
||||||
import { FeatureFlagService } from "../../feature-flag-service/feature-flag-service";
|
import { FeatureFlagService } from "../../feature-flag-service/feature-flag-service";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
service: "SendgridConfigurationService",
|
name: "SendgridConfigurationService",
|
||||||
});
|
});
|
||||||
|
|
||||||
export type SendgridConfigurationServiceErrorType =
|
export type SendgridConfigurationServiceErrorType =
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { sendgridConfigMigrationV1ToV2 } from "./migrations/sendgrid-config-migr
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "SendgridPrivateMetadataManager",
|
name: "SendgridPrivateMetadataManager",
|
||||||
});
|
});
|
||||||
|
|
||||||
export class SendgridPrivateMetadataManager {
|
export class SendgridPrivateMetadataManager {
|
||||||
|
|
|
@ -24,7 +24,7 @@ export const sendSendgrid = async ({
|
||||||
sendgridConfiguration,
|
sendgridConfiguration,
|
||||||
}: SendSendgridArgs) => {
|
}: SendSendgridArgs) => {
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "sendSendgrid",
|
name: "sendSendgrid",
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import Handlebars from "handlebars";
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "compileHandlebarsTemplate",
|
name: "compileHandlebarsTemplate",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const compileHandlebarsTemplate = (template: string, variables: any) => {
|
export const compileHandlebarsTemplate = (template: string, variables: any) => {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import mjml2html from "mjml";
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "compileMjml",
|
name: "compileMjml",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const compileMjml = (mjml: string) => {
|
export const compileMjml = (mjml: string) => {
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
import { AppConfigPrivateMetadataManager } from "../../../app-configuration/app-config-metadata-manager";
|
import { AppConfigPrivateMetadataManager } from "../../../app-configuration/app-config-metadata-manager";
|
||||||
import { AppConfig } from "../../../app-configuration/app-config-schema";
|
|
||||||
import { ChannelConfiguration } from "../../../channels/channel-configuration-schema";
|
|
||||||
import { SettingsManager } from "@saleor/app-sdk/settings-manager";
|
import { SettingsManager } from "@saleor/app-sdk/settings-manager";
|
||||||
import { MjmlPrivateMetadataManager } from "../mjml-metadata-manager";
|
import { MjmlPrivateMetadataManager } from "../mjml-metadata-manager";
|
||||||
import { SmtpConfigV2 } from "./smtp-config-schema-v2";
|
|
||||||
import { getChannelsAssignedToConfigId } from "../../../app-configuration/migrations/get-channels-assigned-to-config-id";
|
|
||||||
import { smtpTransformV1toV2 } from "./smtp-transform-v1-to-v2";
|
import { smtpTransformV1toV2 } from "./smtp-transform-v1-to-v2";
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "smtpConfigMigrationV1ToV2",
|
name: "smtpConfigMigrationV1ToV2",
|
||||||
});
|
});
|
||||||
|
|
||||||
interface SmtpConfigMigrationV1ToV1Args {
|
interface SmtpConfigMigrationV1ToV1Args {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { filterConfigurations } from "../../app-configuration/filter-configurati
|
||||||
import { FeatureFlagService } from "../../feature-flag-service/feature-flag-service";
|
import { FeatureFlagService } from "../../feature-flag-service/feature-flag-service";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
service: "SmtpConfigurationService",
|
name: "SmtpConfigurationService",
|
||||||
});
|
});
|
||||||
|
|
||||||
export type SmtpConfigurationServiceErrorType =
|
export type SmtpConfigurationServiceErrorType =
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { smtpConfigMigrationV1ToV2 } from "./migrations/smtp-config-migration-v1
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "SmtpPrivateMetadataManager",
|
name: "SmtpPrivateMetadataManager",
|
||||||
});
|
});
|
||||||
|
|
||||||
export class SmtpPrivateMetadataManager {
|
export class SmtpPrivateMetadataManager {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { convert } from "html-to-text";
|
||||||
import { createLogger } from "@saleor/apps-shared";
|
import { createLogger } from "@saleor/apps-shared";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "htmlToPlaintext",
|
name: "htmlToPlaintext",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const htmlToPlaintext = (html: string) => {
|
export const htmlToPlaintext = (html: string) => {
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { createLogger } from "@saleor/apps-shared";
|
||||||
import { SmtpEncryptionType } from "./configuration/migrations/mjml-config-schema-v1";
|
import { SmtpEncryptionType } from "./configuration/migrations/mjml-config-schema-v1";
|
||||||
|
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "sendEmailWithSmtp",
|
name: "sendEmailWithSmtp",
|
||||||
});
|
});
|
||||||
|
|
||||||
export interface SendMailArgs {
|
export interface SendMailArgs {
|
||||||
|
|
|
@ -27,7 +27,7 @@ export const sendSmtp = async ({
|
||||||
smtpConfiguration,
|
smtpConfiguration,
|
||||||
}: SendSmtpArgs) => {
|
}: SendSmtpArgs) => {
|
||||||
const logger = createLogger({
|
const logger = createLogger({
|
||||||
fn: "sendSmtp",
|
name: "sendSmtp",
|
||||||
event,
|
event,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,24 +35,12 @@ export const sendSmtp = async ({
|
||||||
|
|
||||||
if (!eventSettings) {
|
if (!eventSettings) {
|
||||||
logger.debug("No active settings for this event, skipping");
|
logger.debug("No active settings for this event, skipping");
|
||||||
return {
|
return;
|
||||||
errors: [
|
|
||||||
{
|
|
||||||
message: "No active settings for this event",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!eventSettings.active) {
|
if (!eventSettings.active) {
|
||||||
logger.debug("Event settings are not active, skipping");
|
logger.debug("Event settings are not active, skipping");
|
||||||
return {
|
return;
|
||||||
errors: [
|
|
||||||
{
|
|
||||||
message: "Event settings are not active",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Sending an email using MJML");
|
logger.debug("Sending an email using MJML");
|
||||||
|
@ -64,8 +52,6 @@ export const sendSmtp = async ({
|
||||||
payload
|
payload
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.warn(`email subject ${emailSubject} ${subject}`);
|
|
||||||
|
|
||||||
if (handlebarsSubjectErrors?.length) {
|
if (handlebarsSubjectErrors?.length) {
|
||||||
logger.error("Error during the handlebars subject template compilation");
|
logger.error("Error during the handlebars subject template compilation");
|
||||||
return {
|
return {
|
||||||
|
@ -80,6 +66,8 @@ export const sendSmtp = async ({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug({ emailSubject }, "Subject compiled");
|
||||||
|
|
||||||
const { template: mjmlTemplate, errors: handlebarsErrors } = compileHandlebarsTemplate(
|
const { template: mjmlTemplate, errors: handlebarsErrors } = compileHandlebarsTemplate(
|
||||||
rawTemplate,
|
rawTemplate,
|
||||||
payload
|
payload
|
||||||
|
@ -99,6 +87,8 @@ export const sendSmtp = async ({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("Handlebars template compiled");
|
||||||
|
|
||||||
const { html: emailBodyHtml, errors: mjmlCompilationErrors } = compileMjml(mjmlTemplate);
|
const { html: emailBodyHtml, errors: mjmlCompilationErrors } = compileMjml(mjmlTemplate);
|
||||||
|
|
||||||
if (mjmlCompilationErrors.length) {
|
if (mjmlCompilationErrors.length) {
|
||||||
|
@ -120,6 +110,8 @@ export const sendSmtp = async ({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("MJML template compiled");
|
||||||
|
|
||||||
const { plaintext: emailBodyPlaintext } = htmlToPlaintext(emailBodyHtml);
|
const { plaintext: emailBodyPlaintext } = htmlToPlaintext(emailBodyHtml);
|
||||||
|
|
||||||
if (!emailBodyPlaintext || !emailBodyPlaintext?.length) {
|
if (!emailBodyPlaintext || !emailBodyPlaintext?.length) {
|
||||||
|
@ -129,6 +121,8 @@ export const sendSmtp = async ({
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.debug("Email body converted to plaintext");
|
||||||
|
|
||||||
const sendEmailSettings: SendMailArgs = {
|
const sendEmailSettings: SendMailArgs = {
|
||||||
mailData: {
|
mailData: {
|
||||||
text: emailBodyPlaintext,
|
text: emailBodyPlaintext,
|
||||||
|
@ -156,5 +150,5 @@ export const sendSmtp = async ({
|
||||||
if (smtpErrors?.length) {
|
if (smtpErrors?.length) {
|
||||||
return { errors: smtpErrors };
|
return { errors: smtpErrors };
|
||||||
}
|
}
|
||||||
logger.debug(response?.response);
|
logger.debug(response?.response, "Email sent");
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,15 +57,15 @@ export const giftCardSentWebhook = new SaleorAsyncWebhook<GiftCardSentWebhookPay
|
||||||
subscriptionQueryAst: GiftCardSentGraphqlSubscription,
|
subscriptionQueryAst: GiftCardSentGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: giftCardSentWebhook.webhookPath,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<GiftCardSentWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<GiftCardSentWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: giftCardSentWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
|
@ -43,15 +43,15 @@ export const invoiceSentWebhook = new SaleorAsyncWebhook<InvoiceSentWebhookPaylo
|
||||||
subscriptionQueryAst: InvoiceSentGraphqlSubscription,
|
subscriptionQueryAst: InvoiceSentGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: invoiceSentWebhook.name,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<InvoiceSentWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<InvoiceSentWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: invoiceSentWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
|
@ -4,6 +4,15 @@ import { createLogger, createGraphQLClient } from "@saleor/apps-shared";
|
||||||
import { sendEventMessages } from "../../../modules/event-handlers/send-event-messages";
|
import { sendEventMessages } from "../../../modules/event-handlers/send-event-messages";
|
||||||
import { MessageEventTypes } from "../../../modules/event-handlers/message-event-types";
|
import { MessageEventTypes } from "../../../modules/event-handlers/message-event-types";
|
||||||
|
|
||||||
|
// Notify webhook event groups multiple event types under the one webhook. We need to map it to events recognized by the App
|
||||||
|
const notifyEventMapping: Record<string, MessageEventTypes> = {
|
||||||
|
account_confirmation: "ACCOUNT_CONFIRMATION",
|
||||||
|
account_delete: "ACCOUNT_DELETE",
|
||||||
|
account_password_reset: "ACCOUNT_PASSWORD_RESET",
|
||||||
|
account_change_email_request: "ACCOUNT_CHANGE_EMAIL_REQUEST",
|
||||||
|
account_change_email_confirm: "ACCOUNT_CHANGE_EMAIL_CONFIRM",
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notify event handles multiple event types which are recognized based on payload field `notify_event`.
|
* Notify event handles multiple event types which are recognized based on payload field `notify_event`.
|
||||||
* Handler recognizes if event is one of the supported typed and sends appropriate message.
|
* Handler recognizes if event is one of the supported typed and sends appropriate message.
|
||||||
|
@ -62,11 +71,11 @@ export const notifyWebhook = new SaleorAsyncWebhook<NotifySubscriptionPayload>({
|
||||||
query: "{}", // We are using the default payload instead of subscription
|
query: "{}", // We are using the default payload instead of subscription
|
||||||
});
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<NotifySubscriptionPayload> = async (req, res, context) => {
|
const logger = createLogger({
|
||||||
const logger = createLogger({
|
name: notifyWebhook.webhookPath,
|
||||||
webhook: notifyWebhook.name,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
const handler: NextWebhookApiHandler<NotifySubscriptionPayload> = async (req, res, context) => {
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
@ -80,22 +89,12 @@ const handler: NextWebhookApiHandler<NotifySubscriptionPayload> = async (req, re
|
||||||
.json({ error: "Email recipient has not been specified in the event payload." });
|
.json({ error: "Email recipient has not been specified in the event payload." });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify webhook event groups multiple event types under the one webhook. We need to map it to events recognized by the App
|
|
||||||
const notifyEventMapping: Record<string, MessageEventTypes> = {
|
|
||||||
account_confirmation: "ACCOUNT_CONFIRMATION",
|
|
||||||
account_delete: "ACCOUNT_DELETE",
|
|
||||||
account_password_reset: "ACCOUNT_PASSWORD_RESET",
|
|
||||||
account_change_email_request: "ACCOUNT_CHANGE_EMAIL_REQUEST",
|
|
||||||
account_change_email_confirm: "ACCOUNT_CHANGE_EMAIL_CONFIRM",
|
|
||||||
};
|
|
||||||
|
|
||||||
const event = notifyEventMapping[payload.notify_event];
|
const event = notifyEventMapping[payload.notify_event];
|
||||||
|
|
||||||
if (!event) {
|
if (!event) {
|
||||||
logger.error(`The type of received notify event (${payload.notify_event}) is not supported.`);
|
// NOTIFY webhook sends multiple events to the same endpoint. The app supports only a subset of them.
|
||||||
return res
|
logger.debug(`The type of received notify event (${payload.notify_event}) is not supported.`);
|
||||||
.status(200)
|
return res.status(200).json({ message: `${payload.notify_event} event is not supported.` });
|
||||||
.json({ error: "Email recipient has not been specified in the event payload." });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const client = createGraphQLClient({
|
const client = createGraphQLClient({
|
||||||
|
|
|
@ -34,15 +34,15 @@ export const orderCancelledWebhook = new SaleorAsyncWebhook<OrderCancelledWebhoo
|
||||||
subscriptionQueryAst: OrderCancelledGraphqlSubscription,
|
subscriptionQueryAst: OrderCancelledGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: orderCancelledWebhook.webhookPath,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<OrderCancelledWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<OrderCancelledWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: orderCancelledWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
|
@ -35,15 +35,15 @@ export const orderConfirmedWebhook = new SaleorAsyncWebhook<OrderConfirmedWebhoo
|
||||||
subscriptionQueryAst: OrderConfirmedGraphqlSubscription,
|
subscriptionQueryAst: OrderConfirmedGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: orderConfirmedWebhook.webhookPath,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<OrderConfirmedWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<OrderConfirmedWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: orderConfirmedWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
|
@ -32,15 +32,15 @@ export const orderCreatedWebhook = new SaleorAsyncWebhook<OrderCreatedWebhookPay
|
||||||
subscriptionQueryAst: OrderCreatedGraphqlSubscription,
|
subscriptionQueryAst: OrderCreatedGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: orderCreatedWebhook.webhookPath,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<OrderCreatedWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<OrderCreatedWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: orderCreatedWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
|
@ -35,15 +35,15 @@ export const orderFulfilledWebhook = new SaleorAsyncWebhook<OrderFulfilledWebhoo
|
||||||
subscriptionQueryAst: OrderFulfilledGraphqlSubscription,
|
subscriptionQueryAst: OrderFulfilledGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: orderFulfilledWebhook.webhookPath,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<OrderFulfilledWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<OrderFulfilledWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: orderFulfilledWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
|
@ -35,15 +35,15 @@ export const orderFullyPaidWebhook = new SaleorAsyncWebhook<OrderFullyPaidWebhoo
|
||||||
subscriptionQueryAst: OrderFullyPaidGraphqlSubscription,
|
subscriptionQueryAst: OrderFullyPaidGraphqlSubscription,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const logger = createLogger({
|
||||||
|
name: orderFullyPaidWebhook.webhookPath,
|
||||||
|
});
|
||||||
|
|
||||||
const handler: NextWebhookApiHandler<OrderFullyPaidWebhookPayloadFragment> = async (
|
const handler: NextWebhookApiHandler<OrderFullyPaidWebhookPayloadFragment> = async (
|
||||||
req,
|
req,
|
||||||
res,
|
res,
|
||||||
context
|
context
|
||||||
) => {
|
) => {
|
||||||
const logger = createLogger({
|
|
||||||
webhook: orderFullyPaidWebhook.name,
|
|
||||||
});
|
|
||||||
|
|
||||||
logger.debug("Webhook received");
|
logger.debug("Webhook received");
|
||||||
|
|
||||||
const { payload, authData } = context;
|
const { payload, authData } = context;
|
||||||
|
|
Loading…
Reference in a new issue