Payum\Paypal\ExpressCheckout\Nvp\Action\CancelAction::execute PHP Метод

execute() публичный Метод

{@inheritDoc}
public execute ( $request )
    public function execute($request)
    {
        /** @var $request Cancel */
        RequestNotSupportedException::assertSupports($this, $request);
        $details = ArrayObject::ensureArrayObject($request->getModel());
        if (!$details['TRANSACTIONID']) {
            return;
        }
        $voidDetails = new ArrayObject(['AUTHORIZATIONID' => $details['TRANSACTIONID']]);
        $this->gateway->execute(new DoVoid($voidDetails));
        $this->gateway->execute(new Sync($request->getModel()));
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function shouldExecuteDoVoidIfTransactionIdSet()
 {
     $gatewayMock = $this->createGatewayMock();
     $gatewayMock->expects($this->exactly(2))->method('execute')->withConsecutive(array($this->isInstanceOf(DoVoid::class)), array($this->isInstanceOf(Sync::class)));
     $action = new CancelAction();
     $action->setGateway($gatewayMock);
     $request = new Cancel(array('TRANSACTIONID' => 'theId'));
     $action->execute($request);
 }