当前位置: 首页>>代码示例>>PHP>>正文


PHP ArrayObject::replace方法代码示例

本文整理汇总了PHP中Payum\Core\Bridge\Spl\ArrayObject::replace方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayObject::replace方法的具体用法?PHP ArrayObject::replace怎么用?PHP ArrayObject::replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Payum\Core\Bridge\Spl\ArrayObject的用法示例。


在下文中一共展示了ArrayObject::replace方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request Capture */
     if (false == $this->supports($request)) {
         throw RequestNotSupportedException::createActionNotSupported($this, $request);
     }
     $model = new ArrayObject($request->getModel());
     if (is_numeric($model['RESULT'])) {
         return;
     }
     $cardFields = array('ACCT', 'CVV2', 'EXPDATE');
     if (false == $model->validateNotEmpty($cardFields, false)) {
         try {
             $this->payment->execute($obtainCreditCard = new ObtainCreditCard());
             $card = $obtainCreditCard->obtain();
             $model['EXPDATE'] = new SensitiveValue($card->getExpireAt()->format('my'));
             $model['ACCT'] = $card->getNumber();
             $model['CVV2'] = $card->getSecurityCode();
         } catch (RequestNotSupportedException $e) {
             throw new LogicException('Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.');
         }
     }
     $buzzRequest = new Request();
     $buzzRequest->setFields($model->toUnsafeArray());
     $response = $this->api->doPayment($buzzRequest);
     $model->replace($response);
 }
开发者ID:Studio-40,项目名称:Payum,代码行数:30,代码来源:CaptureAction.php

示例2: execute

 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request \Payum\Core\Request\Capture */
     if (false == $this->supports($request)) {
         throw RequestNotSupportedException::createActionNotSupported($this, $request);
     }
     $model = new ArrayObject($request->getModel());
     if (null !== $model['EXECCODE']) {
         return;
     }
     $cardFields = array('CARDCODE', 'CARDCVV', 'CARDVALIDITYDATE', 'CARDFULLNAME');
     if (false == $model->validateNotEmpty($cardFields, false) && false == $model['ALIAS']) {
         try {
             $creditCardRequest = new ObtainCreditCard();
             $this->payment->execute($creditCardRequest);
             $card = $creditCardRequest->obtain();
             $model['CARDVALIDITYDATE'] = new SensitiveValue($card->getExpireAt()->format('m-y'));
             $model['CARDCODE'] = $card->getNumber();
             $model['CARDFULLNAME'] = $card->getHolder();
             $model['CARDCVV'] = $card->getSecurityCode();
         } catch (RequestNotSupportedException $e) {
             throw new LogicException('Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.');
         }
     }
     //instruction must have an alias set (e.g oneclick payment) or credit card info.
     if (false == ($model['ALIAS'] || $model->validateNotEmpty($cardFields, false))) {
         throw new LogicException('Either credit card fields or its alias has to be set.');
     }
     $response = $this->api->payment($model->toUnsafeArray());
     $model->replace((array) $response->getContentJson());
 }
开发者ID:Studio-40,项目名称:Payum,代码行数:34,代码来源:CaptureAction.php

示例3: execute

 /**
  * {@inheritDoc}
  *
  * @param Capture $request
  */
 public function execute($request)
 {
     RequestNotSupportedException::assertSupports($this, $request);
     $model = new ArrayObject($request->getModel());
     if (null !== $model['EXECCODE']) {
         return;
     }
     if (false == $model['CLIENTUSERAGENT']) {
         $this->gateway->execute($httpRequest = new GetHttpRequest());
         $model['CLIENTUSERAGENT'] = $httpRequest->userAgent;
     }
     if (false == $model['CLIENTIP']) {
         $this->gateway->execute($httpRequest = new GetHttpRequest());
         $model['CLIENTIP'] = $httpRequest->clientIp;
     }
     $cardFields = array('CARDCODE', 'CARDCVV', 'CARDVALIDITYDATE', 'CARDFULLNAME');
     if (false == $model->validateNotEmpty($cardFields, false) && false == $model['ALIAS']) {
         try {
             $this->gateway->execute($creditCardRequest = new ObtainCreditCard());
             $card = $creditCardRequest->obtain();
             $model['CARDVALIDITYDATE'] = new SensitiveValue($card->getExpireAt()->format('m-y'));
             $model['CARDCODE'] = $card->getNumber();
             $model['CARDFULLNAME'] = $card->getHolder();
             $model['CARDCVV'] = $card->getSecurityCode();
         } catch (RequestNotSupportedException $e) {
             throw new LogicException('Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.');
         }
     }
     //instruction must have an alias set (e.g oneclick payment) or credit card info.
     if (false == ($model['ALIAS'] || $model->validateNotEmpty($cardFields, false))) {
         throw new LogicException('Either credit card fields or its alias has to be set.');
     }
     $result = $this->api->payment($model->toUnsafeArray());
     $model->replace((array) $result);
 }
开发者ID:pfz,项目名称:Payum,代码行数:40,代码来源:CaptureAction.php

示例4: throwIfInvalidArgumentGivenForReplace

 /**
  * @test
  *
  * @expectedException \Payum\Core\Exception\InvalidArgumentException
  * @expectedExceptionMessage Invalid input given. Should be an array or instance of \Traversable
  */
 public function throwIfInvalidArgumentGivenForReplace()
 {
     $array = new ArrayObject();
     $array->replace('foo');
 }
开发者ID:eamador,项目名称:Payum,代码行数:11,代码来源:ArrayObjectTest.php


注:本文中的Payum\Core\Bridge\Spl\ArrayObject::replace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。