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