Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request CheckOrder */
     RequestNotSupportedException::assertSupports($this, $request);
     $model = ArrayObject::ensureArrayObject($request->getModel());
     $model->validateNotEmpty(array('transactionNumber'));
     $result = $this->api->check((array) $model);
     $model->replace($result);
 }
Exemplo n.º 2
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);
 }