getSaleTypes function

List<FbrSaleType> getSaleTypes()

The sale types named in PRAL's DI specification (v1.12, section 9, "Scenarios for Sandbox Testing"), with the scenarios that use each.

FBR's full, current list comes from its reference API; this is a convenience for building forms and tests, and validateFbrInvoice does not reject a sale type that is not in it. Never throws.

getSaleTypes().first;
// FbrSaleType{saleType: Goods at Standard Rate (default),
//   scenarioIds: [SN001, SN002, SN026]}

Implementation

List<FbrSaleType> getSaleTypes() => [
      for (final e in fbrSaleTypesJson.cast<Map<String, Object?>>())
        FbrSaleType(
          saleType: e['saleType']! as String,
          scenarioIds: List.unmodifiable(
            (e['scenarioIds']! as List<Object?>).cast<String>(),
          ),
        ),
    ];