startTask method
Future<void>
startTask(
- AppModel app,
- BuildContext context,
- String? memberId,
- AssignmentModel? assignmentModel,
override
Implementation
@override
Future<void> startTask(AppModel app, BuildContext context, String? memberId,
AssignmentModel? assignmentModel) {
var accessState = AccessBloc.getState(context);
if (accessState is LoggedIn) {
if (paymentType is CreditCardPayTypeModel) {
var casted = paymentType as CreditCardPayTypeModel;
if ((casted.requiresConfirmation != null) &&
casted.requiresConfirmation!) {
openAckNackDialog(app, context, '${app.documentID}/payment',
title: 'Payment',
message:
'Proceed with payment of ${getAmount(context)} ${getCcy(context)!} for ${assignmentModel!.workflow!.name!}?',
onSelection: (value) {
if (value == 0) {
_confirmedCreditCardPayment(
app, context, assignmentModel, accessState);
}
});
} else {
_creditCardPayment(app, context, assignmentModel, accessState);
}
} else if (paymentType is ManualPayTypeModel) {
var p = paymentType as ManualPayTypeModel;
openWidgetDialog(app, context, '${app.documentID}/payment',
child: ManualPaymentDialog(
app: app,
purpose: assignmentModel!.task!.description,
amount: getAmount(context),
ccy: getCcy(context),
payTo: p.payTo,
country: p.country,
bankIdentifierCode: p.bankIdentifierCode,
payeeIBAN: p.payeeIBAN,
bankName: p.bankName,
payedWithTheseDetails:
(paymentReference, String paymentName, bool success) =>
handleManualPayment(app, context, assignmentModel,
paymentReference, paymentName, success)));
}
}
return Future.value(null);
}