PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Modules/PaymentMethods/StripeGateway/Webhook/Webhook.php +4 -3 1.6.4 → 1.6.5 View file →
@@ -104,8 +104,9 @@
104 104
105 105 public function processAndInsertOrderByEvent($event)
106 106 {
107 107 $eventType = $event->type;
108 + $eventLivemode = isset($event->livemode) ? (bool)$event->livemode : null;
108 109
109 110 $this->unresolvedReason = '';
110 111
111 112 $metaDataEvents = [
@@ -130,9 +131,9 @@
130 131
131 132 if ($eventType === 'setup_intent.succeeded') {
132 133 $setupIntentId = Arr::get((array)$vendorDataObject, 'id');
133 134 if ($setupIntentId) {
134 - $result = (new Confirmations())->confirmSetupIntent($setupIntentId);
135 + $result = (new Confirmations())->confirmSetupIntent($setupIntentId, null, StripeHelper::modeFromLivemode($eventLivemode));
135 136 if (!is_wp_error($result)) {
136 137 wp_send_json([
137 138 'message' => 'Setup intent confirmed successfully.',
138 139 ], 200);
@@ -147,9 +148,9 @@
147 148 //check if subscription billing_cycle invoice paid or failed
148 149 $isSubscriptionCycle = $vendorDataObject->billing_reason === 'subscription_cycle';
149 150 if ($isSubscriptionCycle) {
150 151 if ($eventType === 'invoice.paid') {
151 - $vendorDataObject = (new API())->getStripeObject('invoices/' . $vendorDataObject->id, ['expand' => ['payment_intent']]);
152 + $vendorDataObject = (new API())->getStripeObject('invoices/' . $vendorDataObject->id, ['expand' => ['payment_intent']], StripeHelper::modeFromLivemode($eventLivemode));
152 153 $createdOrder = $this->processSubscriptionRenewal($vendorDataObject);
153 154 if ($createdOrder) {
154 155 wp_send_json([
155 156 'message' => 'Subscription renewal processed successfully. Order ID: ' . $createdOrder->id,
@@ -164,9 +165,9 @@
164 165
165 166 if ($eventType === 'invoice.payment_failed') {
166 167 $isSubscriptionCycle = $vendorDataObject->billing_reason === 'subscription_cycle';
167 168 if ($isSubscriptionCycle) {
168 - $invoice = (new API())->getStripeObject('invoices/' . $vendorDataObject->id);
169 + $invoice = (new API())->getStripeObject('invoices/' . $vendorDataObject->id, [], StripeHelper::modeFromLivemode($eventLivemode));
169 170 if (!is_wp_error($invoice)) {
170 171 list($subscription, $parentOrder) = $this->resolveSubscriptionAndOrder($invoice);
171 172
172 173 if ($subscription && $parentOrder && $subscription->current_payment_method === 'stripe') {