run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<int> run() => withApp((app) async {
final rest = argResults!.rest;
if (rest.isEmpty) {
usageException('Give the order id: dartisan payment:check ORDER-42');
}
final orderId = rest.first;
final before = await Payment.find(orderId);
if (before == null) {
stderr.writeln('No payment recorded for $orderId.');
return 1;
}
final outcome = await Payment.manager.reconcile(orderId);
final after = await Payment.find(orderId);
stdout.writeln(
'$orderId (${before.gateway}): ${before.status.name} → '
'${after!.status.name} (${outcome.name})',
);
return 0;
});