6 use Omnipay\Tests\TestCase;
8 class ExpressTransactionSearchRequestTest
extends TestCase
15 public function setUp()
24 $startDate =
'2015-01-01';
25 $endDate =
'2016-01-01';
27 $this->request->initialize(array(
30 'startDate' => $startDate,
31 'endDate' => $endDate,
32 'salutation' =>
'Mr.',
33 'firstName' =>
'Jhon',
34 'middleName' =>
'Carter',
35 'lastName' =>
'Macgiver',
37 'email' =>
'test@email.com',
38 'receiver' =>
'Patt Doret',
39 'receiptId' =>
'1111',
40 'transactionId' =>
'XKCD',
41 'invoiceNumber' =>
'123456789',
42 'card' => array(
'number' =>
'376449047333005'),
43 'auctionItemNumber' =>
'321564',
44 'transactionClass' =>
'Received',
45 'status' =>
'Success',
46 'profileId' =>
'00000000000'
49 $data = $this->request->getData();
51 $startDate = new \DateTime($startDate);
52 $endDate = new \DateTime($endDate);
54 $this->assertSame(
'10.00', $data[
'AMT']);
55 $this->assertSame(
'USD', $data[
'CURRENCYCODE']);
56 $this->assertSame($startDate->format(\DateTime::ISO8601), $data[
'STARTDATE']);
57 $this->assertSame($endDate->format(\DateTime::ISO8601), $data[
'ENDDATE']);
58 $this->assertSame(
'Mr.', $data[
'SALUTATION']);
59 $this->assertSame(
'Jhon', $data[
'FIRSTNAME']);
60 $this->assertSame(
'Carter', $data[
'MIDDLENAME']);
61 $this->assertSame(
'Macgiver', $data[
'LASTNAME']);
62 $this->assertSame(
'Jh', $data[
'SUFFIX']);
63 $this->assertSame(
'test@email.com', $data[
'EMAIL']);
64 $this->assertSame(
'XKCD', $data[
'TRANSACTIONID']);
65 $this->assertSame(
'123456789', $data[
'INVNUM']);
66 $this->assertSame(
'376449047333005', $data[
'ACCT']);
67 $this->assertSame(
'321564', $data[
'AUCTIONITEMNUMBER']);
68 $this->assertSame(
'Received', $data[
'TRANSACTIONCLASS']);
69 $this->assertSame(
'Success', $data[
'STATUS']);
70 $this->assertSame(
'00000000000', $data[
'PROFILEID']);
75 $this->request->initialize(array());
77 $this->expectException(InvalidRequestException::class);
78 $this->expectExceptionMessage(
'The startDate parameter is required');
80 $this->request->getData();
85 $this->request->setStartDate(
'2015-01-01');
86 $this->request->setAmount(150.00);
88 $this->expectException(InvalidRequestException::class);
89 $this->expectExceptionMessage(
'The currency parameter is required');
91 $this->request->getData();