
* feat: ✨ add ping method to avatax-client * refactor: ♻️ use avatax-auth-validation.service instead of address service * refactor: ♻️ extract avatax-configuration-address-fragment * refactor: ♻️ extract avatax-configuration-credentials-fragment * refactor: ♻️ extract form-helper-text * refactor: ♻️ extract form-section * refactor: ♻️ extract avatax-configuration-taxes-fragment * feat: ✨ move verify to credentials fragment && add disabled form section * refactor: 🚚 obfuscator * feat: ✨ add separate credentials and address validation services * build: 👷 add changeset * feat: ✨ add address resolution message * fix: 🐛 changeset * refactor: ♻️ extract avataxAddressResolutionProcessor and add tests * refactor: * refactor: ♻️ remove brs from avatax-instructions * refactor: ♻️ replace b with Text bodyStrong * refactor: ♻️ state tuple to object * refactor: ♻️ destructure some more constructors * refactor: ♻️ memoize isLoadings & handlers
31 lines
1 KiB
TypeScript
31 lines
1 KiB
TypeScript
import { router } from "../../trpc/trpc-server";
|
|
|
|
import { createLogger } from "../../../lib/logger";
|
|
import { protectedClientProcedure } from "../../trpc/protected-client-procedure";
|
|
|
|
import { z } from "zod";
|
|
import { TaxJarConnectionService } from "../configuration/taxjar-connection.service";
|
|
import { TaxJarTaxCodesService } from "./taxjar-tax-codes.service";
|
|
|
|
const getAllForIdSchema = z.object({ connectionId: z.string() });
|
|
|
|
export const taxJarTaxCodesRouter = router({
|
|
getAllForId: protectedClientProcedure.input(getAllForIdSchema).query(async ({ ctx, input }) => {
|
|
const logger = createLogger({
|
|
name: "taxjarTaxCodesRouter.getAllForId",
|
|
});
|
|
|
|
const connectionService = new TaxJarConnectionService({
|
|
appId: ctx.appId!,
|
|
client: ctx.apiClient,
|
|
saleorApiUrl: ctx.saleorApiUrl,
|
|
});
|
|
|
|
const connection = await connectionService.getById(input.connectionId);
|
|
const taxCodesService = new TaxJarTaxCodesService(connection.config);
|
|
|
|
logger.debug("Returning tax codes");
|
|
|
|
return taxCodesService.getAll();
|
|
}),
|
|
});
|