public function setup()
 {
     $this->paypalRequest = Bootstrap::getServiceManager()->get('SpeckPaypal\\Service\\Request');
     $payment = new DoDirectPayment(array('paymentDetails' => new \SpeckPaypal\Element\PaymentDetails(array('amt' => '10.00'))));
     $payment->setCardNumber('4744151425799438');
     $payment->setExpirationDate('112017');
     $payment->setFirstName('John');
     $payment->setLastName('Canyon');
     $payment->setEmail('*****@*****.**');
     $payment->setIpAddress('255.255.255.255');
     $payment->setReturnFmfDetails(1);
     $payment->setCreditCardType('Visa');
     $payment->setStartDate('122012');
     $payment->setCvv2('345');
     $payment->setIssueNumber('12');
     $address = new Address();
     $address->setStreet('27 nowhere');
     $address->setState('California');
     $address->setCity('Ventura');
     $address->setZip(92656);
     $address->setCountry('US');
     $address->setPhoneNum('999-999-9999');
     $payment->setAddress($address);
     $payment->setShipAddress(clone $address);
     $this->payment = $payment;
 }
 public function testValidRequest()
 {
     $request = $this->request;
     $payment = new DoDirectPayment(array('paymentDetails' => new \SpeckPaypal\Element\PaymentDetails(array('amt' => '10.00'))));
     $payment->setIpAddress('255.255.255.255');
     $payment->setCardNumber('4744151425799438');
     $payment->setExpirationDate('112017');
     $payment->setFirstName('John');
     $payment->setLastName('Canyon');
     $address = new Address();
     $address->setStreet('27 nowhere');
     $address->setCity('Ventura');
     $address->setState('California');
     $address->setZip(92656);
     $address->setCountry('US');
     $address->setPhoneNum('999-999-9999');
     $payment->setAddress($address);
     $adapter = new Test();
     $adapter->setResponse("HTTP/1.1 200 OK\nDate: Fri, 02 Nov 2012 06:11:12 GMT\nServer: Apache\nContent-Length: 190\nConnection: close\nContent-Type: text/plain; charset=utf-8\n\nTIMESTAMP=2012%2d11%2d02T06%3a11%3a17Z&CORRELATIONID=ee90a747f2bdb&ACK=Success&VERSION=58%2e0&BUILD=4137385&AMT=10%2e00&CURRENCYCODE=USD&AVSCODE=X&CVV2MATCH=M&TRANSACTIONID=2SB740637D241141K");
     $request->getClient()->setAdapter($adapter);
     $response = $request->send($payment);
     $this->assertTrue($response->isSuccess(), current($response->getErrors()));
 }