Beispiel #1
0
 /**
  * Format price with currency sign
  * @param  \Magento\Payment\Model\Info $payment
  * @param float $amount
  * @return string
  */
 protected function _formatPrice($payment, $amount)
 {
     return $payment->getOrder()->getBaseCurrency()->formatTxt($amount);
 }
Beispiel #2
0
 /**
  * Process exceptions for gateway action with a lot of transactions
  *
  * @param  \Magento\Payment\Model\Info $payment
  * @param  string $messages
  * @param  bool $isSuccessfulTransactions
  * @return void
  * @throws \Magento\Framework\Model\Exception
  */
 protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions)
 {
     if ($isSuccessfulTransactions) {
         $messages[] = __('Gateway actions are locked because the gateway cannot complete ' . 'one or more of the transactions. ' . 'Please log in to your Authorize.Net account to manually resolve the issue(s).');
         /**
          * If there is successful transactions we can not to cancel order but
          * have to save information about processed transactions in order`s comments and disable
          * opportunity to voiding\capturing\refunding in future. Current order and payment will not be saved because we have to
          * load new order object and set information into this object.
          */
         $currentOrderId = $payment->getOrder()->getId();
         $copyOrder = $this->_orderFactory->create()->load($currentOrderId);
         $copyOrder->getPayment()->setAdditionalInformation($this->_isGatewayActionsLockedKey, 1);
         foreach ($messages as $message) {
             $copyOrder->addStatusHistoryComment($message);
         }
         $copyOrder->save();
     }
     throw new \Magento\Framework\Model\Exception($this->_authorizenetData->convertMessagesToMessage($messages));
 }
Beispiel #3
0
 /**
  * Returns request object with needed data for API request to PayPal to get form URL.
  *
  * @param \Magento\Payment\Model\Info $payment
  * @return \Magento\Paypal\Model\Hostedpro\Request
  */
 protected function _buildFormUrlRequest(\Magento\Payment\Model\Info $payment)
 {
     $request = $this->_buildBasicRequest()->setOrder($payment->getOrder())->setPaymentMethod($this);
     return $request;
 }