/** * {@inheritDoc} */ public function execute($request) { /** @var $request CheckRecurringPayment */ RequestNotSupportedException::assertSupports($this, $request); $model = ArrayObject::ensureArrayObject($request->getModel()); $model->validatedKeysSet(array('agreementRef')); $result = $this->api->check((array) $model); $model->replace($result); }
/** * {@inheritDoc} */ public function execute($request) { /** @var $request StartRecurringPayment */ RequestNotSupportedException::assertSupports($this, $request); $model = ArrayObject::ensureArrayObject($request->getModel()); $model->validatedKeysSet(array('agreementRef', 'startDate', 'periodType', 'period', 'alertPeriod', 'price', 'productNumber', 'orderId', 'description')); $result = $this->api->start((array) $model); $model->replace($result); }
/** * {@inheritDoc} */ public function execute($request) { /** @var $request StopRecurringPayment */ if (false == $this->supports($request)) { throw RequestNotSupportedException::createActionNotSupported($this, $request); } $model = ArrayObject::ensureArrayObject($request->getModel()); $model->validatedKeysSet(array('agreementRef')); $result = $this->api->stop((array) $model); $model->replace($result); }
/** * @test */ public function shouldUseSoapClientOnCheckRecurringPaymentAndConvertItsResponse() { $response = new \stdClass(); $response->CheckResult = '<foo>fooValue</foo>'; $soapClientMock = $this->getMock('SoapClient', array('Check'), array(), '', false); $soapClientMock->expects($this->once())->method('Check')->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->check(array()); $this->assertEquals(array('fooValue'), $result); }