Subscriptions
This commit is contained in:
parent
4ef924e0fa
commit
c643b9c677
|
|
@ -65,7 +65,7 @@ abstract class SubscriptionEntity extends Object
|
||||||
createdUserId: '',
|
createdUserId: '',
|
||||||
assignedUserId: '',
|
assignedUserId: '',
|
||||||
archivedAt: 0,
|
archivedAt: 0,
|
||||||
allowCancellation: true,
|
allowCancellation: false,
|
||||||
allowPlanChanges: false,
|
allowPlanChanges: false,
|
||||||
allowQueryOverrides: false,
|
allowQueryOverrides: false,
|
||||||
autoBill: '',
|
autoBill: '',
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,6 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
final _promoDiscountController = TextEditingController();
|
final _promoDiscountController = TextEditingController();
|
||||||
final _maxSeatsLimitController = TextEditingController();
|
final _maxSeatsLimitController = TextEditingController();
|
||||||
final _returnUrlController = TextEditingController();
|
final _returnUrlController = TextEditingController();
|
||||||
final _postPurchaseBodyController = TextEditingController();
|
|
||||||
final _postPurchaseHeadersController = TextEditingController();
|
final _postPurchaseHeadersController = TextEditingController();
|
||||||
final _postPurchaseRestMethodController = TextEditingController();
|
final _postPurchaseRestMethodController = TextEditingController();
|
||||||
final _postPurchaseUrlController = TextEditingController();
|
final _postPurchaseUrlController = TextEditingController();
|
||||||
|
|
@ -83,7 +82,6 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
_promoDiscountController,
|
_promoDiscountController,
|
||||||
_maxSeatsLimitController,
|
_maxSeatsLimitController,
|
||||||
_returnUrlController,
|
_returnUrlController,
|
||||||
_postPurchaseBodyController,
|
|
||||||
_postPurchaseHeadersController,
|
_postPurchaseHeadersController,
|
||||||
_postPurchaseRestMethodController,
|
_postPurchaseRestMethodController,
|
||||||
_postPurchaseUrlController,
|
_postPurchaseUrlController,
|
||||||
|
|
@ -101,7 +99,6 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
subscription.maxSeatsLimit.toDouble(), context,
|
subscription.maxSeatsLimit.toDouble(), context,
|
||||||
formatNumberType: FormatNumberType.inputAmount);
|
formatNumberType: FormatNumberType.inputAmount);
|
||||||
_returnUrlController.text = webhookConfiguration.returnUrl;
|
_returnUrlController.text = webhookConfiguration.returnUrl;
|
||||||
_postPurchaseBodyController.text = webhookConfiguration.postPurchaseBody;
|
|
||||||
_postPurchaseHeadersController.text =
|
_postPurchaseHeadersController.text =
|
||||||
webhookConfiguration.postPurchaseHeaders.join(',');
|
webhookConfiguration.postPurchaseHeaders.join(',');
|
||||||
_postPurchaseRestMethodController.text =
|
_postPurchaseRestMethodController.text =
|
||||||
|
|
@ -131,8 +128,6 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
..promoDiscount = parseDouble(_promoDiscountController.text)
|
..promoDiscount = parseDouble(_promoDiscountController.text)
|
||||||
..maxSeatsLimit = parseInt(_maxSeatsLimitController.text)
|
..maxSeatsLimit = parseInt(_maxSeatsLimitController.text)
|
||||||
..webhookConfiguration.returnUrl = _returnUrlController.text.trim()
|
..webhookConfiguration.returnUrl = _returnUrlController.text.trim()
|
||||||
..webhookConfiguration.postPurchaseBody =
|
|
||||||
_postPurchaseBodyController.text.trim()
|
|
||||||
..webhookConfiguration
|
..webhookConfiguration
|
||||||
.postPurchaseHeaders
|
.postPurchaseHeaders
|
||||||
.replace(_postPurchaseHeadersController.text.trim().split(','))
|
.replace(_postPurchaseHeadersController.text.trim().split(','))
|
||||||
|
|
@ -153,7 +148,6 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
final state = viewModel.state;
|
final state = viewModel.state;
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final subscription = viewModel.subscription;
|
final subscription = viewModel.subscription;
|
||||||
final origSubscription = state.subscriptionState.get(subscription.id);
|
|
||||||
|
|
||||||
final durations = [
|
final durations = [
|
||||||
DropdownMenuItem<int>(
|
DropdownMenuItem<int>(
|
||||||
|
|
@ -385,6 +379,11 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
),
|
),
|
||||||
FormCard(
|
FormCard(
|
||||||
children: [
|
children: [
|
||||||
|
DecoratedFormField(
|
||||||
|
label: localization.returnUrl,
|
||||||
|
controller: _returnUrlController,
|
||||||
|
keyboardType: TextInputType.url,
|
||||||
|
),
|
||||||
BoolDropdownButton(
|
BoolDropdownButton(
|
||||||
label: localization.allowQueryOverrides,
|
label: localization.allowQueryOverrides,
|
||||||
value: subscription.allowQueryOverrides,
|
value: subscription.allowQueryOverrides,
|
||||||
|
|
@ -400,8 +399,7 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
value: subscription.allowCancellation,
|
value: subscription.allowCancellation,
|
||||||
onChanged: (value) => viewModel.onChanged(subscription
|
onChanged: (value) => viewModel.onChanged(subscription
|
||||||
.rebuild((b) => b..allowCancellation = value))),
|
.rebuild((b) => b..allowCancellation = value))),
|
||||||
if (subscription.allowCancellation ||
|
if (subscription.allowCancellation)
|
||||||
origSubscription.allowCancellation)
|
|
||||||
AppDropdownButton<int>(
|
AppDropdownButton<int>(
|
||||||
showBlank: true,
|
showBlank: true,
|
||||||
blankValue: 0,
|
blankValue: 0,
|
||||||
|
|
@ -416,8 +414,7 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
value: subscription.trialEnabled,
|
value: subscription.trialEnabled,
|
||||||
onChanged: (value) => viewModel.onChanged(
|
onChanged: (value) => viewModel.onChanged(
|
||||||
subscription.rebuild((b) => b.trialEnabled = value))),
|
subscription.rebuild((b) => b.trialEnabled = value))),
|
||||||
if (subscription.trialEnabled ||
|
if (subscription.trialEnabled)
|
||||||
origSubscription.trialEnabled)
|
|
||||||
AppDropdownButton<int>(
|
AppDropdownButton<int>(
|
||||||
showBlank: true,
|
showBlank: true,
|
||||||
blankValue: 0,
|
blankValue: 0,
|
||||||
|
|
@ -433,8 +430,7 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
value: subscription.perSeatEnabled,
|
value: subscription.perSeatEnabled,
|
||||||
onChanged: (value) => viewModel.onChanged(subscription
|
onChanged: (value) => viewModel.onChanged(subscription
|
||||||
.rebuild((b) => b.perSeatEnabled = value))),
|
.rebuild((b) => b.perSeatEnabled = value))),
|
||||||
if (subscription.perSeatEnabled ||
|
if (subscription.perSeatEnabled)
|
||||||
origSubscription.perSeatEnabled)
|
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
label: localization.maxSeatsLimit,
|
label: localization.maxSeatsLimit,
|
||||||
controller: _maxSeatsLimitController,
|
controller: _maxSeatsLimitController,
|
||||||
|
|
@ -451,28 +447,18 @@ class _SubscriptionEditState extends State<SubscriptionEdit>
|
||||||
FormCard(
|
FormCard(
|
||||||
children: [
|
children: [
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
label: localization.returnUrl,
|
label: localization.webhookUrl,
|
||||||
controller: _returnUrlController,
|
|
||||||
keyboardType: TextInputType.url,
|
|
||||||
),
|
|
||||||
DecoratedFormField(
|
|
||||||
label: localization.postPurchaseUrl,
|
|
||||||
controller: _postPurchaseUrlController,
|
controller: _postPurchaseUrlController,
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
label: localization.postPurchaseRestMethod,
|
label: localization.restMethod,
|
||||||
controller: _postPurchaseRestMethodController,
|
controller: _postPurchaseRestMethodController,
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
label: localization.postPurchaseHeaders,
|
label: localization.headers,
|
||||||
controller: _postPurchaseHeadersController,
|
controller: _postPurchaseHeadersController,
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
|
||||||
label: localization.postPurchaseBody,
|
|
||||||
controller: _postPurchaseBodyController,
|
|
||||||
maxLines: 6,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
'return_url': 'Return URL',
|
'return_url': 'Return URL',
|
||||||
'post_purchase_url': 'Post Purchase URL',
|
'rest_method': 'REST Method',
|
||||||
'post_purchase_rest_method': 'Post Purchase REST Method',
|
'headers': 'Headers',
|
||||||
'post_purchase_headers': 'Post Purchase Headers',
|
|
||||||
'post_purchase_body': 'Post Purchase Body',
|
|
||||||
'recurring_products': 'Recurring Products',
|
'recurring_products': 'Recurring Products',
|
||||||
'promo_code': 'Promo Code',
|
'promo_code': 'Promo Code',
|
||||||
'promo_discount': 'Promo Discount',
|
'promo_discount': 'Promo Discount',
|
||||||
|
|
@ -56317,21 +56315,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['return_url'] ??
|
_localizedValues[localeCode]['return_url'] ??
|
||||||
_localizedValues['en']['return_url'];
|
_localizedValues['en']['return_url'];
|
||||||
|
|
||||||
String get postPurchaseUrl =>
|
String get restMethod =>
|
||||||
_localizedValues[localeCode]['post_purchase_url'] ??
|
_localizedValues[localeCode]['rest_method'] ??
|
||||||
_localizedValues['en']['post_purchase_url'];
|
_localizedValues['en']['rest_method'];
|
||||||
|
|
||||||
String get postPurchaseRestMethod =>
|
String get headers =>
|
||||||
_localizedValues[localeCode]['post_purchase_rest_method'] ??
|
_localizedValues[localeCode]['headers'] ??
|
||||||
_localizedValues['en']['post_purchase_rest_method'];
|
_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) {
|
String lookup(String key) {
|
||||||
final lookupKey = toSnakeCase(key);
|
final lookupKey = toSnakeCase(key);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue