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
magento2-base
dev
tests
integration
testsuite
Magento
Paypal
_files
order_express_payment_action_order.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Sales\Model\Order
;
9
use
Magento\TestFramework\Helper\Bootstrap
;
10
use
Magento\Sales\Api\OrderRepositoryInterface
;
11
use
Magento\Sales\Api\TransactionRepositoryInterface
;
12
use
Magento\Sales\Model\Order\Payment\Transaction
;
13
use
Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface
as TransactionBuilder;
14
use
Magento\Sales\Model\Order\Item
;
15
16
require
__DIR__
.
'/order_express.php'
;
17
require
__DIR__
.
'/../../../Magento/Catalog/_files/product_simple.php'
;
18
19
$objectManager
= Bootstrap::getObjectManager();
20
22
$transactionBuilder
=
$objectManager
->create(TransactionBuilder::class);
23
$transaction
=
$transactionBuilder
->setPayment(
$payment
)
24
->setOrder(
$order
)
25
->setTransactionId(1)
26
->build(Transaction::TYPE_ORDER);
27
28
$transactionRepository
=
$objectManager
->create(TransactionRepositoryInterface::class);
29
$transactionRepository
->save(
$transaction
);
30
32
$orderItem
=
$objectManager
->create(Item::class);
33
$orderItem
->setProductId(
$product
->getId())->setQtyOrdered(1);
34
$orderItem
->setBasePrice(
$product
->getPrice());
35
$orderItem
->setPrice(
$product
->getPrice());
36
$orderItem
->setRowTotal(
$product
->getPrice());
37
$orderItem
->setRowTotalInclTax(
$product
->getPrice());
38
$orderItem
->setBaseRowTotal(
$product
->getPrice());
39
$orderItem
->setBaseRowTotalInclTax(
$product
->getPrice());
40
$orderItem
->setBaseRowInvoiced(
$product
->getPrice());
41
$orderItem
->setProductType(
'simple'
);
42
43
$totalAmount
=
$product
->getPrice();
44
46
$order
->addItem(
$orderItem
)
47
->setSubtotal(
$totalAmount
)
48
->setBaseSubtotal(
$totalAmount
)
49
->setBaseGrandTotal(
$totalAmount
)
50
->setGrandTotal(
$totalAmount
);
51
53
$orderRepository
=
$objectManager
->get(OrderRepositoryInterface::class);
54
$orderRepository
->save(
$order
);
$transactionRepository
$transactionRepository
Definition:
order_express_payment_action_order.php:28
$objectManager
$objectManager
Definition:
order_express_payment_action_order.php:19
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
Magento\Sales\Model\Order
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
Magento\Sales\Api\TransactionRepositoryInterface
Definition:
TransactionRepositoryInterface.php:15
$order
$order
Definition:
order.php:55
Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface
Definition:
BuilderInterface.php:18
$payment
$payment
Definition:
order.php:17
Magento\Sales\Model\Order\Item
Definition:
Item.php:25
Magento\Sales\Model\Order\Payment\Transaction
Definition:
Builder.php:7
$orderRepository
$orderRepository
Definition:
order_express_payment_action_order.php:53
$product
$product
Definition:
bundle_product_with_not_visible_children.php:22
$orderItem
$orderItem
Definition:
order_express_payment_action_order.php:32
$totalAmount
$totalAmount
Definition:
order_express_payment_action_order.php:43
$transaction
$transaction
Definition:
order_express_payment_action_order.php:23
Magento\Sales\Api\OrderRepositoryInterface
Definition:
OrderRepositoryInterface.php:17
$transactionBuilder
$transactionBuilder
Definition:
order_express_payment_action_order.php:22