handleCreditCardPayment method
void
handleCreditCardPayment(
- AppModel app,
- BuildContext theContext,
- AssignmentModel? theAssignmentModel,
- PaymentStatus status,
Implementation
void handleCreditCardPayment(AppModel app, BuildContext theContext,
AssignmentModel? theAssignmentModel, PaymentStatus status) {
if (status is PaymentSucceeded) {
// now store in results status.reference;
finishTask(
app,
theContext,
theAssignmentModel!,
ExecutionResults(ExecutionStatus.success, results: [
AssignmentResultModel(
documentID: newRandomKey(),
key: payTaskFieldPaymentType,
value: 'Credit card'),
AssignmentResultModel(
documentID: newRandomKey(),
key: payTaskFieldPaymentReference,
value: status.reference)
]),
null);
} else if (status is PaymentFailure) {
finishTask(
app,
theContext,
theAssignmentModel!,
ExecutionResults(ExecutionStatus.failure, results: [
AssignmentResultModel(
documentID: newRandomKey(),
key: payTaskFieldPaymentType,
value: 'Credit card'),
AssignmentResultModel(
documentID: newRandomKey(),
key: payTaskFieldPaymentReference,
value: status.reference),
AssignmentResultModel(
documentID: newRandomKey(),
key: payTaskFieldError,
value: status.error)
]),
null);
}
}