@classytic/ca-tax 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,98 @@
1
+ import { _ as getCombinedRate, a as SIMPLIFIED_DIGITAL_THRESHOLD_MINOR, b as resetCaTaxRuleExtensions, c as calculateCaSalesTax, d as placeOfSupply, f as CA_SUPPLY_CATEGORIES, g as PROVINCIAL_REGIMES, h as GST_RATE, i as PSB_SMALL_SUPPLIER_THRESHOLD_MINOR, l as claimableItc, m as pstApplies, n as gst34LedgerAdapter, o as SMALL_SUPPLIER_THRESHOLD_MINOR, p as classifySupply, r as gst34Template, s as VEHICLE_ITC_CEILINGS, t as gst34Engine, u as isSmallSupplier, v as getProvincialRegime, y as extendCaTaxRules } from "./gst-hst.mjs";
2
+ import { $ as SCHEDULE_2_CARRYFORWARD_YEARS, A as SCHEDULE_8_CCA_LINE, At as AT1_DONATION_CARRYFORWARD_YEARS, B as SCHEDULE_5_JURISDICTIONS, Bt as AT1_SCHEDULE_13, C as SCHEDULE_23_GROUP_BUSINESS_LIMIT, Ct as AT1_IEG_ENHANCED_RATE, D as T2_SCHEDULE_21, Dt as AT1_SCHEDULE_29, E as SCHEDULE_21_NON_BUSINESS_CREDIT_LINE, Et as AT1_IEG_PRIOR_YEARS, F as SCHEDULE_7_ADJUSTED_AII_LINE, Ft as AT1_SECTION_34_2_GROSS_UP, G as SCHEDULE_4_LPP_CARRYFORWARD_YEARS, Gt as AT1_BALANCE_LINE, H as SCHEDULE_5_SALARIES_OFFSET, Ht as AT1_SCHEDULE_12, I as SCHEDULE_7_PASSIVE_INCOME_THRESHOLD, It as AT1_SCHEDULE_17, J as UnclassifiedLineError, K as SCHEDULE_4_NON_CAPITAL_CARRYFORWARD_YEARS, Kt as AT1_JACKET, L as T2_SCHEDULE_7, Lt as AT1_SCHEDULE_17_RESERVES, M as SCHEDULE_8_RECAPTURE_LINE, Mt as AT1_SCHEDULE_20_POOLS, N as SCHEDULE_8_TERMINAL_LOSS_LINE, Nt as AT1_SCHEDULE_18, O as SCHEDULE_13_RESERVE_ROWS, Ot as AT1_SCHEDULE_21, P as T2_SCHEDULE_8, Pt as AT1_SCHEDULE_18_CATEGORIES, Q as T2_SCHEDULE_3, R as SCHEDULE_6_GRIDS, Rt as AT1_SCHEDULE_16, S as T2_SCHEDULE_24, St as AT1_IEG_BASE_RATE, T as SCHEDULE_21_BUSINESS_CREDIT_LINE, Tt as AT1_IEG_MAX_EXPENDITURE, U as T2_SCHEDULE_5, Ut as AT1_SCHEDULE_12_PAIRS, V as SCHEDULE_5_REVENUE_OFFSET, Vt as AT1_SCHEDULE_13_COLUMNS, W as SCHEDULE_4_CARRYBACK_YEARS, Wt as AT1_BALANCE_CREDIT_LINES, X as SCHEDULE_3_ELIGIBLE_PAID_LINE, Y as buildFields, Z as SCHEDULE_3_TAXABLE_PAID_LINE, _ as T2_SCHEDULE_33, _t as T2_TOTAL_TAX_PAYABLE_LINE, a as getField, at as SCHEDULE_1_TOTAL_DEDUCTIONS_LINE, b as T2_SCHEDULE_31, bt as CO17_TAXABLE_INCOME_BOX, c as T2_SCHEDULE_55, ct as indexByLine, d as T2_SCHEDULE_53, dt as validateFormDefinition, et as SCHEDULE_2_CHARITABLE_CURRENT_LINE, f as SCHEDULE_50_DISCLOSURE_THRESHOLD, ft as T2_BASE_PART_I_RATE, g as SCHEDULE_33_TAXABLE_CAPITAL_IN_CANADA_LINE, gt as T2_TAXABLE_INCOME_LINE, h as T2_SCHEDULE_43, ht as T2_SMALL_BUSINESS_DEDUCTION_RATE, i as formsForProgram, it as SCHEDULE_1_TOTAL_ADDITIONS_LINE, j as SCHEDULE_8_COLUMNS, jt as AT1_SCHEDULE_20, k as T2_SCHEDULE_13, kt as AT1_SCHEDULE_21_POOLS, l as SCHEDULE_53_CLOSING_GRIP_LINE, lt as inputFields, m as SCHEDULE_43_DIVIDEND_ALLOWANCE, mt as T2_NET_INCOME_FOR_TAX_LINE, n as describeLine, nt as SCHEDULE_1_LINES, o as getForm, ot as T2_SCHEDULE_1, p as T2_SCHEDULE_50, pt as T2_JACKET, q as T2_SCHEDULE_4, qt as AT1_TAX_PAYABLE_LINE, r as findBrokenLinks, rt as SCHEDULE_1_LINE_BY_NUMBER, s as T2_SCHEDULE_130, st as fieldsInSection, t as FORMS, tt as T2_SCHEDULE_2, u as SCHEDULE_53_GENERAL_RATE_FACTOR, ut as isEnterableLine, v as SCHEDULE_31_ENHANCED_SRED_RATE, vt as CO17_QUEBEC_PROPORTION_BOX, w as T2_SCHEDULE_23, wt as AT1_IEG_JACKET_LINE, x as SCHEDULE_24_OPERATION_TYPE_LINE, xt as CO17_TAX_PAYABLE_BOX, y as SCHEDULE_31_GENERAL_SRED_RATE, yt as CO17_RETURN, z as T2_SCHEDULE_6, zt as AT1_SCHEDULE_16_CARRYFORWARD_LINE } from "./forms.mjs";
3
+ import { $ as computeProvincialAllocation, $n as at1TaxPayableDeductions, $t as CEC_DEDUCTION_RATE, A as runConformance, An as reconcileAlbertaNetIncome, Ar as AB_GENERAL_RATE_BANDS, At as computeCcpcActiveBusinessTax, B as computeGrip, Bn as formatRsiText, Bt as AT1_DONATION_GAIN_RATE, C as computeQuebecTax, Cn as albertaCcaScheduleAdjustments, Cr as schedule1Values, Ct as blendProvinceRateTable, D as T2_LINE_META, Dn as albertaReserveDifference, Dr as schedule2Values, Dt as dividendsDeductibleS112, E as resolveQuebecTaxRates, En as albertaRecaptureDifference, Er as schedule29Values, Et as computeTaxableIncome, F as normalizeSchedule88, Fn as RSI_NEGATIVE_PREFIX, Fr as earliestRateYear, Ft as CORP_TAX_RATE_BOOK, G as ITC_RECAPTURE_PERIOD_YEARS, Gn as AT1_CRITICAL_MANDATORY_FIELDS, Gt as SECTION_34_2_GROSS_UP, H as LARGE_CORPORATION_THRESHOLD, Hn as renderRsiHeader, Ht as computeDonationMaximum, I as computeSchedule55, In as RSI_WORD_GAP, Ir as extendRateBook, It as resolveCorpTaxRates, J as allocateEvenly, Jn as At1TaxPayableMismatchError, Jt as AT1_RESERVE_LINES, K as computeItcRecapture, Kn as At1CriticalFieldMissingError, Kt as computeAlbertaSchedule18, L as LRIP_INVESTMENT_CORPORATION_MULTIPLE, Ln as RsiLineItemError, Lr as hasExactRateYear, Lt as T2_CERTIFICATION_FIXTURES, M as computeFederalT2, Mn as computeLossCarryback, Mr as AB_TAX_2024, Mt as computeBusinessLimit, N as computeSchedule101, Nn as RSI_COLUMN_GAP, Nr as AB_TAX_RATE_BOOK, Nt as computeSBD, O as foldT2Lines, On as albertaTerminalLossDifference, Or as computeAlbertaTax, Ot as netCapitalLossApplied, P as SCHEDULE_88_MAX_URLS, Pn as RSI_DELIMITER, Pr as resolveAlbertaTaxRates, Pt as CORP_TAX_2024, Q as computeSchedule6, Qn as assertCriticalFields, Qt as computeAlbertaSchedule16, R as LRIP_INVESTMENT_INCOME_FACTOR, Rn as formatRsiAmount, Rr as latestRateYear, Rt as computeLossSchedule, S as computeQuebecAllocationFactor, Sn as albertaCcaDifference, Sr as schedule18Values, St as resolveProvinceRates, T as QC_TAX_RATE_BOOK, Tn as albertaDispositionAdjustments, Tr as schedule21Values, Tt as charitableDonationsDeduction, U as computeTaxableCapital, Un as renderRsiLineItem, Ut as computeSchedule20, V as computeSchedule43, Vn as renderAt1Rsi, Vt as AT1_DONATION_INCOME_RATE, W as computeSchedule31, Wn as renderAt1NetFile, Wt as AT1_DISPOSITION_CATEGORIES, X as computeSchedule21, Xn as assertAt1MandatoryComplete, Xt as computeAlbertaSchedule17, Y as computeBusinessLimitAllocation, Yn as albertaBalanceUnpaid, Yt as AT1_RESERVE_TOTAL_LINES, Z as computeSchedule13, Zn as assertAt1TaxPayableReconciles, Zt as assistanceFrom, _ as renderT2DraftReturn, _n as CCA_RATE_BOOK, _r as schedule12LossDeductions, _t as EIFEL_EFFECTIVE_FROM, a as PART_VI_1_DEDUCTION_BANDS, an as computeCcaClass, ar as allocateIegExpenditureLimit, at as computeSchedule2, b as co17Engine, bn as albertaAbilDifference, br as schedule16Values, bt as PROVINCE_RATE_BOOK, c as EIFEL_FIRST_YEAR_START, cn as CLASS_14_1_MINIMUM_DEDUCTION, cr as computeIeg, ct as assertSchedule1Fileable, d as EIFEL_TRANSITIONAL_RATIO, dn as MIN_LEASEHOLD_PERIODS, dr as SINGLE_JURISDICTION_ALBERTA_FACTOR, dt as deferredIncomeTaxProvisionAddBack, en as CEC_INCLUSION_RATE, er as at1YesNo, et as computeSchedule5, f as computeEifelLimitation, fn as computeClass13, fr as computeAllocationFactor, ft as findSchedule1LineDefects, g as computeT2Settlement, gn as CCA_DECLINING_BALANCE_RATES_2024, gr as schedule10Values, gt as terminalLossDeduction, h as computeAdjustedTaxableIncome, hn as leaseholdPeriods, hr as at1LineItemId, ht as recaptureAddBack, i as computeMpDeduction, in as UnsupportedCcaClassError, ir as allocateIegEvenly, it as computePart4Rdtoh, j as runConformanceSuite, jn as LossCarrybackError, jr as computeDayWeightedGeneralTax, jt as computePartITax, k as formatConformanceReport, kn as computeSchedule12, kr as computeAlbertaSbd, kt as nonCapitalLossApplied, l as EIFEL_STANDARD_RATIO, ln as CLASS_14_1_TRANSITIONAL_RATE, lr as computeIegBaseAmount, lt as ccaDeduction, m as FOREIGN_TAX_CREDIT_GROSS_UP, mn as computeClass141AdditionalAllowance, mr as AT1_SCHEDULES_WITH_BUILDERS, mt as mealsAndEntertainmentAddBack, n as MP_GROSS_REVENUE_THRESHOLD, nn as computeAlbertaSchedule14, nr as at1Engine, nt as PART_IV_RATE, o as computePartVI1Deduction, on as computeCcaSchedule, or as computeIegGroupFigures, ot as Schedule1NotFileableError, p as ratioOfPermissibleExpenses, pn as computeClass14, pr as AT1_SCHEDULES_WITHOUT_BUILDERS, pt as incomeTaxProvisionAddBack, q as computeZetm, qn as At1MandatoryFieldMissingError, qt as AT1_RESERVE_KINDS, r as MP_RATES_2024, rn as computeAlbertaSchedule13, rr as computeAlbertaReturn, rt as REFUNDABLE_PART_I_RATE, s as partVI1DeductionMultiple, sn as computeSchedule8, sr as IEG_2024, st as amortizationAddBack, t as MP_EXCLUDED_ACTIVITIES, tn as cecScheduleAppliesToTaxYear, tr as xmlEscape, tt as computeSchedule4Losses, u as EIFEL_STANDARD_RATIO_FROM, un as MAX_LEASEHOLD_PERIODS, ur as computeIegExpenditureLimit, ut as computeSchedule1, v as t2Engine, vn as isDecliningBalanceClass, vr as schedule12Values, vt as assessEifel, w as QC_TAX_2024, wn as albertaCurrentYearLoss, wr as schedule20Values, wt as dayWeightedRate, x as computeQuebecReturn, xn as albertaCapitalGainDifference, xr as schedule17Values, xt as isSchedule5Province, y as renderCo17DraftReturn, yn as resolveCcaRates, yr as schedule13Values, yt as PROVINCE_RATES_2024, z as computeSchedule54, zn as formatRsiDate, zr as resolveRates, zt as computeLossContinuity } from "./t2.mjs";
4
+ import { wireTaxToLedger } from "@classytic/tax-core/obligation";
5
+ //#region src/resolver.ts
6
+ function createCaTaxResolver(options) {
7
+ const province = options.province.toUpperCase();
8
+ return {
9
+ countryCode: "CA",
10
+ province,
11
+ resolveClass(taxClass, asOf) {
12
+ const at = asOf ?? /* @__PURE__ */ new Date();
13
+ const regime = getProvincialRegime(province, at);
14
+ if (!regime) return null;
15
+ if (!CA_SUPPLY_CATEGORIES.includes(taxClass)) return null;
16
+ const cls = classifySupply(taxClass);
17
+ let rate = 0;
18
+ if (cls.treatment === "TAXABLE") {
19
+ rate = getCombinedRate(province, at) ?? 0;
20
+ if (regime.regime === "GST+PST" && !pstApplies(province, taxClass, at)) rate = 5;
21
+ }
22
+ return {
23
+ rateCode: `${province}:${taxClass}`,
24
+ rate,
25
+ inputCreditAllowed: cls.itcEligible,
26
+ meta: {
27
+ province,
28
+ regime: regime.regime,
29
+ treatment: cls.treatment,
30
+ ...regime.notes ? { notes: regime.notes } : {}
31
+ }
32
+ };
33
+ },
34
+ listClasses() {
35
+ return CA_SUPPLY_CATEGORIES;
36
+ },
37
+ /**
38
+ * CA fiscal positions: exports (zero-rate everything), small-supplier
39
+ * sellers (not registered — no tax collected), and registered-buyer
40
+ * pass-through. Buyer keys: `country`, `gstRegistration`. Seller keys:
41
+ * `smallSupplier: { trailingFourQuartersMinor, currentQuarterMinor?,
42
+ * publicServiceBody? }`.
43
+ */
44
+ resolveFiscalPosition(buyer, seller, _asOf) {
45
+ if (typeof buyer.country === "string" && buyer.country.toUpperCase() !== "CA") return {
46
+ position: "EXPORT",
47
+ reason: "Supply to a non-resident outside Canada — zero-rated (ETA Part V).",
48
+ mapTaxClass: () => "EXPORT"
49
+ };
50
+ if (seller.smallSupplier && typeof seller.smallSupplier === "object") {
51
+ const ss = seller.smallSupplier;
52
+ if (isSmallSupplier({
53
+ trailingFourQuartersMinor: ss.trailingFourQuartersMinor ?? 0,
54
+ currentQuarterMinor: ss.currentQuarterMinor,
55
+ publicServiceBody: ss.publicServiceBody
56
+ })) return {
57
+ position: "SMALL_SUPPLIER",
58
+ reason: "Seller is a small supplier (≤ $30k over four consecutive quarters) and not registered — no GST/HST charged.",
59
+ mapTaxClass: () => "EXEMPT"
60
+ };
61
+ }
62
+ return {
63
+ position: "DEFAULT",
64
+ reason: `Destination-rated for ${province}.`,
65
+ mapTaxClass: (productClass) => productClass
66
+ };
67
+ },
68
+ /**
69
+ * BOTH directions post (the VAT shape): output → collected liability;
70
+ * input → the ITC receivable — with the exempt-class exception (no
71
+ * recovery on inputs relating to exempt supplies → null).
72
+ */
73
+ accountFor(rateCode, direction) {
74
+ const { itcEligible, treatment } = classifySupply(rateCode.includes(":") ? rateCode.split(":")[1] : "STANDARD");
75
+ if (direction === "output") return treatment === "EXEMPT" ? null : "gst-hst-payable";
76
+ return itcEligible ? "gst-hst-itc-receivable" : null;
77
+ }
78
+ };
79
+ }
80
+ const caTaxPack = {
81
+ countryCode: "CA",
82
+ name: "Canada (CRA + Revenu Québec + provincial PST)",
83
+ currency: "CAD",
84
+ minorUnitsPerMajor: 100,
85
+ fiscalYearStartMonth: 1,
86
+ categories: [
87
+ "gst-hst",
88
+ "pst",
89
+ "qst"
90
+ ],
91
+ authorities: [
92
+ "CRA",
93
+ "Revenu Québec",
94
+ "BC/SK/MB finance ministries"
95
+ ]
96
+ };
97
+ //#endregion
98
+ export { AB_GENERAL_RATE_BANDS, AB_TAX_2024, AB_TAX_RATE_BOOK, AT1_BALANCE_CREDIT_LINES, AT1_BALANCE_LINE, AT1_CRITICAL_MANDATORY_FIELDS, AT1_DISPOSITION_CATEGORIES, AT1_DONATION_CARRYFORWARD_YEARS, AT1_DONATION_GAIN_RATE, AT1_DONATION_INCOME_RATE, AT1_IEG_BASE_RATE, AT1_IEG_ENHANCED_RATE, AT1_IEG_JACKET_LINE, AT1_IEG_MAX_EXPENDITURE, AT1_IEG_PRIOR_YEARS, AT1_JACKET, AT1_RESERVE_KINDS, AT1_RESERVE_LINES, AT1_RESERVE_TOTAL_LINES, AT1_SCHEDULES_WITHOUT_BUILDERS, AT1_SCHEDULES_WITH_BUILDERS, AT1_SCHEDULE_12, AT1_SCHEDULE_12_PAIRS, AT1_SCHEDULE_13, AT1_SCHEDULE_13_COLUMNS, AT1_SCHEDULE_16, AT1_SCHEDULE_16_CARRYFORWARD_LINE, AT1_SCHEDULE_17, AT1_SCHEDULE_17_RESERVES, AT1_SCHEDULE_18, AT1_SCHEDULE_18_CATEGORIES, AT1_SCHEDULE_20, AT1_SCHEDULE_20_POOLS, AT1_SCHEDULE_21, AT1_SCHEDULE_21_POOLS, AT1_SCHEDULE_29, AT1_SECTION_34_2_GROSS_UP, AT1_TAX_PAYABLE_LINE, At1CriticalFieldMissingError, At1MandatoryFieldMissingError, At1TaxPayableMismatchError, CA_SUPPLY_CATEGORIES, CCA_DECLINING_BALANCE_RATES_2024, CCA_RATE_BOOK, CEC_DEDUCTION_RATE, CEC_INCLUSION_RATE, CLASS_14_1_MINIMUM_DEDUCTION, CLASS_14_1_TRANSITIONAL_RATE, CO17_QUEBEC_PROPORTION_BOX, CO17_RETURN, CO17_TAXABLE_INCOME_BOX, CO17_TAX_PAYABLE_BOX, CORP_TAX_2024, CORP_TAX_RATE_BOOK, EIFEL_EFFECTIVE_FROM, EIFEL_FIRST_YEAR_START, EIFEL_STANDARD_RATIO, EIFEL_STANDARD_RATIO_FROM, EIFEL_TRANSITIONAL_RATIO, FOREIGN_TAX_CREDIT_GROSS_UP, FORMS, GST_RATE, IEG_2024, ITC_RECAPTURE_PERIOD_YEARS, LARGE_CORPORATION_THRESHOLD, LRIP_INVESTMENT_CORPORATION_MULTIPLE, LRIP_INVESTMENT_INCOME_FACTOR, LossCarrybackError, MAX_LEASEHOLD_PERIODS, MIN_LEASEHOLD_PERIODS, MP_EXCLUDED_ACTIVITIES, MP_GROSS_REVENUE_THRESHOLD, MP_RATES_2024, PART_IV_RATE, PART_VI_1_DEDUCTION_BANDS, PROVINCE_RATES_2024, PROVINCE_RATE_BOOK, PROVINCIAL_REGIMES, PSB_SMALL_SUPPLIER_THRESHOLD_MINOR, QC_TAX_2024, QC_TAX_RATE_BOOK, REFUNDABLE_PART_I_RATE, RSI_COLUMN_GAP, RSI_DELIMITER, RSI_NEGATIVE_PREFIX, RSI_WORD_GAP, RsiLineItemError, SCHEDULE_13_RESERVE_ROWS, SCHEDULE_1_LINES, SCHEDULE_1_LINE_BY_NUMBER, SCHEDULE_1_TOTAL_ADDITIONS_LINE, SCHEDULE_1_TOTAL_DEDUCTIONS_LINE, SCHEDULE_21_BUSINESS_CREDIT_LINE, SCHEDULE_21_NON_BUSINESS_CREDIT_LINE, SCHEDULE_23_GROUP_BUSINESS_LIMIT, SCHEDULE_24_OPERATION_TYPE_LINE, SCHEDULE_2_CARRYFORWARD_YEARS, SCHEDULE_2_CHARITABLE_CURRENT_LINE, SCHEDULE_31_ENHANCED_SRED_RATE, SCHEDULE_31_GENERAL_SRED_RATE, SCHEDULE_33_TAXABLE_CAPITAL_IN_CANADA_LINE, SCHEDULE_3_ELIGIBLE_PAID_LINE, SCHEDULE_3_TAXABLE_PAID_LINE, SCHEDULE_43_DIVIDEND_ALLOWANCE, SCHEDULE_4_CARRYBACK_YEARS, SCHEDULE_4_LPP_CARRYFORWARD_YEARS, SCHEDULE_4_NON_CAPITAL_CARRYFORWARD_YEARS, SCHEDULE_50_DISCLOSURE_THRESHOLD, SCHEDULE_53_CLOSING_GRIP_LINE, SCHEDULE_53_GENERAL_RATE_FACTOR, SCHEDULE_5_JURISDICTIONS, SCHEDULE_5_REVENUE_OFFSET, SCHEDULE_5_SALARIES_OFFSET, SCHEDULE_6_GRIDS, SCHEDULE_7_ADJUSTED_AII_LINE, SCHEDULE_7_PASSIVE_INCOME_THRESHOLD, SCHEDULE_88_MAX_URLS, SCHEDULE_8_CCA_LINE, SCHEDULE_8_COLUMNS, SCHEDULE_8_RECAPTURE_LINE, SCHEDULE_8_TERMINAL_LOSS_LINE, SECTION_34_2_GROSS_UP, SIMPLIFIED_DIGITAL_THRESHOLD_MINOR, SINGLE_JURISDICTION_ALBERTA_FACTOR, SMALL_SUPPLIER_THRESHOLD_MINOR, Schedule1NotFileableError, T2_BASE_PART_I_RATE, T2_CERTIFICATION_FIXTURES, T2_JACKET, T2_LINE_META, T2_NET_INCOME_FOR_TAX_LINE, T2_SCHEDULE_1, T2_SCHEDULE_13, T2_SCHEDULE_130, T2_SCHEDULE_2, T2_SCHEDULE_21, T2_SCHEDULE_23, T2_SCHEDULE_24, T2_SCHEDULE_3, T2_SCHEDULE_31, T2_SCHEDULE_33, T2_SCHEDULE_4, T2_SCHEDULE_43, T2_SCHEDULE_5, T2_SCHEDULE_50, T2_SCHEDULE_53, T2_SCHEDULE_55, T2_SCHEDULE_6, T2_SCHEDULE_7, T2_SCHEDULE_8, T2_SMALL_BUSINESS_DEDUCTION_RATE, T2_TAXABLE_INCOME_LINE, T2_TOTAL_TAX_PAYABLE_LINE, UnclassifiedLineError, UnsupportedCcaClassError, VEHICLE_ITC_CEILINGS, albertaAbilDifference, albertaBalanceUnpaid, albertaCapitalGainDifference, albertaCcaDifference, albertaCcaScheduleAdjustments, albertaCurrentYearLoss, albertaDispositionAdjustments, albertaRecaptureDifference, albertaReserveDifference, albertaTerminalLossDifference, allocateEvenly, allocateIegEvenly, allocateIegExpenditureLimit, amortizationAddBack, assertAt1MandatoryComplete, assertAt1TaxPayableReconciles, assertCriticalFields, assertSchedule1Fileable, assessEifel, assistanceFrom, at1Engine, at1LineItemId, at1TaxPayableDeductions, at1YesNo, blendProvinceRateTable, buildFields, caTaxPack, calculateCaSalesTax, ccaDeduction, cecScheduleAppliesToTaxYear, charitableDonationsDeduction, claimableItc, classifySupply, co17Engine, computeAdjustedTaxableIncome, computeAlbertaReturn, computeAlbertaSbd, computeAlbertaSchedule13, computeAlbertaSchedule14, computeAlbertaSchedule16, computeAlbertaSchedule17, computeAlbertaSchedule18, computeAlbertaTax, computeAllocationFactor, computeBusinessLimit, computeBusinessLimitAllocation, computeCcaClass, computeCcaSchedule, computeCcpcActiveBusinessTax, computeClass13, computeClass14, computeClass141AdditionalAllowance, computeDayWeightedGeneralTax, computeDonationMaximum, computeEifelLimitation, computeFederalT2, computeGrip, computeIeg, computeIegBaseAmount, computeIegExpenditureLimit, computeIegGroupFigures, computeItcRecapture, computeLossCarryback, computeLossContinuity, computeLossSchedule, computeMpDeduction, computePart4Rdtoh, computePartITax, computePartVI1Deduction, computeProvincialAllocation, computeQuebecAllocationFactor, computeQuebecReturn, computeQuebecTax, computeSBD, computeSchedule1, computeSchedule101, computeSchedule12, computeSchedule13, computeSchedule2, computeSchedule20, computeSchedule21, computeSchedule31, computeSchedule43, computeSchedule4Losses, computeSchedule5, computeSchedule54, computeSchedule55, computeSchedule6, computeSchedule8, computeT2Settlement, computeTaxableCapital, computeTaxableIncome, computeZetm, createCaTaxResolver, dayWeightedRate, deferredIncomeTaxProvisionAddBack, describeLine, dividendsDeductibleS112, earliestRateYear, extendCaTaxRules, extendRateBook, fieldsInSection, findBrokenLinks, findSchedule1LineDefects, foldT2Lines, formatConformanceReport, formatRsiAmount, formatRsiDate, formatRsiText, formsForProgram, getCombinedRate, getField, getForm, getProvincialRegime, gst34Engine, gst34LedgerAdapter, gst34Template, hasExactRateYear, incomeTaxProvisionAddBack, indexByLine, inputFields, isDecliningBalanceClass, isEnterableLine, isSchedule5Province, isSmallSupplier, latestRateYear, leaseholdPeriods, mealsAndEntertainmentAddBack, netCapitalLossApplied, nonCapitalLossApplied, normalizeSchedule88, partVI1DeductionMultiple, placeOfSupply, pstApplies, ratioOfPermissibleExpenses, recaptureAddBack, reconcileAlbertaNetIncome, renderAt1NetFile, renderAt1Rsi, renderCo17DraftReturn, renderRsiHeader, renderRsiLineItem, renderT2DraftReturn, resetCaTaxRuleExtensions, resolveAlbertaTaxRates, resolveCcaRates, resolveCorpTaxRates, resolveProvinceRates, resolveQuebecTaxRates, resolveRates, runConformance, runConformanceSuite, schedule10Values, schedule12LossDeductions, schedule12Values, schedule13Values, schedule16Values, schedule17Values, schedule18Values, schedule1Values, schedule20Values, schedule21Values, schedule29Values, schedule2Values, t2Engine, terminalLossDeduction, validateFormDefinition, wireTaxToLedger, xmlEscape };
@@ -0,0 +1,182 @@
1
+ import { LedgerPostingAdapter, TaxEngine } from "@classytic/tax-core/obligation";
2
+ import { EffectiveDated } from "@classytic/tax-core/effective";
3
+ import { TaxReportTemplate } from "@classytic/tax-core/ledger";
4
+
5
+ //#region src/gst-hst/rates.d.ts
6
+ /** Federal GST rate (percent) — unchanged since 2008. */
7
+ declare const GST_RATE = 5;
8
+ type CaProvince = 'AB' | 'BC' | 'MB' | 'NB' | 'NL' | 'NS' | 'NT' | 'NU' | 'ON' | 'PE' | 'QC' | 'SK' | 'YT' | (string & {});
9
+ type ProvincialRegime = 'GST' | 'HST' | 'GST+PST' | 'GST+QST';
10
+ interface ProvincialRegimeEntry extends EffectiveDated {
11
+ province: CaProvince;
12
+ regime: ProvincialRegime;
13
+ /** Combined HST rate (percent) — HST provinces only. */
14
+ hstRate?: number | undefined;
15
+ /** PST/RST/QST rate (percent) — non-harmonized provinces only. */
16
+ provincialRate?: number | undefined;
17
+ /** Display name of the provincial levy ('PST', 'RST', 'QST'). */
18
+ provincialName?: string | undefined;
19
+ notes?: string | undefined;
20
+ }
21
+ declare const PROVINCIAL_REGIMES: readonly ProvincialRegimeEntry[];
22
+ /** Regime entry for a province at a date (host extensions first). Null for unknown codes. */
23
+ declare function getProvincialRegime(province: CaProvince, asOf?: Date): ProvincialRegimeEntry | null;
24
+ /**
25
+ * Combined nominal rate for display (percent). NOTE: for GST+QST/PST this
26
+ * is additive on the same base (both charge on the pre-GST price) — use
27
+ * `calculateCaSalesTax` for actual leg amounts, not this sum.
28
+ */
29
+ declare function getCombinedRate(province: CaProvince, asOf?: Date): number | null;
30
+ //#endregion
31
+ //#region src/gst-hst/taxability.d.ts
32
+ type CaSupplyTreatment = 'TAXABLE' | 'ZERO_RATED' | 'EXEMPT';
33
+ declare const CA_SUPPLY_CATEGORIES: readonly ["STANDARD", "GROCERY", "PRESCRIPTION_DRUGS", "MEDICAL_DEVICE", "EXPORT", "AGRICULTURE_FISHING", "FEMININE_HYGIENE", "RESIDENTIAL_RENT", "HEALTH_SERVICES", "EDUCATION", "FINANCIAL_SERVICES", "CHILDCARE", "SAAS", "GENERAL_SERVICE"];
34
+ type CaSupplyCategory = (typeof CA_SUPPLY_CATEGORIES)[number] | string;
35
+ interface CaSupplyClassification {
36
+ treatment: CaSupplyTreatment;
37
+ /** ITCs claimable on inputs for this supply — TRUE for taxable AND zero-rated. */
38
+ itcEligible: boolean;
39
+ }
40
+ /** Classify a category under the GST/HST/QST (VAT-side) rules. */
41
+ declare function classifySupply(category: CaSupplyCategory): CaSupplyClassification;
42
+ interface PstBaseRule {
43
+ province: CaProvince;
44
+ category: CaSupplyCategory;
45
+ taxable: boolean;
46
+ /** Dated rules (MB cloud expansion) — omitted = always in the horizon. */
47
+ effectiveFrom?: Date | undefined;
48
+ effectiveTo?: Date | undefined;
49
+ notes?: string | undefined;
50
+ }
51
+ /**
52
+ * Does the province's PST/RST apply to this category on this date?
53
+ * Defaults: STANDARD (tangible goods) → true; zero-rated/exempt VAT
54
+ * families → false; unlisted service categories → false (PST bases are
55
+ * enumerative). Host extensions win.
56
+ */
57
+ declare function pstApplies(province: CaProvince, category: CaSupplyCategory, asOf?: Date): boolean;
58
+ //#endregion
59
+ //#region src/gst-hst/calculate.d.ts
60
+ type CaSupplyType = 'goods' | 'service' | 'intangible';
61
+ interface PlaceOfSupplyInput {
62
+ supplyType: CaSupplyType;
63
+ /** Goods: province where delivered/made available (destination governs). */
64
+ deliveryProvince?: CaProvince | undefined;
65
+ /** Services/intangibles: recipient's address province (general rule). */
66
+ recipientProvince?: CaProvince | undefined;
67
+ /** Fallback when no recipient address was obtained: where performed. */
68
+ performedProvince?: CaProvince | undefined;
69
+ }
70
+ /**
71
+ * Place-of-supply (ETA Sch. IX; CRA Memoranda 3-3-3/-5/-6, simplified):
72
+ * goods → delivery province; services/intangibles → recipient address,
73
+ * falling back to where performed.
74
+ */
75
+ declare function placeOfSupply(input: PlaceOfSupplyInput): CaProvince;
76
+ interface CaTaxLeg {
77
+ /** 'GST' | 'HST' | 'PST' | 'RST' | 'QST' */
78
+ tax: string;
79
+ /** Rate applied (percent). */
80
+ rate: number;
81
+ /** Leg amount in cents. */
82
+ amountMinor: number;
83
+ /** Who is remitted to: 'CRA' | 'BC' | 'SK' | 'MB' | 'RQ'. */
84
+ authority: string;
85
+ /** Whether the payer can recover this leg as ITC/ITR when registered. */
86
+ recoverable: boolean;
87
+ }
88
+ interface CaSalesTaxInput extends PlaceOfSupplyInput {
89
+ category: CaSupplyCategory;
90
+ /** Pre-tax line amount in cents. */
91
+ amountMinor: number;
92
+ asOf?: Date | undefined;
93
+ }
94
+ interface CaSalesTaxResult {
95
+ province: CaProvince;
96
+ classification: CaSupplyClassification;
97
+ legs: CaTaxLeg[];
98
+ /** Sum of legs (cents). */
99
+ totalTaxMinor: number;
100
+ }
101
+ declare function calculateCaSalesTax(input: CaSalesTaxInput): CaSalesTaxResult;
102
+ /** Small-supplier threshold: $30,000 over four consecutive calendar quarters (CRA Memo 2-2). */
103
+ declare const SMALL_SUPPLIER_THRESHOLD_MINOR = 3000000;
104
+ /** Public service bodies: $50,000. */
105
+ declare const PSB_SMALL_SUPPLIER_THRESHOLD_MINOR = 5000000;
106
+ /** Simplified digital regime (non-resident vendors/platforms): $30,000 over 12 months, no ITCs. */
107
+ declare const SIMPLIFIED_DIGITAL_THRESHOLD_MINOR = 3000000;
108
+ interface SmallSupplierInput {
109
+ /** Worldwide taxable + zero-rated supplies over the last four calendar quarters (cents, incl. associates). */
110
+ trailingFourQuartersMinor: number;
111
+ /** Supplies in the single current quarter — exceeding alone ends status immediately. */
112
+ currentQuarterMinor?: number | undefined;
113
+ publicServiceBody?: boolean | undefined;
114
+ }
115
+ /** Is the person still a small supplier (no obligation to register/collect)? */
116
+ declare function isSmallSupplier(input: SmallSupplierInput): boolean;
117
+ /** Class 10.1 passenger-vehicle ITC cost ceilings (pre-tax, cents) — dated. */
118
+ declare const VEHICLE_ITC_CEILINGS: readonly (EffectiveDated & {
119
+ ceilingMinor: number;
120
+ })[];
121
+ type ItcExpenseKind = 'general' | 'meals_entertainment' | 'club_dues' | 'passenger_vehicle';
122
+ interface ItcInput {
123
+ /** GST/HST/QST actually paid on the input (cents). */
124
+ taxPaidMinor: number;
125
+ kind: ItcExpenseKind;
126
+ /** For passenger vehicles: pre-tax cost (cents) — ceiling prorates the claim. */
127
+ vehicleCostMinor?: number | undefined;
128
+ /** The output supplies the input relates to — exempt outputs kill the claim. */
129
+ relatedSupplyCategory?: string | undefined;
130
+ asOf?: Date | undefined;
131
+ }
132
+ /**
133
+ * Claimable ITC for an input (cents). Rules: inputs relating to EXEMPT
134
+ * outputs → 0; meals & entertainment → 50%; club dues → 0; passenger
135
+ * vehicles → prorated to the dated cost ceiling.
136
+ */
137
+ declare function claimableItc(input: ItcInput): number;
138
+ //#endregion
139
+ //#region src/gst-hst/gst34.d.ts
140
+ /** The GST34 grid as a tax-core `TaxReportTemplate`. */
141
+ declare const gst34Template: TaxReportTemplate;
142
+ interface Gst34Input {
143
+ period: {
144
+ start: Date;
145
+ end: Date;
146
+ label: string;
147
+ };
148
+ /** Line 101 — total sales excl. GST/HST (cents). */
149
+ salesMinor: number;
150
+ /** Line 103 (cents). */
151
+ taxCollectedMinor: number;
152
+ /** Line 104 (cents). */
153
+ adjustmentsIncreaseMinor?: number | undefined;
154
+ /** Line 106 (cents). */
155
+ itcsMinor: number;
156
+ /** Line 107 (cents). */
157
+ adjustmentsDecreaseMinor?: number | undefined;
158
+ /** Line 110 (cents). */
159
+ instalmentsMinor?: number | undefined;
160
+ /** Line 111 (cents). */
161
+ rebatesMinor?: number | undefined;
162
+ /** Lines 205/405 (cents). */
163
+ selfAssessedRealPropertyMinor?: number | undefined;
164
+ selfAssessedOtherMinor?: number | undefined;
165
+ }
166
+ interface Gst34Breakdown {
167
+ lines: Record<string | number, number>;
168
+ netTaxMinor: number;
169
+ refundMinor: number;
170
+ owingMinor: number;
171
+ }
172
+ /** The GST34 as a tax-core TaxEngine. Negative `totalOwing` = refund position (line 114). */
173
+ declare const gst34Engine: TaxEngine<Gst34Input, Gst34Breakdown>;
174
+ /**
175
+ * Settlement adapter. Owing: clear the collected-liability, recognize the
176
+ * ITC receivable consumption, pay cash. Refund: net tax is negative — a
177
+ * receivable from CRA. Roles: `gst-hst-payable`, `gst-hst-itc-receivable`,
178
+ * `cash`, `cra-receivable`.
179
+ */
180
+ declare const gst34LedgerAdapter: LedgerPostingAdapter<Gst34Breakdown>;
181
+ //#endregion
182
+ export { GST_RATE as A, CaSupplyCategory as C, classifySupply as D, PstBaseRule as E, getProvincialRegime as F, ProvincialRegime as M, ProvincialRegimeEntry as N, pstApplies as O, getCombinedRate as P, CA_SUPPLY_CATEGORIES as S, CaSupplyTreatment as T, VEHICLE_ITC_CEILINGS as _, gst34Template as a, isSmallSupplier as b, CaSupplyType as c, ItcInput as d, PSB_SMALL_SUPPLIER_THRESHOLD_MINOR as f, SmallSupplierInput as g, SMALL_SUPPLIER_THRESHOLD_MINOR as h, gst34LedgerAdapter as i, PROVINCIAL_REGIMES as j, CaProvince as k, CaTaxLeg as l, SIMPLIFIED_DIGITAL_THRESHOLD_MINOR as m, Gst34Input as n, CaSalesTaxInput as o, PlaceOfSupplyInput as p, gst34Engine as r, CaSalesTaxResult as s, Gst34Breakdown as t, ItcExpenseKind as u, calculateCaSalesTax as v, CaSupplyClassification as w, placeOfSupply as x, claimableItc as y };