Last active
May 29, 2024 09:36
-
-
Save snez/cc976fd41ea7aef84e52fff4b9162a0c to your computer and use it in GitHub Desktop.
Multi-capture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/app/code/StripeIntegration/Payments/Helper/Generic.php b/src/app/code/StripeIntegration/Payments/Helper/Generic.php | |
index 37029bd91..ad23b5f78 100644 | |
--- a/src/app/code/StripeIntegration/Payments/Helper/Generic.php | |
+++ b/src/app/code/StripeIntegration/Payments/Helper/Generic.php | |
@@ -1858,7 +1858,10 @@ class Generic | |
try | |
{ | |
$this->cache->save($value = "1", $key, ["stripe_payments"], $lifetime = 60 * 60); | |
- $paymentObject->capture(array($amountToCapture => $stripeAmount)); | |
+ $paymentObject->capture([ | |
+ $amountToCapture => $stripeAmount, | |
+ "final_capture" => ($paymentObject->amount_capturable == $stripeAmount) | |
+ ]); | |
} | |
catch (\Exception $e) | |
{ | |
diff --git a/src/app/code/StripeIntegration/Payments/Model/PaymentIntent.php b/src/app/code/StripeIntegration/Payments/Model/PaymentIntent.php | |
index f1fd81dac..afe60bf33 100644 | |
--- a/src/app/code/StripeIntegration/Payments/Model/PaymentIntent.php | |
+++ b/src/app/code/StripeIntegration/Payments/Model/PaymentIntent.php | |
@@ -298,7 +298,13 @@ class PaymentIntent extends \Magento\Framework\Model\AbstractModel | |
$wechatOptions["wechat_pay"]["client"] = $this->paymentIntentHelper->getWechatClient(); | |
- return array_merge_recursive($sfuOptions, $captureOptions, $wechatOptions); | |
+ $multiCaptureOptions = [ | |
+ 'card' => [ | |
+ 'request_multicapture' => 'if_available' | |
+ ] | |
+ ]; | |
+ | |
+ return array_merge_recursive($sfuOptions, $captureOptions, $wechatOptions, $multiCaptureOptions); | |
} | |
public function getMultishippingParamsFrom($quote, $orders, $paymentMethodId) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment