public function setUp() { parent::setUp(); $bankAccount = new BankAccount(); $bankAccount->setAccountNumber("12345678"); $bankAccount->setRoutingNumber("112200439"); $bankAccount->setBankName("Mikey National Bank"); $bankAccount->setBankAccountType(BankAccount::ACCOUNT_TYPE_CHECKING); $bankAccount->setBillingFirstName("Mikey"); $bankAccount->setBillingLastName("DABLname"); $bankAccount->setName("Mikey DABLname"); $bankAccount->setBillingAddress1("15505 Pennsylvania Ave."); $bankAccount->setBillingCity("Washington DC"); $bankAccount->setBillingName("FED-Payor"); $bankAccount->setBillingPostcode("20003"); $bankAccount->setBillingState("CA"); $bankAccount->setBillingCountry('USA'); $bankAccount->setBillingPhone('5555555555'); $bankAccount->setCompany("DAB2LLC"); $bankAccount->setEmail('*****@*****.**'); $creditCard = new CreditCard(); $creditCard->setNumber('4111111111111111'); $creditCard->setCvv("432"); $creditCard->setExpiryMonth('12'); $creditCard->setExpiryYear('2025'); $creditCard->setEmail('*****@*****.**'); $creditCard->setName("Mikey DABLname"); $creditCard->setBillingAddress1("15505 Pennsylvania Ave."); $creditCard->setBillingCity("Washington DC"); $creditCard->setBillingFirstName("FED-Payor"); $creditCard->setBillingLastName("DABLname"); $creditCard->setBillingPostcode("20003"); $creditCard->setBillingState("DC"); $creditCard->setBillingCountry("USA"); $this->gateway = new CybersourceGateway($this->getHttpClient(), $this->getHttpRequest()); $this->gateway->setTestMode(true); $defaultOptions = array('merchantId' => '', 'username' => '', 'transactionKey' => ''); if ($defaultOptions['merchantId'] != '' && $defaultOptions['username'] != '' && $defaultOptions['transactionKey'] != '' && $defaultOptions['password'] != '') { $purchaseOptions = array('amount' => '12.00', 'card' => $creditCard, 'merchantReferenceCode' => uniqid()); /** @var \Omnipay\Cybersource\Message\PurchaseRequest $request */ $request = $this->gateway->purchase(array_merge($defaultOptions, $purchaseOptions)); /** @var \Omnipay\Cybersource\Message\CybersourceResponse $response */ $response = $request->send(); $this->assertEquals(true, $response->isSuccessful()); $purchaseOptions = array('amount' => '12.00', 'bankAccount' => $bankAccount, 'merchantReferenceCode' => uniqid()); /** @var \Omnipay\Cybersource\Message\PurchaseRequest $request */ $request = $this->gateway->purchase(array_merge($defaultOptions, $purchaseOptions)); $response = $request->send(); $this->assertEquals(true, $response->isSuccessful()); $reportOptions = array('reportDate' => new \DateTime('12/17/2014')); /** @var \Omnipay\Cybersource\Message\TransactionDetailReportRequest $request */ $request = $this->gateway->transactionDetailReport(array_merge($defaultOptions, $reportOptions)); /** @var \Omnipay\Cybersource\Message\TransactionDetailReportResponse $response */ $response = $request->send(); $this->assertEquals(true, $response->isSuccessful()); } }
public function testCardDetails() { $card = new CreditCard(); $card->setName('Test Foo'); $card->setEmail('*****@*****.**'); $card->setCompany('Test Company'); $card->setPostcode('13100'); $card->setCity('Nicetown'); $card->setCountry('TN'); $card->setPhone('00999555666'); $card->setAddress1('Home street'); $card->setAddress2('Near the shop'); $this->request->setCard($card); $data = $this->request->getData(); $this->assertSame("Test Foo", $data['CN']); $this->assertSame("*****@*****.**", $data['EMAIL']); $this->assertSame("Test Company", $data['COM']); $this->assertSame("13100", $data['OWNERZIP']); $this->assertSame("Nicetown", $data['OWNERTOWN']); $this->assertSame("TN", $data['OWNERCTY']); $this->assertSame("00999555666", $data['OWNERTELNO']); $this->assertSame("Home street", $data['OWNERADDRESS']); $this->assertSame("Near the shop", $data['OWNERADDRESS2']); }
public function testSetNameWithMultipleNames() { $this->card->setName('Bob John Smith'); $this->assertEquals('Bob', $this->card->getFirstName()); $this->assertEquals('John Smith', $this->card->getLastName()); }