Example #1
0
 /**
  * 2016-08-27
  * @param object $caller
  * @param array(string => mixed) $p
  * @return string
  */
 private static function _sign($caller, array $p)
 {
     /** @var string $type */
     $type = df_trim_text_left(df_caller_f(), 'sign');
     /** @var self $i */
     $i = df_create(df_con($caller, df_cc_class('Signer', $type), df_con($caller, 'Signer')), $p);
     $i->_caller = $caller;
     return $i->sign();
 }
Example #2
0
 /**
  * 2016-08-27
  * @param Method $method
  * @return array(string, array(string => mixed))
  */
 public static final function p(Method $method)
 {
     /** @var self $i */
     $i = df_create(df_con($method, 'Charge'), [self::$P__METHOD => $method]);
     /**
      * 2016-08-29
      * Метод @uses \Df\Payment\R\ICharge::requestIdKey(),
      * но мы вызываем его нестатично (чтобы он был вызван для нужного класса, а не бля базового),
      * и это успешно работает безо всяких предупреждений интерпретатора:
      * https://3v4l.org/N2VD2
      * http://stackoverflow.com/a/32746909
      * http://stackoverflow.com/a/15756165
      * Некоторые утверждают, что якобы на старых версиях PHP
      * это может выдавать предупреждение уровня E_STRICT:
      * http://stackoverflow.com/a/12874405
      * Однако это неправда, я проверил: https://3v4l.org/1JY8i
      */
     /** @var string $id */
     $id = $i->requestId();
     df_assert_string_not_empty($id);
     /** @var array(string => mixed) $p */
     $p = [$i->requestIdKey() => $id] + $i->params();
     return [$id, $p + [$i->signatureKey() => Signer::signRequest($i, $p)]];
 }
Example #3
0
 /**
  * 2016-02-11
  * @override
  * How is a payment method's getInfoBlockType() used? https://mage2.pro/t/687
  *
  * @see \Magento\Payment\Model\MethodInterface::getInfoBlockType()
  * https://github.com/magento/magento2/blob/6ce74b2/app/code/Magento/Payment/Model/MethodInterface.php#L25-L32
  * @see \Magento\Payment\Model\Method\AbstractMethod::getInfoBlockType()
  * https://github.com/magento/magento2/blob/6ce74b2/app/code/Magento/Payment/Model/Method/AbstractMethod.php#L510-L518
  *
  * 2016-08-29
  * Метод вызывается единократно, поэтому кэшировать результат не надо:
  * @used-by \Magento\Payment\Helper\Data::getInfoBlock()
  *
  * @return string
  */
 public function getInfoBlockType()
 {
     return df_con($this, 'Block\\Info', \Df\Payment\Block\Info::class);
 }
Example #4
0
 /**
  * 2016-07-18
  * @return Response[]
  */
 private function responses()
 {
     return dfc($this, function () {
         /** @var string $class */
         $class = df_con($this, 'Response');
         return array_map(function (T $t) use($class) {
             return call_user_func([$class, 'i'], df_trans_raw_details($t));
         }, $this->transChildren());
     });
 }
Example #5
0
/**
 * 2016-08-29
 * @used-by dfp_method_call_s()
 * @param string|object $c
 * @param string|string[] $suffix
 * @param string $method
 * @param mixed[] $params [optional]
 * @return mixed
 */
function df_con_s($c, $suffix, $method, array $params = [])
{
    return dfcf(function ($c, $suffix, $method, array $params = []) {
        return call_user_func_array([df_con($c, $suffix), $method], $params);
    }, func_get_args());
}