Skip to content

Commit 56eee0a

Browse files
committed
MAGETWO-91526: Authorize.net Direct Post does not show credit card information
1 parent b55989d commit 56eee0a

File tree

5 files changed

+47
-2
lines changed

5 files changed

+47
-2
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Authorizenet\Block\Adminhtml\Order\View\Info;
7+
8+
use Magento\Framework\Phrase;
9+
use Magento\Payment\Block\ConfigurableInfo;
10+
11+
/**
12+
* Payment information block for Authorize.net payment method
13+
*/
14+
class PaymentDetails extends ConfigurableInfo
15+
{
16+
/**
17+
* Returns localized label for payment info block
18+
*
19+
* @param string $field
20+
* @return string | Phrase
21+
*/
22+
protected function getLabel($field)
23+
{
24+
return __($field);
25+
}
26+
}

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
2727
/**
2828
* @var string
2929
*/
30-
protected $_infoBlockType = \Magento\Payment\Block\Info::class;
30+
protected $_infoBlockType = \Magento\Authorizenet\Block\Adminhtml\Order\View\Info\PaymentDetails::class;
3131

3232
/**
3333
* Payment Method feature
@@ -626,6 +626,14 @@ protected function fillPaymentByResponse(\Magento\Framework\DataObject $payment)
626626
$payment->setIsTransactionPending(true)
627627
->setIsFraudDetected(true);
628628
}
629+
630+
$additionalInformationKeys = explode(',', $this->getValue('paymentInfoKeys'));
631+
foreach ($additionalInformationKeys as $paymentInfoKey) {
632+
$paymentInfoValue = $response->getDataByKey($paymentInfoKey);
633+
if($paymentInfoValue !== null) {
634+
$payment->setAdditionalInformation($paymentInfoKey, $paymentInfoValue);
635+
}
636+
}
629637
}
630638

631639
/**
@@ -918,7 +926,7 @@ public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payme
918926
$payment->setIsTransactionDenied(true);
919927
}
920928
$this->addStatusCommentOnUpdate($payment, $response, $transactionId);
921-
return [];
929+
return $response->getData();
922930
}
923931

924932
/**

app/code/Magento/Authorizenet/etc/config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<cgi_url>https://secure.authorize.net/gateway/transact.dll</cgi_url>
3333
<cgi_url_td_test_mode>https://apitest.authorize.net/xml/v1/request.api</cgi_url_td_test_mode>
3434
<cgi_url_td>https://api2.authorize.net/xml/v1/request.api</cgi_url_td>
35+
<paymentInfoKeys>x_card_type,x_account_number,x_avs_code,x_auth_code,x_response_reason_text,x_cvv2_resp_code</paymentInfoKeys>
3536
</authorizenet_directpost>
3637
</payment>
3738
</default>

app/code/Magento/Authorizenet/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,9 @@
3535
</argument>
3636
</arguments>
3737
</type>
38+
<type name="Magento\Authorizenet\Block\Adminhtml\Order\View\Info\PaymentDetails">
39+
<arguments>
40+
<argument name="config" xsi:type="object">Magento\Authorizenet\Model\Directpost</argument>
41+
</arguments>
42+
</type>
3843
</config>

app/code/Magento/Authorizenet/i18n/en_US.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,8 @@ Debug,Debug
6767
"Minimum Order Total","Minimum Order Total"
6868
"Maximum Order Total","Maximum Order Total"
6969
"Sort Order","Sort Order"
70+
"x_card_type","Credit Card Type"
71+
"x_account_number", "Credit Card Number"
72+
"x_avs_code","AVS Response Code"
73+
"x_auth_code","Processor Authentication Code"
74+
"x_response_reason_text","Processor Response Text"

0 commit comments

Comments
 (0)