function payment_action(IPaymentModule $system, StandardWebInterface $web)
 {
     $action = $web->payment_get_action();
     switch ($action) {
         case 'ipn':
             try {
                 $msg = $system->ipn();
             } catch (\Exception $ex) {
                 $msg = new IPNErrorMessage($ex->getMessage());
             }
             if ($msg) {
                 return $this->payment_handle($msg);
             }
             return 'ipn_error';
         case 'success':
         case 'cancel':
             return $action;
         default:
             return new FileNotFound();
     }
 }