77use Fintecture \Payment \Helper \Fintecture as FintectureHelper ;
88use Fintecture \Payment \Logger \Logger ;
99use Magento \Framework \DB \Transaction ;
10- use Magento \Sales \Api \Data \TransactionInterface ;
1110use Magento \Sales \Api \InvoiceRepositoryInterface ;
1211use Magento \Sales \Api \OrderManagementInterface ;
1312use Magento \Sales \Api \OrderPaymentRepositoryInterface ;
@@ -140,6 +139,8 @@ public function create(
140139 $ payment ->setAmountPaid ($ paidAmount );
141140 $ payment ->setBaseAmountPaid ($ basePaidAmount );
142141
142+ $ payment ->setTransactionId ($ params ['sessionId ' ]);
143+
143144 $ this ->paymentRepository ->save ($ payment );
144145
145146 $ transaction = $ this ->transactionBuilder ->setPayment ($ payment )
@@ -153,7 +154,7 @@ public function create(
153154 'type ' => $ params ['type ' ],
154155 ]])
155156 ->setFailSafe (true )
156- ->build (TransactionInterface ::TYPE_CAPTURE );
157+ ->build (Payment \Transaction ::TYPE_CAPTURE );
157158
158159 $ this ->transactionRepository ->save ($ transaction );
159160
@@ -208,14 +209,15 @@ public function sendInvoice(Order $order, array $params): void
208209 if ($ this ->fintectureHelper ->isStatusAlreadyFinal ($ order )
209210 && $ order ->canInvoice () && $ this ->config ->isInvoicingActive ()) {
210211 $ invoice = $ this ->invoiceService ->prepareInvoice ($ order );
212+ $ invoice ->setRequestedCaptureCase (Order \Invoice::CAPTURE_ONLINE );
211213 $ invoice ->setTransactionId ($ params ['sessionId ' ]);
212214 $ invoice ->register ();
213215 $ invoice ->pay ();
214216 $ this ->invoiceRepository ->save ($ invoice );
215- $ transactionSave = $ this ->transaction
217+ $ transaction = $ this ->transaction
216218 ->addObject ($ invoice )
217219 ->addObject ($ invoice ->getOrder ());
218- $ transactionSave ->save ();
220+ $ transaction ->save ();
219221 // Send Invoice mail to customer
220222 $ this ->invoiceSender ->send ($ invoice );
221223
0 commit comments