21
21
use Magento \Payment \Gateway \Data \PaymentDataObjectInterface ;
22
22
23
23
/**
24
- * Class CaptureStrategyCommand
24
+ * Braintree capture implementation.
25
+ *
25
26
* @SuppressWarnings(PHPMD)
26
27
*/
27
28
class CaptureStrategyCommand implements CommandInterface
@@ -84,7 +85,7 @@ class CaptureStrategyCommand implements CommandInterface
84
85
* @param FilterBuilder $filterBuilder
85
86
* @param SearchCriteriaBuilder $searchCriteriaBuilder
86
87
* @param SubjectReader $subjectReader
87
- * @param BraintreeAdapterFactory $braintreeAdapterFactory,
88
+ * @param BraintreeAdapterFactory $braintreeAdapterFactory
88
89
* @param BraintreeSearchAdapter $braintreeSearchAdapter
89
90
*/
90
91
public function __construct (
@@ -112,9 +113,9 @@ public function execute(array $commandSubject)
112
113
{
113
114
/** @var \Magento\Payment\Gateway\Data\PaymentDataObjectInterface $paymentDO */
114
115
$ paymentDO = $ this ->subjectReader ->readPayment ($ commandSubject );
115
-
116
116
$ command = $ this ->getCommand ($ paymentDO );
117
- $ this ->commandPool ->get ($ command )->execute ($ commandSubject );
117
+
118
+ return $ this ->commandPool ->get ($ command )->execute ($ commandSubject );
118
119
}
119
120
120
121
/**
@@ -128,11 +129,8 @@ private function getCommand(PaymentDataObjectInterface $paymentDO)
128
129
$ payment = $ paymentDO ->getPayment ();
129
130
ContextHelper::assertOrderPayment ($ payment );
130
131
131
- // if auth transaction does not exist then execute authorize& capture command
132
+ // if capture transaction does not exist then execute capture command
132
133
$ existsCapture = $ this ->isExistsCaptureTransaction ($ payment );
133
- if (!$ payment ->getAuthorizationTransaction () && !$ existsCapture ) {
134
- return self ::SALE ;
135
- }
136
134
137
135
// do capture for authorization transaction
138
136
if (!$ existsCapture && !$ this ->isExpiredAuthorization ($ payment , $ paymentDO ->getOrder ())) {
0 commit comments