Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-sales
Model
Order
Payment
Operations
AuthorizeOperation.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Sales\Model\Order\Payment\Operations
;
7
8
use
Magento\Sales\Api\Data\OrderPaymentInterface
;
9
use
Magento\Sales\Model\Order
;
10
use
Magento\Sales\Model\Order\Payment
;
11
use
Magento\Sales\Model\Order\Payment\Transaction
;
12
13
class
AuthorizeOperation
extends
AbstractOperation
14
{
23
public
function
authorize
(
OrderPaymentInterface
$payment
, $isOnline,
$amount
)
24
{
25
// check for authorization amount to be equal to grand total
29
$payment
->setShouldCloseParentTransaction(
false
);
30
$isSameCurrency =
$payment
->isSameCurrency();
31
if
(!$isSameCurrency || !
$payment
->isCaptureFinal(
$amount
)) {
32
$payment
->setIsFraudDetected(
true
);
33
}
34
35
// update totals
36
$amount
=
$payment
->formatAmount(
$amount
,
true
);
37
$payment
->setBaseAmountAuthorized(
$amount
);
38
39
// do authorization
40
$order
=
$payment
->getOrder();
41
if
($isOnline) {
42
// invoke authorization on gateway
43
$method
=
$payment
->getMethodInstance();
44
$method
->setStore(
$order
->getStoreId());
45
$method
->authorize(
$payment
,
$amount
);
46
}
47
48
$message
= $this->stateCommand->execute(
$payment
,
$amount
,
$order
);
49
// update transactions, order state and add comments
50
$transaction
=
$payment
->addTransaction(
Transaction::TYPE_AUTH
);
51
$message
=
$payment
->prependMessage(
$message
);
52
$payment
->addTransactionCommentsToOrder(
$transaction
,
$message
);
53
54
return
$payment
;
55
}
56
}
$transaction
$transaction
Definition:
partial_invoice.php:43
Magento\Sales\Api\Data\OrderPaymentInterface
Definition:
OrderPaymentInterface.php:17
Magento\Sales\Model\Order
Magento\Sales\Model\Order\Payment\Operations\AuthorizeOperation
Definition:
AuthorizeOperation.php:13
Magento\Sales\Api\Data\TransactionInterface\TYPE_AUTH
const TYPE_AUTH
Definition:
TransactionInterface.php:25
$order
$order
Definition:
order.php:55
Magento\Sales\Model\Order\Payment\authorize
authorize($isOnline, $amount)
Definition:
Payment.php:1105
$message
$message
Definition:
notifications.php:7
$amount
$amount
Definition:
order.php:14
$payment
$payment
Definition:
order.php:17
Magento\Sales\Model\Order\Payment\Operations
Definition:
AbstractOperation.php:6
Magento\Sales\Model\Order\Payment\Transaction
Definition:
Builder.php:7
$method
$method
Definition:
info.phtml:13
Magento\Sales\Model\Order\Payment\Operations\AbstractOperation
Definition:
AbstractOperation.php:19
Magento\Sales\Model\Order\Payment
Definition:
RepositoryTest.php:6