Beispiel #1
0
 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request CompleteOrder */
     RequestNotSupportedException::assertSupports($this, $request);
     $model = ArrayObject::ensureArrayObject($request->getModel());
     $model->validateNotEmpty(array('orderRef'));
     $result = $this->api->complete((array) $model);
     $model->replace($result);
 }
Beispiel #2
0
 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request CheckOrder */
     if (false == $this->supports($request)) {
         throw RequestNotSupportedException::createActionNotSupported($this, $request);
     }
     $model = ArrayObject::ensureArrayObject($request->getModel());
     $model->validateNotEmpty(array('transactionNumber'));
     $result = $this->api->check((array) $model);
     $model->replace($result);
 }
 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request InitializeOrder */
     RequestNotSupportedException::assertSupports($this, $request);
     $model = ArrayObject::ensureArrayObject($request->getModel());
     if ($model['orderRef']) {
         throw new LogicException('The order has already been initialized.');
     }
     $model->validatedKeysSet(array('price', 'priceArgList', 'vat', 'currency', 'orderId', 'productNumber', 'purchaseOperation', 'view', 'description', 'additionalValues', 'returnUrl', 'cancelUrl', 'clientIPAddress', 'clientIdentifier', 'agreementRef', 'clientLanguage'));
     $result = $this->api->initialize((array) $model);
     $model->replace($result);
     if ($model['redirectUrl']) {
         throw new HttpRedirect($model['redirectUrl']);
     }
 }
Beispiel #4
0
 /**
  * @test
  */
 public function shouldUseSoapClientOnCheckAndConvertItsResponse()
 {
     $response = new \stdClass();
     $response->Check2Result = '<foo>fooValue</foo>';
     $soapClientMock = $this->getMock('SoapClient', array('Check2'), array(), '', false);
     $soapClientMock->expects($this->once())->method('Check2')->with($this->isType('array'))->will($this->returnValue($response));
     $clientFactoryMock = $this->getMock('Payum\\Payex\\Api\\SoapClientFactory', array('createWsdlClient'));
     $clientFactoryMock->expects($this->atLeastOnce())->method('createWsdlClient')->will($this->returnValue($soapClientMock));
     $orderApi = new OrderApi($clientFactoryMock, array('encryption_key' => 'aKey', 'account_number' => 'aNumber', 'sandbox' => true));
     $result = $orderApi->check(array());
     $this->assertEquals(array('fooValue'), $result);
 }