Skip to content

Commit 53209aa

Browse files
author
lestare
committed
MAGETWO-58377: PayPal Payflow Pro always using USD (even if this currency is absent on your store) - for 2.0
1 parent 0d31c3e commit 53209aa

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
*/
66
namespace Magento\Paypal\Model\Payflow;
77

8-
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;
128
use Magento\Framework\Exception\LocalizedException;
13-
use Magento\Payment\Model\Method\TransparentInterface;
14-
use Magento\Payment\Model\Method\ConfigInterfaceFactory;
159
use Magento\Framework\Exception\State\InvalidTransitionException;
10+
use Magento\Payment\Model\InfoInterface;
11+
use Magento\Payment\Model\Method\ConfigInterfaceFactory;
12+
use Magento\Payment\Model\Method\TransparentInterface;
13+
use Magento\Paypal\Model\Payflow\Service\Gateway;
1614
use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
1715
use Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator;
16+
use Magento\Paypal\Model\Payflowpro;
17+
use Magento\Sales\Model\Order\Payment;
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 Payment $payment */
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)