|
5 | 5 | */
|
6 | 6 | namespace Magento\Paypal\Model\Payflow;
|
7 | 7 |
|
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; |
12 | 8 | use Magento\Framework\Exception\LocalizedException;
|
13 |
| -use Magento\Payment\Model\Method\TransparentInterface; |
14 |
| -use Magento\Payment\Model\Method\ConfigInterfaceFactory; |
15 | 9 | 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; |
16 | 14 | use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
|
17 | 15 | use Magento\Paypal\Model\Payflow\Service\Response\Validator\ResponseValidator;
|
| 16 | +use Magento\Paypal\Model\Payflowpro; |
| 17 | +use Magento\Sales\Model\Order\Payment; |
18 | 18 |
|
19 | 19 | /**
|
20 | 20 | * Payflow Pro payment gateway model
|
@@ -112,23 +112,27 @@ public function validate()
|
112 | 112 | /**
|
113 | 113 | * Performs authorize transaction
|
114 | 114 | *
|
115 |
| - * @param \Magento\Payment\Model\InfoInterface|Object $payment |
| 115 | + * @param InfoInterface|Object $payment |
116 | 116 | * @param float $amount
|
117 | 117 | * @return $this
|
118 | 118 | * @throws InvalidTransitionException
|
119 | 119 | * @throws LocalizedException
|
120 | 120 | */
|
121 |
| - public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount) |
| 121 | + public function authorize(InfoInterface $payment, $amount) |
122 | 122 | {
|
| 123 | + /** @var Payment $payment */ |
123 | 124 | $request = $this->buildBasicRequest();
|
124 | 125 |
|
| 126 | + /** @var \Magento\Sales\Model\Order $order */ |
125 | 127 | $order = $payment->getOrder();
|
126 | 128 | $this->addRequestOrderInfo($request, $order);
|
127 | 129 | $request = $this->fillCustomerContacts($order, $request);
|
128 | 130 |
|
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()); |
132 | 136 |
|
133 | 137 | $response = $this->postRequest($request, $this->getConfig());
|
134 | 138 | $this->processErrors($response);
|
|
0 commit comments