← back to Filemaker Mcp
scripts/test-real-units.mjs
19 lines
import { createInvoiceForOrder } from '../lib/invoice.js';
const order = {
order_number: 999123,
total_tax: 0,
customer: { first_name: 'Test', last_name: 'Buyer' },
shipping_address: { company: 'Test Project', address1: '1 Main', city: 'LA', province_code: 'CA', zip: '90001', country_code: 'US' },
shipping_lines: [{ title: 'UPS', price: '0' }],
line_items: [
{ sku: 'DWTT-80502', name: "Edward's Paper", price: '12.50', quantity: 2, variant_title: 'Double Roll' },
{ sku: 'DWAK-1120', name: 'Ashbury', price: '4.25', quantity: 3, variant_title: 'Sample' },
],
};
const r = await createInvoiceForOrder(order, 'TEST-ACCT', { commit: false });
console.log('MONEY RECORD (real invoice):');
for (const L of r.moneyRecordLines) console.log(` ${L.detail.padEnd(28)} Q=${L.qty} NET=$${L.price} ext=$${L.ext}`);
console.log(` merch subtotal = $${r.merch} (GRAND TOTAL will calc to this)`);
console.log('$0 STUB RECORDS:');
for (const s of r.stubRecords) console.log(` ${s.sku} Q=${s.qty} $${s.dollars}`);