<?php
/**
 * @copyright (c) Kufer Software GmbH, Oderstraße 7, D-84453 Mühldorf
 */

namespace Kufer\Web\KuferTools\Allgemein\PersoenlicheDaten\BankdatenAnhandIban;

class BankdatenAnhandIbanUseCase extends \Kufer\Web\KuferTools\Basis\UseCase\ToolUseCase
{
  public function __construct($request)
  {
    parent::__construct($request, new BankdatenAnhandIbanResponse());
  }

  public static function getToolId()
  {
    return 13;
  }

  public static function getToolSectionId()
  {
    return 90;
  }

  
  public function hasAccess($pToolSectionId = null)
  {
    $user = $this->getUser();
    $dbwTools = new \DBWorkTools();

    if (!$dbwTools->isToolAllowed($user->getIdentifier(), $this->getToolId())) {
      return false;
    }

    return true;
  }

  public function action()
  {
    $this->response->bankdaten = \BankDatenOperations::getBankdatenAnhandIban($this->request->iban);

    return $this->response;
  }
}

class BankdatenAnhandIbanRequest
{
  public $iban;
}

class BankdatenAnhandIbanResponse extends \Kufer\Web\KuferTools\Basis\UseCase\ToolResponse
{
  public $bankdaten;
}