diff --git a/lib/data/models/company_gateway_model.dart b/lib/data/models/company_gateway_model.dart index eca81e8c9..2dba989a9 100644 --- a/lib/data/models/company_gateway_model.dart +++ b/lib/data/models/company_gateway_model.dart @@ -82,6 +82,7 @@ abstract class CompanyGatewayEntity extends Object createdAt: 0, label: '', tokenBilling: TOKEN_BILLING_ALWAYS, + isTestMode: false, ); } @@ -136,6 +137,9 @@ abstract class CompanyGatewayEntity extends Object @BuiltValueField(wireName: 'token_billing') String get tokenBilling; + @BuiltValueField(wireName: 'test_mode') + bool get isTestMode; + String get label; Map get parsedConfig => diff --git a/lib/data/models/company_gateway_model.g.dart b/lib/data/models/company_gateway_model.g.dart index c05b9cc49..f36daecdc 100644 --- a/lib/data/models/company_gateway_model.g.dart +++ b/lib/data/models/company_gateway_model.g.dart @@ -165,6 +165,9 @@ class _$CompanyGatewayEntitySerializer 'token_billing', serializers.serialize(object.tokenBilling, specifiedType: const FullType(String)), + 'test_mode', + serializers.serialize(object.isTestMode, + specifiedType: const FullType(bool)), 'label', serializers.serialize(object.label, specifiedType: const FullType(String)), @@ -270,6 +273,10 @@ class _$CompanyGatewayEntitySerializer result.tokenBilling = serializers.deserialize(value, specifiedType: const FullType(String)) as String; break; + case 'test_mode': + result.isTestMode = serializers.deserialize(value, + specifiedType: const FullType(bool)) as bool; + break; case 'label': result.label = serializers.deserialize(value, specifiedType: const FullType(String)) as String; @@ -656,6 +663,8 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity { @override final String tokenBilling; @override + final bool isTestMode; + @override final String label; @override final bool isChanged; @@ -691,6 +700,7 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity { this.customValue4, this.config, this.tokenBilling, + this.isTestMode, this.label, this.isChanged, this.createdAt, @@ -747,6 +757,9 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity { throw new BuiltValueNullFieldError( 'CompanyGatewayEntity', 'tokenBilling'); } + if (isTestMode == null) { + throw new BuiltValueNullFieldError('CompanyGatewayEntity', 'isTestMode'); + } if (label == null) { throw new BuiltValueNullFieldError('CompanyGatewayEntity', 'label'); } @@ -789,6 +802,7 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity { customValue4 == other.customValue4 && config == other.config && tokenBilling == other.tokenBilling && + isTestMode == other.isTestMode && label == other.label && isChanged == other.isChanged && createdAt == other.createdAt && @@ -821,17 +835,17 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity { $jc( $jc( $jc( - $jc($jc($jc(0, gatewayId.hashCode), acceptedCreditCards.hashCode), - showBillingAddress.hashCode), - showShippingAddress.hashCode), - updateDetails.hashCode), - feesAndLimitsMap.hashCode), - customValue1.hashCode), - customValue2.hashCode), - customValue3.hashCode), - customValue4.hashCode), - config.hashCode), - tokenBilling.hashCode), + $jc($jc($jc($jc(0, gatewayId.hashCode), acceptedCreditCards.hashCode), showBillingAddress.hashCode), + showShippingAddress.hashCode), + updateDetails.hashCode), + feesAndLimitsMap.hashCode), + customValue1.hashCode), + customValue2.hashCode), + customValue3.hashCode), + customValue4.hashCode), + config.hashCode), + tokenBilling.hashCode), + isTestMode.hashCode), label.hashCode), isChanged.hashCode), createdAt.hashCode), @@ -858,6 +872,7 @@ class _$CompanyGatewayEntity extends CompanyGatewayEntity { ..add('customValue4', customValue4) ..add('config', config) ..add('tokenBilling', tokenBilling) + ..add('isTestMode', isTestMode) ..add('label', label) ..add('isChanged', isChanged) ..add('createdAt', createdAt) @@ -931,6 +946,10 @@ class CompanyGatewayEntityBuilder String get tokenBilling => _$this._tokenBilling; set tokenBilling(String tokenBilling) => _$this._tokenBilling = tokenBilling; + bool _isTestMode; + bool get isTestMode => _$this._isTestMode; + set isTestMode(bool isTestMode) => _$this._isTestMode = isTestMode; + String _label; String get label => _$this._label; set label(String label) => _$this._label = label; @@ -985,6 +1004,7 @@ class CompanyGatewayEntityBuilder _customValue4 = _$v.customValue4; _config = _$v.config; _tokenBilling = _$v.tokenBilling; + _isTestMode = _$v.isTestMode; _label = _$v.label; _isChanged = _$v.isChanged; _createdAt = _$v.createdAt; @@ -1030,6 +1050,7 @@ class CompanyGatewayEntityBuilder customValue4: customValue4, config: config, tokenBilling: tokenBilling, + isTestMode: isTestMode, label: label, isChanged: isChanged, createdAt: createdAt, diff --git a/lib/ui/company_gateway/company_gateway_list_item.dart b/lib/ui/company_gateway/company_gateway_list_item.dart index 3a8da64eb..a2b303827 100644 --- a/lib/ui/company_gateway/company_gateway_list_item.dart +++ b/lib/ui/company_gateway/company_gateway_list_item.dart @@ -73,7 +73,10 @@ class CompanyGatewayListItem extends StatelessWidget { children: [ Expanded( child: Text( - companyGateway.label, + companyGateway.label + + (companyGateway.isTestMode + ? ' [${AppLocalization.of(context).testMode}]' + : ''), style: Theme.of(context).textTheme.headline6, ), ), diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index 7225efbd0..7ae949fd4 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -15,6 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware { static final Map> _localizedValues = { 'en': { // STARTER: lang key - do not remove comment + 'test_mode': 'Test Mode', 'opened': 'opened', 'payment_reconciliation_failure': 'Reconciliation Failure', 'payment_reconciliation_success': 'Reconciliation Success', @@ -4464,6 +4465,8 @@ mixin LocalizationsProvider on LocaleCodeAware { String get opened => _localizedValues[localeCode]['opened'] ?? ''; + String get testMode => _localizedValues[localeCode]['test_mode'] ?? ''; + String lookup(String key) { final lookupKey = toSnakeCase(key);