saleor-apps-redis_apl/apps/taxes/scripts/migrations/1.15-taxes-migration.ts
Adrian Pilarczyk 34efd39dcf
fix customer code calculate taxes (#922)
* fix: 🐛 calculate taxes customerCode

* build: 👷 changeset

* refactor: ♻️ address feedback

* feat:  add migration

* Empty-Commit
2023-08-25 14:50:47 +02:00

15 lines
859 B
TypeScript

/* eslint-disable multiline-comment-style */
import { checkoutCalculateTaxesSyncWebhook } from "../../src/pages/api/webhooks/checkout-calculate-taxes";
import { orderCalculateTaxesSyncWebhook } from "../../src/pages/api/webhooks/order-calculate-taxes";
import { AppWebhookMigrator } from "./app-webhook-migrator";
/**
* Contains the migration logic for the Taxes App. In the 1st step, it is expected to only write, not delete. The cleanup will be done in the 2nd step.
* @param webhookMigrator - The AppWebhookMigrator instance.
*/
export async function migrateTaxes(webhookMigrator: AppWebhookMigrator) {
// Migration plan:
// 1. Update subscriptionQuery of all calculateTaxes webhooks
webhookMigrator.updateWebhookQueryByHandler(orderCalculateTaxesSyncWebhook);
webhookMigrator.updateWebhookQueryByHandler(checkoutCalculateTaxesSyncWebhook);
}