Example #1
0
 /**
  * Returns name of class for handle callback
  *
  * @param string $action one of Action::<const>-s
  *
  * @return string
  * @throws Exception
  */
 public static function getClassName($action)
 {
     if (!Action::isValid($action)) {
         throw new Exception(Exception\Code::ACTION_NOT_VALID);
     }
     return self::$classNames[$action];
 }
Example #2
0
 /**
  * Factory method
  *
  * @param string $action one of Action::<CONST>-ants
  * @param Signer $signer just instance of Signer
  *
  * @return Response
  * @throws Exception
  */
 public static function create($action, Signer $signer)
 {
     $className = __NAMESPACE__ . '\\Response\\' . Action::getClassName($action);
     return new $className($signer);
 }
Example #3
0
 /**
  * @param Signer $signer
  *
  * @return Handler\Init|Handler\Payment|Handler\CancelInit|Handler\CancelPayment
  * @throws Exception
  */
 public static function create(Signer $signer)
 {
     list($action, $input) = self::getAction();
     $className = __NAMESPACE__ . '\\Handler\\' . Action::getClassName($action);
     return new $className($action, $input, $signer);
 }