diff --git a/lib/data/models/client_model.dart b/lib/data/models/client_model.dart index 1b25944da0a..ce35a4b1571 100644 --- a/lib/data/models/client_model.dart +++ b/lib/data/models/client_model.dart @@ -157,7 +157,7 @@ abstract class ClientEntity extends Object customValue4: '', routingId: '', isTaxExempt: false, - taxConfig: TaxConfigEntity(), + taxData: TaxDataEntity(), contacts: BuiltList( [ ClientContactEntity().rebuild((b) => b..isPrimary = true) @@ -316,7 +316,7 @@ abstract class ClientEntity extends Object bool get isTaxExempt; @BuiltValueField(wireName: 'tax_data') - TaxConfigEntity get taxConfig; + TaxDataEntity get taxData; BuiltList get contacts; @@ -780,7 +780,7 @@ abstract class ClientEntity extends Object ..number = '' ..routingId = '' ..isTaxExempt = false - ..taxConfig.replace(TaxConfigEntity()) + ..taxData.replace(TaxDataEntity()) ..paymentBalance = 0; static Serializer get serializer => _$clientEntitySerializer; diff --git a/lib/data/models/client_model.g.dart b/lib/data/models/client_model.g.dart index 23091c4d0c1..9e14dea9100 100644 --- a/lib/data/models/client_model.g.dart +++ b/lib/data/models/client_model.g.dart @@ -222,8 +222,8 @@ class _$ClientEntitySerializer implements StructuredSerializer { serializers.serialize(object.isTaxExempt, specifiedType: const FullType(bool)), 'tax_data', - serializers.serialize(object.taxConfig, - specifiedType: const FullType(TaxConfigEntity)), + serializers.serialize(object.taxData, + specifiedType: const FullType(TaxDataEntity)), 'contacts', serializers.serialize(object.contacts, specifiedType: const FullType( @@ -462,9 +462,8 @@ class _$ClientEntitySerializer implements StructuredSerializer { specifiedType: const FullType(bool)) as bool; break; case 'tax_data': - result.taxConfig.replace(serializers.deserialize(value, - specifiedType: const FullType(TaxConfigEntity)) - as TaxConfigEntity); + result.taxData.replace(serializers.deserialize(value, + specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity); break; case 'contacts': result.contacts.replace(serializers.deserialize(value, @@ -1023,7 +1022,7 @@ class _$ClientEntity extends ClientEntity { @override final bool isTaxExempt; @override - final TaxConfigEntity taxConfig; + final TaxDataEntity taxData; @override final BuiltList contacts; @override @@ -1095,7 +1094,7 @@ class _$ClientEntity extends ClientEntity { this.customValue4, this.routingId, this.isTaxExempt, - this.taxConfig, + this.taxData, this.contacts, this.activities, this.ledger, @@ -1176,8 +1175,7 @@ class _$ClientEntity extends ClientEntity { routingId, r'ClientEntity', 'routingId'); BuiltValueNullFieldError.checkNotNull( isTaxExempt, r'ClientEntity', 'isTaxExempt'); - BuiltValueNullFieldError.checkNotNull( - taxConfig, r'ClientEntity', 'taxConfig'); + BuiltValueNullFieldError.checkNotNull(taxData, r'ClientEntity', 'taxData'); BuiltValueNullFieldError.checkNotNull( contacts, r'ClientEntity', 'contacts'); BuiltValueNullFieldError.checkNotNull( @@ -1246,7 +1244,7 @@ class _$ClientEntity extends ClientEntity { customValue4 == other.customValue4 && routingId == other.routingId && isTaxExempt == other.isTaxExempt && - taxConfig == other.taxConfig && + taxData == other.taxData && contacts == other.contacts && activities == other.activities && ledger == other.ledger && @@ -1305,7 +1303,7 @@ class _$ClientEntity extends ClientEntity { _$hash = $jc(_$hash, customValue4.hashCode); _$hash = $jc(_$hash, routingId.hashCode); _$hash = $jc(_$hash, isTaxExempt.hashCode); - _$hash = $jc(_$hash, taxConfig.hashCode); + _$hash = $jc(_$hash, taxData.hashCode); _$hash = $jc(_$hash, contacts.hashCode); _$hash = $jc(_$hash, activities.hashCode); _$hash = $jc(_$hash, ledger.hashCode); @@ -1365,7 +1363,7 @@ class _$ClientEntity extends ClientEntity { ..add('customValue4', customValue4) ..add('routingId', routingId) ..add('isTaxExempt', isTaxExempt) - ..add('taxConfig', taxConfig) + ..add('taxData', taxData) ..add('contacts', contacts) ..add('activities', activities) ..add('ledger', ledger) @@ -1548,11 +1546,10 @@ class ClientEntityBuilder bool get isTaxExempt => _$this._isTaxExempt; set isTaxExempt(bool isTaxExempt) => _$this._isTaxExempt = isTaxExempt; - TaxConfigEntityBuilder _taxConfig; - TaxConfigEntityBuilder get taxConfig => - _$this._taxConfig ??= new TaxConfigEntityBuilder(); - set taxConfig(TaxConfigEntityBuilder taxConfig) => - _$this._taxConfig = taxConfig; + TaxDataEntityBuilder _taxData; + TaxDataEntityBuilder get taxData => + _$this._taxData ??= new TaxDataEntityBuilder(); + set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData; ListBuilder _contacts; ListBuilder get contacts => @@ -1668,7 +1665,7 @@ class ClientEntityBuilder _customValue4 = $v.customValue4; _routingId = $v.routingId; _isTaxExempt = $v.isTaxExempt; - _taxConfig = $v.taxConfig.toBuilder(); + _taxData = $v.taxData.toBuilder(); _contacts = $v.contacts.toBuilder(); _activities = $v.activities.toBuilder(); _ledger = $v.ledger.toBuilder(); @@ -1753,7 +1750,7 @@ class ClientEntityBuilder customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'ClientEntity', 'customValue4'), routingId: BuiltValueNullFieldError.checkNotNull(routingId, r'ClientEntity', 'routingId'), isTaxExempt: BuiltValueNullFieldError.checkNotNull(isTaxExempt, r'ClientEntity', 'isTaxExempt'), - taxConfig: taxConfig.build(), + taxData: taxData.build(), contacts: contacts.build(), activities: activities.build(), ledger: ledger.build(), @@ -1774,8 +1771,8 @@ class ClientEntityBuilder _$failedField = 'settings'; settings.build(); - _$failedField = 'taxConfig'; - taxConfig.build(); + _$failedField = 'taxData'; + taxData.build(); _$failedField = 'contacts'; contacts.build(); _$failedField = 'activities'; diff --git a/lib/data/models/company_model.dart b/lib/data/models/company_model.dart index 5a4ae9ffd65..98b806f6187 100644 --- a/lib/data/models/company_model.dart +++ b/lib/data/models/company_model.dart @@ -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; @@ -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()) ..subscriptions.replace(BuiltList()) ..recurringExpenses.replace(BuiltList()) @@ -1397,114 +1397,3 @@ abstract class DashboardField static Serializer get serializer => _$dashboardFieldSerializer; } - -abstract class TaxDataEntity - implements Built { - factory TaxDataEntity() { - return _$TaxDataEntity._( - version: '', - sellerSubregion: '', - regions: BuiltMap(), - ); - } - - TaxDataEntity._(); - - @override - @memoized - int get hashCode; - - String get version; - - @BuiltValueField(wireName: 'seller_subregion') - String get sellerSubregion; - - BuiltMap get regions; - - // ignore: unused_element - static void _initializeBuilder(TaxDataEntityBuilder builder) => builder - ..version = '' - ..sellerSubregion = '' - ..regions.replace(BuiltMap()); - - static Serializer get serializer => _$taxDataEntitySerializer; -} - -abstract class TaxRegionDataEntity - implements Built { - factory TaxRegionDataEntity(bool reportErrors) { - return _$TaxRegionDataEntity._( - hasSalesAboveThreshold: false, - taxAll: false, - taxThreshold: 0, - subregions: BuiltMap(), - ); - } - - 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 get subregions; - - // ignore: unused_element - static void _initializeBuilder(TaxRegionDataEntityBuilder builder) => builder - ..hasSalesAboveThreshold = false - ..taxAll = false - ..taxThreshold = 0; - - static Serializer get serializer => - _$taxRegionDataEntitySerializer; -} - -abstract class TaxSubregionDataEntity - implements Built { - 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 get serializer => - _$taxSubregionDataEntitySerializer; -} diff --git a/lib/data/models/company_model.g.dart b/lib/data/models/company_model.g.dart index 8cc61826e56..2d828d126c4 100644 --- a/lib/data/models/company_model.g.dart +++ b/lib/data/models/company_model.g.dart @@ -24,12 +24,6 @@ Serializer _$registrationFieldEntitySerializer = new _$RegistrationFieldEntitySerializer(); Serializer _$dashboardFieldSerializer = new _$DashboardFieldSerializer(); -Serializer _$taxDataEntitySerializer = - new _$TaxDataEntitySerializer(); -Serializer _$taxRegionDataEntitySerializer = - new _$TaxRegionDataEntitySerializer(); -Serializer _$taxSubregionDataEntitySerializer = - new _$TaxSubregionDataEntitySerializer(); class _$CompanyEntitySerializer implements StructuredSerializer { @override @@ -387,11 +381,11 @@ class _$CompanyEntitySerializer implements StructuredSerializer { serializers.serialize(object.calculateTaxes, specifiedType: const FullType(bool)), 'tax_data', - serializers.serialize(object.taxData, - specifiedType: const FullType(TaxDataEntity)), - 'origin_tax_data', serializers.serialize(object.taxConfig, specifiedType: const FullType(TaxConfigEntity)), + 'origin_tax_data', + serializers.serialize(object.taxData, + specifiedType: const FullType(TaxDataEntity)), 'has_e_invoice_certificate', serializers.serialize(object.hasEInvoiceCertificate, specifiedType: const FullType(bool)), @@ -945,14 +939,14 @@ class _$CompanyEntitySerializer implements StructuredSerializer { specifiedType: const FullType(bool)) as bool; break; case 'tax_data': - result.taxData.replace(serializers.deserialize(value, - specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity); - break; - case 'origin_tax_data': result.taxConfig.replace(serializers.deserialize(value, specifiedType: const FullType(TaxConfigEntity)) as TaxConfigEntity); break; + case 'origin_tax_data': + result.taxData.replace(serializers.deserialize(value, + specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity); + break; case 'has_e_invoice_certificate': result.hasEInvoiceCertificate = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool; @@ -1666,206 +1660,6 @@ class _$DashboardFieldSerializer } } -class _$TaxDataEntitySerializer implements StructuredSerializer { - @override - final Iterable types = const [TaxDataEntity, _$TaxDataEntity]; - @override - final String wireName = 'TaxDataEntity'; - - @override - Iterable serialize(Serializers serializers, TaxDataEntity object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'version', - serializers.serialize(object.version, - specifiedType: const FullType(String)), - 'seller_subregion', - serializers.serialize(object.sellerSubregion, - specifiedType: const FullType(String)), - 'regions', - serializers.serialize(object.regions, - specifiedType: const FullType(BuiltMap, const [ - const FullType(String), - const FullType(TaxRegionDataEntity) - ])), - ]; - - return result; - } - - @override - TaxDataEntity deserialize( - Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = new TaxDataEntityBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final Object value = iterator.current; - switch (key) { - case 'version': - result.version = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case 'seller_subregion': - result.sellerSubregion = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case 'regions': - result.regions.replace(serializers.deserialize(value, - specifiedType: const FullType(BuiltMap, const [ - const FullType(String), - const FullType(TaxRegionDataEntity) - ]))); - break; - } - } - - return result.build(); - } -} - -class _$TaxRegionDataEntitySerializer - implements StructuredSerializer { - @override - final Iterable types = const [ - TaxRegionDataEntity, - _$TaxRegionDataEntity - ]; - @override - final String wireName = 'TaxRegionDataEntity'; - - @override - Iterable serialize( - Serializers serializers, TaxRegionDataEntity object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'has_sales_above_threshold', - serializers.serialize(object.hasSalesAboveThreshold, - specifiedType: const FullType(bool)), - 'tax_all_subregions', - serializers.serialize(object.taxAll, specifiedType: const FullType(bool)), - 'tax_threshold', - serializers.serialize(object.taxThreshold, - specifiedType: const FullType(double)), - 'subregions', - serializers.serialize(object.subregions, - specifiedType: const FullType(BuiltMap, const [ - const FullType(String), - const FullType(TaxSubregionDataEntity) - ])), - ]; - - return result; - } - - @override - TaxRegionDataEntity deserialize( - Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = new TaxRegionDataEntityBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final Object value = iterator.current; - switch (key) { - case 'has_sales_above_threshold': - result.hasSalesAboveThreshold = serializers.deserialize(value, - specifiedType: const FullType(bool)) as bool; - break; - case 'tax_all_subregions': - result.taxAll = serializers.deserialize(value, - specifiedType: const FullType(bool)) as bool; - break; - case 'tax_threshold': - result.taxThreshold = serializers.deserialize(value, - specifiedType: const FullType(double)) as double; - break; - case 'subregions': - result.subregions.replace(serializers.deserialize(value, - specifiedType: const FullType(BuiltMap, const [ - const FullType(String), - const FullType(TaxSubregionDataEntity) - ]))); - break; - } - } - - return result.build(); - } -} - -class _$TaxSubregionDataEntitySerializer - implements StructuredSerializer { - @override - final Iterable types = const [ - TaxSubregionDataEntity, - _$TaxSubregionDataEntity - ]; - @override - final String wireName = 'TaxSubregionDataEntity'; - - @override - Iterable serialize( - Serializers serializers, TaxSubregionDataEntity object, - {FullType specifiedType = FullType.unspecified}) { - final result = [ - 'apply_tax', - serializers.serialize(object.applyTax, - specifiedType: const FullType(bool)), - 'tax_rate', - serializers.serialize(object.taxRate, - specifiedType: const FullType(double)), - 'tax_name', - serializers.serialize(object.taxName, - specifiedType: const FullType(String)), - 'reduced_tax_rate', - serializers.serialize(object.reducedTaxRate, - specifiedType: const FullType(double)), - ]; - - return result; - } - - @override - TaxSubregionDataEntity deserialize( - Serializers serializers, Iterable serialized, - {FullType specifiedType = FullType.unspecified}) { - final result = new TaxSubregionDataEntityBuilder(); - - final iterator = serialized.iterator; - while (iterator.moveNext()) { - final key = iterator.current as String; - iterator.moveNext(); - final Object value = iterator.current; - switch (key) { - case 'apply_tax': - result.applyTax = serializers.deserialize(value, - specifiedType: const FullType(bool)) as bool; - break; - case 'tax_rate': - result.taxRate = serializers.deserialize(value, - specifiedType: const FullType(double)) as double; - break; - case 'tax_name': - result.taxName = serializers.deserialize(value, - specifiedType: const FullType(String)) as String; - break; - case 'reduced_tax_rate': - result.reducedTaxRate = serializers.deserialize(value, - specifiedType: const FullType(double)) as double; - break; - } - } - - return result.build(); - } -} - class _$CompanyEntity extends CompanyEntity { @override final bool enableCustomSurchargeTaxes1; @@ -2074,10 +1868,10 @@ class _$CompanyEntity extends CompanyEntity { @override final bool calculateTaxes; @override - final TaxDataEntity taxData; - @override final TaxConfigEntity taxConfig; @override + final TaxDataEntity taxData; + @override final bool hasEInvoiceCertificate; @override final bool hasEInvoiceCertificatePassphrase; @@ -2209,8 +2003,8 @@ class _$CompanyEntity extends CompanyEntity { this.calculateExpenseTaxByAmount, this.stopOnUnpaidRecurring, this.calculateTaxes, - this.taxData, this.taxConfig, + this.taxData, this.hasEInvoiceCertificate, this.hasEInvoiceCertificatePassphrase, this.eInvoiceCertificatePassphrase, @@ -2419,9 +2213,9 @@ class _$CompanyEntity extends CompanyEntity { stopOnUnpaidRecurring, r'CompanyEntity', 'stopOnUnpaidRecurring'); BuiltValueNullFieldError.checkNotNull( calculateTaxes, r'CompanyEntity', 'calculateTaxes'); - BuiltValueNullFieldError.checkNotNull(taxData, r'CompanyEntity', 'taxData'); BuiltValueNullFieldError.checkNotNull( taxConfig, r'CompanyEntity', 'taxConfig'); + BuiltValueNullFieldError.checkNotNull(taxData, r'CompanyEntity', 'taxData'); BuiltValueNullFieldError.checkNotNull( hasEInvoiceCertificate, r'CompanyEntity', 'hasEInvoiceCertificate'); BuiltValueNullFieldError.checkNotNull(hasEInvoiceCertificatePassphrase, @@ -2551,8 +2345,8 @@ class _$CompanyEntity extends CompanyEntity { calculateExpenseTaxByAmount == other.calculateExpenseTaxByAmount && stopOnUnpaidRecurring == other.stopOnUnpaidRecurring && calculateTaxes == other.calculateTaxes && - taxData == other.taxData && taxConfig == other.taxConfig && + taxData == other.taxData && hasEInvoiceCertificate == other.hasEInvoiceCertificate && hasEInvoiceCertificatePassphrase == other.hasEInvoiceCertificatePassphrase && @@ -2676,8 +2470,8 @@ class _$CompanyEntity extends CompanyEntity { _$hash = $jc(_$hash, calculateExpenseTaxByAmount.hashCode); _$hash = $jc(_$hash, stopOnUnpaidRecurring.hashCode); _$hash = $jc(_$hash, calculateTaxes.hashCode); - _$hash = $jc(_$hash, taxData.hashCode); _$hash = $jc(_$hash, taxConfig.hashCode); + _$hash = $jc(_$hash, taxData.hashCode); _$hash = $jc(_$hash, hasEInvoiceCertificate.hashCode); _$hash = $jc(_$hash, hasEInvoiceCertificatePassphrase.hashCode); _$hash = $jc(_$hash, eInvoiceCertificatePassphrase.hashCode); @@ -2800,8 +2594,8 @@ class _$CompanyEntity extends CompanyEntity { ..add('calculateExpenseTaxByAmount', calculateExpenseTaxByAmount) ..add('stopOnUnpaidRecurring', stopOnUnpaidRecurring) ..add('calculateTaxes', calculateTaxes) - ..add('taxData', taxData) ..add('taxConfig', taxConfig) + ..add('taxData', taxData) ..add('hasEInvoiceCertificate', hasEInvoiceCertificate) ..add('hasEInvoiceCertificatePassphrase', hasEInvoiceCertificatePassphrase) @@ -3354,17 +3148,17 @@ class CompanyEntityBuilder set calculateTaxes(bool calculateTaxes) => _$this._calculateTaxes = calculateTaxes; - TaxDataEntityBuilder _taxData; - TaxDataEntityBuilder get taxData => - _$this._taxData ??= new TaxDataEntityBuilder(); - set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData; - TaxConfigEntityBuilder _taxConfig; TaxConfigEntityBuilder get taxConfig => _$this._taxConfig ??= new TaxConfigEntityBuilder(); set taxConfig(TaxConfigEntityBuilder taxConfig) => _$this._taxConfig = taxConfig; + TaxDataEntityBuilder _taxData; + TaxDataEntityBuilder get taxData => + _$this._taxData ??= new TaxDataEntityBuilder(); + set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData; + bool _hasEInvoiceCertificate; bool get hasEInvoiceCertificate => _$this._hasEInvoiceCertificate; set hasEInvoiceCertificate(bool hasEInvoiceCertificate) => @@ -3531,8 +3325,8 @@ class CompanyEntityBuilder _calculateExpenseTaxByAmount = $v.calculateExpenseTaxByAmount; _stopOnUnpaidRecurring = $v.stopOnUnpaidRecurring; _calculateTaxes = $v.calculateTaxes; - _taxData = $v.taxData.toBuilder(); _taxConfig = $v.taxConfig.toBuilder(); + _taxData = $v.taxData.toBuilder(); _hasEInvoiceCertificate = $v.hasEInvoiceCertificate; _hasEInvoiceCertificatePassphrase = $v.hasEInvoiceCertificatePassphrase; _eInvoiceCertificatePassphrase = $v.eInvoiceCertificatePassphrase; @@ -3686,8 +3480,8 @@ class CompanyEntityBuilder calculateExpenseTaxByAmount: BuiltValueNullFieldError.checkNotNull(calculateExpenseTaxByAmount, r'CompanyEntity', 'calculateExpenseTaxByAmount'), stopOnUnpaidRecurring: BuiltValueNullFieldError.checkNotNull(stopOnUnpaidRecurring, r'CompanyEntity', 'stopOnUnpaidRecurring'), calculateTaxes: BuiltValueNullFieldError.checkNotNull(calculateTaxes, r'CompanyEntity', 'calculateTaxes'), - taxData: taxData.build(), taxConfig: taxConfig.build(), + taxData: taxData.build(), hasEInvoiceCertificate: BuiltValueNullFieldError.checkNotNull(hasEInvoiceCertificate, r'CompanyEntity', 'hasEInvoiceCertificate'), hasEInvoiceCertificatePassphrase: BuiltValueNullFieldError.checkNotNull(hasEInvoiceCertificatePassphrase, r'CompanyEntity', 'hasEInvoiceCertificatePassphrase'), eInvoiceCertificatePassphrase: BuiltValueNullFieldError.checkNotNull(eInvoiceCertificatePassphrase, r'CompanyEntity', 'eInvoiceCertificatePassphrase'), @@ -3775,10 +3569,10 @@ class CompanyEntityBuilder _$failedField = 'settings'; settings.build(); - _$failedField = 'taxData'; - taxData.build(); _$failedField = 'taxConfig'; taxConfig.build(); + _$failedField = 'taxData'; + taxData.build(); } catch (e) { throw new BuiltValueNestedFieldError( r'CompanyEntity', _$failedField, e.toString()); @@ -5144,428 +4938,4 @@ class DashboardFieldBuilder } } -class _$TaxDataEntity extends TaxDataEntity { - @override - final String version; - @override - final String sellerSubregion; - @override - final BuiltMap regions; - - factory _$TaxDataEntity([void Function(TaxDataEntityBuilder) updates]) => - (new TaxDataEntityBuilder()..update(updates))._build(); - - _$TaxDataEntity._({this.version, this.sellerSubregion, this.regions}) - : super._() { - BuiltValueNullFieldError.checkNotNull(version, r'TaxDataEntity', 'version'); - BuiltValueNullFieldError.checkNotNull( - sellerSubregion, r'TaxDataEntity', 'sellerSubregion'); - BuiltValueNullFieldError.checkNotNull(regions, r'TaxDataEntity', 'regions'); - } - - @override - TaxDataEntity rebuild(void Function(TaxDataEntityBuilder) updates) => - (toBuilder()..update(updates)).build(); - - @override - TaxDataEntityBuilder toBuilder() => new TaxDataEntityBuilder()..replace(this); - - @override - bool operator ==(Object other) { - if (identical(other, this)) return true; - return other is TaxDataEntity && - version == other.version && - sellerSubregion == other.sellerSubregion && - regions == other.regions; - } - - int __hashCode; - @override - int get hashCode { - if (__hashCode != null) return __hashCode; - var _$hash = 0; - _$hash = $jc(_$hash, version.hashCode); - _$hash = $jc(_$hash, sellerSubregion.hashCode); - _$hash = $jc(_$hash, regions.hashCode); - _$hash = $jf(_$hash); - return __hashCode ??= _$hash; - } - - @override - String toString() { - return (newBuiltValueToStringHelper(r'TaxDataEntity') - ..add('version', version) - ..add('sellerSubregion', sellerSubregion) - ..add('regions', regions)) - .toString(); - } -} - -class TaxDataEntityBuilder - implements Builder { - _$TaxDataEntity _$v; - - String _version; - String get version => _$this._version; - set version(String version) => _$this._version = version; - - String _sellerSubregion; - String get sellerSubregion => _$this._sellerSubregion; - set sellerSubregion(String sellerSubregion) => - _$this._sellerSubregion = sellerSubregion; - - MapBuilder _regions; - MapBuilder get regions => - _$this._regions ??= new MapBuilder(); - set regions(MapBuilder regions) => - _$this._regions = regions; - - TaxDataEntityBuilder() { - TaxDataEntity._initializeBuilder(this); - } - - TaxDataEntityBuilder get _$this { - final $v = _$v; - if ($v != null) { - _version = $v.version; - _sellerSubregion = $v.sellerSubregion; - _regions = $v.regions.toBuilder(); - _$v = null; - } - return this; - } - - @override - void replace(TaxDataEntity other) { - ArgumentError.checkNotNull(other, 'other'); - _$v = other as _$TaxDataEntity; - } - - @override - void update(void Function(TaxDataEntityBuilder) updates) { - if (updates != null) updates(this); - } - - @override - TaxDataEntity build() => _build(); - - _$TaxDataEntity _build() { - _$TaxDataEntity _$result; - try { - _$result = _$v ?? - new _$TaxDataEntity._( - version: BuiltValueNullFieldError.checkNotNull( - version, r'TaxDataEntity', 'version'), - sellerSubregion: BuiltValueNullFieldError.checkNotNull( - sellerSubregion, r'TaxDataEntity', 'sellerSubregion'), - regions: regions.build()); - } catch (_) { - String _$failedField; - try { - _$failedField = 'regions'; - regions.build(); - } catch (e) { - throw new BuiltValueNestedFieldError( - r'TaxDataEntity', _$failedField, e.toString()); - } - rethrow; - } - replace(_$result); - return _$result; - } -} - -class _$TaxRegionDataEntity extends TaxRegionDataEntity { - @override - final bool hasSalesAboveThreshold; - @override - final bool taxAll; - @override - final double taxThreshold; - @override - final BuiltMap subregions; - - factory _$TaxRegionDataEntity( - [void Function(TaxRegionDataEntityBuilder) updates]) => - (new TaxRegionDataEntityBuilder()..update(updates))._build(); - - _$TaxRegionDataEntity._( - {this.hasSalesAboveThreshold, - this.taxAll, - this.taxThreshold, - this.subregions}) - : super._() { - BuiltValueNullFieldError.checkNotNull(hasSalesAboveThreshold, - r'TaxRegionDataEntity', 'hasSalesAboveThreshold'); - BuiltValueNullFieldError.checkNotNull( - taxAll, r'TaxRegionDataEntity', 'taxAll'); - BuiltValueNullFieldError.checkNotNull( - taxThreshold, r'TaxRegionDataEntity', 'taxThreshold'); - BuiltValueNullFieldError.checkNotNull( - subregions, r'TaxRegionDataEntity', 'subregions'); - } - - @override - TaxRegionDataEntity rebuild( - void Function(TaxRegionDataEntityBuilder) updates) => - (toBuilder()..update(updates)).build(); - - @override - TaxRegionDataEntityBuilder toBuilder() => - new TaxRegionDataEntityBuilder()..replace(this); - - @override - bool operator ==(Object other) { - if (identical(other, this)) return true; - return other is TaxRegionDataEntity && - hasSalesAboveThreshold == other.hasSalesAboveThreshold && - taxAll == other.taxAll && - taxThreshold == other.taxThreshold && - subregions == other.subregions; - } - - int __hashCode; - @override - int get hashCode { - if (__hashCode != null) return __hashCode; - var _$hash = 0; - _$hash = $jc(_$hash, hasSalesAboveThreshold.hashCode); - _$hash = $jc(_$hash, taxAll.hashCode); - _$hash = $jc(_$hash, taxThreshold.hashCode); - _$hash = $jc(_$hash, subregions.hashCode); - _$hash = $jf(_$hash); - return __hashCode ??= _$hash; - } - - @override - String toString() { - return (newBuiltValueToStringHelper(r'TaxRegionDataEntity') - ..add('hasSalesAboveThreshold', hasSalesAboveThreshold) - ..add('taxAll', taxAll) - ..add('taxThreshold', taxThreshold) - ..add('subregions', subregions)) - .toString(); - } -} - -class TaxRegionDataEntityBuilder - implements Builder { - _$TaxRegionDataEntity _$v; - - bool _hasSalesAboveThreshold; - bool get hasSalesAboveThreshold => _$this._hasSalesAboveThreshold; - set hasSalesAboveThreshold(bool hasSalesAboveThreshold) => - _$this._hasSalesAboveThreshold = hasSalesAboveThreshold; - - bool _taxAll; - bool get taxAll => _$this._taxAll; - set taxAll(bool taxAll) => _$this._taxAll = taxAll; - - double _taxThreshold; - double get taxThreshold => _$this._taxThreshold; - set taxThreshold(double taxThreshold) => _$this._taxThreshold = taxThreshold; - - MapBuilder _subregions; - MapBuilder get subregions => - _$this._subregions ??= new MapBuilder(); - set subregions(MapBuilder subregions) => - _$this._subregions = subregions; - - TaxRegionDataEntityBuilder() { - TaxRegionDataEntity._initializeBuilder(this); - } - - TaxRegionDataEntityBuilder get _$this { - final $v = _$v; - if ($v != null) { - _hasSalesAboveThreshold = $v.hasSalesAboveThreshold; - _taxAll = $v.taxAll; - _taxThreshold = $v.taxThreshold; - _subregions = $v.subregions.toBuilder(); - _$v = null; - } - return this; - } - - @override - void replace(TaxRegionDataEntity other) { - ArgumentError.checkNotNull(other, 'other'); - _$v = other as _$TaxRegionDataEntity; - } - - @override - void update(void Function(TaxRegionDataEntityBuilder) updates) { - if (updates != null) updates(this); - } - - @override - TaxRegionDataEntity build() => _build(); - - _$TaxRegionDataEntity _build() { - _$TaxRegionDataEntity _$result; - try { - _$result = _$v ?? - new _$TaxRegionDataEntity._( - hasSalesAboveThreshold: BuiltValueNullFieldError.checkNotNull( - hasSalesAboveThreshold, - r'TaxRegionDataEntity', - 'hasSalesAboveThreshold'), - taxAll: BuiltValueNullFieldError.checkNotNull( - taxAll, r'TaxRegionDataEntity', 'taxAll'), - taxThreshold: BuiltValueNullFieldError.checkNotNull( - taxThreshold, r'TaxRegionDataEntity', 'taxThreshold'), - subregions: subregions.build()); - } catch (_) { - String _$failedField; - try { - _$failedField = 'subregions'; - subregions.build(); - } catch (e) { - throw new BuiltValueNestedFieldError( - r'TaxRegionDataEntity', _$failedField, e.toString()); - } - rethrow; - } - replace(_$result); - return _$result; - } -} - -class _$TaxSubregionDataEntity extends TaxSubregionDataEntity { - @override - final bool applyTax; - @override - final double taxRate; - @override - final String taxName; - @override - final double reducedTaxRate; - - factory _$TaxSubregionDataEntity( - [void Function(TaxSubregionDataEntityBuilder) updates]) => - (new TaxSubregionDataEntityBuilder()..update(updates))._build(); - - _$TaxSubregionDataEntity._( - {this.applyTax, this.taxRate, this.taxName, this.reducedTaxRate}) - : super._() { - BuiltValueNullFieldError.checkNotNull( - applyTax, r'TaxSubregionDataEntity', 'applyTax'); - BuiltValueNullFieldError.checkNotNull( - taxRate, r'TaxSubregionDataEntity', 'taxRate'); - BuiltValueNullFieldError.checkNotNull( - taxName, r'TaxSubregionDataEntity', 'taxName'); - BuiltValueNullFieldError.checkNotNull( - reducedTaxRate, r'TaxSubregionDataEntity', 'reducedTaxRate'); - } - - @override - TaxSubregionDataEntity rebuild( - void Function(TaxSubregionDataEntityBuilder) updates) => - (toBuilder()..update(updates)).build(); - - @override - TaxSubregionDataEntityBuilder toBuilder() => - new TaxSubregionDataEntityBuilder()..replace(this); - - @override - bool operator ==(Object other) { - if (identical(other, this)) return true; - return other is TaxSubregionDataEntity && - applyTax == other.applyTax && - taxRate == other.taxRate && - taxName == other.taxName && - reducedTaxRate == other.reducedTaxRate; - } - - int __hashCode; - @override - int get hashCode { - if (__hashCode != null) return __hashCode; - var _$hash = 0; - _$hash = $jc(_$hash, applyTax.hashCode); - _$hash = $jc(_$hash, taxRate.hashCode); - _$hash = $jc(_$hash, taxName.hashCode); - _$hash = $jc(_$hash, reducedTaxRate.hashCode); - _$hash = $jf(_$hash); - return __hashCode ??= _$hash; - } - - @override - String toString() { - return (newBuiltValueToStringHelper(r'TaxSubregionDataEntity') - ..add('applyTax', applyTax) - ..add('taxRate', taxRate) - ..add('taxName', taxName) - ..add('reducedTaxRate', reducedTaxRate)) - .toString(); - } -} - -class TaxSubregionDataEntityBuilder - implements Builder { - _$TaxSubregionDataEntity _$v; - - bool _applyTax; - bool get applyTax => _$this._applyTax; - set applyTax(bool applyTax) => _$this._applyTax = applyTax; - - double _taxRate; - double get taxRate => _$this._taxRate; - set taxRate(double taxRate) => _$this._taxRate = taxRate; - - String _taxName; - String get taxName => _$this._taxName; - set taxName(String taxName) => _$this._taxName = taxName; - - double _reducedTaxRate; - double get reducedTaxRate => _$this._reducedTaxRate; - set reducedTaxRate(double reducedTaxRate) => - _$this._reducedTaxRate = reducedTaxRate; - - TaxSubregionDataEntityBuilder() { - TaxSubregionDataEntity._initializeBuilder(this); - } - - TaxSubregionDataEntityBuilder get _$this { - final $v = _$v; - if ($v != null) { - _applyTax = $v.applyTax; - _taxRate = $v.taxRate; - _taxName = $v.taxName; - _reducedTaxRate = $v.reducedTaxRate; - _$v = null; - } - return this; - } - - @override - void replace(TaxSubregionDataEntity other) { - ArgumentError.checkNotNull(other, 'other'); - _$v = other as _$TaxSubregionDataEntity; - } - - @override - void update(void Function(TaxSubregionDataEntityBuilder) updates) { - if (updates != null) updates(this); - } - - @override - TaxSubregionDataEntity build() => _build(); - - _$TaxSubregionDataEntity _build() { - final _$result = _$v ?? - new _$TaxSubregionDataEntity._( - applyTax: BuiltValueNullFieldError.checkNotNull( - applyTax, r'TaxSubregionDataEntity', 'applyTax'), - taxRate: BuiltValueNullFieldError.checkNotNull( - taxRate, r'TaxSubregionDataEntity', 'taxRate'), - taxName: BuiltValueNullFieldError.checkNotNull( - taxName, r'TaxSubregionDataEntity', 'taxName'), - reducedTaxRate: BuiltValueNullFieldError.checkNotNull( - reducedTaxRate, r'TaxSubregionDataEntity', 'reducedTaxRate')); - replace(_$result); - return _$result; - } -} - // ignore_for_file: deprecated_member_use_from_same_package,type=lint diff --git a/lib/data/models/serializers.dart b/lib/data/models/serializers.dart index 6ee18e4a93b..9f9b4bbd362 100644 --- a/lib/data/models/serializers.dart +++ b/lib/data/models/serializers.dart @@ -176,7 +176,7 @@ part 'serializers.g.dart'; ImportRequestMapping, UserTwoFactorResponse, PdfPreviewRequest, - TaxConfigEntity, + TaxDataEntity, ]) final Serializers serializers = (_$serializers.toBuilder()..addPlugin(StandardJsonPlugin())).build(); diff --git a/lib/data/models/serializers.g.dart b/lib/data/models/serializers.g.dart index ada6cb0aaef..c72a910a680 100644 --- a/lib/data/models/serializers.g.dart +++ b/lib/data/models/serializers.g.dart @@ -187,14 +187,14 @@ Serializers _$serializers = (new Serializers().toBuilder() ..add(TaskStatusUIState.serializer) ..add(TaskUIState.serializer) ..add(TaxConfigEntity.serializer) + ..add(TaxConfigRegionEntity.serializer) + ..add(TaxConfigSubregionEntity.serializer) ..add(TaxDataEntity.serializer) ..add(TaxRateEntity.serializer) ..add(TaxRateItemResponse.serializer) ..add(TaxRateListResponse.serializer) ..add(TaxRateState.serializer) ..add(TaxRateUIState.serializer) - ..add(TaxRegionDataEntity.serializer) - ..add(TaxSubregionDataEntity.serializer) ..add(TemplateEntity.serializer) ..add(TimezoneEntity.serializer) ..add(TimezoneItemResponse.serializer) @@ -941,25 +941,25 @@ Serializers _$serializers = (new Serializers().toBuilder() ..addBuilderFactory( const FullType(BuiltList, const [const FullType(String)]), () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltMap, - const [const FullType(String), const FullType(TaxRateEntity)]), - () => new MapBuilder()) - ..addBuilderFactory( - const FullType(BuiltList, const [const FullType(String)]), - () => new ListBuilder()) ..addBuilderFactory( const FullType(BuiltMap, const [ const FullType(String), - const FullType(TaxRegionDataEntity) + const FullType(TaxConfigRegionEntity) ]), - () => new MapBuilder()) + () => new MapBuilder()) ..addBuilderFactory( const FullType(BuiltMap, const [ const FullType(String), - const FullType(TaxSubregionDataEntity) + const FullType(TaxConfigSubregionEntity) ]), - () => new MapBuilder()) + () => new MapBuilder()) + ..addBuilderFactory( + const FullType(BuiltMap, + const [const FullType(String), const FullType(TaxRateEntity)]), + () => new MapBuilder()) + ..addBuilderFactory( + const FullType(BuiltList, const [const FullType(String)]), + () => new ListBuilder()) ..addBuilderFactory( const FullType(BuiltMap, const [const FullType(String), const FullType(TokenEntity)]), diff --git a/lib/data/models/tax_model.dart b/lib/data/models/tax_model.dart index 987300a78ae..8f4a2c1da04 100644 --- a/lib/data/models/tax_model.dart +++ b/lib/data/models/tax_model.dart @@ -1,15 +1,51 @@ +import 'package:built_collection/built_collection.dart'; import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; part 'tax_model.g.dart'; -abstract class TaxConfigEntity - implements Built { - factory TaxConfigEntity() { - return _$TaxConfigEntity._(); +abstract class TaxDataEntity + implements Built { + factory TaxDataEntity() { + return _$TaxDataEntity._( + citySalesTax: 0, + cityTaxCode: '', + cityUseTax: 0, + countySalesTax: 0, + countyTaxCode: '', + countyUseTax: 0, + district1Code: '', + district1SalesTax: 0, + district1UseTax: 0, + district2Code: '', + district2SalesTax: 0, + district2UseTax: 0, + district3Code: '', + district3SalesTax: 0, + district3UseTax: 0, + district4Code: '', + district4SalesTax: 0, + district4UseTax: 0, + district5Code: '', + district5SalesTax: 0, + district5UseTax: 0, + districtSalesTax: 0, + districtUseTax: 0, + geoCity: '', + geoCounty: '', + geoPostalCode: '', + geoState: '', + originDestination: '', + stateSalesTax: 0, + stateUseTax: 0, + taxSales: 0, + taxUse: 0, + txbFreight: '', + txbService: '', + ); } - TaxConfigEntity._(); + TaxDataEntity._(); String get geoPostalCode; String get geoCity; @@ -46,6 +82,119 @@ abstract class TaxConfigEntity double get district5UseTax; String get originDestination; + static Serializer get serializer => _$taxDataEntitySerializer; +} + +abstract class TaxConfigEntity + implements Built { + factory TaxConfigEntity() { + return _$TaxConfigEntity._( + version: '', + sellerSubregion: '', + regions: BuiltMap(), + ); + } + + TaxConfigEntity._(); + + @override + @memoized + int get hashCode; + + String get version; + + @BuiltValueField(wireName: 'seller_subregion') + String get sellerSubregion; + + BuiltMap get regions; + + // ignore: unused_element + static void _initializeBuilder(TaxConfigEntityBuilder builder) => builder + ..version = '' + ..sellerSubregion = '' + ..regions.replace(BuiltMap()); + static Serializer get serializer => _$taxConfigEntitySerializer; } + +abstract class TaxConfigRegionEntity + implements Built { + factory TaxConfigRegionEntity(bool reportErrors) { + return _$TaxConfigRegionEntity._( + hasSalesAboveThreshold: false, + taxAll: false, + taxThreshold: 0, + subregions: BuiltMap(), + ); + } + + TaxConfigRegionEntity._(); + + @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 get subregions; + + // ignore: unused_element + static void _initializeBuilder(TaxConfigRegionEntityBuilder builder) => + builder + ..hasSalesAboveThreshold = false + ..taxAll = false + ..taxThreshold = 0; + + static Serializer get serializer => + _$taxConfigRegionEntitySerializer; +} + +abstract class TaxConfigSubregionEntity + implements + Built { + factory TaxConfigSubregionEntity(bool reportErrors) { + return _$TaxConfigSubregionEntity._( + applyTax: false, + taxRate: 0, + reducedTaxRate: 0, + taxName: '', + ); + } + + TaxConfigSubregionEntity._(); + + @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(TaxConfigSubregionEntityBuilder builder) => + builder + ..applyTax = false + ..taxName = '' + ..reducedTaxRate = 0 + ..taxRate = 0; + + static Serializer get serializer => + _$taxConfigSubregionEntitySerializer; +} diff --git a/lib/data/models/tax_model.g.dart b/lib/data/models/tax_model.g.dart index 36f6c619442..2abbbbbead1 100644 --- a/lib/data/models/tax_model.g.dart +++ b/lib/data/models/tax_model.g.dart @@ -6,18 +6,23 @@ part of 'tax_model.dart'; // BuiltValueGenerator // ************************************************************************** +Serializer _$taxDataEntitySerializer = + new _$TaxDataEntitySerializer(); Serializer _$taxConfigEntitySerializer = new _$TaxConfigEntitySerializer(); +Serializer _$taxConfigRegionEntitySerializer = + new _$TaxConfigRegionEntitySerializer(); +Serializer _$taxConfigSubregionEntitySerializer = + new _$TaxConfigSubregionEntitySerializer(); -class _$TaxConfigEntitySerializer - implements StructuredSerializer { +class _$TaxDataEntitySerializer implements StructuredSerializer { @override - final Iterable types = const [TaxConfigEntity, _$TaxConfigEntity]; + final Iterable types = const [TaxDataEntity, _$TaxDataEntity]; @override - final String wireName = 'TaxConfigEntity'; + final String wireName = 'TaxDataEntity'; @override - Iterable serialize(Serializers serializers, TaxConfigEntity object, + Iterable serialize(Serializers serializers, TaxDataEntity object, {FullType specifiedType = FullType.unspecified}) { final result = [ 'geoPostalCode', @@ -128,10 +133,10 @@ class _$TaxConfigEntitySerializer } @override - TaxConfigEntity deserialize( + TaxDataEntity deserialize( Serializers serializers, Iterable serialized, {FullType specifiedType = FullType.unspecified}) { - final result = new TaxConfigEntityBuilder(); + final result = new TaxDataEntityBuilder(); final iterator = serialized.iterator; while (iterator.moveNext()) { @@ -282,7 +287,208 @@ class _$TaxConfigEntitySerializer } } -class _$TaxConfigEntity extends TaxConfigEntity { +class _$TaxConfigEntitySerializer + implements StructuredSerializer { + @override + final Iterable types = const [TaxConfigEntity, _$TaxConfigEntity]; + @override + final String wireName = 'TaxConfigEntity'; + + @override + Iterable serialize(Serializers serializers, TaxConfigEntity object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'version', + serializers.serialize(object.version, + specifiedType: const FullType(String)), + 'seller_subregion', + serializers.serialize(object.sellerSubregion, + specifiedType: const FullType(String)), + 'regions', + serializers.serialize(object.regions, + specifiedType: const FullType(BuiltMap, const [ + const FullType(String), + const FullType(TaxConfigRegionEntity) + ])), + ]; + + return result; + } + + @override + TaxConfigEntity deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new TaxConfigEntityBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object value = iterator.current; + switch (key) { + case 'version': + result.version = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case 'seller_subregion': + result.sellerSubregion = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case 'regions': + result.regions.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltMap, const [ + const FullType(String), + const FullType(TaxConfigRegionEntity) + ]))); + break; + } + } + + return result.build(); + } +} + +class _$TaxConfigRegionEntitySerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + TaxConfigRegionEntity, + _$TaxConfigRegionEntity + ]; + @override + final String wireName = 'TaxConfigRegionEntity'; + + @override + Iterable serialize( + Serializers serializers, TaxConfigRegionEntity object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'has_sales_above_threshold', + serializers.serialize(object.hasSalesAboveThreshold, + specifiedType: const FullType(bool)), + 'tax_all_subregions', + serializers.serialize(object.taxAll, specifiedType: const FullType(bool)), + 'tax_threshold', + serializers.serialize(object.taxThreshold, + specifiedType: const FullType(double)), + 'subregions', + serializers.serialize(object.subregions, + specifiedType: const FullType(BuiltMap, const [ + const FullType(String), + const FullType(TaxConfigSubregionEntity) + ])), + ]; + + return result; + } + + @override + TaxConfigRegionEntity deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new TaxConfigRegionEntityBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object value = iterator.current; + switch (key) { + case 'has_sales_above_threshold': + result.hasSalesAboveThreshold = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + case 'tax_all_subregions': + result.taxAll = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + case 'tax_threshold': + result.taxThreshold = serializers.deserialize(value, + specifiedType: const FullType(double)) as double; + break; + case 'subregions': + result.subregions.replace(serializers.deserialize(value, + specifiedType: const FullType(BuiltMap, const [ + const FullType(String), + const FullType(TaxConfigSubregionEntity) + ]))); + break; + } + } + + return result.build(); + } +} + +class _$TaxConfigSubregionEntitySerializer + implements StructuredSerializer { + @override + final Iterable types = const [ + TaxConfigSubregionEntity, + _$TaxConfigSubregionEntity + ]; + @override + final String wireName = 'TaxConfigSubregionEntity'; + + @override + Iterable serialize( + Serializers serializers, TaxConfigSubregionEntity object, + {FullType specifiedType = FullType.unspecified}) { + final result = [ + 'apply_tax', + serializers.serialize(object.applyTax, + specifiedType: const FullType(bool)), + 'tax_rate', + serializers.serialize(object.taxRate, + specifiedType: const FullType(double)), + 'tax_name', + serializers.serialize(object.taxName, + specifiedType: const FullType(String)), + 'reduced_tax_rate', + serializers.serialize(object.reducedTaxRate, + specifiedType: const FullType(double)), + ]; + + return result; + } + + @override + TaxConfigSubregionEntity deserialize( + Serializers serializers, Iterable serialized, + {FullType specifiedType = FullType.unspecified}) { + final result = new TaxConfigSubregionEntityBuilder(); + + final iterator = serialized.iterator; + while (iterator.moveNext()) { + final key = iterator.current as String; + iterator.moveNext(); + final Object value = iterator.current; + switch (key) { + case 'apply_tax': + result.applyTax = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; + case 'tax_rate': + result.taxRate = serializers.deserialize(value, + specifiedType: const FullType(double)) as double; + break; + case 'tax_name': + result.taxName = serializers.deserialize(value, + specifiedType: const FullType(String)) as String; + break; + case 'reduced_tax_rate': + result.reducedTaxRate = serializers.deserialize(value, + specifiedType: const FullType(double)) as double; + break; + } + } + + return result.build(); + } +} + +class _$TaxDataEntity extends TaxDataEntity { @override final String geoPostalCode; @override @@ -352,10 +558,10 @@ class _$TaxConfigEntity extends TaxConfigEntity { @override final String originDestination; - factory _$TaxConfigEntity([void Function(TaxConfigEntityBuilder) updates]) => - (new TaxConfigEntityBuilder()..update(updates))._build(); + factory _$TaxDataEntity([void Function(TaxDataEntityBuilder) updates]) => + (new TaxDataEntityBuilder()..update(updates))._build(); - _$TaxConfigEntity._( + _$TaxDataEntity._( {this.geoPostalCode, this.geoCity, this.geoCounty, @@ -392,86 +598,84 @@ class _$TaxConfigEntity extends TaxConfigEntity { this.originDestination}) : super._() { BuiltValueNullFieldError.checkNotNull( - geoPostalCode, r'TaxConfigEntity', 'geoPostalCode'); + geoPostalCode, r'TaxDataEntity', 'geoPostalCode'); + BuiltValueNullFieldError.checkNotNull(geoCity, r'TaxDataEntity', 'geoCity'); BuiltValueNullFieldError.checkNotNull( - geoCity, r'TaxConfigEntity', 'geoCity'); + geoCounty, r'TaxDataEntity', 'geoCounty'); BuiltValueNullFieldError.checkNotNull( - geoCounty, r'TaxConfigEntity', 'geoCounty'); + geoState, r'TaxDataEntity', 'geoState'); BuiltValueNullFieldError.checkNotNull( - geoState, r'TaxConfigEntity', 'geoState'); + taxSales, r'TaxDataEntity', 'taxSales'); + BuiltValueNullFieldError.checkNotNull(taxUse, r'TaxDataEntity', 'taxUse'); BuiltValueNullFieldError.checkNotNull( - taxSales, r'TaxConfigEntity', 'taxSales'); - BuiltValueNullFieldError.checkNotNull(taxUse, r'TaxConfigEntity', 'taxUse'); + txbService, r'TaxDataEntity', 'txbService'); BuiltValueNullFieldError.checkNotNull( - txbService, r'TaxConfigEntity', 'txbService'); + txbFreight, r'TaxDataEntity', 'txbFreight'); BuiltValueNullFieldError.checkNotNull( - txbFreight, r'TaxConfigEntity', 'txbFreight'); + stateSalesTax, r'TaxDataEntity', 'stateSalesTax'); BuiltValueNullFieldError.checkNotNull( - stateSalesTax, r'TaxConfigEntity', 'stateSalesTax'); + stateUseTax, r'TaxDataEntity', 'stateUseTax'); BuiltValueNullFieldError.checkNotNull( - stateUseTax, r'TaxConfigEntity', 'stateUseTax'); + citySalesTax, r'TaxDataEntity', 'citySalesTax'); BuiltValueNullFieldError.checkNotNull( - citySalesTax, r'TaxConfigEntity', 'citySalesTax'); + cityUseTax, r'TaxDataEntity', 'cityUseTax'); BuiltValueNullFieldError.checkNotNull( - cityUseTax, r'TaxConfigEntity', 'cityUseTax'); + cityTaxCode, r'TaxDataEntity', 'cityTaxCode'); BuiltValueNullFieldError.checkNotNull( - cityTaxCode, r'TaxConfigEntity', 'cityTaxCode'); + countySalesTax, r'TaxDataEntity', 'countySalesTax'); BuiltValueNullFieldError.checkNotNull( - countySalesTax, r'TaxConfigEntity', 'countySalesTax'); + countyUseTax, r'TaxDataEntity', 'countyUseTax'); BuiltValueNullFieldError.checkNotNull( - countyUseTax, r'TaxConfigEntity', 'countyUseTax'); + countyTaxCode, r'TaxDataEntity', 'countyTaxCode'); BuiltValueNullFieldError.checkNotNull( - countyTaxCode, r'TaxConfigEntity', 'countyTaxCode'); + districtSalesTax, r'TaxDataEntity', 'districtSalesTax'); BuiltValueNullFieldError.checkNotNull( - districtSalesTax, r'TaxConfigEntity', 'districtSalesTax'); + districtUseTax, r'TaxDataEntity', 'districtUseTax'); BuiltValueNullFieldError.checkNotNull( - districtUseTax, r'TaxConfigEntity', 'districtUseTax'); + district1Code, r'TaxDataEntity', 'district1Code'); BuiltValueNullFieldError.checkNotNull( - district1Code, r'TaxConfigEntity', 'district1Code'); + district1SalesTax, r'TaxDataEntity', 'district1SalesTax'); BuiltValueNullFieldError.checkNotNull( - district1SalesTax, r'TaxConfigEntity', 'district1SalesTax'); + district1UseTax, r'TaxDataEntity', 'district1UseTax'); BuiltValueNullFieldError.checkNotNull( - district1UseTax, r'TaxConfigEntity', 'district1UseTax'); + district2Code, r'TaxDataEntity', 'district2Code'); BuiltValueNullFieldError.checkNotNull( - district2Code, r'TaxConfigEntity', 'district2Code'); + district2SalesTax, r'TaxDataEntity', 'district2SalesTax'); BuiltValueNullFieldError.checkNotNull( - district2SalesTax, r'TaxConfigEntity', 'district2SalesTax'); + district2UseTax, r'TaxDataEntity', 'district2UseTax'); BuiltValueNullFieldError.checkNotNull( - district2UseTax, r'TaxConfigEntity', 'district2UseTax'); + district3Code, r'TaxDataEntity', 'district3Code'); BuiltValueNullFieldError.checkNotNull( - district3Code, r'TaxConfigEntity', 'district3Code'); + district3SalesTax, r'TaxDataEntity', 'district3SalesTax'); BuiltValueNullFieldError.checkNotNull( - district3SalesTax, r'TaxConfigEntity', 'district3SalesTax'); + district3UseTax, r'TaxDataEntity', 'district3UseTax'); BuiltValueNullFieldError.checkNotNull( - district3UseTax, r'TaxConfigEntity', 'district3UseTax'); + district4Code, r'TaxDataEntity', 'district4Code'); BuiltValueNullFieldError.checkNotNull( - district4Code, r'TaxConfigEntity', 'district4Code'); + district4SalesTax, r'TaxDataEntity', 'district4SalesTax'); BuiltValueNullFieldError.checkNotNull( - district4SalesTax, r'TaxConfigEntity', 'district4SalesTax'); + district4UseTax, r'TaxDataEntity', 'district4UseTax'); BuiltValueNullFieldError.checkNotNull( - district4UseTax, r'TaxConfigEntity', 'district4UseTax'); + district5Code, r'TaxDataEntity', 'district5Code'); BuiltValueNullFieldError.checkNotNull( - district5Code, r'TaxConfigEntity', 'district5Code'); + district5SalesTax, r'TaxDataEntity', 'district5SalesTax'); BuiltValueNullFieldError.checkNotNull( - district5SalesTax, r'TaxConfigEntity', 'district5SalesTax'); + district5UseTax, r'TaxDataEntity', 'district5UseTax'); BuiltValueNullFieldError.checkNotNull( - district5UseTax, r'TaxConfigEntity', 'district5UseTax'); - BuiltValueNullFieldError.checkNotNull( - originDestination, r'TaxConfigEntity', 'originDestination'); + originDestination, r'TaxDataEntity', 'originDestination'); } @override - TaxConfigEntity rebuild(void Function(TaxConfigEntityBuilder) updates) => + TaxDataEntity rebuild(void Function(TaxDataEntityBuilder) updates) => (toBuilder()..update(updates)).build(); @override - TaxConfigEntityBuilder toBuilder() => - new TaxConfigEntityBuilder()..replace(this); + TaxDataEntityBuilder toBuilder() => new TaxDataEntityBuilder()..replace(this); @override bool operator ==(Object other) { if (identical(other, this)) return true; - return other is TaxConfigEntity && + return other is TaxDataEntity && geoPostalCode == other.geoPostalCode && geoCity == other.geoCity && geoCounty == other.geoCounty && @@ -551,7 +755,7 @@ class _$TaxConfigEntity extends TaxConfigEntity { @override String toString() { - return (newBuiltValueToStringHelper(r'TaxConfigEntity') + return (newBuiltValueToStringHelper(r'TaxDataEntity') ..add('geoPostalCode', geoPostalCode) ..add('geoCity', geoCity) ..add('geoCounty', geoCounty) @@ -590,9 +794,9 @@ class _$TaxConfigEntity extends TaxConfigEntity { } } -class TaxConfigEntityBuilder - implements Builder { - _$TaxConfigEntity _$v; +class TaxDataEntityBuilder + implements Builder { + _$TaxDataEntity _$v; String _geoPostalCode; String get geoPostalCode => _$this._geoPostalCode; @@ -752,9 +956,9 @@ class TaxConfigEntityBuilder set originDestination(String originDestination) => _$this._originDestination = originDestination; - TaxConfigEntityBuilder(); + TaxDataEntityBuilder(); - TaxConfigEntityBuilder get _$this { + TaxDataEntityBuilder get _$this { final $v = _$v; if ($v != null) { _geoPostalCode = $v.geoPostalCode; @@ -797,64 +1001,492 @@ class TaxConfigEntityBuilder } @override - void replace(TaxConfigEntity other) { + void replace(TaxDataEntity other) { ArgumentError.checkNotNull(other, 'other'); - _$v = other as _$TaxConfigEntity; + _$v = other as _$TaxDataEntity; } @override - void update(void Function(TaxConfigEntityBuilder) updates) { + void update(void Function(TaxDataEntityBuilder) updates) { if (updates != null) updates(this); } @override - TaxConfigEntity build() => _build(); + TaxDataEntity build() => _build(); - _$TaxConfigEntity _build() { + _$TaxDataEntity _build() { final _$result = _$v ?? - new _$TaxConfigEntity._( + new _$TaxDataEntity._( geoPostalCode: BuiltValueNullFieldError.checkNotNull( - geoPostalCode, r'TaxConfigEntity', 'geoPostalCode'), + geoPostalCode, r'TaxDataEntity', 'geoPostalCode'), geoCity: BuiltValueNullFieldError.checkNotNull( - geoCity, r'TaxConfigEntity', 'geoCity'), + geoCity, r'TaxDataEntity', 'geoCity'), geoCounty: BuiltValueNullFieldError.checkNotNull( - geoCounty, r'TaxConfigEntity', 'geoCounty'), + geoCounty, r'TaxDataEntity', 'geoCounty'), geoState: BuiltValueNullFieldError.checkNotNull( - geoState, r'TaxConfigEntity', 'geoState'), + geoState, r'TaxDataEntity', 'geoState'), taxSales: BuiltValueNullFieldError.checkNotNull( - taxSales, r'TaxConfigEntity', 'taxSales'), + taxSales, r'TaxDataEntity', 'taxSales'), taxUse: BuiltValueNullFieldError.checkNotNull( - taxUse, r'TaxConfigEntity', 'taxUse'), + taxUse, r'TaxDataEntity', 'taxUse'), txbService: BuiltValueNullFieldError.checkNotNull( - txbService, r'TaxConfigEntity', 'txbService'), + txbService, r'TaxDataEntity', 'txbService'), txbFreight: BuiltValueNullFieldError.checkNotNull( - txbFreight, r'TaxConfigEntity', 'txbFreight'), - stateSalesTax: BuiltValueNullFieldError.checkNotNull(stateSalesTax, r'TaxConfigEntity', 'stateSalesTax'), - stateUseTax: BuiltValueNullFieldError.checkNotNull(stateUseTax, r'TaxConfigEntity', 'stateUseTax'), - citySalesTax: BuiltValueNullFieldError.checkNotNull(citySalesTax, r'TaxConfigEntity', 'citySalesTax'), - cityUseTax: BuiltValueNullFieldError.checkNotNull(cityUseTax, r'TaxConfigEntity', 'cityUseTax'), - cityTaxCode: BuiltValueNullFieldError.checkNotNull(cityTaxCode, r'TaxConfigEntity', 'cityTaxCode'), - countySalesTax: BuiltValueNullFieldError.checkNotNull(countySalesTax, r'TaxConfigEntity', 'countySalesTax'), - countyUseTax: BuiltValueNullFieldError.checkNotNull(countyUseTax, r'TaxConfigEntity', 'countyUseTax'), - countyTaxCode: BuiltValueNullFieldError.checkNotNull(countyTaxCode, r'TaxConfigEntity', 'countyTaxCode'), - districtSalesTax: BuiltValueNullFieldError.checkNotNull(districtSalesTax, r'TaxConfigEntity', 'districtSalesTax'), - districtUseTax: BuiltValueNullFieldError.checkNotNull(districtUseTax, r'TaxConfigEntity', 'districtUseTax'), - district1Code: BuiltValueNullFieldError.checkNotNull(district1Code, r'TaxConfigEntity', 'district1Code'), - district1SalesTax: BuiltValueNullFieldError.checkNotNull(district1SalesTax, r'TaxConfigEntity', 'district1SalesTax'), - district1UseTax: BuiltValueNullFieldError.checkNotNull(district1UseTax, r'TaxConfigEntity', 'district1UseTax'), - district2Code: BuiltValueNullFieldError.checkNotNull(district2Code, r'TaxConfigEntity', 'district2Code'), - district2SalesTax: BuiltValueNullFieldError.checkNotNull(district2SalesTax, r'TaxConfigEntity', 'district2SalesTax'), - district2UseTax: BuiltValueNullFieldError.checkNotNull(district2UseTax, r'TaxConfigEntity', 'district2UseTax'), - district3Code: BuiltValueNullFieldError.checkNotNull(district3Code, r'TaxConfigEntity', 'district3Code'), - district3SalesTax: BuiltValueNullFieldError.checkNotNull(district3SalesTax, r'TaxConfigEntity', 'district3SalesTax'), - district3UseTax: BuiltValueNullFieldError.checkNotNull(district3UseTax, r'TaxConfigEntity', 'district3UseTax'), - district4Code: BuiltValueNullFieldError.checkNotNull(district4Code, r'TaxConfigEntity', 'district4Code'), - district4SalesTax: BuiltValueNullFieldError.checkNotNull(district4SalesTax, r'TaxConfigEntity', 'district4SalesTax'), - district4UseTax: BuiltValueNullFieldError.checkNotNull(district4UseTax, r'TaxConfigEntity', 'district4UseTax'), - district5Code: BuiltValueNullFieldError.checkNotNull(district5Code, r'TaxConfigEntity', 'district5Code'), - district5SalesTax: BuiltValueNullFieldError.checkNotNull(district5SalesTax, r'TaxConfigEntity', 'district5SalesTax'), - district5UseTax: BuiltValueNullFieldError.checkNotNull(district5UseTax, r'TaxConfigEntity', 'district5UseTax'), - originDestination: BuiltValueNullFieldError.checkNotNull(originDestination, r'TaxConfigEntity', 'originDestination')); + txbFreight, r'TaxDataEntity', 'txbFreight'), + stateSalesTax: BuiltValueNullFieldError.checkNotNull(stateSalesTax, r'TaxDataEntity', 'stateSalesTax'), + stateUseTax: BuiltValueNullFieldError.checkNotNull(stateUseTax, r'TaxDataEntity', 'stateUseTax'), + citySalesTax: BuiltValueNullFieldError.checkNotNull(citySalesTax, r'TaxDataEntity', 'citySalesTax'), + cityUseTax: BuiltValueNullFieldError.checkNotNull(cityUseTax, r'TaxDataEntity', 'cityUseTax'), + cityTaxCode: BuiltValueNullFieldError.checkNotNull(cityTaxCode, r'TaxDataEntity', 'cityTaxCode'), + countySalesTax: BuiltValueNullFieldError.checkNotNull(countySalesTax, r'TaxDataEntity', 'countySalesTax'), + countyUseTax: BuiltValueNullFieldError.checkNotNull(countyUseTax, r'TaxDataEntity', 'countyUseTax'), + countyTaxCode: BuiltValueNullFieldError.checkNotNull(countyTaxCode, r'TaxDataEntity', 'countyTaxCode'), + districtSalesTax: BuiltValueNullFieldError.checkNotNull(districtSalesTax, r'TaxDataEntity', 'districtSalesTax'), + districtUseTax: BuiltValueNullFieldError.checkNotNull(districtUseTax, r'TaxDataEntity', 'districtUseTax'), + district1Code: BuiltValueNullFieldError.checkNotNull(district1Code, r'TaxDataEntity', 'district1Code'), + district1SalesTax: BuiltValueNullFieldError.checkNotNull(district1SalesTax, r'TaxDataEntity', 'district1SalesTax'), + district1UseTax: BuiltValueNullFieldError.checkNotNull(district1UseTax, r'TaxDataEntity', 'district1UseTax'), + district2Code: BuiltValueNullFieldError.checkNotNull(district2Code, r'TaxDataEntity', 'district2Code'), + district2SalesTax: BuiltValueNullFieldError.checkNotNull(district2SalesTax, r'TaxDataEntity', 'district2SalesTax'), + district2UseTax: BuiltValueNullFieldError.checkNotNull(district2UseTax, r'TaxDataEntity', 'district2UseTax'), + district3Code: BuiltValueNullFieldError.checkNotNull(district3Code, r'TaxDataEntity', 'district3Code'), + district3SalesTax: BuiltValueNullFieldError.checkNotNull(district3SalesTax, r'TaxDataEntity', 'district3SalesTax'), + district3UseTax: BuiltValueNullFieldError.checkNotNull(district3UseTax, r'TaxDataEntity', 'district3UseTax'), + district4Code: BuiltValueNullFieldError.checkNotNull(district4Code, r'TaxDataEntity', 'district4Code'), + district4SalesTax: BuiltValueNullFieldError.checkNotNull(district4SalesTax, r'TaxDataEntity', 'district4SalesTax'), + district4UseTax: BuiltValueNullFieldError.checkNotNull(district4UseTax, r'TaxDataEntity', 'district4UseTax'), + district5Code: BuiltValueNullFieldError.checkNotNull(district5Code, r'TaxDataEntity', 'district5Code'), + district5SalesTax: BuiltValueNullFieldError.checkNotNull(district5SalesTax, r'TaxDataEntity', 'district5SalesTax'), + district5UseTax: BuiltValueNullFieldError.checkNotNull(district5UseTax, r'TaxDataEntity', 'district5UseTax'), + originDestination: BuiltValueNullFieldError.checkNotNull(originDestination, r'TaxDataEntity', 'originDestination')); + replace(_$result); + return _$result; + } +} + +class _$TaxConfigEntity extends TaxConfigEntity { + @override + final String version; + @override + final String sellerSubregion; + @override + final BuiltMap regions; + + factory _$TaxConfigEntity([void Function(TaxConfigEntityBuilder) updates]) => + (new TaxConfigEntityBuilder()..update(updates))._build(); + + _$TaxConfigEntity._({this.version, this.sellerSubregion, this.regions}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + version, r'TaxConfigEntity', 'version'); + BuiltValueNullFieldError.checkNotNull( + sellerSubregion, r'TaxConfigEntity', 'sellerSubregion'); + BuiltValueNullFieldError.checkNotNull( + regions, r'TaxConfigEntity', 'regions'); + } + + @override + TaxConfigEntity rebuild(void Function(TaxConfigEntityBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + TaxConfigEntityBuilder toBuilder() => + new TaxConfigEntityBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is TaxConfigEntity && + version == other.version && + sellerSubregion == other.sellerSubregion && + regions == other.regions; + } + + int __hashCode; + @override + int get hashCode { + if (__hashCode != null) return __hashCode; + var _$hash = 0; + _$hash = $jc(_$hash, version.hashCode); + _$hash = $jc(_$hash, sellerSubregion.hashCode); + _$hash = $jc(_$hash, regions.hashCode); + _$hash = $jf(_$hash); + return __hashCode ??= _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'TaxConfigEntity') + ..add('version', version) + ..add('sellerSubregion', sellerSubregion) + ..add('regions', regions)) + .toString(); + } +} + +class TaxConfigEntityBuilder + implements Builder { + _$TaxConfigEntity _$v; + + String _version; + String get version => _$this._version; + set version(String version) => _$this._version = version; + + String _sellerSubregion; + String get sellerSubregion => _$this._sellerSubregion; + set sellerSubregion(String sellerSubregion) => + _$this._sellerSubregion = sellerSubregion; + + MapBuilder _regions; + MapBuilder get regions => + _$this._regions ??= new MapBuilder(); + set regions(MapBuilder regions) => + _$this._regions = regions; + + TaxConfigEntityBuilder() { + TaxConfigEntity._initializeBuilder(this); + } + + TaxConfigEntityBuilder get _$this { + final $v = _$v; + if ($v != null) { + _version = $v.version; + _sellerSubregion = $v.sellerSubregion; + _regions = $v.regions.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(TaxConfigEntity other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$TaxConfigEntity; + } + + @override + void update(void Function(TaxConfigEntityBuilder) updates) { + if (updates != null) updates(this); + } + + @override + TaxConfigEntity build() => _build(); + + _$TaxConfigEntity _build() { + _$TaxConfigEntity _$result; + try { + _$result = _$v ?? + new _$TaxConfigEntity._( + version: BuiltValueNullFieldError.checkNotNull( + version, r'TaxConfigEntity', 'version'), + sellerSubregion: BuiltValueNullFieldError.checkNotNull( + sellerSubregion, r'TaxConfigEntity', 'sellerSubregion'), + regions: regions.build()); + } catch (_) { + String _$failedField; + try { + _$failedField = 'regions'; + regions.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'TaxConfigEntity', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$TaxConfigRegionEntity extends TaxConfigRegionEntity { + @override + final bool hasSalesAboveThreshold; + @override + final bool taxAll; + @override + final double taxThreshold; + @override + final BuiltMap subregions; + + factory _$TaxConfigRegionEntity( + [void Function(TaxConfigRegionEntityBuilder) updates]) => + (new TaxConfigRegionEntityBuilder()..update(updates))._build(); + + _$TaxConfigRegionEntity._( + {this.hasSalesAboveThreshold, + this.taxAll, + this.taxThreshold, + this.subregions}) + : super._() { + BuiltValueNullFieldError.checkNotNull(hasSalesAboveThreshold, + r'TaxConfigRegionEntity', 'hasSalesAboveThreshold'); + BuiltValueNullFieldError.checkNotNull( + taxAll, r'TaxConfigRegionEntity', 'taxAll'); + BuiltValueNullFieldError.checkNotNull( + taxThreshold, r'TaxConfigRegionEntity', 'taxThreshold'); + BuiltValueNullFieldError.checkNotNull( + subregions, r'TaxConfigRegionEntity', 'subregions'); + } + + @override + TaxConfigRegionEntity rebuild( + void Function(TaxConfigRegionEntityBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + TaxConfigRegionEntityBuilder toBuilder() => + new TaxConfigRegionEntityBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is TaxConfigRegionEntity && + hasSalesAboveThreshold == other.hasSalesAboveThreshold && + taxAll == other.taxAll && + taxThreshold == other.taxThreshold && + subregions == other.subregions; + } + + int __hashCode; + @override + int get hashCode { + if (__hashCode != null) return __hashCode; + var _$hash = 0; + _$hash = $jc(_$hash, hasSalesAboveThreshold.hashCode); + _$hash = $jc(_$hash, taxAll.hashCode); + _$hash = $jc(_$hash, taxThreshold.hashCode); + _$hash = $jc(_$hash, subregions.hashCode); + _$hash = $jf(_$hash); + return __hashCode ??= _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'TaxConfigRegionEntity') + ..add('hasSalesAboveThreshold', hasSalesAboveThreshold) + ..add('taxAll', taxAll) + ..add('taxThreshold', taxThreshold) + ..add('subregions', subregions)) + .toString(); + } +} + +class TaxConfigRegionEntityBuilder + implements Builder { + _$TaxConfigRegionEntity _$v; + + bool _hasSalesAboveThreshold; + bool get hasSalesAboveThreshold => _$this._hasSalesAboveThreshold; + set hasSalesAboveThreshold(bool hasSalesAboveThreshold) => + _$this._hasSalesAboveThreshold = hasSalesAboveThreshold; + + bool _taxAll; + bool get taxAll => _$this._taxAll; + set taxAll(bool taxAll) => _$this._taxAll = taxAll; + + double _taxThreshold; + double get taxThreshold => _$this._taxThreshold; + set taxThreshold(double taxThreshold) => _$this._taxThreshold = taxThreshold; + + MapBuilder _subregions; + MapBuilder get subregions => + _$this._subregions ??= new MapBuilder(); + set subregions(MapBuilder subregions) => + _$this._subregions = subregions; + + TaxConfigRegionEntityBuilder() { + TaxConfigRegionEntity._initializeBuilder(this); + } + + TaxConfigRegionEntityBuilder get _$this { + final $v = _$v; + if ($v != null) { + _hasSalesAboveThreshold = $v.hasSalesAboveThreshold; + _taxAll = $v.taxAll; + _taxThreshold = $v.taxThreshold; + _subregions = $v.subregions.toBuilder(); + _$v = null; + } + return this; + } + + @override + void replace(TaxConfigRegionEntity other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$TaxConfigRegionEntity; + } + + @override + void update(void Function(TaxConfigRegionEntityBuilder) updates) { + if (updates != null) updates(this); + } + + @override + TaxConfigRegionEntity build() => _build(); + + _$TaxConfigRegionEntity _build() { + _$TaxConfigRegionEntity _$result; + try { + _$result = _$v ?? + new _$TaxConfigRegionEntity._( + hasSalesAboveThreshold: BuiltValueNullFieldError.checkNotNull( + hasSalesAboveThreshold, + r'TaxConfigRegionEntity', + 'hasSalesAboveThreshold'), + taxAll: BuiltValueNullFieldError.checkNotNull( + taxAll, r'TaxConfigRegionEntity', 'taxAll'), + taxThreshold: BuiltValueNullFieldError.checkNotNull( + taxThreshold, r'TaxConfigRegionEntity', 'taxThreshold'), + subregions: subregions.build()); + } catch (_) { + String _$failedField; + try { + _$failedField = 'subregions'; + subregions.build(); + } catch (e) { + throw new BuiltValueNestedFieldError( + r'TaxConfigRegionEntity', _$failedField, e.toString()); + } + rethrow; + } + replace(_$result); + return _$result; + } +} + +class _$TaxConfigSubregionEntity extends TaxConfigSubregionEntity { + @override + final bool applyTax; + @override + final double taxRate; + @override + final String taxName; + @override + final double reducedTaxRate; + + factory _$TaxConfigSubregionEntity( + [void Function(TaxConfigSubregionEntityBuilder) updates]) => + (new TaxConfigSubregionEntityBuilder()..update(updates))._build(); + + _$TaxConfigSubregionEntity._( + {this.applyTax, this.taxRate, this.taxName, this.reducedTaxRate}) + : super._() { + BuiltValueNullFieldError.checkNotNull( + applyTax, r'TaxConfigSubregionEntity', 'applyTax'); + BuiltValueNullFieldError.checkNotNull( + taxRate, r'TaxConfigSubregionEntity', 'taxRate'); + BuiltValueNullFieldError.checkNotNull( + taxName, r'TaxConfigSubregionEntity', 'taxName'); + BuiltValueNullFieldError.checkNotNull( + reducedTaxRate, r'TaxConfigSubregionEntity', 'reducedTaxRate'); + } + + @override + TaxConfigSubregionEntity rebuild( + void Function(TaxConfigSubregionEntityBuilder) updates) => + (toBuilder()..update(updates)).build(); + + @override + TaxConfigSubregionEntityBuilder toBuilder() => + new TaxConfigSubregionEntityBuilder()..replace(this); + + @override + bool operator ==(Object other) { + if (identical(other, this)) return true; + return other is TaxConfigSubregionEntity && + applyTax == other.applyTax && + taxRate == other.taxRate && + taxName == other.taxName && + reducedTaxRate == other.reducedTaxRate; + } + + int __hashCode; + @override + int get hashCode { + if (__hashCode != null) return __hashCode; + var _$hash = 0; + _$hash = $jc(_$hash, applyTax.hashCode); + _$hash = $jc(_$hash, taxRate.hashCode); + _$hash = $jc(_$hash, taxName.hashCode); + _$hash = $jc(_$hash, reducedTaxRate.hashCode); + _$hash = $jf(_$hash); + return __hashCode ??= _$hash; + } + + @override + String toString() { + return (newBuiltValueToStringHelper(r'TaxConfigSubregionEntity') + ..add('applyTax', applyTax) + ..add('taxRate', taxRate) + ..add('taxName', taxName) + ..add('reducedTaxRate', reducedTaxRate)) + .toString(); + } +} + +class TaxConfigSubregionEntityBuilder + implements + Builder { + _$TaxConfigSubregionEntity _$v; + + bool _applyTax; + bool get applyTax => _$this._applyTax; + set applyTax(bool applyTax) => _$this._applyTax = applyTax; + + double _taxRate; + double get taxRate => _$this._taxRate; + set taxRate(double taxRate) => _$this._taxRate = taxRate; + + String _taxName; + String get taxName => _$this._taxName; + set taxName(String taxName) => _$this._taxName = taxName; + + double _reducedTaxRate; + double get reducedTaxRate => _$this._reducedTaxRate; + set reducedTaxRate(double reducedTaxRate) => + _$this._reducedTaxRate = reducedTaxRate; + + TaxConfigSubregionEntityBuilder() { + TaxConfigSubregionEntity._initializeBuilder(this); + } + + TaxConfigSubregionEntityBuilder get _$this { + final $v = _$v; + if ($v != null) { + _applyTax = $v.applyTax; + _taxRate = $v.taxRate; + _taxName = $v.taxName; + _reducedTaxRate = $v.reducedTaxRate; + _$v = null; + } + return this; + } + + @override + void replace(TaxConfigSubregionEntity other) { + ArgumentError.checkNotNull(other, 'other'); + _$v = other as _$TaxConfigSubregionEntity; + } + + @override + void update(void Function(TaxConfigSubregionEntityBuilder) updates) { + if (updates != null) updates(this); + } + + @override + TaxConfigSubregionEntity build() => _build(); + + _$TaxConfigSubregionEntity _build() { + final _$result = _$v ?? + new _$TaxConfigSubregionEntity._( + applyTax: BuiltValueNullFieldError.checkNotNull( + applyTax, r'TaxConfigSubregionEntity', 'applyTax'), + taxRate: BuiltValueNullFieldError.checkNotNull( + taxRate, r'TaxConfigSubregionEntity', 'taxRate'), + taxName: BuiltValueNullFieldError.checkNotNull( + taxName, r'TaxConfigSubregionEntity', 'taxName'), + reducedTaxRate: BuiltValueNullFieldError.checkNotNull( + reducedTaxRate, r'TaxConfigSubregionEntity', 'reducedTaxRate')); replace(_$result); return _$result; } diff --git a/lib/ui/settings/tax_settings.dart b/lib/ui/settings/tax_settings.dart index 976e4428b64..4a38abd0f1b 100644 --- a/lib/ui/settings/tax_settings.dart +++ b/lib/ui/settings/tax_settings.dart @@ -1,7 +1,7 @@ // Flutter imports: import 'package:flutter/material.dart'; import 'package:invoiceninja_flutter/constants.dart'; -import 'package:invoiceninja_flutter/data/models/company_model.dart'; +import 'package:invoiceninja_flutter/data/models/tax_model.dart'; import 'package:invoiceninja_flutter/redux/static/static_selectors.dart'; import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart'; import 'package:invoiceninja_flutter/utils/formatting.dart'; @@ -61,7 +61,7 @@ class _TaxSettingsState extends State { final settings = viewModel.settings; final company = viewModel.company; final state = viewModel.state; - final taxData = company.taxData; + final taxConfig = company.taxConfig; final countryMap = memoizedCountryIso2Map(state.staticState.countryMap); List subregions = []; @@ -72,8 +72,8 @@ class _TaxSettingsState extends State { region = kTaxRegionAustralia; } - if (taxData.regions.containsKey(region)) { - subregions = taxData.regions[region].subregions.keys.toList(); + if (taxConfig.regions.containsKey(region)) { + subregions = taxConfig.regions[region].subregions.keys.toList(); } return EditScaffold( @@ -184,10 +184,10 @@ class _TaxSettingsState extends State { SizedBox(height: 16), AppDropdownButton( labelText: localization.sellerSubregion, - value: taxData.sellerSubregion, + value: taxConfig.sellerSubregion, onChanged: (dynamic value) { viewModel.onCompanyChanged(company.rebuild( - (b) => b..taxData.sellerSubregion = value)); + (b) => b..taxConfig.sellerSubregion = value)); }, items: subregions .map((code) => DropdownMenuItem( @@ -197,8 +197,8 @@ class _TaxSettingsState extends State { value: code)) .toList()), SizedBox(height: 12), - ...taxData.regions.keys.map((region) { - final taxDataRegion = taxData.regions[region]; + ...taxConfig.regions.keys.map((region) { + final taxDataRegion = taxConfig.regions[region]; return Column(children: [ Padding( padding: const EdgeInsets.symmetric(vertical: 4), @@ -213,7 +213,7 @@ class _TaxSettingsState extends State { onChanged: (dynamic value) { viewModel.onCompanyChanged(company.rebuild( (b) => b - ..taxData.regions[region] = + ..taxConfig.regions[region] = taxDataRegion.rebuild( (b) => b..taxAll = value))); }, @@ -281,7 +281,7 @@ class _TaxSettingsState extends State { ? null : (value) { viewModel.onCompanyChanged(company.rebuild((b) => b - ..taxData.replace(taxData.rebuild((b) => b + ..taxConfig.replace(taxConfig.rebuild((b) => b ..regions[region] = taxDataRegion.rebuild((b) => b ..subregions[subregion] = @@ -298,7 +298,7 @@ class _TaxSettingsState extends State { builder: (context) => _EditSubregionDialog( viewModel: viewModel, - subregionData: taxDataSubregion, + subregionConfig: taxDataSubregion, region: region, subregion: subregion, )); @@ -365,12 +365,12 @@ class _EditSubregionDialog extends StatefulWidget { const _EditSubregionDialog({ Key key, @required this.viewModel, - @required this.subregionData, + @required this.subregionConfig, @required this.region, @required this.subregion, }) : super(key: key); - final TaxSubregionDataEntity subregionData; + final TaxConfigSubregionEntity subregionConfig; final TaxSettingsVM viewModel; final String region; final String subregion; @@ -388,24 +388,24 @@ class __EditSubregionDialogState extends State<_EditSubregionDialog> { void initState() { super.initState(); - final subregionData = widget.subregionData; - _taxName = subregionData.taxName; - _taxRate = subregionData.taxRate; - _reducedTaxRate = subregionData.reducedTaxRate; + final subregionConfig = widget.subregionConfig; + _taxName = subregionConfig.taxName; + _taxRate = subregionConfig.taxRate; + _reducedTaxRate = subregionConfig.reducedTaxRate; } void _onDone() { final viewModel = widget.viewModel; final company = viewModel.company; - final taxData = company.taxData; - final taxDataRegion = taxData.regions[widget.region]; - final taxDataSubregion = taxDataRegion.subregions[widget.subregion]; + final taxConfig = company.taxConfig; + final taxConfigRegion = taxConfig.regions[widget.region]; + final taxConfigSubregion = taxConfigRegion.subregions[widget.subregion]; viewModel.onCompanyChanged(company.rebuild((b) => b - ..taxData.replace(taxData.rebuild((b) => b - ..regions[widget.region] = taxDataRegion.rebuild((b) => b - ..subregions[widget.subregion] = taxDataSubregion.rebuild( + ..taxConfig.replace(taxConfig.rebuild((b) => b + ..regions[widget.region] = taxConfigRegion.rebuild((b) => b + ..subregions[widget.subregion] = taxConfigSubregion.rebuild( (b) => b ..taxName = _taxName ..taxRate = _taxRate @@ -418,7 +418,7 @@ class __EditSubregionDialogState extends State<_EditSubregionDialog> { @override Widget build(BuildContext context) { final localization = AppLocalization.of(context); - final subregionData = widget.subregionData; + final subregionData = widget.subregionConfig; return AlertDialog( title: Text(localization.edit),