2121use Magento \Payment \Gateway \Data \PaymentDataObjectInterface ;
2222
2323/**
24- * Class CaptureStrategyCommand
24+ * Braintree capture implementation.
25+ *
2526 * @SuppressWarnings(PHPMD)
2627 */
2728class CaptureStrategyCommand implements CommandInterface
@@ -84,7 +85,7 @@ class CaptureStrategyCommand implements CommandInterface
8485 * @param FilterBuilder $filterBuilder
8586 * @param SearchCriteriaBuilder $searchCriteriaBuilder
8687 * @param SubjectReader $subjectReader
87- * @param BraintreeAdapterFactory $braintreeAdapterFactory,
88+ * @param BraintreeAdapterFactory $braintreeAdapterFactory
8889 * @param BraintreeSearchAdapter $braintreeSearchAdapter
8990 */
9091 public function __construct (
@@ -112,9 +113,9 @@ public function execute(array $commandSubject)
112113 {
113114 /** @var \Magento\Payment\Gateway\Data\PaymentDataObjectInterface $paymentDO */
114115 $ paymentDO = $ this ->subjectReader ->readPayment ($ commandSubject );
115-
116116 $ command = $ this ->getCommand ($ paymentDO );
117- $ this ->commandPool ->get ($ command )->execute ($ commandSubject );
117+
118+ return $ this ->commandPool ->get ($ command )->execute ($ commandSubject );
118119 }
119120
120121 /**
@@ -128,11 +129,8 @@ private function getCommand(PaymentDataObjectInterface $paymentDO)
128129 $ payment = $ paymentDO ->getPayment ();
129130 ContextHelper::assertOrderPayment ($ payment );
130131
131- // if auth transaction does not exist then execute authorize& capture command
132+ // if capture transaction does not exist then execute capture command
132133 $ existsCapture = $ this ->isExistsCaptureTransaction ($ payment );
133- if (!$ payment ->getAuthorizationTransaction () && !$ existsCapture ) {
134- return self ::SALE ;
135- }
136134
137135 // do capture for authorization transaction
138136 if (!$ existsCapture && !$ this ->isExpiredAuthorization ($ payment , $ paymentDO ->getOrder ())) {
0 commit comments