8 class DataTest extends \PHPUnit\Framework\TestCase
32 $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
34 $this->storeManagerMock = $this->getMockBuilder(\
Magento\Store\Model\StoreManagerInterface::class)
35 ->getMockForAbstractClass();
37 $this->dataHelper =
$helper->getObject(
38 \
Magento\Authorizenet\Helper\Data::class,
39 [
'storeManager' => $this->storeManagerMock]
53 $currency = $this->createPartialMock(\
Magento\Directory\Model\Currency::class, [
'formatTxt',
'__wakeup']);
54 $currency->expects($this->any())
56 ->will($this->returnValue(
$amount));
57 $order = $this->createPartialMock(\
Magento\Sales\Model\Order::class, [
'getBaseCurrency',
'__wakeup']);
58 $order->expects($this->any())
59 ->method(
'getBaseCurrency')
60 ->will($this->returnValue($currency));
61 $payment = $this->createPartialMock(\
Magento\Payment\Model\Info::class, [
'getOrder',
'__wakeup']);
64 ->will($this->returnValue(
$order));
65 $card = new \Magento\Framework\DataObject([
'cc_last_4' => self::LAST4]);
66 $message = $this->dataHelper->getTransactionMessage(
76 $this->assertEquals($expected,
$message);
85 $additionalMessage =
'Addition message.';
92 'Credit Card: xxxx-' . self::LAST4 .
' amount 12.3 authorize - successful. ' 93 .
'Authorize.Net Transaction ID ' . self::TRID .
'. Addition message.',
100 'Credit Card: xxxx-' . self::LAST4 .
' amount 12.3 authorize and capture - failed. ' 101 .
'Authorize.Net Transaction ID ' . self::TRID .
'. some exception' 108 'Credit Card: xxxx-' . self::LAST4 .
' refund - successful. ' 109 .
'Authorize.Net Transaction ID ' . self::TRID .
'. Addition message.' 117 $baseUrl =
'http://base.url/';
119 $storeMock = $this->getMockBuilder(\
Magento\Store\Model\Store::class)
120 ->disableOriginalConstructor()
123 $storeMock->expects($this->once())
124 ->method(
'getBaseUrl')
125 ->with(\
Magento\Framework\UrlInterface::URL_TYPE_LINK)
126 ->willReturn($baseUrl);
128 $this->storeManagerMock->expects($this->once())
131 ->willReturn($storeMock);
134 'http://base.url/authorizenet/directpost_payment/response',
135 $this->dataHelper->getRelayUrl(
$storeId)
147 $this->assertSame($expected, (
string)$this->dataHelper->getFdsFilterActionLabel(
$code));
156 [
'decline ',
'Decline'],
158 [
'authAndHold',
'Authorize and Hold'],
159 [
'report',
'Report Only'],
160 [
'unknown_status',
'unknown_status']
172 $this->assertSame($expected, (
string)$this->dataHelper->getTransactionStatusLabel(
$code));
181 [
'authorizedPendingCapture',
'Authorized/Pending Capture'],
182 [
'capturedPendingSettlement',
'Captured/Pending Settlement'],
183 [
'refundSettledSuccessfully',
'Refund/Settled Successfully'],
184 [
'refundPendingSettlement',
'Refund/Pending Settlement'],
185 [
'declined',
'Declined'],
186 [
'expired',
'Expired'],
187 [
'voided',
'Voided'],
188 [
'FDSPendingReview',
'FDS - Pending Review'],
189 [
'FDSAuthorizedPendingReview',
'FDS - Authorized/Pending Review'],
190 [
'unknown_status',
'unknown_status']
testGetFdsFilterActionLabel($code, $expected)
getMessagesParamDataProvider()
getFdsFilterActionLabelDataProvider()
testGetTransactionMessage($type, $amount, $exception, $additionalMessage, $expected)
testGetTransactionStatusLabel($code, $expected)
getTransactionStatusLabelDataProvider()