@flopay/react 0.5.11 → 0.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3150,6 +3150,7 @@ function FloPayCheckout({
3150
3150
  );
3151
3151
  }
3152
3152
  const paymentMethodId = typeof paymentIntent.payment_method === "string" ? paymentIntent.payment_method : paymentIntent.payment_method?.id;
3153
+ let finalResultStatus = resultStatus;
3153
3154
  if (resumeState.sessionId) {
3154
3155
  const resumeApi = new import_js2.PaymentAPI(resolvedBillingUrl);
3155
3156
  const resumeSessionResult = await resumeApi.getUnifiedCheckoutSession(resumeState.sessionId);
@@ -3172,13 +3173,14 @@ function FloPayCheckout({
3172
3173
  { checkoutMethod: "paypal" }
3173
3174
  );
3174
3175
  }
3176
+ finalResultStatus = processResult.result.status;
3175
3177
  }
3176
3178
  }
3177
3179
  if (resumeState.sessionId) markSessionRecentlyCompleted(resumeState.sessionId);
3178
3180
  setModeOverlayStatus("success");
3179
3181
  await sleep(PROCESSING_OVERLAY_SUCCESS_DELAY_MS);
3180
3182
  onCompleteRef.current?.({
3181
- status: resultStatus,
3183
+ status: finalResultStatus,
3182
3184
  paymentIntentId: paymentIntent.id,
3183
3185
  paymentMethodId,
3184
3186
  checkoutMethod: "paypal"
@@ -5109,13 +5111,14 @@ function FloPayAutomaticPaymentButton({
5109
5111
  }
5110
5112
  const api = new import_js3.PaymentAPI(resolvedBillingUrl);
5111
5113
  const sessionResult = await api.getUnifiedCheckoutSession(resumeState.sessionId);
5112
- const resumeSession = sessionResult.data.session;
5114
+ let resumeSession = sessionResult.data.session;
5113
5115
  if (!resumeSession) {
5114
5116
  throw Object.assign(
5115
5117
  new import_shared10.FloPayError("Could not load session to capture PayPal payment.", "api_error"),
5116
5118
  { checkoutMethod: "paypal" }
5117
5119
  );
5118
5120
  }
5121
+ let finalResultStatus = resultStatus;
5119
5122
  if (resumeSession.status !== "complete") {
5120
5123
  const processResult = await processSavedPaymentForMode({
5121
5124
  billingApiUrl: resolvedBillingUrl,
@@ -5134,10 +5137,18 @@ function FloPayAutomaticPaymentButton({
5134
5137
  { checkoutMethod: "paypal" }
5135
5138
  );
5136
5139
  }
5140
+ finalResultStatus = processResult.result.status;
5141
+ try {
5142
+ const refreshed = await api.getUnifiedCheckoutSession(resumeState.sessionId);
5143
+ if (refreshed.data.session) {
5144
+ resumeSession = refreshed.data.session;
5145
+ }
5146
+ } catch {
5147
+ }
5137
5148
  }
5138
5149
  await showSuccess({
5139
5150
  result: {
5140
- status: resultStatus,
5151
+ status: finalResultStatus,
5141
5152
  paymentIntentId: paymentIntent.id,
5142
5153
  paymentMethodId: paymentMethodId2,
5143
5154
  checkoutMethod: "paypal"