/**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request StopRecurringPayment */
     RequestNotSupportedException::assertSupports($this, $request);
     $model = ArrayObject::ensureArrayObject($request->getModel());
     $model->validatedKeysSet(array('agreementRef'));
     $result = $this->api->stop((array) $model);
     $model->replace($result);
 }
Example #2
0
 /**
  * @test
  */
 public function shouldUseSoapClientOnStopRecurringPaymentAndConvertItsResponse()
 {
     $response = new \stdClass();
     $response->StopResult = '<foo>fooValue</foo>';
     $soapClientMock = $this->getMock('SoapClient', array('Stop'), array(), '', false);
     $soapClientMock->expects($this->once())->method('Stop')->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));
     $recurringApi = new RecurringApi($clientFactoryMock, array('encryptionKey' => 'aKey', 'accountNumber' => 'aNumber', 'sandbox' => true));
     $result = $recurringApi->stop(array());
     $this->assertEquals(array('fooValue'), $result);
 }