PayflowproTest.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Paypal\Test\Unit\Model;
  7. use Magento\Framework\App\Config\ScopeConfigInterface;
  8. use Magento\Framework\DataObject;
  9. use Magento\Framework\Exception\LocalizedException;
  10. use Magento\Framework\Event\ManagerInterface;
  11. use Magento\Framework\HTTP\ZendClient;
  12. use Magento\Framework\HTTP\ZendClientFactory;
  13. use Magento\Payment\Model\Method\ConfigInterface;
  14. use Magento\Payment\Model\Method\ConfigInterfaceFactory;
  15. use Magento\Paypal\Model\Config;
  16. use Magento\Paypal\Model\Payflow\Service\Gateway;
  17. use Magento\Paypal\Model\PayflowConfig;
  18. use Magento\Paypal\Model\Payflowpro;
  19. use Magento\Sales\Model\Order\Payment;
  20. use Magento\Store\Model\ScopeInterface;
  21. use Magento\Payment\Model\InfoInterface;
  22. use Magento\Store\Model\StoreManagerInterface;
  23. use PHPUnit_Framework_MockObject_MockObject as MockObject;
  24. /**
  25. * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
  26. */
  27. class PayflowproTest extends \PHPUnit\Framework\TestCase
  28. {
  29. /**
  30. * @var Payflowpro
  31. */
  32. protected $payflowpro;
  33. /**
  34. * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
  35. */
  36. protected $helper;
  37. /**
  38. * @var ConfigInterface|MockObject
  39. */
  40. protected $configMock;
  41. /**
  42. * @var StoreManagerInterface|MockObject
  43. */
  44. protected $storeManagerMock;
  45. /**
  46. * @var Gateway|MockObject
  47. */
  48. protected $gatewayMock;
  49. /**
  50. * @var ScopeConfigInterface|MockObject
  51. */
  52. protected $scopeConfigMock;
  53. /**
  54. * @var ManagerInterface|MockObject
  55. */
  56. private $eventManager;
  57. protected function setUp()
  58. {
  59. $this->configMock = $this->getMockBuilder(PayflowConfig::class)
  60. ->disableOriginalConstructor()
  61. ->getMock();
  62. $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)
  63. ->getMockForAbstractClass();
  64. $this->gatewayMock = $this->getMockBuilder(Gateway::class)
  65. ->disableOriginalConstructor()
  66. ->getMock();
  67. $this->scopeConfigMock = $this->getMockBuilder(ScopeConfigInterface::class)
  68. ->getMockForAbstractClass();
  69. $configFactoryMock = $this->getMockBuilder(ConfigInterfaceFactory::class)
  70. ->setMethods(['create'])
  71. ->disableOriginalConstructor()
  72. ->getMock();
  73. $configFactoryMock->method('create')
  74. ->willReturn($this->configMock);
  75. $client = $this->getMockBuilder(ZendClient::class)
  76. ->getMock();
  77. $clientFactory = $this->getMockBuilder(ZendClientFactory::class)
  78. ->disableOriginalConstructor()
  79. ->getMock();
  80. $clientFactory->method('create')->will($this->returnValue($client));
  81. $this->eventManager = $this->getMockBuilder(ManagerInterface::class)
  82. ->getMockForAbstractClass();
  83. $this->helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
  84. $this->payflowpro = $this->helper->getObject(
  85. \Magento\Paypal\Model\Payflowpro::class,
  86. [
  87. 'eventDispatcher' => $this->eventManager,
  88. 'configFactory' => $configFactoryMock,
  89. 'httpClientFactory' => $clientFactory,
  90. 'storeManager' => $this->storeManagerMock,
  91. 'gateway' => $this->gatewayMock,
  92. 'scopeConfig' => $this->scopeConfigMock
  93. ]
  94. );
  95. }
  96. /**
  97. * @covers \Magento\Paypal\Model\Payflowpro::canVoid
  98. *
  99. * @param string $message
  100. * @param int|null $amountPaid
  101. * @param bool $expected
  102. * @dataProvider canVoidDataProvider
  103. */
  104. public function testCanVoid($message, $amountPaid, $expected)
  105. {
  106. /** @var Payment|MockObject $payment */
  107. $payment = $this->getMockBuilder(Payment::class)
  108. ->disableOriginalConstructor()
  109. ->getMock();
  110. $payment->method('getAmountPaid')->willReturn($amountPaid);
  111. $this->payflowpro->setInfoInstance($payment);
  112. $this->assertEquals($expected, $this->payflowpro->canVoid(), $message);
  113. }
  114. /**
  115. * @return array
  116. */
  117. public function canVoidDataProvider()
  118. {
  119. return [
  120. ["Can void transaction if order's paid amount not set", null, true],
  121. ["Can void transaction if order's paid amount equals zero", 0, true],
  122. ["Can't void transaction if order's paid amount greater than zero", 10, false],
  123. ];
  124. }
  125. public function testCanCapturePartial()
  126. {
  127. $this->assertTrue($this->payflowpro->canCapturePartial());
  128. }
  129. public function testCanRefundPartialPerInvoice()
  130. {
  131. $this->assertTrue($this->payflowpro->canRefundPartialPerInvoice());
  132. }
  133. /**
  134. * test for _buildBasicRequest (BDCODE)
  135. */
  136. public function testFetchTransactionInfoForBN()
  137. {
  138. $response = $this->getGatewayResponseObject();
  139. $this->gatewayMock->expects($this->once())
  140. ->method('postRequest')
  141. ->willReturn($response);
  142. $this->initStoreMock();
  143. $this->configMock->expects($this->once())->method('getBuildNotationCode')
  144. ->will($this->returnValue('BNCODE'));
  145. $payment = $this->createPartialMock(\Magento\Payment\Model\Info::class, ['setTransactionId', '__wakeup']);
  146. $payment->expects($this->once())->method('setTransactionId')->will($this->returnSelf());
  147. $this->payflowpro->fetchTransactionInfo($payment, 'AD49G8N825');
  148. }
  149. /**
  150. * @param $response
  151. * @dataProvider setTransStatusDataProvider
  152. */
  153. public function testSetTransStatus($response, $paymentExpected)
  154. {
  155. $payment = $this->helper->getObject(\Magento\Payment\Model\Info::class);
  156. $this->payflowpro->setTransStatus($payment, $response);
  157. $this->assertEquals($paymentExpected->getData(), $payment->getData());
  158. }
  159. /**
  160. * @return array
  161. */
  162. public function setTransStatusDataProvider()
  163. {
  164. return [
  165. [
  166. 'response' => new \Magento\Framework\DataObject(
  167. [
  168. 'pnref' => 'V19A3D27B61E',
  169. 'result_code' => Payflowpro::RESPONSE_CODE_APPROVED,
  170. ]
  171. ),
  172. 'paymentExpected' => new \Magento\Framework\DataObject(
  173. [
  174. 'transaction_id' => 'V19A3D27B61E',
  175. 'is_transaction_closed' => 0,
  176. ]
  177. ),
  178. ],
  179. [
  180. 'response' => new \Magento\Framework\DataObject(
  181. [
  182. 'pnref' => 'V19A3D27B61E',
  183. 'result_code' => Payflowpro::RESPONSE_CODE_FRAUDSERVICE_FILTER
  184. ]
  185. ),
  186. 'paymentExpected' => new \Magento\Framework\DataObject(
  187. [
  188. 'transaction_id' => 'V19A3D27B61E',
  189. 'is_transaction_closed' => 0,
  190. 'is_transaction_pending' => true,
  191. 'is_fraud_detected' => true,
  192. ]
  193. ),
  194. ],
  195. ];
  196. }
  197. /**
  198. * @param array $expectsMethods
  199. * @param bool $result
  200. *
  201. * @dataProvider dataProviderForTestIsActive
  202. */
  203. public function testIsActive(array $expectsMethods, $result)
  204. {
  205. $storeId = 15;
  206. $i = 0;
  207. foreach ($expectsMethods as $method => $isActive) {
  208. $this->scopeConfigMock->expects($this->at($i++))
  209. ->method('getValue')
  210. ->with(
  211. "payment/{$method}/active",
  212. ScopeInterface::SCOPE_STORE,
  213. $storeId
  214. )->willReturn($isActive);
  215. }
  216. $this->assertEquals($result, $this->payflowpro->isActive($storeId));
  217. }
  218. /**
  219. * @covers \Magento\Paypal\Model\Payflowpro::capture
  220. */
  221. public function testCaptureWithBuildPlaceRequest()
  222. {
  223. $paymentMock = $this->getPaymentMock();
  224. $orderMock = $this->getOrderMock();
  225. // test case to build basic request
  226. $paymentMock->expects(static::once())
  227. ->method('getAdditionalInformation')
  228. ->with('pnref')
  229. ->willReturn(false);
  230. $paymentMock->expects(static::once())
  231. ->method('getParentTransactionId')
  232. ->willReturn(false);
  233. $paymentMock->expects(static::exactly(2))
  234. ->method('getOrder')
  235. ->willReturn($orderMock);
  236. $response = $this->execGatewayRequest();
  237. $amount = 23.03;
  238. $this->payflowpro->capture($paymentMock, $amount);
  239. static::assertEquals($response['pnref'], $paymentMock->getTransactionId());
  240. static::assertFalse((bool)$paymentMock->getIsTransactionPending());
  241. }
  242. /**
  243. * @return array
  244. */
  245. public function dataProviderCaptureAmountRounding()
  246. {
  247. return [
  248. [
  249. 'amount' => 14.13999999999999999999999999999999999999999999999999,
  250. 'setAmount' => 49.99,
  251. 'expectedResult' => 14.14
  252. ],
  253. [
  254. 'amount' => 14.13199999999999999999999999999999999999999999999999,
  255. 'setAmount' => 49.99,
  256. 'expectedResult' => 14.13,
  257. ],
  258. [
  259. 'amount' => 14.14,
  260. 'setAmount' => 49.99,
  261. 'expectedResult' => 14.14,
  262. ],
  263. [
  264. 'amount' => 14.13999999999999999999999999999999999999999999999999,
  265. 'setAmount' => 14.14,
  266. 'expectedResult' => 0,
  267. ]
  268. ];
  269. }
  270. /**
  271. * @param float $amount
  272. * @param float $setAmount
  273. * @param float $expectedResult
  274. * @dataProvider dataProviderCaptureAmountRounding
  275. */
  276. public function testCaptureAmountRounding($amount, $setAmount, $expectedResult)
  277. {
  278. $paymentMock = $this->getPaymentMock();
  279. $orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
  280. ->disableOriginalConstructor()
  281. ->getMock();
  282. $infoInstanceMock = $this->getMockForAbstractClass(
  283. InfoInterface::class,
  284. [],
  285. '',
  286. false,
  287. false,
  288. false,
  289. ['getAmountAuthorized','hasAmountPaid']
  290. );
  291. $infoInstanceMock->expects($this->once())
  292. ->method('getAmountAuthorized')
  293. ->willReturn($setAmount);
  294. $infoInstanceMock->expects($this->once())
  295. ->method('hasAmountPaid')
  296. ->willReturn(true);
  297. $this->payflowpro->setData('info_instance', $infoInstanceMock);
  298. // test case to build basic request
  299. $paymentMock->expects($this->once())
  300. ->method('getAdditionalInformation')
  301. ->with('pnref')
  302. ->willReturn(false);
  303. $paymentMock->expects($this->any())
  304. ->method('getParentTransactionId')
  305. ->willReturn(true);
  306. $paymentMock->expects($this->once())
  307. ->method('getOrder')
  308. ->willReturn($orderMock);
  309. $this->initStoreMock();
  310. $response = $this->getGatewayResponseObject();
  311. $this->gatewayMock->expects($this->once())
  312. ->method('postRequest')
  313. ->with(
  314. $this->callback(function ($request) use ($expectedResult) {
  315. return is_callable([$request, 'getAmt']) && $request->getAmt() == $expectedResult;
  316. }),
  317. $this->isInstanceOf(PayflowConfig::class)
  318. )
  319. ->willReturn($response);
  320. $this->payflowpro->capture($paymentMock, $amount);
  321. $this->assertEquals($response['pnref'], $paymentMock->getTransactionId());
  322. $this->assertFalse((bool)$paymentMock->getIsTransactionPending());
  323. }
  324. /**
  325. * @covers \Magento\Paypal\Model\Payflowpro::authorize
  326. */
  327. public function testAuthorize()
  328. {
  329. $paymentMock = $this->getPaymentMock();
  330. $orderMock = $this->getOrderMock();
  331. $paymentMock->expects(static::exactly(2))
  332. ->method('getOrder')
  333. ->willReturn($orderMock);
  334. $response = $this->execGatewayRequest();
  335. $amount = 43.20;
  336. $this->payflowpro->authorize($paymentMock, $amount);
  337. static::assertEquals($response['pnref'], $paymentMock->getTransactionId());
  338. static::assertFalse((bool)$paymentMock->getIsTransactionPending());
  339. }
  340. /**
  341. * @return array
  342. */
  343. public function dataProviderForTestIsActive()
  344. {
  345. return [
  346. [
  347. 'expectsMethods' => [
  348. Config::METHOD_PAYFLOWPRO => 0,
  349. Config::METHOD_PAYMENT_PRO => 1,
  350. ],
  351. 'result' => true,
  352. ],
  353. [
  354. 'expectsMethods' => [
  355. Config::METHOD_PAYFLOWPRO => 1
  356. ],
  357. 'result' => true,
  358. ],
  359. [
  360. 'expectsMethods' => [
  361. Config::METHOD_PAYFLOWPRO => 0,
  362. Config::METHOD_PAYMENT_PRO => 0,
  363. ],
  364. 'result' => false,
  365. ],
  366. ];
  367. }
  368. /**
  369. * @covers \Magento\Paypal\Model\Payflowpro::refund()
  370. */
  371. public function testRefund()
  372. {
  373. /** @var Payment $paymentMock */
  374. $paymentMock = $this->getPaymentMock();
  375. $response = $this->execGatewayRequest();
  376. $amount = 213.04;
  377. $this->payflowpro->refund($paymentMock, $amount);
  378. static::assertEquals($response['pnref'], $paymentMock->getTransactionId());
  379. static::assertTrue($paymentMock->getIsTransactionClosed());
  380. }
  381. /**
  382. * Create mock object for store model
  383. * @return void
  384. */
  385. protected function initStoreMock()
  386. {
  387. $storeId = 27;
  388. $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class)
  389. ->disableOriginalConstructor()
  390. ->setMethods(['getId'])
  391. ->getMock();
  392. $this->storeManagerMock->expects(static::once())
  393. ->method('getStore')
  394. ->willReturn($storeMock);
  395. $storeMock->expects(static::once())
  396. ->method('getId')
  397. ->willReturn($storeId);
  398. }
  399. /**
  400. * Create response object for Payflowpro gateway
  401. * @return \Magento\Framework\DataObject
  402. */
  403. protected function getGatewayResponseObject()
  404. {
  405. return new \Magento\Framework\DataObject(
  406. [
  407. 'result' => '0',
  408. 'pnref' => 'V19A3D27B61E',
  409. 'respmsg' => 'Approved',
  410. 'authcode' => '510PNI',
  411. 'hostcode' => 'A',
  412. 'request_id' => 'f930d3dc6824c1f7230c5529dc37ae5e',
  413. 'result_code' => '0',
  414. ]
  415. );
  416. }
  417. /**
  418. * Call payflow gateway request and return response object
  419. * @return \Magento\Framework\DataObject
  420. */
  421. protected function execGatewayRequest()
  422. {
  423. $this->initStoreMock();
  424. $response = $this->getGatewayResponseObject();
  425. $this->gatewayMock->expects(static::once())
  426. ->method('postRequest')
  427. ->with(
  428. $this->isInstanceOf(\Magento\Framework\DataObject::class),
  429. $this->isInstanceOf(PayflowConfig::class)
  430. )
  431. ->willReturn($response);
  432. return $response;
  433. }
  434. /**
  435. * Create mock object for payment model
  436. * @return MockObject
  437. */
  438. protected function getPaymentMock()
  439. {
  440. $paymentMock = $this->getMockBuilder(\Magento\Payment\Model\Info::class)
  441. ->disableOriginalConstructor()
  442. ->setMethods([
  443. 'getAdditionalInformation', 'getParentTransactionId', 'getOrder',
  444. 'getCcNumber', 'getCcExpMonth', 'getCcExpYear', 'getCcCid'
  445. ])
  446. ->getMock();
  447. $cardData = [
  448. 'number' => 4111111111111111,
  449. 'month' => 12,
  450. 'year' => 18,
  451. 'cvv' => 123
  452. ];
  453. $paymentMock->expects(static::any())
  454. ->method('getCcNumber')
  455. ->willReturn($cardData['number']);
  456. $paymentMock->expects(static::any())
  457. ->method('getCcExpMonth')
  458. ->willReturn($cardData['month']);
  459. $paymentMock->expects(static::any())
  460. ->method('getCcExpYear')
  461. ->willReturn($cardData['year']);
  462. $paymentMock->expects(static::any())
  463. ->method('getCcCid')
  464. ->willReturn($cardData['cvv']);
  465. return $paymentMock;
  466. }
  467. /**
  468. * Create mock object for order model
  469. * @return MockObject
  470. */
  471. protected function getOrderMock()
  472. {
  473. $orderData = [
  474. 'currency' => 'USD',
  475. 'id' => 4,
  476. 'increment_id' => '0000004'
  477. ];
  478. $orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
  479. ->disableOriginalConstructor()
  480. ->setMethods(['getBaseCurrencyCode', 'getIncrementId', 'getId', 'getBillingAddress', 'getShippingAddress'])
  481. ->getMock();
  482. $orderMock->expects(static::once())
  483. ->method('getId')
  484. ->willReturn($orderData['id']);
  485. $orderMock->expects(static::once())
  486. ->method('getBaseCurrencyCode')
  487. ->willReturn($orderData['currency']);
  488. $orderMock->expects(static::atLeastOnce())
  489. ->method('getIncrementId')
  490. ->willReturn($orderData['increment_id']);
  491. return $orderMock;
  492. }
  493. public function testPostRequest()
  494. {
  495. $expectedResult = new DataObject();
  496. $request = new DataObject();
  497. /** @var ConfigInterface $config */
  498. $config = $this->createMock(ConfigInterface::class);
  499. $this->gatewayMock->expects(static::once())
  500. ->method('postRequest')
  501. ->with($request, $config)
  502. ->willReturn($expectedResult);
  503. static::assertSame($expectedResult, $this->payflowpro->postRequest($request, $config));
  504. }
  505. /**
  506. * @expectedException \Magento\Framework\Exception\LocalizedException
  507. * @expectedExceptionMessage Payment Gateway is unreachable at the moment. Please use another payment option.
  508. */
  509. public function testPostRequestException()
  510. {
  511. $request = new DataObject();
  512. /** @var ConfigInterface $config */
  513. $config = $this->createMock(ConfigInterface::class);
  514. $this->gatewayMock->expects(static::once())
  515. ->method('postRequest')
  516. ->with($request, $config)
  517. ->willThrowException(new \Zend_Http_Client_Exception());
  518. $this->payflowpro->postRequest($request, $config);
  519. }
  520. /**
  521. * @covers \Magento\Paypal\Model\Payflowpro::addRequestOrderInfo
  522. */
  523. public function testAddRequestOrderInfo()
  524. {
  525. $orderData = [
  526. 'id' => 1,
  527. 'increment_id' => '0000001'
  528. ];
  529. $data = [
  530. 'ponum' => $orderData['id'],
  531. 'custref' => $orderData['increment_id'],
  532. 'invnum' => $orderData['increment_id'],
  533. 'comment1' => $orderData['increment_id']
  534. ];
  535. $expectedData = new DataObject($data);
  536. $actualData = new DataObject();
  537. $orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
  538. ->disableOriginalConstructor()
  539. ->setMethods(['getIncrementId', 'getId'])
  540. ->getMock();
  541. $orderMock->expects(static::once())
  542. ->method('getId')
  543. ->willReturn($orderData['id']);
  544. $orderMock->expects(static::atLeastOnce())
  545. ->method('getIncrementId')
  546. ->willReturn($orderData['increment_id']);
  547. $this->payflowpro->addRequestOrderInfo($actualData, $orderMock);
  548. $this->assertEquals($expectedData, $actualData);
  549. }
  550. /**
  551. * @covers \Magento\Paypal\Model\Payflowpro::assignData
  552. */
  553. public function testAssignData()
  554. {
  555. $data = [
  556. 'cc_type' => 'VI',
  557. 'cc_last_4' => 1111,
  558. 'cc_exp_month' => 12,
  559. 'cc_exp_year' => 2023
  560. ];
  561. $dataObject = new DataObject($data);
  562. $infoInstance = $this->getMockForAbstractClass(InfoInterface::class);
  563. $this->payflowpro->setData('info_instance', $infoInstance);
  564. $this->eventManager->expects(static::exactly(2))
  565. ->method('dispatch');
  566. $this->payflowpro->assignData($dataObject);
  567. }
  568. /**
  569. * Asserts that PayPal gateway response mapping correctly.
  570. *
  571. * @param array $postData
  572. * @param DataObject $expectedResponse
  573. * @dataProvider dataProviderMapGatewayResponse
  574. */
  575. public function testMapGatewayResponse($postData, $expectedResponse)
  576. {
  577. self::assertEquals(
  578. $this->payflowpro->mapGatewayResponse($postData, new DataObject()),
  579. $expectedResponse
  580. );
  581. }
  582. /**
  583. * @return array
  584. */
  585. public function dataProviderMapGatewayResponse()
  586. {
  587. return [
  588. [
  589. [
  590. 'BILLTONAME' => 'John Doe',
  591. 'BILLTOFIRSTNAME' => 'John',
  592. 'BILLTOLASTNAME' => 'Doe',
  593. 'BILLTOEMAIL' => 'user@magento.com',
  594. 'BILLTOSTREET' => '6161 West Centinela Avenue',
  595. 'BILLTOCITY' => 'Culver City',
  596. 'BILLTOSTATE' => 'CA',
  597. 'BILLTOZIP' => '90230',
  598. 'BILLTOCOUNTRY' => 'US',
  599. 'SHIPTOSTREET' => '6161 West Centinela Avenue',
  600. 'SHIPTOCITY' => 'Culver City',
  601. 'SHIPTOSTATE' => 'CA',
  602. 'SHIPTOZIP' => '90230',
  603. 'SHIPTOCOUNTRY' => 'US',
  604. 'NAMETOSHIP' => 'John Doe',
  605. 'ADDRESSTOSHIP' => '6161 West Centinela Avenue',
  606. 'CITYTOSHIP' => 'Culver City',
  607. 'STATETOSHIP' => 'CA',
  608. 'ZIPTOSHIP' => '90230',
  609. 'COUNTRYTOSHIP' => 'US',
  610. 'NAME' => 'John Doe',
  611. 'CVV2MATCH' => 'Y',
  612. 'CARDTYPE' => '0',
  613. 'AVSDATA' => 'NNN',
  614. 'AVSZIP' => 'N',
  615. 'AVSADDR' => 'N',
  616. ],
  617. new DataObject([
  618. 'billtoname' => 'John Doe',
  619. 'billtofirstname' => 'John',
  620. 'billtolastname' => 'Doe',
  621. 'billtoemail' => 'user@magento.com',
  622. 'billtostreet' => '6161 West Centinela Avenue',
  623. 'billtocity' => 'Culver City',
  624. 'billtostate' => 'CA',
  625. 'billtozip' => '90230',
  626. 'billtocountry' => 'US',
  627. 'shiptostreet' => '6161 West Centinela Avenue',
  628. 'shiptocity' => 'Culver City',
  629. 'shiptostate' => 'CA',
  630. 'shiptozip' => '90230',
  631. 'shiptocountry' => 'US',
  632. 'nametoship' => 'John Doe',
  633. 'addresstoship' => '6161 West Centinela Avenue',
  634. 'citytoship' => 'Culver City',
  635. 'statetoship' => 'CA',
  636. 'ziptoship' => '90230',
  637. 'countrytoship' => 'US',
  638. 'name' => 'John Doe',
  639. 'cvv2match' => 'Y',
  640. 'cardtype' => '0',
  641. 'avsdata' => 'NN',
  642. 'avszip' => 'N',
  643. 'avsaddr' => 'N',
  644. 'firstname' => 'John',
  645. 'lastname' => 'Doe',
  646. 'address' => '6161 West Centinela Avenue',
  647. 'city' => 'Culver City',
  648. 'state' => 'CA',
  649. 'zip' => '90230',
  650. 'country' => 'US',
  651. 'email' => 'user@magento.com',
  652. 'cscmatch' => 'Y',
  653. 'ccavsstatus' => 'NNN',
  654. 'cc_type' => 'VI',
  655. ]),
  656. ]
  657. ];
  658. }
  659. }