Skip to content

Commit

Permalink
Improve auto-taxes
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jul 19, 2023
1 parent 2591dbc commit 21ead56
Show file tree
Hide file tree
Showing 9 changed files with 967 additions and 930 deletions.
6 changes: 3 additions & 3 deletions lib/data/models/client_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ abstract class ClientEntity extends Object
customValue4: '',
routingId: '',
isTaxExempt: false,
taxConfig: TaxConfigEntity(),
taxData: TaxDataEntity(),
contacts: BuiltList<ClientContactEntity>(
<ClientContactEntity>[
ClientContactEntity().rebuild((b) => b..isPrimary = true)
Expand Down Expand Up @@ -316,7 +316,7 @@ abstract class ClientEntity extends Object
bool get isTaxExempt;

@BuiltValueField(wireName: 'tax_data')
TaxConfigEntity get taxConfig;
TaxDataEntity get taxData;

BuiltList<ClientContactEntity> get contacts;

Expand Down Expand Up @@ -780,7 +780,7 @@ abstract class ClientEntity extends Object
..number = ''
..routingId = ''
..isTaxExempt = false
..taxConfig.replace(TaxConfigEntity())
..taxData.replace(TaxDataEntity())
..paymentBalance = 0;

static Serializer<ClientEntity> get serializer => _$clientEntitySerializer;
Expand Down
39 changes: 18 additions & 21 deletions lib/data/models/client_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

117 changes: 3 additions & 114 deletions lib/data/models/company_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,10 @@ abstract class CompanyEntity extends Object
bool get calculateTaxes;

@BuiltValueField(wireName: 'tax_data')
TaxDataEntity get taxData;
TaxConfigEntity get taxConfig;

@BuiltValueField(wireName: 'origin_tax_data')
TaxConfigEntity get taxConfig;
TaxDataEntity get taxData;

@BuiltValueField(wireName: 'has_e_invoice_certificate')
bool get hasEInvoiceCertificate;
Expand Down Expand Up @@ -786,8 +786,8 @@ abstract class CompanyEntity extends Object
..hasEInvoiceCertificate = false
..hasEInvoiceCertificatePassphrase = false
..eInvoiceCertificatePassphrase = ''
..taxData.replace(TaxDataEntity())
..taxConfig.replace(TaxConfigEntity())
..taxData.replace(TaxDataEntity())
..systemLogs.replace(BuiltList<SystemLogEntity>())
..subscriptions.replace(BuiltList<SubscriptionEntity>())
..recurringExpenses.replace(BuiltList<ExpenseEntity>())
Expand Down Expand Up @@ -1397,114 +1397,3 @@ abstract class DashboardField
static Serializer<DashboardField> get serializer =>
_$dashboardFieldSerializer;
}

abstract class TaxDataEntity
implements Built<TaxDataEntity, TaxDataEntityBuilder> {
factory TaxDataEntity() {
return _$TaxDataEntity._(
version: '',
sellerSubregion: '',
regions: BuiltMap<String, TaxRegionDataEntity>(),
);
}

TaxDataEntity._();

@override
@memoized
int get hashCode;

String get version;

@BuiltValueField(wireName: 'seller_subregion')
String get sellerSubregion;

BuiltMap<String, TaxRegionDataEntity> get regions;

// ignore: unused_element
static void _initializeBuilder(TaxDataEntityBuilder builder) => builder
..version = ''
..sellerSubregion = ''
..regions.replace(BuiltMap<String, TaxRegionDataEntity>());

static Serializer<TaxDataEntity> get serializer => _$taxDataEntitySerializer;
}

abstract class TaxRegionDataEntity
implements Built<TaxRegionDataEntity, TaxRegionDataEntityBuilder> {
factory TaxRegionDataEntity(bool reportErrors) {
return _$TaxRegionDataEntity._(
hasSalesAboveThreshold: false,
taxAll: false,
taxThreshold: 0,
subregions: BuiltMap<String, TaxSubregionDataEntity>(),
);
}

TaxRegionDataEntity._();

@override
@memoized
int get hashCode;

@BuiltValueField(wireName: 'has_sales_above_threshold')
bool get hasSalesAboveThreshold;

@BuiltValueField(wireName: 'tax_all_subregions')
bool get taxAll;

@BuiltValueField(wireName: 'tax_threshold')
double get taxThreshold;

BuiltMap<String, TaxSubregionDataEntity> get subregions;

// ignore: unused_element
static void _initializeBuilder(TaxRegionDataEntityBuilder builder) => builder
..hasSalesAboveThreshold = false
..taxAll = false
..taxThreshold = 0;

static Serializer<TaxRegionDataEntity> get serializer =>
_$taxRegionDataEntitySerializer;
}

abstract class TaxSubregionDataEntity
implements Built<TaxSubregionDataEntity, TaxSubregionDataEntityBuilder> {
factory TaxSubregionDataEntity(bool reportErrors) {
return _$TaxSubregionDataEntity._(
applyTax: false,
taxRate: 0,
reducedTaxRate: 0,
taxName: '',
);
}

TaxSubregionDataEntity._();

@override
@memoized
int get hashCode;

@BuiltValueField(wireName: 'apply_tax')
bool get applyTax;

@BuiltValueField(wireName: 'tax_rate')
double get taxRate;

@BuiltValueField(wireName: 'tax_name')
String get taxName;

@BuiltValueField(wireName: 'reduced_tax_rate')
double get reducedTaxRate;

// ignore: unused_element
static void _initializeBuilder(TaxSubregionDataEntityBuilder builder) =>
builder
..applyTax = false
..taxName = ''
..reducedTaxRate = 0
..taxRate = 0;

static Serializer<TaxSubregionDataEntity> get serializer =>
_$taxSubregionDataEntitySerializer;
}
Loading

0 comments on commit 21ead56

Please sign in to comment.