Company gateway settings

This commit is contained in:
Hillel Coren 2020-08-23 17:53:43 +03:00
parent 157bdfb685
commit 04d55dabc3
7 changed files with 118 additions and 38 deletions

View File

@ -86,6 +86,11 @@ abstract class CompanyGatewayEntity extends Object
CompanyGatewayEntity._(); CompanyGatewayEntity._();
static const AUTO_BILL_ALWAYS = 'always';
static const AUTO_BILL_OPT_IN = 'optin';
static const AUTO_BILL_OPT_OUT = 'optout';
static const AUTO_BILL_DISABLED = 'disabled';
@override @override
@memoized @memoized
int get hashCode; int get hashCode;
@ -129,6 +134,12 @@ abstract class CompanyGatewayEntity extends Object
String get config; String get config;
@nullable
String get autobill;
@nullable
String get label;
Map<String, dynamic> get parsedConfig => Map<String, dynamic> get parsedConfig =>
config.isEmpty ? <String, dynamic>{} : jsonDecode(config); config.isEmpty ? <String, dynamic>{} : jsonDecode(config);

View File

@ -177,6 +177,18 @@ class _$CompanyGatewayEntitySerializer
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(String)), serializers.serialize(object.id, specifiedType: const FullType(String)),
]; ];
if (object.autobill != null) {
result
..add('autobill')
..add(serializers.serialize(object.autobill,
specifiedType: const FullType(String)));
}
if (object.label != null) {
result
..add('label')
..add(serializers.serialize(object.label,
specifiedType: const FullType(String)));
}
if (object.isChanged != null) { if (object.isChanged != null) {
result result
..add('isChanged') ..add('isChanged')
@ -267,6 +279,14 @@ class _$CompanyGatewayEntitySerializer
result.config = serializers.deserialize(value, result.config = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'autobill':
result.autobill = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'label':
result.label = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'isChanged': case 'isChanged':
result.isChanged = serializers.deserialize(value, result.isChanged = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool; specifiedType: const FullType(bool)) as bool;
@ -649,6 +669,10 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
@override @override
final String config; final String config;
@override @override
final String autobill;
@override
final String label;
@override
final bool isChanged; final bool isChanged;
@override @override
final int createdAt; final int createdAt;
@ -682,6 +706,8 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
this.customValue3, this.customValue3,
this.customValue4, this.customValue4,
this.config, this.config,
this.autobill,
this.label,
this.isChanged, this.isChanged,
this.createdAt, this.createdAt,
this.updatedAt, this.updatedAt,
@ -775,6 +801,8 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
customValue3 == other.customValue3 && customValue3 == other.customValue3 &&
customValue4 == other.customValue4 && customValue4 == other.customValue4 &&
config == other.config && config == other.config &&
autobill == other.autobill &&
label == other.label &&
isChanged == other.isChanged && isChanged == other.isChanged &&
createdAt == other.createdAt && createdAt == other.createdAt &&
updatedAt == other.updatedAt && updatedAt == other.updatedAt &&
@ -806,28 +834,18 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
$jc( $jc($jc($jc($jc(0, gateway.hashCode), gatewayId.hashCode), acceptedCreditCards.hashCode),
$jc( showBillingAddress.hashCode),
0, showShippingAddress.hashCode),
gateway updateDetails.hashCode),
.hashCode), feesAndLimitsMap.hashCode),
gatewayId customValue1.hashCode),
.hashCode), customValue2.hashCode),
acceptedCreditCards customValue3.hashCode),
.hashCode), customValue4.hashCode),
showBillingAddress config.hashCode),
.hashCode), autobill.hashCode),
showShippingAddress label.hashCode),
.hashCode),
updateDetails
.hashCode),
feesAndLimitsMap
.hashCode),
customValue1.hashCode),
customValue2.hashCode),
customValue3.hashCode),
customValue4.hashCode),
config.hashCode),
isChanged.hashCode), isChanged.hashCode),
createdAt.hashCode), createdAt.hashCode),
updatedAt.hashCode), updatedAt.hashCode),
@ -853,6 +871,8 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity {
..add('customValue3', customValue3) ..add('customValue3', customValue3)
..add('customValue4', customValue4) ..add('customValue4', customValue4)
..add('config', config) ..add('config', config)
..add('autobill', autobill)
..add('label', label)
..add('isChanged', isChanged) ..add('isChanged', isChanged)
..add('createdAt', createdAt) ..add('createdAt', createdAt)
..add('updatedAt', updatedAt) ..add('updatedAt', updatedAt)
@ -926,6 +946,14 @@ class CompanyGatewayEntityBuilder
String get config => _$this._config; String get config => _$this._config;
set config(String config) => _$this._config = config; set config(String config) => _$this._config = config;
String _autobill;
String get autobill => _$this._autobill;
set autobill(String autobill) => _$this._autobill = autobill;
String _label;
String get label => _$this._label;
set label(String label) => _$this._label = label;
bool _isChanged; bool _isChanged;
bool get isChanged => _$this._isChanged; bool get isChanged => _$this._isChanged;
set isChanged(bool isChanged) => _$this._isChanged = isChanged; set isChanged(bool isChanged) => _$this._isChanged = isChanged;
@ -976,6 +1004,8 @@ class CompanyGatewayEntityBuilder
_customValue3 = _$v.customValue3; _customValue3 = _$v.customValue3;
_customValue4 = _$v.customValue4; _customValue4 = _$v.customValue4;
_config = _$v.config; _config = _$v.config;
_autobill = _$v.autobill;
_label = _$v.label;
_isChanged = _$v.isChanged; _isChanged = _$v.isChanged;
_createdAt = _$v.createdAt; _createdAt = _$v.createdAt;
_updatedAt = _$v.updatedAt; _updatedAt = _$v.updatedAt;
@ -1020,6 +1050,8 @@ class CompanyGatewayEntityBuilder
customValue3: customValue3, customValue3: customValue3,
customValue4: customValue4, customValue4: customValue4,
config: config, config: config,
autobill: autobill,
label: label,
isChanged: isChanged, isChanged: isChanged,
createdAt: createdAt, createdAt: createdAt,
updatedAt: updatedAt, updatedAt: updatedAt,

View File

@ -629,7 +629,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
//return 'Last Updated: ${userCompanyStates.map((state) => state.lastUpdated).join(',')}'; //return 'Last Updated: ${userCompanyStates.map((state) => state.lastUpdated).join(',')}';
//return 'Names: ${userCompanyStates.map((state) => state.company.id).join(',')}'; //return 'Names: ${userCompanyStates.map((state) => state.company.id).join(',')}';
//return 'Client Count: ${userCompanyState.clientState.list.length}, Last Updated: ${userCompanyState.lastUpdated}'; //return 'Client Count: ${userCompanyState.clientState.list.length}, Last Updated: ${userCompanyState.lastUpdated}';
//return 'Token: ${credentials.token} - ${userCompanyStates.map((state) => state?.token?.token ?? '').where((name) => name.isNotEmpty).join(',')}'; return 'Token: ${credentials.token} - ${userCompanyStates.map((state) => state?.token?.token ?? '').where((name) => name.isNotEmpty).join(',')}';
//return 'Payment Terms: ${company.settings.defaultPaymentTerms}'; //return 'Payment Terms: ${company.settings.defaultPaymentTerms}';
//return 'Invitations: ${uiState.invoiceUIState.editing.invitations}'; //return 'Invitations: ${uiState.invoiceUIState.editing.invitations}';
//return 'Selection: ${clientUIState.selectedId}'; //return 'Selection: ${clientUIState.selectedId}';

View File

@ -129,8 +129,33 @@ class _CompanyGatewayEditState extends State<CompanyGatewayEdit>
), ),
ListView( ListView(
children: <Widget>[ children: <Widget>[
FormCard(children: <Widget>[
DecoratedFormField(
label: localization.label,
initialValue: companyGateway.label,
onChanged: (String value) => viewModel.onChanged(
companyGateway.rebuild((b) => b..label = value.trim())),
),
if (state.staticState.gatewayMap[companyGateway.gatewayId]
.supportsTokenBilling)
AppDropdownButton<String>(
labelText: localization.autoBill,
value: companyGateway.autobill,
onChanged: (dynamic value) => null,
items: [
CompanyGatewayEntity.AUTO_BILL_ALWAYS,
CompanyGatewayEntity.AUTO_BILL_OPT_IN,
CompanyGatewayEntity.AUTO_BILL_OPT_OUT,
CompanyGatewayEntity.AUTO_BILL_DISABLED
]
.map((value) => DropdownMenuItem(
child: Text(value),
value: value,
))
.toList())
]),
FormCard( FormCard(
children: <Widget>[ children: [
SwitchListTile( SwitchListTile(
activeColor: Theme.of(context).accentColor, activeColor: Theme.of(context).accentColor,
title: Text(localization.updateAddress), title: Text(localization.updateAddress),

View File

@ -15,6 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = { static final Map<String, Map<String, String>> _localizedValues = {
'en': { 'en': {
// STARTER: lang key - do not remove comment // STARTER: lang key - do not remove comment
'label': 'Label',
'client_number': 'Client Number', 'client_number': 'Client Number',
'auto_convert': 'Auto Convert', 'auto_convert': 'Auto Convert',
'company_name': 'Company Name', 'company_name': 'Company Name',
@ -4393,6 +4394,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get autoConvert => _localizedValues[localeCode]['auto_convert'] ?? ''; String get autoConvert => _localizedValues[localeCode]['auto_convert'] ?? '';
String get label => _localizedValues[localeCode]['label'] ?? '';
String lookup(String key) { String lookup(String key) {
final lookupKey = toSnakeCase(key); final lookupKey = toSnakeCase(key);

View File

@ -49,11 +49,13 @@ class WebUtils {
static void registerWebView(String html) { static void registerWebView(String html) {
// ignore: undefined_prefixed_name // ignore: undefined_prefixed_name
/*
ui.platformViewRegistry.registerViewFactory( ui.platformViewRegistry.registerViewFactory(
html, html,
(int viewId) => IFrameElement() (int viewId) => IFrameElement()
..src = html ..src = html
..style.border = 'none'); ..style.border = 'none');
*/
} }
static void warnChanges(Store<AppState> store) { static void warnChanges(Store<AppState> store) {

View File

@ -217,21 +217,28 @@ packages:
name: device_info name: device_info
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.2+6" version: "0.4.2+7"
device_info_platform_interface:
dependency: transitive
description:
name: device_info_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
extended_image: extended_image:
dependency: transitive dependency: transitive
description: description:
name: extended_image name: extended_image
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
extended_image_library: extended_image_library:
dependency: transitive dependency: transitive
description: description:
name: extended_image_library name: extended_image_library
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.3" version: "0.3.0"
extension: extension:
dependency: transitive dependency: transitive
description: description:
@ -431,7 +438,7 @@ packages:
name: google_sign_in name: google_sign_in
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.5.1" version: "4.5.3"
google_sign_in_platform_interface: google_sign_in_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -501,7 +508,7 @@ packages:
name: image_picker name: image_picker
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.7+4" version: "0.6.7+6"
image_picker_platform_interface: image_picker_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -515,7 +522,7 @@ packages:
name: in_app_purchase name: in_app_purchase
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.4+3" version: "0.3.4+4"
intl: intl:
dependency: "direct main" dependency: "direct main"
description: description:
@ -557,7 +564,7 @@ packages:
name: local_auth name: local_auth
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3+1"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -648,7 +655,7 @@ packages:
name: package_info name: package_info
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.1" version: "0.4.3"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -662,7 +669,7 @@ packages:
name: path_provider name: path_provider
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.11" version: "1.6.14"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -795,21 +802,21 @@ packages:
name: share name: share
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.4+3" version: "0.6.4+5"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
name: shared_preferences name: shared_preferences
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.5.8" version: "0.5.10"
shared_preferences_linux: shared_preferences_linux:
dependency: transitive dependency: transitive
description: description:
name: shared_preferences_linux name: shared_preferences_linux
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.2+1" version: "0.0.2+2"
shared_preferences_macos: shared_preferences_macos:
dependency: transitive dependency: transitive
description: description:
@ -982,7 +989,7 @@ packages:
name: timeago name: timeago
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.26" version: "2.0.27"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -1115,7 +1122,7 @@ packages:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1" version: "0.1.2"
xml: xml:
dependency: transitive dependency: transitive
description: description: