Skip to content

Commit 8b575cc

Browse files
committed
Merge branch 'MAGETWO-58377' into 2.0-develop-pr1
2 parents 0f6671c + 2266346 commit 8b575cc

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

app/code/Magento/Paypal/Model/Payflow/Transparent.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
namespace Magento\Paypal\Model\Payflow;
77

88
use Magento\Framework\DataObject;
9-
use Magento\Paypal\Model\Payflowpro;
10-
use Magento\Sales\Model\Order\Payment;
11-
use Magento\Paypal\Model\Payflow\Service\Gateway;
129
use Magento\Framework\Exception\LocalizedException;
13-
use Magento\Payment\Model\Method\TransparentInterface;
14-
use Magento\Payment\Model\Method\ConfigInterfaceFactory;
1510
use Magento\Framework\Exception\State\InvalidTransitionException;
11+
use Magento\Payment\Model\InfoInterface;
12+
use Magento\Payment\Model\Method\ConfigInterfaceFactory;
13+
use Magento\Payment\Model\Method\TransparentInterface;
14+
use Magento\Paypal\Model\Payflow\Service\Gateway;
1615
use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
1716
use Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator;
17+
use Magento\Paypal\Model\Payflowpro;
1818

1919
/**
2020
* Payflow Pro payment gateway model
@@ -112,23 +112,27 @@ public function validate()
112112
/**
113113
* Performs authorize transaction
114114
*
115-
* @param \Magento\Payment\Model\InfoInterface|Object $payment
115+
* @param InfoInterface|Object $payment
116116
* @param float $amount
117117
* @return $this
118118
* @throws InvalidTransitionException
119119
* @throws LocalizedException
120120
*/
121-
public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
121+
public function authorize(InfoInterface $payment, $amount)
122122
{
123+
/** @var DataObject $request */
123124
$request = $this->buildBasicRequest();
124125

126+
/** @var \Magento\Sales\Model\Order $order */
125127
$order = $payment->getOrder();
126128
$this->addRequestOrderInfo($request, $order);
127129
$request = $this->fillCustomerContacts($order, $request);
128130

129-
$request->setTrxtype(self::TRXTYPE_AUTH_ONLY);
130-
$request->setOrigid($payment->getAdditionalInformation('pnref'));
131-
$request->setAmt(round($amount, 2));
131+
$token = $payment->getAdditionalInformation('pnref');
132+
$request->setData('trxtype', self::TRXTYPE_AUTH_ONLY);
133+
$request->setData('origid', $token);
134+
$request->setData('amt', round($amount, 2));
135+
$request->setData('currency', $order->getBaseCurrencyCode());
132136

133137
$response = $this->postRequest($request, $this->getConfig());
134138
$this->processErrors($response);

app/code/Magento/Paypal/Test/Unit/Model/Payflow/TransparentTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ protected function initializationAuthorizeMock()
121121
$this->orderMock = $this->getMockBuilder('Magento\Sales\Model\Order')
122122
->setMethods([
123123
'getCustomerId', 'getBillingAddress', 'getShippingAddress', 'getCustomerEmail',
124-
'getId', 'getIncrementId'
124+
'getId', 'getIncrementId', 'getBaseCurrencyCode'
125125
])
126126
->disableOriginalConstructor()
127127
->getMock();
@@ -163,6 +163,9 @@ protected function buildRequestData()
163163
$this->paymentMock->expects($this->once())
164164
->method('getOrder')
165165
->willReturn($this->orderMock);
166+
$this->orderMock->expects($this->once())
167+
->method('getBaseCurrencyCode')
168+
->willReturn('USD');
166169
$this->orderMock->expects($this->once())
167170
->method('getBillingAddress')
168171
->willReturn($this->addressBillingMock);

0 commit comments

Comments
 (0)