diff --git a/lib/data/models/subscription_model.dart b/lib/data/models/subscription_model.dart index e1bc13144..f62353440 100644 --- a/lib/data/models/subscription_model.dart +++ b/lib/data/models/subscription_model.dart @@ -65,7 +65,7 @@ abstract class SubscriptionEntity extends Object createdUserId: '', assignedUserId: '', archivedAt: 0, - allowCancellation: true, + allowCancellation: false, allowPlanChanges: false, allowQueryOverrides: false, autoBill: '', diff --git a/lib/ui/subscription/edit/subscription_edit.dart b/lib/ui/subscription/edit/subscription_edit.dart index a82699c97..0e616530a 100644 --- a/lib/ui/subscription/edit/subscription_edit.dart +++ b/lib/ui/subscription/edit/subscription_edit.dart @@ -52,7 +52,6 @@ class _SubscriptionEditState extends State final _promoDiscountController = TextEditingController(); final _maxSeatsLimitController = TextEditingController(); final _returnUrlController = TextEditingController(); - final _postPurchaseBodyController = TextEditingController(); final _postPurchaseHeadersController = TextEditingController(); final _postPurchaseRestMethodController = TextEditingController(); final _postPurchaseUrlController = TextEditingController(); @@ -83,7 +82,6 @@ class _SubscriptionEditState extends State _promoDiscountController, _maxSeatsLimitController, _returnUrlController, - _postPurchaseBodyController, _postPurchaseHeadersController, _postPurchaseRestMethodController, _postPurchaseUrlController, @@ -101,7 +99,6 @@ class _SubscriptionEditState extends State subscription.maxSeatsLimit.toDouble(), context, formatNumberType: FormatNumberType.inputAmount); _returnUrlController.text = webhookConfiguration.returnUrl; - _postPurchaseBodyController.text = webhookConfiguration.postPurchaseBody; _postPurchaseHeadersController.text = webhookConfiguration.postPurchaseHeaders.join(','); _postPurchaseRestMethodController.text = @@ -131,8 +128,6 @@ class _SubscriptionEditState extends State ..promoDiscount = parseDouble(_promoDiscountController.text) ..maxSeatsLimit = parseInt(_maxSeatsLimitController.text) ..webhookConfiguration.returnUrl = _returnUrlController.text.trim() - ..webhookConfiguration.postPurchaseBody = - _postPurchaseBodyController.text.trim() ..webhookConfiguration .postPurchaseHeaders .replace(_postPurchaseHeadersController.text.trim().split(',')) @@ -153,7 +148,6 @@ class _SubscriptionEditState extends State final state = viewModel.state; final localization = AppLocalization.of(context); final subscription = viewModel.subscription; - final origSubscription = state.subscriptionState.get(subscription.id); final durations = [ DropdownMenuItem( @@ -385,6 +379,11 @@ class _SubscriptionEditState extends State ), FormCard( children: [ + DecoratedFormField( + label: localization.returnUrl, + controller: _returnUrlController, + keyboardType: TextInputType.url, + ), BoolDropdownButton( label: localization.allowQueryOverrides, value: subscription.allowQueryOverrides, @@ -400,8 +399,7 @@ class _SubscriptionEditState extends State value: subscription.allowCancellation, onChanged: (value) => viewModel.onChanged(subscription .rebuild((b) => b..allowCancellation = value))), - if (subscription.allowCancellation || - origSubscription.allowCancellation) + if (subscription.allowCancellation) AppDropdownButton( showBlank: true, blankValue: 0, @@ -416,8 +414,7 @@ class _SubscriptionEditState extends State value: subscription.trialEnabled, onChanged: (value) => viewModel.onChanged( subscription.rebuild((b) => b.trialEnabled = value))), - if (subscription.trialEnabled || - origSubscription.trialEnabled) + if (subscription.trialEnabled) AppDropdownButton( showBlank: true, blankValue: 0, @@ -433,8 +430,7 @@ class _SubscriptionEditState extends State value: subscription.perSeatEnabled, onChanged: (value) => viewModel.onChanged(subscription .rebuild((b) => b.perSeatEnabled = value))), - if (subscription.perSeatEnabled || - origSubscription.perSeatEnabled) + if (subscription.perSeatEnabled) DecoratedFormField( label: localization.maxSeatsLimit, controller: _maxSeatsLimitController, @@ -451,28 +447,18 @@ class _SubscriptionEditState extends State FormCard( children: [ DecoratedFormField( - label: localization.returnUrl, - controller: _returnUrlController, - keyboardType: TextInputType.url, - ), - DecoratedFormField( - label: localization.postPurchaseUrl, + label: localization.webhookUrl, controller: _postPurchaseUrlController, keyboardType: TextInputType.url, ), DecoratedFormField( - label: localization.postPurchaseRestMethod, + label: localization.restMethod, controller: _postPurchaseRestMethodController, ), DecoratedFormField( - label: localization.postPurchaseHeaders, + label: localization.headers, controller: _postPurchaseHeadersController, ), - DecoratedFormField( - label: localization.postPurchaseBody, - controller: _postPurchaseBodyController, - maxLines: 6, - ), ], ), ]), diff --git a/lib/utils/i18n.dart b/lib/utils/i18n.dart index fb9ed9bc6..0565fccac 100644 --- a/lib/utils/i18n.dart +++ b/lib/utils/i18n.dart @@ -16,10 +16,8 @@ mixin LocalizationsProvider on LocaleCodeAware { 'en': { // STARTER: lang key - do not remove comment 'return_url': 'Return URL', - 'post_purchase_url': 'Post Purchase URL', - 'post_purchase_rest_method': 'Post Purchase REST Method', - 'post_purchase_headers': 'Post Purchase Headers', - 'post_purchase_body': 'Post Purchase Body', + 'rest_method': 'REST Method', + 'headers': 'Headers', 'recurring_products': 'Recurring Products', 'promo_code': 'Promo Code', 'promo_discount': 'Promo Discount', @@ -56317,21 +56315,14 @@ mixin LocalizationsProvider on LocaleCodeAware { _localizedValues[localeCode]['return_url'] ?? _localizedValues['en']['return_url']; - String get postPurchaseUrl => - _localizedValues[localeCode]['post_purchase_url'] ?? - _localizedValues['en']['post_purchase_url']; + String get restMethod => + _localizedValues[localeCode]['rest_method'] ?? + _localizedValues['en']['rest_method']; - String get postPurchaseRestMethod => - _localizedValues[localeCode]['post_purchase_rest_method'] ?? - _localizedValues['en']['post_purchase_rest_method']; + String get headers => + _localizedValues[localeCode]['headers'] ?? + _localizedValues['en']['headers']; - String get postPurchaseHeaders => - _localizedValues[localeCode]['post_purchase_headers'] ?? - _localizedValues['en']['post_purchase_headers']; - - String get postPurchaseBody => - _localizedValues[localeCode]['post_purchase_body'] ?? - _localizedValues['en']['post_purchase_body']; String lookup(String key) { final lookupKey = toSnakeCase(key);