import { randomUUID } from 'node:crypto'; import type { IdentityApp } from './identity-app'; export function pricingInput() { // Synthetic test rules; these are not Mani Candles tax or shipping settings. return { name: 'Test-' + randomUUID(), currency: 'INR', countryCode: 'IN', region: '', taxMode: 'EXCLUSIVE', merchandiseTaxBps: 1800, shippingFee: '50.00', shippingTaxBps: 1800, freeShippingMinimum: null, }; } export async function activatePricing( ctx: IdentityApp, changes: Record = {}, ) { const policy = await ctx .api() .post('/api/v1/admin/pricing-policies') .auth(ctx.token, { type: 'bearer' }) .send({ ...pricingInput(), ...changes }) .expect(201); expect(policy.body.active).toBe(false); await ctx .api() .patch('/api/v1/admin/pricing-policies/' + policy.body.id + '/status') .auth(ctx.token, { type: 'bearer' }) .send({ active: true }) .expect(200); return policy.body; }