Transaction rules
This commit is contained in:
parent
73ae403487
commit
b2a844f61c
|
|
@ -17,6 +17,7 @@ const String kWhiteLabelUrl =
|
|||
'https://app.invoiceninja.com/buy_now/?account_key=AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT&product_id=3';
|
||||
const String kPrivacyPolicyURL = 'https://www.invoiceninja.com/privacy-policy';
|
||||
const String kTermsOfServiceURL = 'https://www.invoiceninja.com/terms';
|
||||
const String kBankingURL = 'https://invoiceninja.com/banking/';
|
||||
const String kTransifexURL =
|
||||
'https://www.transifex.com/invoice-ninja/invoice-ninja';
|
||||
const String kSourceCodeBackend =
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class TransactionRuleRepository {
|
|||
Future<TransactionRuleEntity> loadItem(
|
||||
Credentials credentials, String entityId) async {
|
||||
final dynamic response = await webClient.get(
|
||||
'${credentials.url}/transaction_rules/$entityId', credentials.token);
|
||||
'${credentials.url}/bank_transaction_rules/$entityId',
|
||||
credentials.token);
|
||||
|
||||
final TransactionRuleItemResponse transactionRuleResponse = serializers
|
||||
.deserializeWith(TransactionRuleItemResponse.serializer, response);
|
||||
|
|
@ -27,7 +28,7 @@ class TransactionRuleRepository {
|
|||
|
||||
Future<BuiltList<TransactionRuleEntity>> loadList(
|
||||
Credentials credentials) async {
|
||||
final String url = credentials.url + '/transaction_rules?';
|
||||
final String url = credentials.url + '/bnak_transaction_rules?';
|
||||
final dynamic response = await webClient.get(url, credentials.token);
|
||||
|
||||
final TransactionRuleListResponse transactionRuleResponse = serializers
|
||||
|
|
@ -43,7 +44,7 @@ class TransactionRuleRepository {
|
|||
}
|
||||
|
||||
final url = credentials.url +
|
||||
'/transaction_rules/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
||||
'/bank_transaction_rules/bulk?per_page=$kMaxEntitiesPerBulkAction';
|
||||
final dynamic response = await webClient.post(url, credentials.token,
|
||||
data: json.encode({'ids': ids, 'action': action.toApiParam()}));
|
||||
|
||||
|
|
@ -61,10 +62,11 @@ class TransactionRuleRepository {
|
|||
|
||||
if (transactionRule.isNew) {
|
||||
response = await webClient.post(
|
||||
credentials.url + '/transaction_rules', credentials.token,
|
||||
credentials.url + '/bank_transaction_rules', credentials.token,
|
||||
data: json.encode(data));
|
||||
} else {
|
||||
final url = '${credentials.url}/transaction_rules/${transactionRule.id}';
|
||||
final url =
|
||||
'${credentials.url}/bank_transaction_rules/${transactionRule.id}';
|
||||
response =
|
||||
await webClient.put(url, credentials.token, data: json.encode(data));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,44 +94,56 @@ class BankAccountScreen extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16, top: 8, right: 16, bottom: 10),
|
||||
child: state.isEnterprisePlan
|
||||
? Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: localization.connect.toUpperCase(),
|
||||
onPressed: () => connectAccounts(context),
|
||||
iconData: Icons.link,
|
||||
),
|
||||
),
|
||||
SizedBox(width: kGutterWidth),
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: localization.refresh.toUpperCase(),
|
||||
onPressed: () =>
|
||||
viewModel.onRefreshAccounts(context),
|
||||
iconData: Icons.refresh,
|
||||
),
|
||||
),
|
||||
SizedBox(width: kGutterWidth),
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: localization.rules.toUpperCase(),
|
||||
onPressed: () {
|
||||
store.dispatch(ViewSettings(
|
||||
section: kSettingsTransactionRules));
|
||||
},
|
||||
iconData: Icons.rule_folder,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 8),
|
||||
child: Center(
|
||||
child: HelpText(
|
||||
localization.upgradeToConnectBankAccount)),
|
||||
child: Row(
|
||||
children: [
|
||||
if (state.isEnterprisePlan) ...[
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: localization.connect.toUpperCase(),
|
||||
onPressed: () => connectAccounts(context),
|
||||
iconData: Icons.link,
|
||||
),
|
||||
),
|
||||
SizedBox(width: kGutterWidth),
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: localization.refresh.toUpperCase(),
|
||||
onPressed: () => viewModel.onRefreshAccounts(context),
|
||||
iconData: Icons.refresh,
|
||||
),
|
||||
),
|
||||
] else
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 8),
|
||||
child: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
HelpText(localization.upgradeToConnectBankAccount),
|
||||
SizedBox(height: 16),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
launchUrl(Uri.parse(kBankingURL)),
|
||||
child: Text(localization.learnMore),
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
),
|
||||
SizedBox(width: kGutterWidth),
|
||||
Expanded(
|
||||
child: AppButton(
|
||||
label: localization.rules.toUpperCase(),
|
||||
onPressed: () {
|
||||
store.dispatch(
|
||||
ViewSettings(section: kSettingsTransactionRules));
|
||||
},
|
||||
iconData: Icons.rule_folder,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: BankAccountListBuilder()),
|
||||
],
|
||||
|
|
|
|||
Loading…
Reference in New Issue