Show message to enable Zip-Tax
This commit is contained in:
parent
ae457cf8aa
commit
4bafdfd807
|
|
@ -22,6 +22,7 @@ const String kBankingURL = 'https://invoiceninja.com/banking';
|
|||
const String kTransifexURL =
|
||||
'https://www.transifex.com/invoice-ninja/invoice-ninja';
|
||||
const String kWebhookSiteURL = 'https://requestcatcher.com';
|
||||
const String kZipTaxURL = 'https://zip-tax.com';
|
||||
const String kSourceCodeBackend =
|
||||
'https://github.com/invoiceninja/invoiceninja/tree/v5-stable';
|
||||
const String kSourceCodeFrontend =
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ abstract class AccountEntity
|
|||
trialDaysLeft: 0,
|
||||
hasIapPlan: false,
|
||||
paymentId: '',
|
||||
taxApiEnabled: false,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -111,6 +112,9 @@ abstract class AccountEntity
|
|||
@BuiltValueField(wireName: 'payment_id')
|
||||
String get paymentId;
|
||||
|
||||
@BuiltValueField(wireName: 'tax_api_enabled')
|
||||
bool get taxApiEnabled;
|
||||
|
||||
bool get canMakeIAP => !hasIapPlan && paymentId.isEmpty;
|
||||
|
||||
bool get isUpdateAvailable {
|
||||
|
|
@ -148,7 +152,8 @@ abstract class AccountEntity
|
|||
..hostedCompanyCount = 1
|
||||
..accountSmsVerified = true
|
||||
..setReactAsDefaultAP = false
|
||||
..paymentId = '';
|
||||
..paymentId = ''
|
||||
..taxApiEnabled = false;
|
||||
|
||||
static Serializer<AccountEntity> get serializer => _$accountEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ class _$AccountEntitySerializer implements StructuredSerializer<AccountEntity> {
|
|||
'payment_id',
|
||||
serializers.serialize(object.paymentId,
|
||||
specifiedType: const FullType(String)),
|
||||
'tax_api_enabled',
|
||||
serializers.serialize(object.taxApiEnabled,
|
||||
specifiedType: const FullType(bool)),
|
||||
];
|
||||
|
||||
return result;
|
||||
|
|
@ -194,6 +197,10 @@ class _$AccountEntitySerializer implements StructuredSerializer<AccountEntity> {
|
|||
result.paymentId = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'tax_api_enabled':
|
||||
result.taxApiEnabled = serializers.deserialize(value,
|
||||
specifiedType: const FullType(bool)) as bool;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,6 +255,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
final bool hasIapPlan;
|
||||
@override
|
||||
final String paymentId;
|
||||
@override
|
||||
final bool taxApiEnabled;
|
||||
|
||||
factory _$AccountEntity([void Function(AccountEntityBuilder) updates]) =>
|
||||
(new AccountEntityBuilder()..update(updates))._build();
|
||||
|
|
@ -275,7 +284,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
this.accountSmsVerified,
|
||||
this.trialDaysLeft,
|
||||
this.hasIapPlan,
|
||||
this.paymentId})
|
||||
this.paymentId,
|
||||
this.taxApiEnabled})
|
||||
: super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(id, r'AccountEntity', 'id');
|
||||
BuiltValueNullFieldError.checkNotNull(key, r'AccountEntity', 'key');
|
||||
|
|
@ -320,6 +330,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
hasIapPlan, r'AccountEntity', 'hasIapPlan');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
paymentId, r'AccountEntity', 'paymentId');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
taxApiEnabled, r'AccountEntity', 'taxApiEnabled');
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -355,7 +367,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
accountSmsVerified == other.accountSmsVerified &&
|
||||
trialDaysLeft == other.trialDaysLeft &&
|
||||
hasIapPlan == other.hasIapPlan &&
|
||||
paymentId == other.paymentId;
|
||||
paymentId == other.paymentId &&
|
||||
taxApiEnabled == other.taxApiEnabled;
|
||||
}
|
||||
|
||||
int __hashCode;
|
||||
|
|
@ -386,6 +399,7 @@ class _$AccountEntity extends AccountEntity {
|
|||
_$hash = $jc(_$hash, trialDaysLeft.hashCode);
|
||||
_$hash = $jc(_$hash, hasIapPlan.hashCode);
|
||||
_$hash = $jc(_$hash, paymentId.hashCode);
|
||||
_$hash = $jc(_$hash, taxApiEnabled.hashCode);
|
||||
_$hash = $jf(_$hash);
|
||||
return __hashCode ??= _$hash;
|
||||
}
|
||||
|
|
@ -415,7 +429,8 @@ class _$AccountEntity extends AccountEntity {
|
|||
..add('accountSmsVerified', accountSmsVerified)
|
||||
..add('trialDaysLeft', trialDaysLeft)
|
||||
..add('hasIapPlan', hasIapPlan)
|
||||
..add('paymentId', paymentId))
|
||||
..add('paymentId', paymentId)
|
||||
..add('taxApiEnabled', taxApiEnabled))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -525,6 +540,11 @@ class AccountEntityBuilder
|
|||
String get paymentId => _$this._paymentId;
|
||||
set paymentId(String paymentId) => _$this._paymentId = paymentId;
|
||||
|
||||
bool _taxApiEnabled;
|
||||
bool get taxApiEnabled => _$this._taxApiEnabled;
|
||||
set taxApiEnabled(bool taxApiEnabled) =>
|
||||
_$this._taxApiEnabled = taxApiEnabled;
|
||||
|
||||
AccountEntityBuilder() {
|
||||
AccountEntity._initializeBuilder(this);
|
||||
}
|
||||
|
|
@ -555,6 +575,7 @@ class AccountEntityBuilder
|
|||
_trialDaysLeft = $v.trialDaysLeft;
|
||||
_hasIapPlan = $v.hasIapPlan;
|
||||
_paymentId = $v.paymentId;
|
||||
_taxApiEnabled = $v.taxApiEnabled;
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
|
|
@ -609,7 +630,8 @@ class AccountEntityBuilder
|
|||
accountSmsVerified: BuiltValueNullFieldError.checkNotNull(accountSmsVerified, r'AccountEntity', 'accountSmsVerified'),
|
||||
trialDaysLeft: BuiltValueNullFieldError.checkNotNull(trialDaysLeft, r'AccountEntity', 'trialDaysLeft'),
|
||||
hasIapPlan: BuiltValueNullFieldError.checkNotNull(hasIapPlan, r'AccountEntity', 'hasIapPlan'),
|
||||
paymentId: BuiltValueNullFieldError.checkNotNull(paymentId, r'AccountEntity', 'paymentId'));
|
||||
paymentId: BuiltValueNullFieldError.checkNotNull(paymentId, r'AccountEntity', 'paymentId'),
|
||||
taxApiEnabled: BuiltValueNullFieldError.checkNotNull(taxApiEnabled, r'AccountEntity', 'taxApiEnabled'));
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import 'package:invoiceninja_flutter/constants.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/ui/app/forms/learn_more.dart';
|
||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
|
||||
// Package imports:
|
||||
|
|
@ -172,6 +173,16 @@ class _TaxSettingsState extends State<TaxSettings> {
|
|||
company.rebuild((b) => b..calculateTaxes = value)),
|
||||
helpLabel: localization.calculateTaxesHelp,
|
||||
),
|
||||
if (state.isSelfHosted &&
|
||||
!state.account.taxApiEnabled &&
|
||||
state.company.settings.countryId == kCountryUnitedStates)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: LearnMoreUrl(
|
||||
child: Text(localization.ziptaxHelp),
|
||||
url: kZipTaxURL,
|
||||
),
|
||||
),
|
||||
if (company.calculateTaxes) ...[
|
||||
/*
|
||||
DecoratedFormField(
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'ziptax_help':
|
||||
'Note: this feature requires a Zip-Tax API key to lookup US sales tax by address',
|
||||
'cache_data': 'Cache Data',
|
||||
'unknown': 'Unknown',
|
||||
'webhook_failure': 'Webhook Failure',
|
||||
|
|
@ -109437,6 +109439,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['cache_data'] ??
|
||||
_localizedValues['en']['cache_data'];
|
||||
|
||||
String get ziptaxHelp =>
|
||||
_localizedValues[localeCode]['ziptax_help'] ??
|
||||
_localizedValues['en']['ziptax_help'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
String lookup(String key) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue