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-braintree
Gateway
Request
RefundDataBuilder.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Braintree\Gateway\Request
;
7
8
use
Magento\Braintree\Gateway\SubjectReader
;
9
use
Magento\Payment\Gateway\Request\BuilderInterface
;
10
use Magento\Payment\Helper\Formatter;
11
use
Magento\Sales\Api\Data\TransactionInterface
;
12
use
Magento\Sales\Model\Order\Payment
;
13
14
class
RefundDataBuilder
implements
BuilderInterface
15
{
16
use Formatter;
17
21
private
$subjectReader;
22
28
public
function
__construct
(
SubjectReader
$subjectReader)
29
{
30
$this->subjectReader = $subjectReader;
31
}
32
39
public
function
build
(array $buildSubject)
40
{
41
$paymentDO = $this->subjectReader->readPayment($buildSubject);
42
44
$payment
= $paymentDO->getPayment();
45
46
$amount
=
null
;
47
try
{
48
$amount
= $this->formatPrice($this->subjectReader->readAmount($buildSubject));
49
}
catch
(\InvalidArgumentException $e) {
50
// pass
51
}
52
53
/*
54
* we should remember that Payment sets Capture txn id of current Invoice into ParentTransactionId Field
55
* We should also support previous implementations of Magento Braintree -
56
* and cut off '-capture' postfix from transaction ID to support backward compatibility
57
*/
58
$txnId = str_replace(
59
'-'
.
TransactionInterface::TYPE_CAPTURE
,
60
''
,
61
$payment
->getParentTransactionId()
62
);
63
64
return
[
65
'transaction_id'
=> $txnId,
66
PaymentDataBuilder::AMOUNT
=>
$amount
67
];
68
}
69
}
Magento\Braintree\Gateway\Request
Definition:
AddressDataBuilder.php:6
Magento\Braintree\Gateway\Request\PaymentDataBuilder\AMOUNT
const AMOUNT
Definition:
PaymentDataBuilder.php:25
Magento\Payment\Gateway\Request\BuilderInterface
Definition:
BuilderInterface.php:14
Magento\Sales\Api\Data\TransactionInterface\TYPE_CAPTURE
const TYPE_CAPTURE
Definition:
TransactionInterface.php:27
$amount
$amount
Definition:
order.php:14
$payment
$payment
Definition:
order.php:17
Magento\Braintree\Gateway\Request\RefundDataBuilder\__construct
__construct(SubjectReader $subjectReader)
Definition:
RefundDataBuilder.php:28
Magento\Payment\Gateway\Request\BuilderInterface\build
build(array $buildSubject)
Magento\Sales\Api\Data\TransactionInterface
Definition:
TransactionInterface.php:15
Magento\Braintree\Gateway\Request\RefundDataBuilder
Definition:
RefundDataBuilder.php:14
Magento\Sales\Model\Order\Payment
Definition:
RepositoryTest.php:6
Magento\Braintree\Gateway\SubjectReader
Definition:
SubjectReader.php:16