コード例 #1
0
 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;
 }
コード例 #2
0
 public function testInvalidRequest()
 {
     $request = $this->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');
     $address = new Address();
     $address->setStreet('27 nowhere');
     $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 23:41:44 GMT\nServer: Apache\nContent-Length: 146\nConnection: close\nContent-Type: text/plain; charset=utf-8\n\nACK=Failure&L_ERRORCODE0=81002&L_SHORTMESSAGE0=Unspecified%20Method&L_LONGMESSAGE0=Method%20Specified%20is%20not%20Supported&L_SEVERITYCODE0=Error");
     $request->getClient()->setAdapter($adapter);
     $response = $request->send($payment);
     $this->assertFalse($response->isSuccess());
 }