Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Payment.php
Go to the documentation of this file.
1 <?php
8 
18 
28 class Payment extends Info implements OrderPaymentInterface
29 {
35  const REVIEW_ACTION_ACCEPT = 'accept';
36 
37  const REVIEW_ACTION_DENY = 'deny';
38 
39  const REVIEW_ACTION_UPDATE = 'update';
40 
41  const PARENT_TXN_ID = 'parent_transaction_id';
42 
48  protected $_order;
49 
54  protected $_canVoidLookup = null;
55 
59  protected $_eventPrefix = 'sales_order_payment';
60 
64  protected $_eventObject = 'payment';
65 
72 
76  protected $creditmemoFactory;
77 
81  protected $priceCurrency;
82 
87 
92 
97 
102 
106  protected $orderRepository;
107 
111  private $orderStateResolver;
112 
116  private $creditmemoManager = null;
117 
138  public function __construct(
139  \Magento\Framework\Model\Context $context,
140  \Magento\Framework\Registry $registry,
141  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
144  \Magento\Framework\Encryption\EncryptorInterface $encryptor,
150  \Magento\Sales\Model\Order\Payment\Processor $paymentProcessor,
152  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
153  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
154  array $data = [],
155  CreditmemoManager $creditmemoManager = null
156  ) {
157  $this->priceCurrency = $priceCurrency;
158  $this->creditmemoFactory = $creditmemoFactory;
159  $this->transactionRepository = $transactionRepository;
160  $this->transactionManager = $transactionManager;
161  $this->transactionBuilder = $transactionBuilder;
162  $this->orderPaymentProcessor = $paymentProcessor;
163  $this->orderRepository = $orderRepository;
164  $this->creditmemoManager = $creditmemoManager ?: ObjectManager::getInstance()->get(CreditmemoManager::class);
165  parent::__construct(
166  $context,
167  $registry,
168  $extensionFactory,
170  $paymentData,
171  $encryptor,
172  $resource,
173  $resourceCollection,
174  $data
175  );
176  }
177 
183  protected function _construct()
184  {
185  $this->_init(\Magento\Sales\Model\ResourceModel\Order\Payment::class);
186  }
187 
196  public function setOrder(Order $order)
197  {
198  $this->_order = $order;
199 
200  return $this;
201  }
202 
209  public function getOrder()
210  {
211  if (!$this->_order && $this->getParentId()) {
212  $this->_order = $this->orderRepository->get($this->getParentId());
213  }
214 
215  return $this->_order;
216  }
217 
224  public function setTransactionId($transactionId)
225  {
226  $this->setData('transaction_id', $transactionId);
227 
228  return $this;
229  }
230 
236  public function getTransactionId()
237  {
238  return $this->getData('transaction_id');
239  }
240 
247  public function setIsTransactionClosed($isClosed)
248  {
249  $this->setData('is_transaction_closed', (bool)$isClosed);
250 
251  return $this;
252  }
253 
259  public function getParentTransactionId()
260  {
261  return $this->getData(self::PARENT_TXN_ID);
262  }
263 
270  public function setParentTransactionId($txnId)
271  {
272  return $this->setData(self::PARENT_TXN_ID, $txnId);
273  }
274 
280  public function canCapture()
281  {
282  if (!$this->getMethodInstance()->canCapture()) {
283  return false;
284  }
285  // Check Authorization transaction state
286  $authTransaction = $this->getAuthorizationTransaction();
287  if ($authTransaction && $authTransaction->getIsClosed()) {
288  $orderTransaction = $this->transactionRepository->getByTransactionType(
290  $this->getId(),
291  $this->getOrder()->getId()
292  );
293  if (!$orderTransaction) {
294  return false;
295  }
296  }
297 
298  return true;
299  }
300 
304  public function canRefund()
305  {
306  return $this->getMethodInstance()->canRefund();
307  }
308 
312  public function canRefundPartialPerInvoice()
313  {
314  return $this->getMethodInstance()->canRefundPartialPerInvoice();
315  }
316 
320  public function canCapturePartial()
321  {
322  return $this->getMethodInstance()->canCapturePartial();
323  }
324 
333  public function place()
334  {
335  $this->_eventManager->dispatch('sales_order_payment_place_start', ['payment' => $this]);
336  $order = $this->getOrder();
337 
338  $this->setAmountOrdered($order->getTotalDue());
339  $this->setBaseAmountOrdered($order->getBaseTotalDue());
340  $this->setShippingAmount($order->getShippingAmount());
341  $this->setBaseShippingAmount($order->getBaseShippingAmount());
342 
343  $methodInstance = $this->getMethodInstance();
344  $methodInstance->setStore($order->getStoreId());
345 
346  $orderState = Order::STATE_NEW;
347  $orderStatus = $methodInstance->getConfigData('order_status');
348  $isCustomerNotified = $order->getCustomerNoteNotify();
349 
350  // Do order payment validation on payment method level
351  $methodInstance->validate();
352  $action = $methodInstance->getConfigPaymentAction();
353 
354  if ($action) {
355  if ($methodInstance->isInitializeNeeded()) {
356  $stateObject = new \Magento\Framework\DataObject();
357  // For method initialization we have to use original config value for payment action
358  $methodInstance->initialize($methodInstance->getConfigData('payment_action'), $stateObject);
359  $orderState = $stateObject->getData('state') ?: $orderState;
360  $orderStatus = $stateObject->getData('status') ?: $orderStatus;
361  $isCustomerNotified = $stateObject->hasData('is_notified')
362  ? $stateObject->getData('is_notified')
363  : $isCustomerNotified;
364  } else {
365  $orderState = Order::STATE_PROCESSING;
366  $this->processAction($action, $order);
367  $orderState = $order->getState() ? $order->getState() : $orderState;
368  $orderStatus = $order->getStatus() ? $order->getStatus() : $orderStatus;
369  }
370  } else {
371  $order->setState($orderState)
372  ->setStatus($orderStatus);
373  }
374 
375  $isCustomerNotified = $isCustomerNotified ?: $order->getCustomerNoteNotify();
376 
377  if (!array_key_exists($orderStatus, $order->getConfig()->getStateStatuses($orderState))) {
378  $orderStatus = $order->getConfig()->getStateDefaultStatus($orderState);
379  }
380 
381  $this->updateOrder($order, $orderState, $orderStatus, $isCustomerNotified);
382 
383  $this->_eventManager->dispatch('sales_order_payment_place_end', ['payment' => $this]);
384 
385  return $this;
386  }
387 
397  protected function updateOrder(Order $order, $orderState, $orderStatus, $isCustomerNotified)
398  {
399  // add message if order was put into review during authorization or capture
400  $message = $order->getCustomerNote();
401  $originalOrderState = $order->getState();
402  $originalOrderStatus = $order->getStatus();
403 
404  switch (true) {
405  case ($message && ($originalOrderState == Order::STATE_PAYMENT_REVIEW)):
406  $order->addStatusToHistory($originalOrderStatus, $message, $isCustomerNotified);
407  break;
408  case ($message):
409  case ($originalOrderState && $message):
410  case ($originalOrderState != $orderState):
411  case ($originalOrderStatus != $orderStatus):
412  $order->setState($orderState)
413  ->setStatus($orderStatus)
414  ->addStatusHistoryComment($message)
415  ->setIsCustomerNotified($isCustomerNotified);
416  break;
417  default:
418  break;
419  }
420  }
421 
429  protected function processAction($action, Order $order)
430  {
431  $totalDue = $order->getTotalDue();
432  $baseTotalDue = $order->getBaseTotalDue();
433 
434  switch ($action) {
435  case \Magento\Payment\Model\Method\AbstractMethod::ACTION_ORDER:
436  $this->_order($baseTotalDue);
437  break;
438  case \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE:
439  $this->authorize(true, $baseTotalDue);
440  // base amount will be set inside
441  $this->setAmountAuthorized($totalDue);
442  break;
443  case \Magento\Payment\Model\Method\AbstractMethod::ACTION_AUTHORIZE_CAPTURE:
444  $this->setAmountAuthorized($totalDue);
445  $this->setBaseAmountAuthorized($baseTotalDue);
446  $this->capture(null);
447  break;
448  default:
449  break;
450  }
451  }
452 
463  public function capture($invoice = null)
464  {
465  return $this->orderPaymentProcessor->capture($this, $invoice);
466  }
467 
479  public function registerCaptureNotification($amount, $skipFraudDetection = false)
480  {
481  return $this->orderPaymentProcessor->registerCaptureNotification($this, $amount, $skipFraudDetection);
482  }
483 
492  {
493  return $this->checkIfTransactionExists() ? $this : $this->authorize(false, $amount);
494  }
495 
502  public function pay($invoice)
503  {
504  $totals = $this->collectTotalAmounts(
505  $this->getOrder(),
506  ['grand_total', 'base_grand_total', 'shipping_amount', 'base_shipping_amount']
507  );
508  $this->setAmountPaid($totals['grand_total']);
509  $this->setBaseAmountPaid($totals['base_grand_total']);
510  $this->setShippingCaptured($totals['shipping_amount']);
511  $this->setBaseShippingCaptured($totals['base_shipping_amount']);
512  $this->_eventManager->dispatch('sales_order_payment_pay', ['payment' => $this, 'invoice' => $invoice]);
513 
514  return $this;
515  }
516 
523  public function cancelInvoice($invoice)
524  {
525  $this->_updateTotals(
526  [
527  'amount_paid' => -1 * $invoice->getGrandTotal(),
528  'base_amount_paid' => -1 * $invoice->getBaseGrandTotal(),
529  'shipping_captured' => -1 * $invoice->getShippingAmount(),
530  'base_shipping_captured' => -1 * $invoice->getBaseShippingAmount(),
531  ]
532  );
533  $this->_eventManager->dispatch(
534  'sales_order_payment_cancel_invoice',
535  ['payment' => $this, 'invoice' => $invoice]
536  );
537  return $this;
538  }
539 
546  protected function _invoice()
547  {
548  $invoice = $this->getOrder()->prepareInvoice();
549 
550  $invoice->register();
551  if ($this->getMethodInstance()->canCapture()) {
552  $invoice->capture();
553  }
554 
555  $this->getOrder()->addRelatedObject($invoice);
556 
557  return $invoice;
558  }
559 
565  public function canVoid()
566  {
567  if (null === $this->_canVoidLookup) {
568  $this->_canVoidLookup = (bool)$this->getMethodInstance()->canVoid();
569  if ($this->_canVoidLookup) {
570  $authTransaction = $this->getAuthorizationTransaction();
571  $this->_canVoidLookup = (bool)$authTransaction && !(int)$authTransaction->getIsClosed();
572  }
573  }
574 
575  return $this->_canVoidLookup;
576  }
577 
585  public function void(\Magento\Framework\DataObject $document)
586  {
587  $this->_void(true);
588  $this->_eventManager->dispatch('sales_order_payment_void', ['payment' => $this, 'invoice' => $document]);
589 
590  return $this;
591  }
592 
600  public function registerVoidNotification($amount = null)
601  {
602  if (!$this->hasMessage()) {
603  $this->setMessage(__('Registered a Void notification.'));
604  }
605 
606  return $this->_void(false, $amount);
607  }
608 
616  {
617  $this->setData('creditmemo', $creditmemo);
618 
619  return $this;
620  }
621 
627  public function getCreditmemo()
628  {
629  return $this->getData('creditmemo') instanceof Creditmemo
630  ? $this->getData('creditmemo')
631  : null;
632  }
633 
646  public function refund($creditmemo)
647  {
648  $baseAmountToRefund = $this->formatAmount($creditmemo->getBaseGrandTotal());
649  $this->setTransactionId(
650  $this->transactionManager->generateTransactionId($this, Transaction::TYPE_REFUND)
651  );
652 
653  $isOnline = false;
654  $gateway = $this->getMethodInstance();
655  $invoice = null;
656  if ($gateway->canRefund()) {
657  $this->setCreditmemo($creditmemo);
658  if ($creditmemo->getDoTransaction()) {
659  $invoice = $creditmemo->getInvoice();
660  if ($invoice) {
661  $isOnline = true;
662  $captureTxn = $this->transactionRepository->getByTransactionId(
663  $invoice->getTransactionId(),
664  $this->getId(),
665  $this->getOrder()->getId()
666  );
667  if ($captureTxn) {
668  $this->setTransactionIdsForRefund($captureTxn);
669  }
670  $this->setShouldCloseParentTransaction(true);
671  // TODO: implement multiple refunds per capture
672  try {
673  $gateway->setStore(
674  $this->getOrder()->getStoreId()
675  );
676  $this->setRefundTransactionId($invoice->getTransactionId());
677  $gateway->refund($this, $baseAmountToRefund);
678 
679  $creditmemo->setTransactionId($this->getLastTransId());
680  } catch (\Magento\Framework\Exception\LocalizedException $e) {
681  if (!$captureTxn) {
682  throw new \Magento\Framework\Exception\LocalizedException(
683  __('If the invoice was created offline, try creating an offline credit memo.'),
684  $e
685  );
686  }
687  throw $e;
688  }
689  }
690  } elseif ($gateway->isOffline()) {
691  $gateway->setStore(
692  $this->getOrder()->getStoreId()
693  );
694  $gateway->refund($this, $baseAmountToRefund);
695  }
696  }
697 
698  // update self totals from creditmemo
699  $this->_updateTotals(
700  [
701  'amount_refunded' => $creditmemo->getGrandTotal(),
702  'base_amount_refunded' => $baseAmountToRefund,
703  'base_amount_refunded_online' => $isOnline ? $baseAmountToRefund : null,
704  'shipping_refunded' => $creditmemo->getShippingAmount(),
705  'base_shipping_refunded' => $creditmemo->getBaseShippingAmount(),
706  ]
707  );
708 
709  // update transactions and order state
710  $transaction = $this->addTransaction(
712  $creditmemo,
713  $isOnline
714  );
715  if ($invoice) {
716  $message = __('We refunded %1 online.', $this->formatPrice($baseAmountToRefund));
717  } else {
718  $message = $this->hasMessage() ? $this->getMessage() : __(
719  'We refunded %1 offline.',
720  $this->formatPrice($baseAmountToRefund)
721  );
722  }
724  $message = $this->_appendTransactionToMessage($transaction, $message);
725  $orderState = $this->getOrderStateResolver()->getStateForOrder($this->getOrder());
726  $this->getOrder()
727  ->addStatusHistoryComment(
728  $message,
729  $this->getOrder()->getConfig()->getStateDefaultStatus($orderState)
730  )->setIsCustomerNotified($creditmemo->getOrder()->getCustomerNoteNotify());
731  $this->_eventManager->dispatch(
732  'sales_order_payment_refund',
733  ['payment' => $this, 'creditmemo' => $creditmemo]
734  );
735 
736  return $this;
737  }
738 
753  {
754  $notificationAmount = $amount;
755  $this->setTransactionId(
756  $this->transactionManager->generateTransactionId(
757  $this,
759  $this->transactionRepository->getByTransactionId(
760  $this->getParentTransactionId(),
761  $this->getId(),
762  $this->getOrder()->getId()
763  )
764  )
765  );
766  if ($this->checkIfTransactionExists()) {
767  return $this;
768  }
769  $order = $this->getOrder();
771 
772  //choose where we get totals
773  $salesEntity = $invoice ?: $order;
774  $baseGrandTotal = $salesEntity->getBaseGrandTotal();
775  $amountRefundLeft = $baseGrandTotal - $salesEntity->getBaseTotalRefunded();
776 
777  if ($amountRefundLeft < $amount) {
778  $amount = $amountRefundLeft;
779  }
780 
781  if ($amount != $baseGrandTotal) {
782  $order->addStatusHistoryComment(
783  __(
784  'IPN "Refunded". Refund issued by merchant. '
785  . 'Registered notification about refunded amount of %1. Transaction ID: "%2". '
786  . 'Credit Memo has not been created. Please create offline Credit Memo.',
787  $this->formatPrice($notificationAmount),
788  $this->getTransactionId()
789  ),
790  false
791  );
792 
793  return $this;
794  }
795 
796  $creditmemo = $this->prepareCreditMemo($amount, $baseGrandTotal, $invoice);
797  $creditmemo->setPaymentRefundDisallowed(
798  true
799  )->setAutomaticallyCreated(
800  true
801  )->addComment(
802  __('The credit memo has been created automatically.')
803  );
804 
805  $this->creditmemoManager->refund($creditmemo, false);
806 
807  $this->_updateTotals(
808  ['amount_refunded' => $creditmemo->getGrandTotal(), 'base_amount_refunded_online' => $amount]
809  );
810 
811  $this->setCreatedCreditmemo($creditmemo);
812  // update transactions and order state
813  $transaction = $this->addTransaction(
816  );
817  $message = $this->prependMessage(
818  __('Registered notification about refunded amount of %1.', $this->formatPrice($amount))
819  );
822 
823  return $this;
824  }
825 
832  public function cancelCreditmemo($creditmemo)
833  {
834  $this->_updateTotals(
835  [
836  'amount_refunded' => -1 * $creditmemo->getGrandTotal(),
837  'base_amount_refunded' => -1 * $creditmemo->getBaseGrandTotal(),
838  'shipping_refunded' => -1 * $creditmemo->getShippingAmount(),
839  'base_shipping_refunded' => -1 * $creditmemo->getBaseShippingAmount(),
840  ]
841  );
842  $this->_eventManager->dispatch(
843  'sales_order_payment_cancel_creditmemo',
844  ['payment' => $this, 'creditmemo' => $creditmemo]
845  );
846 
847  return $this;
848  }
849 
856  public function cancel()
857  {
858  $isOnline = true;
859  if (!$this->canVoid()) {
860  $isOnline = false;
861  }
862 
863  if (!$this->hasMessage()) {
864  $this->setMessage($isOnline ? __('Canceled order online') : __('Canceled order offline'));
865  }
866 
867  if ($isOnline) {
868  $this->_void($isOnline, null, 'cancel');
869  }
870 
871  $this->_eventManager->dispatch('sales_order_payment_cancel', ['payment' => $this]);
872 
873  return $this;
874  }
875 
881  public function canReviewPayment()
882  {
883  return (bool)$this->getMethodInstance()->canReviewPayment();
884  }
885 
889  public function canFetchTransactionInfo()
890  {
891  return (bool)$this->getMethodInstance()->canFetchTransactionInfo();
892  }
893 
899  public function accept()
900  {
901  $transactionId = $this->getLastTransId();
902 
904  $method = $this->getMethodInstance();
905  $method->setStore($this->getOrder()->getStoreId());
906  if ($method->acceptPayment($this)) {
907  $invoice = $this->_getInvoiceForTransactionId($transactionId);
909  $transactionId,
910  $this->prependMessage(__('Approved the payment online.'))
911  );
914  } else {
916  $transactionId,
917  $this->prependMessage(__('There is no need to approve this payment.'))
918  );
919  $this->setOrderStatePaymentReview($message, $transactionId);
920  }
921 
922  return $this;
923  }
924 
932  public function deny($isOnline = true)
933  {
934  $transactionId = $isOnline ? $this->getLastTransId() : $this->getTransactionId();
935 
936  if ($isOnline) {
938  $method = $this->getMethodInstance();
939  $method->setStore($this->getOrder()->getStoreId());
940 
941  $result = $method->denyPayment($this);
942  } else {
943  $result = (bool)$this->getNotificationResult();
944  }
945 
946  if ($result) {
947  $invoice = $this->_getInvoiceForTransactionId($transactionId);
949  $transactionId,
950  $this->prependMessage(__('Denied the payment online'))
951  );
953  } else {
954  $txt = $isOnline ?
955  'There is no need to deny this payment.' : 'Registered notification about denied payment.';
957  $transactionId,
958  $this->prependMessage(__($txt))
959  );
960  $this->setOrderStatePaymentReview($message, $transactionId);
961  }
962 
963  return $this;
964  }
965 
973  public function update($isOnline = true)
974  {
975  $transactionId = $isOnline ? $this->getLastTransId() : $this->getTransactionId();
976  $invoice = $this->_getInvoiceForTransactionId($transactionId);
977 
978  if ($isOnline) {
979  $method = $this->getMethodInstance();
980  $method->setStore($this->getOrder()->getStoreId());
981  $method->fetchTransactionInfo($this, $transactionId);
982  }
983 
984  if ($this->getIsTransactionApproved()) {
986  $transactionId,
987  $this->prependMessage(__('Registered update about approved payment.'))
988  );
991  } elseif ($this->getIsTransactionDenied()) {
993  $transactionId,
994  $this->prependMessage(__('Registered update about denied payment.'))
995  );
997  } else {
999  $transactionId,
1000  $this->prependMessage(__('There is no update for the payment.'))
1001  );
1002  $this->setOrderStatePaymentReview($message, $transactionId);
1003  }
1004 
1005  return $this;
1006  }
1007 
1014  {
1015  if ($invoice instanceof Invoice) {
1016  $invoice->pay();
1017  $totals = $this->collectTotalAmounts($this->getOrder(), ['base_grand_total']);
1018  $this->setBaseAmountPaidOnline($totals['base_grand_total']);
1019  $this->getOrder()->addRelatedObject($invoice);
1020  }
1021  }
1022 
1028  protected function setOrderStateProcessing($message)
1029  {
1030  $this->getOrder()->setState(Order::STATE_PROCESSING)
1031  ->setStatus($this->getOrder()->getConfig()->getStateDefaultStatus(Order::STATE_PROCESSING))
1032  ->addStatusHistoryComment($message);
1033  }
1034 
1042  {
1043  if ($invoice instanceof Invoice) {
1044  $invoice->cancel();
1045  $this->getOrder()->addRelatedObject($invoice);
1046  }
1047  $this->getOrder()->registerCancellation($message, false);
1048  }
1049 
1056  protected function setOrderStatePaymentReview($message, $transactionId)
1057  {
1058  if ($this->getOrder()->getState() != Order::STATE_PAYMENT_REVIEW) {
1059  $this->getOrder()->setState(Order::STATE_PAYMENT_REVIEW)
1060  ->addStatusHistoryComment($message);
1061  if ($this->getIsFraudDetected()) {
1062  $this->getOrder()->setStatus(Order::STATUS_FRAUD);
1063  }
1064  if ($transactionId) {
1065  $this->setLastTransId($transactionId);
1066  }
1067  } else {
1068  $this->getOrder()->addStatusHistoryComment($message);
1069  }
1070  }
1071 
1089  protected function _order($amount)
1090  {
1091  return $this->orderPaymentProcessor->order($this, $amount);
1092  }
1093 
1105  public function authorize($isOnline, $amount)
1106  {
1107  return $this->orderPaymentProcessor->authorize($this, $isOnline, $amount);
1108  }
1109 
1123  protected function _void($isOnline, $amount = null, $gatewayCallback = 'void')
1124  {
1125  $order = $this->getOrder();
1126  $authTransaction = $this->getAuthorizationTransaction();
1127  $this->setTransactionId(
1128  $this->transactionManager->generateTransactionId($this, Transaction::TYPE_VOID, $authTransaction)
1129  );
1130  $this->setShouldCloseParentTransaction(true);
1131 
1132  // attempt to void
1133  if ($isOnline) {
1134  $method = $this->getMethodInstance();
1135  $method->setStore($order->getStoreId());
1136  $method->{$gatewayCallback}($this);
1137  }
1138  if ($this->checkIfTransactionExists()) {
1139  return $this;
1140  }
1141 
1142  // if the authorization was untouched, we may assume voided amount = order grand total
1143  // but only if the payment auth amount equals to order grand total
1144  if ($authTransaction &&
1145  $order->getBaseGrandTotal() == $this->getBaseAmountAuthorized() &&
1146  0 == $this->getBaseAmountCanceled()
1147  ) {
1148  if ($authTransaction->canVoidAuthorizationCompletely()) {
1149  $amount = (double)$order->getBaseGrandTotal();
1150  }
1151  }
1152 
1153  if ($amount) {
1154  $amount = $this->formatAmount($amount);
1155  }
1156 
1157  // update transactions, order state and add comments
1158  $transaction = $this->addTransaction(Transaction::TYPE_VOID, null, true);
1159  $message = $this->hasMessage() ? $this->getMessage() : __('Voided authorization.');
1160  $message = $this->prependMessage($message);
1161  if ($amount) {
1162  $message .= ' ' . __('Amount: %1.', $this->formatPrice($amount));
1163  }
1166  $order->setDataChanges(true);
1167 
1168  return $this;
1169  }
1170 
1179  public function addTransaction($type, $salesDocument = null, $failSafe = false)
1180  {
1181  $builder = $this->transactionBuilder->setPayment($this)
1182  ->setOrder($this->getOrder())
1183  ->setFailSafe($failSafe)
1184  ->setTransactionId($this->getTransactionId())
1185  ->setAdditionalInformation($this->transactionAdditionalInfo);
1186  if ($salesDocument) {
1187  $builder->setSalesDocument($salesDocument);
1188  }
1189 
1190  return $builder->build($type);
1191  }
1192 
1196  {
1197  $order = $this->getOrder();
1198  $message = $this->_appendTransactionToMessage($transaction, $message);
1199  $order->addStatusHistoryComment($message);
1200  }
1201 
1208  public function importTransactionInfo(Transaction $transactionTo)
1209  {
1210  $method = $this->getMethodInstance();
1211  $method->setStore(
1212  $this->getOrder()->getStoreId()
1213  );
1214  $data = $method->fetchTransactionInfo(
1215  $this,
1216  $transactionTo->getTxnId()
1217  );
1218  if ($data) {
1219  $transactionTo->setAdditionalInformation(
1221  $data
1222  );
1223  }
1224 
1225  return $this;
1226  }
1227 
1235  protected function _updateTotals($data)
1236  {
1237  foreach ($data as $key => $amount) {
1238  if (null !== $amount) {
1239  $was = $this->getDataUsingMethod($key);
1240  $this->setDataUsingMethod($key, $was + $amount);
1241  }
1242  }
1243  }
1244 
1253  {
1254  if ($transaction) {
1255  $txnId = is_object($transaction) ? $transaction->getHtmlTxnId() : $transaction;
1256  $message .= ' ' . __('Transaction ID: "%1"', $txnId);
1257  }
1258 
1259  return $message;
1260  }
1261 
1269  public function prependMessage($messagePrependTo)
1270  {
1271  $preparedMessage = $this->getPreparedMessage();
1272  if ($preparedMessage) {
1273  if (is_string($preparedMessage)
1274  || $preparedMessage instanceof \Magento\Framework\Phrase
1275  ) {
1276  return $preparedMessage . ' ' . $messagePrependTo;
1277  } elseif (is_object($preparedMessage)
1278  && $preparedMessage instanceof \Magento\Sales\Model\Order\Status\History
1279  ) {
1280  $comment = $preparedMessage->getComment() . ' ' . $messagePrependTo;
1281  $preparedMessage->setComment($comment);
1282 
1283  return $comment;
1284  }
1285  }
1286 
1287  return $messagePrependTo;
1288  }
1289 
1297  public function formatAmount($amount, $asFloat = false)
1298  {
1299  $amount = $this->priceCurrency->round($amount);
1300 
1301  return !$asFloat ? (string)$amount : $amount;
1302  }
1303 
1309  public function formatPrice($amount)
1310  {
1311  return $this->getOrder()->getBaseCurrency()->formatTxt($amount);
1312  }
1313 
1319  {
1320  return $this->transactionManager->getAuthorizationTransaction(
1321  $this->getParentTransactionId(),
1322  $this->getId(),
1323  $this->getOrder()->getId()
1324  );
1325  }
1326 
1333  public function isCaptureFinal($amountToCapture)
1334  {
1335  $total = $this->getOrder()->getBaseTotalDue();
1336 
1337  return $this->formatAmount($total, true) == $this->formatAmount($amountToCapture, true);
1338  }
1339 
1345  public function isSameCurrency()
1346  {
1347  return !$this->getCurrencyCode() || $this->getCurrencyCode() == $this->getOrder()->getBaseCurrencyCode();
1348  }
1349 
1357  public function setTransactionAdditionalInfo($key, $value)
1358  {
1359  $this->transactionAdditionalInfo[$key] = $value;
1360  }
1361 
1368  {
1369  return $this->transactionAdditionalInfo;
1370  }
1371 
1378  {
1379  $this->transactionAdditionalInfo = [];
1380 
1381  return $this;
1382  }
1383 
1392  protected function prepareCreditMemo($amount, $baseGrandTotal, $invoice)
1393  {
1394  $entity = $invoice ?: $this->getOrder();
1395  if ($entity->getBaseTotalRefunded() > 0) {
1396  $adjustment = ['adjustment_positive' => $amount];
1397  } else {
1398  $adjustment = ['adjustment_negative' => $baseGrandTotal - $amount];
1399  }
1400  if ($invoice) {
1401  $creditMemo = $this->creditmemoFactory->createByInvoice($invoice, $adjustment);
1402  } else {
1403  $creditMemo = $this->creditmemoFactory->createByOrder($this->getOrder(), $adjustment);
1404  }
1405  if ($creditMemo) {
1406  $totalRefunded = $entity->getBaseTotalRefunded() + $creditMemo->getBaseGrandTotal();
1407  $this->setShouldCloseParentTransaction($entity->getBaseGrandTotal() <= $totalRefunded);
1408  }
1409 
1410  return $creditMemo;
1411  }
1412 
1418  protected function checkIfTransactionExists()
1419  {
1420  return $this->transactionManager->isTransactionExists(
1421  $this->getTransactionId(),
1422  $this->getId(),
1423  $this->getOrder()->getId()
1424  );
1425  }
1426 
1433  protected function _getInvoiceForTransactionId($transactionId)
1434  {
1435  foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
1436  if ($invoice->getTransactionId() == $transactionId) {
1437  $invoice->load($invoice->getId());
1438 
1439  // to make sure all data will properly load (maybe not required)
1440  return $invoice;
1441  }
1442  }
1443  foreach ($this->getOrder()->getInvoiceCollection() as $invoice) {
1444  if ($invoice->getState() == \Magento\Sales\Model\Order\Invoice::STATE_OPEN
1445  && $invoice->load($invoice->getId())
1446  ) {
1447  $invoice->setTransactionId($transactionId);
1448 
1449  return $invoice;
1450  }
1451  }
1452 
1453  return false;
1454  }
1455 
1460  private function getOrderStateResolver()
1461  {
1462  if ($this->orderStateResolver === null) {
1463  $this->orderStateResolver = ObjectManager::getInstance()->get(OrderStateResolverInterface::class);
1464  }
1465 
1466  return $this->orderStateResolver;
1467  }
1468 
1469  //@codeCoverageIgnoreStart
1470 
1476  public function getAccountStatus()
1477  {
1479  }
1480 
1486  public function getAdditionalData()
1487  {
1489  }
1490 
1496  public function getAddressStatus()
1497  {
1499  }
1500 
1506  public function getAmountAuthorized()
1507  {
1509  }
1510 
1516  public function getAmountCanceled()
1517  {
1519  }
1520 
1526  public function getAmountOrdered()
1527  {
1529  }
1530 
1536  public function getAmountPaid()
1537  {
1539  }
1540 
1546  public function getAmountRefunded()
1547  {
1549  }
1550 
1556  public function getAnetTransMethod()
1557  {
1559  }
1560 
1566  public function getBaseAmountAuthorized()
1567  {
1569  }
1570 
1576  public function getBaseAmountCanceled()
1577  {
1579  }
1580 
1586  public function getBaseAmountOrdered()
1587  {
1589  }
1590 
1596  public function getBaseAmountPaid()
1597  {
1599  }
1600 
1606  public function getBaseAmountPaidOnline()
1607  {
1609  }
1610 
1616  public function getBaseAmountRefunded()
1617  {
1619  }
1620 
1627  {
1629  }
1630 
1636  public function getBaseShippingAmount()
1637  {
1639  }
1640 
1646  public function getBaseShippingCaptured()
1647  {
1649  }
1650 
1656  public function getBaseShippingRefunded()
1657  {
1659  }
1660 
1666  public function getCcApproval()
1667  {
1669  }
1670 
1676  public function getCcAvsStatus()
1677  {
1679  }
1680 
1686  public function getCcCidStatus()
1687  {
1689  }
1690 
1696  public function getCcDebugRequestBody()
1697  {
1699  }
1700 
1706  public function getCcDebugResponseBody()
1707  {
1709  }
1710 
1717  {
1719  }
1720 
1726  public function getCcExpMonth()
1727  {
1729  }
1730 
1736  public function getCcExpYear()
1737  {
1739  }
1740 
1746  public function getCcLast4()
1747  {
1749  }
1750 
1756  public function getCcNumberEnc()
1757  {
1759  }
1760 
1766  public function getCcOwner()
1767  {
1769  }
1770 
1776  public function getCcSecureVerify()
1777  {
1779  }
1780 
1787  public function getCcSsIssue()
1788  {
1790  }
1791 
1798  public function getCcSsStartMonth()
1799  {
1801  }
1802 
1809  public function getCcSsStartYear()
1810  {
1812  }
1813 
1819  public function getCcStatus()
1820  {
1822  }
1823 
1829  public function getCcStatusDescription()
1830  {
1832  }
1833 
1839  public function getCcTransId()
1840  {
1842  }
1843 
1849  public function getCcType()
1850  {
1851  return $this->getData(OrderPaymentInterface::CC_TYPE);
1852  }
1853 
1859  public function getEcheckAccountName()
1860  {
1862  }
1863 
1869  public function getEcheckAccountType()
1870  {
1872  }
1873 
1879  public function getEcheckBankName()
1880  {
1882  }
1883 
1889  public function getEcheckRoutingNumber()
1890  {
1892  }
1893 
1899  public function getEcheckType()
1900  {
1902  }
1903 
1909  public function getLastTransId()
1910  {
1912  }
1913 
1919  public function getMethod()
1920  {
1921  return $this->getData(OrderPaymentInterface::METHOD);
1922  }
1923 
1929  public function getParentId()
1930  {
1932  }
1933 
1939  public function getPoNumber()
1940  {
1942  }
1943 
1949  public function getProtectionEligibility()
1950  {
1952  }
1953 
1959  public function getQuotePaymentId()
1960  {
1962  }
1963 
1969  public function getShippingAmount()
1970  {
1972  }
1973 
1979  public function getShippingCaptured()
1980  {
1982  }
1983 
1989  public function getShippingRefunded()
1990  {
1992  }
1993 
1997  public function setParentId($id)
1998  {
2000  }
2001 
2005  public function setBaseShippingCaptured($baseShippingCaptured)
2006  {
2007  return $this->setData(OrderPaymentInterface::BASE_SHIPPING_CAPTURED, $baseShippingCaptured);
2008  }
2009 
2013  public function setShippingCaptured($shippingCaptured)
2014  {
2015  return $this->setData(OrderPaymentInterface::SHIPPING_CAPTURED, $shippingCaptured);
2016  }
2017 
2021  public function setAmountRefunded($amountRefunded)
2022  {
2023  return $this->setData(OrderPaymentInterface::AMOUNT_REFUNDED, $amountRefunded);
2024  }
2025 
2029  public function setBaseAmountPaid($baseAmountPaid)
2030  {
2031  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_PAID, $baseAmountPaid);
2032  }
2033 
2037  public function setAmountCanceled($amountCanceled)
2038  {
2039  return $this->setData(OrderPaymentInterface::AMOUNT_CANCELED, $amountCanceled);
2040  }
2041 
2045  public function setBaseAmountAuthorized($baseAmountAuthorized)
2046  {
2047  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_AUTHORIZED, $baseAmountAuthorized);
2048  }
2049 
2053  public function setBaseAmountPaidOnline($baseAmountPaidOnline)
2054  {
2055  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_PAID_ONLINE, $baseAmountPaidOnline);
2056  }
2057 
2061  public function setBaseAmountRefundedOnline($baseAmountRefundedOnline)
2062  {
2063  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_REFUNDED_ONLINE, $baseAmountRefundedOnline);
2064  }
2065 
2070  {
2072  }
2073 
2077  public function setShippingAmount($amount)
2078  {
2080  }
2081 
2085  public function setAmountPaid($amountPaid)
2086  {
2087  return $this->setData(OrderPaymentInterface::AMOUNT_PAID, $amountPaid);
2088  }
2089 
2093  public function setAmountAuthorized($amountAuthorized)
2094  {
2095  return $this->setData(OrderPaymentInterface::AMOUNT_AUTHORIZED, $amountAuthorized);
2096  }
2097 
2101  public function setBaseAmountOrdered($baseAmountOrdered)
2102  {
2103  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_ORDERED, $baseAmountOrdered);
2104  }
2105 
2109  public function setBaseShippingRefunded($baseShippingRefunded)
2110  {
2111  return $this->setData(OrderPaymentInterface::BASE_SHIPPING_REFUNDED, $baseShippingRefunded);
2112  }
2113 
2117  public function setShippingRefunded($shippingRefunded)
2118  {
2119  return $this->setData(OrderPaymentInterface::SHIPPING_REFUNDED, $shippingRefunded);
2120  }
2121 
2125  public function setBaseAmountRefunded($baseAmountRefunded)
2126  {
2127  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_REFUNDED, $baseAmountRefunded);
2128  }
2129 
2133  public function setAmountOrdered($amountOrdered)
2134  {
2135  return $this->setData(OrderPaymentInterface::AMOUNT_ORDERED, $amountOrdered);
2136  }
2137 
2141  public function setBaseAmountCanceled($baseAmountCanceled)
2142  {
2143  return $this->setData(OrderPaymentInterface::BASE_AMOUNT_CANCELED, $baseAmountCanceled);
2144  }
2145 
2149  public function setQuotePaymentId($id)
2150  {
2152  }
2153 
2157  public function setAdditionalData($additionalData)
2158  {
2159  return $this->setData(OrderPaymentInterface::ADDITIONAL_DATA, $additionalData);
2160  }
2161 
2165  public function setCcExpMonth($ccExpMonth)
2166  {
2168  }
2169 
2174  public function setCcSsStartYear($ccSsStartYear)
2175  {
2176  return $this->setData(OrderPaymentInterface::CC_SS_START_YEAR, $ccSsStartYear);
2177  }
2178 
2182  public function setEcheckBankName($echeckBankName)
2183  {
2184  return $this->setData(OrderPaymentInterface::ECHECK_BANK_NAME, $echeckBankName);
2185  }
2186 
2190  public function setMethod($method)
2191  {
2193  }
2194 
2198  public function setCcDebugRequestBody($ccDebugRequestBody)
2199  {
2200  return $this->setData(OrderPaymentInterface::CC_DEBUG_REQUEST_BODY, $ccDebugRequestBody);
2201  }
2202 
2206  public function setCcSecureVerify($ccSecureVerify)
2207  {
2208  return $this->setData(OrderPaymentInterface::CC_SECURE_VERIFY, $ccSecureVerify);
2209  }
2210 
2214  public function setProtectionEligibility($protectionEligibility)
2215  {
2216  return $this->setData(OrderPaymentInterface::PROTECTION_ELIGIBILITY, $protectionEligibility);
2217  }
2218 
2222  public function setCcApproval($ccApproval)
2223  {
2224  return $this->setData(OrderPaymentInterface::CC_APPROVAL, $ccApproval);
2225  }
2226 
2230  public function setCcLast4($ccLast4)
2231  {
2232  return $this->setData(OrderPaymentInterface::CC_LAST_4, $ccLast4);
2233  }
2234 
2239  {
2241  }
2242 
2246  public function setEcheckType($echeckType)
2247  {
2248  return $this->setData(OrderPaymentInterface::ECHECK_TYPE, $echeckType);
2249  }
2250 
2254  public function setCcDebugResponseSerialized($ccDebugResponseSerialized)
2255  {
2256  return $this->setData(OrderPaymentInterface::CC_DEBUG_RESPONSE_SERIALIZED, $ccDebugResponseSerialized);
2257  }
2258 
2263  public function setCcSsStartMonth($ccSsStartMonth)
2264  {
2265  return $this->setData(OrderPaymentInterface::CC_SS_START_MONTH, $ccSsStartMonth);
2266  }
2267 
2271  public function setEcheckAccountType($echeckAccountType)
2272  {
2273  return $this->setData(OrderPaymentInterface::ECHECK_ACCOUNT_TYPE, $echeckAccountType);
2274  }
2275 
2279  public function setLastTransId($id)
2280  {
2282  }
2283 
2287  public function setCcCidStatus($ccCidStatus)
2288  {
2289  return $this->setData(OrderPaymentInterface::CC_CID_STATUS, $ccCidStatus);
2290  }
2291 
2295  public function setCcOwner($ccOwner)
2296  {
2297  return $this->setData(OrderPaymentInterface::CC_OWNER, $ccOwner);
2298  }
2299 
2303  public function setCcType($ccType)
2304  {
2306  }
2307 
2311  public function setPoNumber($poNumber)
2312  {
2313  return $this->setData(OrderPaymentInterface::PO_NUMBER, $poNumber);
2314  }
2315 
2319  public function setCcExpYear($ccExpYear)
2320  {
2322  }
2323 
2327  public function setCcStatus($ccStatus)
2328  {
2329  return $this->setData(OrderPaymentInterface::CC_STATUS, $ccStatus);
2330  }
2331 
2335  public function setEcheckRoutingNumber($echeckRoutingNumber)
2336  {
2337  return $this->setData(OrderPaymentInterface::ECHECK_ROUTING_NUMBER, $echeckRoutingNumber);
2338  }
2339 
2343  public function setAccountStatus($accountStatus)
2344  {
2345  return $this->setData(OrderPaymentInterface::ACCOUNT_STATUS, $accountStatus);
2346  }
2347 
2351  public function setAnetTransMethod($anetTransMethod)
2352  {
2353  return $this->setData(OrderPaymentInterface::ANET_TRANS_METHOD, $anetTransMethod);
2354  }
2355 
2359  public function setCcDebugResponseBody($ccDebugResponseBody)
2360  {
2361  return $this->setData(OrderPaymentInterface::CC_DEBUG_RESPONSE_BODY, $ccDebugResponseBody);
2362  }
2363 
2368  public function setCcSsIssue($ccSsIssue)
2369  {
2370  return $this->setData(OrderPaymentInterface::CC_SS_ISSUE, $ccSsIssue);
2371  }
2372 
2376  public function setEcheckAccountName($echeckAccountName)
2377  {
2378  return $this->setData(OrderPaymentInterface::ECHECK_ACCOUNT_NAME, $echeckAccountName);
2379  }
2380 
2384  public function setCcAvsStatus($ccAvsStatus)
2385  {
2386  return $this->setData(OrderPaymentInterface::CC_AVS_STATUS, $ccAvsStatus);
2387  }
2388 
2392  public function setCcNumberEnc($ccNumberEnc)
2393  {
2394  return $this->setData(OrderPaymentInterface::CC_NUMBER_ENC, $ccNumberEnc);
2395  }
2396 
2400  public function setCcTransId($id)
2401  {
2403  }
2404 
2408  public function setAddressStatus($addressStatus)
2409  {
2410  return $this->setData(OrderPaymentInterface::ADDRESS_STATUS, $addressStatus);
2411  }
2412 
2418  public function getExtensionAttributes()
2419  {
2420  return $this->_getExtensionAttributes();
2421  }
2422 
2429  public function setExtensionAttributes(\Magento\Sales\Api\Data\OrderPaymentExtensionInterface $extensionAttributes)
2430  {
2431  return $this->_setExtensionAttributes($extensionAttributes);
2432  }
2433 
2440  public function setIsTransactionPending($flag)
2441  {
2442  $this->setData('is_transaction_pending', (bool)$flag);
2443 
2444  return $this;
2445  }
2446 
2453  public function getIsTransactionPending()
2454  {
2455  return (bool)$this->getData('is_transaction_pending');
2456  }
2457 
2464  public function setIsFraudDetected($flag)
2465  {
2466  $this->setData('is_fraud_detected', (bool)$flag);
2467 
2468  return $this;
2469  }
2470 
2477  public function getIsFraudDetected()
2478  {
2479  return (bool)$this->getData('is_fraud_detected');
2480  }
2481 
2488  public function setShouldCloseParentTransaction($flag)
2489  {
2490  $this->setData('should_close_parent_transaction', (bool)$flag);
2491 
2492  return $this;
2493  }
2494 
2502  {
2503  return (bool)$this->getData('should_close_parent_transaction');
2504  }
2505 
2511  private function setTransactionIdsForRefund(Transaction $transaction)
2512  {
2513  if (!$this->getTransactionId()) {
2514  $this->setTransactionId(
2515  $this->transactionManager->generateTransactionId(
2516  $this,
2518  $transaction
2519  )
2520  );
2521  }
2522  $this->setParentTransactionId($transaction->getTxnId());
2523  }
2524 
2525  //@codeCoverageIgnoreEnd
2526 
2535  private function collectTotalAmounts(Order $order, array $keys)
2536  {
2537  $result = array_fill_keys($keys, 0.00);
2538  $invoiceCollection = $order->getInvoiceCollection();
2540  foreach ($invoiceCollection as $invoice) {
2541  foreach ($keys as $key) {
2542  $result[$key] += $invoice->getData($key);
2543  }
2544  }
2545 
2546  return $result;
2547  }
2548 }
$transaction
setAmountRefunded($amountRefunded)
Definition: Payment.php:2021
setAnetTransMethod($anetTransMethod)
Definition: Payment.php:2351
addTransactionCommentsToOrder($transaction, $message)
Definition: Payment.php:1195
setProtectionEligibility($protectionEligibility)
Definition: Payment.php:2214
getData($key='', $index=null)
Definition: Info.php:82
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\Encryption\EncryptorInterface $encryptor, \Magento\Sales\Model\Order\CreditmemoFactory $creditmemoFactory, PriceCurrencyInterface $priceCurrency, \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository, ManagerInterface $transactionManager, \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $transactionBuilder, \Magento\Sales\Model\Order\Payment\Processor $paymentProcessor, OrderRepositoryInterface $orderRepository, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[], CreditmemoManager $creditmemoManager=null)
Definition: Payment.php:138
setBaseAmountAuthorized($baseAmountAuthorized)
Definition: Payment.php:2045
setBaseAmountPaidOnline($baseAmountPaidOnline)
Definition: Payment.php:2053
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
prependMessage($messagePrependTo)
Definition: Payment.php:1269
getDataUsingMethod($key, $args=null)
Definition: DataObject.php:218
registerVoidNotification($amount=null)
Definition: Payment.php:600
$id
Definition: fieldset.phtml:14
setEcheckAccountName($echeckAccountName)
Definition: Payment.php:2376
setEcheckRoutingNumber($echeckRoutingNumber)
Definition: Payment.php:2335
void(\Magento\Framework\DataObject $document)
Definition: Payment.php:585
addTransaction($type, $salesDocument=null, $failSafe=false)
Definition: Payment.php:1179
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
setCcStatusDescription($description)
Definition: Payment.php:2238
$order
Definition: order.php:55
setAdditionalData($additionalData)
Definition: Payment.php:2157
setAmountCanceled($amountCanceled)
Definition: Payment.php:2037
setShippingCaptured($shippingCaptured)
Definition: Payment.php:2013
$ccExpYear
Definition: info.phtml:18
__()
Definition: __.php:13
setBaseShippingCaptured($baseShippingCaptured)
Definition: Payment.php:2005
authorize($isOnline, $amount)
Definition: Payment.php:1105
$resource
Definition: bulk.php:12
registerCaptureNotification($amount, $skipFraudDetection=false)
Definition: Payment.php:479
$message
isCaptureFinal($amountToCapture)
Definition: Payment.php:1333
setCcSsStartYear($ccSsStartYear)
Definition: Payment.php:2174
$amount
Definition: order.php:14
$type
Definition: item.phtml:13
setShippingRefunded($shippingRefunded)
Definition: Payment.php:2117
setCcDebugResponseSerialized($ccDebugResponseSerialized)
Definition: Payment.php:2254
updateOrder(Order $order, $orderState, $orderStatus, $isCustomerNotified)
Definition: Payment.php:397
$orderStatus
Definition: order_status.php:9
prepareCreditMemo($amount, $baseGrandTotal, $invoice)
Definition: Payment.php:1392
$value
Definition: gender.phtml:16
$totals
Definition: totalbar.phtml:10
$ccExpMonth
Definition: info.phtml:17
setOrderStatePaymentReview($message, $transactionId)
Definition: Payment.php:1056
$invoice
setCcSsStartMonth($ccSsStartMonth)
Definition: Payment.php:2263
setAddressStatus($addressStatus)
Definition: Payment.php:2408
_appendTransactionToMessage($transaction, $message)
Definition: Payment.php:1252
setCcDebugRequestBody($ccDebugRequestBody)
Definition: Payment.php:2198
$entity
Definition: element.phtml:22
$method
Definition: info.phtml:13
setCreditmemo(Creditmemo $creditmemo)
Definition: Payment.php:615
setTransactionId($transactionId)
Definition: Payment.php:224
getData($key='', $index=null)
Definition: Order.php:1740
$ccType
Definition: info.phtml:16
setBaseShippingRefunded($baseShippingRefunded)
Definition: Payment.php:2109
processAction($action, Order $order)
Definition: Payment.php:429
setTransactionAdditionalInfo($key, $value)
Definition: Payment.php:1357
setCcSecureVerify($ccSecureVerify)
Definition: Payment.php:2206
setBaseAmountPaid($baseAmountPaid)
Definition: Payment.php:2029
cancelInvoiceAndRegisterCancellation($invoice, $message)
Definition: Payment.php:1041
setAmountOrdered($amountOrdered)
Definition: Payment.php:2133
setCcDebugResponseBody($ccDebugResponseBody)
Definition: Payment.php:2359
setBaseAmountRefundedOnline($baseAmountRefundedOnline)
Definition: Payment.php:2061
setBaseAmountOrdered($baseAmountOrdered)
Definition: Payment.php:2101
setDataUsingMethod($key, $args=[])
Definition: DataObject.php:204
setAmountAuthorized($amountAuthorized)
Definition: Payment.php:2093
formatAmount($amount, $asFloat=false)
Definition: Payment.php:1297
setBaseAmountCanceled($baseAmountCanceled)
Definition: Payment.php:2141
setEcheckBankName($echeckBankName)
Definition: Payment.php:2182
importTransactionInfo(Transaction $transactionTo)
Definition: Payment.php:1208
setAccountStatus($accountStatus)
Definition: Payment.php:2343
_void($isOnline, $amount=null, $gatewayCallback='void')
Definition: Payment.php:1123
setEcheckAccountType($echeckAccountType)
Definition: Payment.php:2271
setExtensionAttributes(\Magento\Sales\Api\Data\OrderPaymentExtensionInterface $extensionAttributes)
Definition: Payment.php:2429
_getInvoiceForTransactionId($transactionId)
Definition: Payment.php:1433
setBaseAmountRefunded($baseAmountRefunded)
Definition: Payment.php:2125