Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function execute($request)
 {
     /** @var $request AutoPayAgreement */
     RequestNotSupportedException::assertSupports($this, $request);
     $model = ArrayObject::ensureArrayObject($request->getModel());
     $model->validatedKeysSet(array('agreementRef', 'price', 'productNumber', 'description', 'orderId', 'purchaseOperation', 'currency'));
     $result = $this->api->autoPay((array) $model);
     $model->replace($result);
 }
Exemplo n.º 2
0
 /**
  * @test
  */
 public function shouldUseSoapClientOnAgreementAutoPayAndConvertItsResponse()
 {
     $response = new \stdClass();
     $response->AutoPay3Result = '<foo>fooValue</foo>';
     $soapClientMock = $this->getMock('SoapClient', array('AutoPay3'), array(), '', false);
     $soapClientMock->expects($this->once())->method('AutoPay3')->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));
     $agreementApi = new AgreementApi($clientFactoryMock, array('encryptionKey' => 'aKey', 'accountNumber' => 'aNumber', 'sandbox' => true));
     $result = $agreementApi->autoPay(array());
     $this->assertEquals(array('fooValue'), $result);
 }