@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.mjs CHANGED
@@ -3113,6 +3113,7 @@ function FloPayCheckout({
3113
3113
  );
3114
3114
  }
3115
3115
  const paymentMethodId = typeof paymentIntent.payment_method === "string" ? paymentIntent.payment_method : paymentIntent.payment_method?.id;
3116
+ let finalResultStatus = resultStatus;
3116
3117
  if (resumeState.sessionId) {
3117
3118
  const resumeApi = new PaymentAPI2(resolvedBillingUrl);
3118
3119
  const resumeSessionResult = await resumeApi.getUnifiedCheckoutSession(resumeState.sessionId);
@@ -3135,13 +3136,14 @@ function FloPayCheckout({
3135
3136
  { checkoutMethod: "paypal" }
3136
3137
  );
3137
3138
  }
3139
+ finalResultStatus = processResult.result.status;
3138
3140
  }
3139
3141
  }
3140
3142
  if (resumeState.sessionId) markSessionRecentlyCompleted(resumeState.sessionId);
3141
3143
  setModeOverlayStatus("success");
3142
3144
  await sleep(PROCESSING_OVERLAY_SUCCESS_DELAY_MS);
3143
3145
  onCompleteRef.current?.({
3144
- status: resultStatus,
3146
+ status: finalResultStatus,
3145
3147
  paymentIntentId: paymentIntent.id,
3146
3148
  paymentMethodId,
3147
3149
  checkoutMethod: "paypal"
@@ -5072,13 +5074,14 @@ function FloPayAutomaticPaymentButton({
5072
5074
  }
5073
5075
  const api = new PaymentAPI3(resolvedBillingUrl);
5074
5076
  const sessionResult = await api.getUnifiedCheckoutSession(resumeState.sessionId);
5075
- const resumeSession = sessionResult.data.session;
5077
+ let resumeSession = sessionResult.data.session;
5076
5078
  if (!resumeSession) {
5077
5079
  throw Object.assign(
5078
5080
  new FloPayError7("Could not load session to capture PayPal payment.", "api_error"),
5079
5081
  { checkoutMethod: "paypal" }
5080
5082
  );
5081
5083
  }
5084
+ let finalResultStatus = resultStatus;
5082
5085
  if (resumeSession.status !== "complete") {
5083
5086
  const processResult = await processSavedPaymentForMode({
5084
5087
  billingApiUrl: resolvedBillingUrl,
@@ -5097,10 +5100,18 @@ function FloPayAutomaticPaymentButton({
5097
5100
  { checkoutMethod: "paypal" }
5098
5101
  );
5099
5102
  }
5103
+ finalResultStatus = processResult.result.status;
5104
+ try {
5105
+ const refreshed = await api.getUnifiedCheckoutSession(resumeState.sessionId);
5106
+ if (refreshed.data.session) {
5107
+ resumeSession = refreshed.data.session;
5108
+ }
5109
+ } catch {
5110
+ }
5100
5111
  }
5101
5112
  await showSuccess({
5102
5113
  result: {
5103
- status: resultStatus,
5114
+ status: finalResultStatus,
5104
5115
  paymentIntentId: paymentIntent.id,
5105
5116
  paymentMethodId: paymentMethodId2,
5106
5117
  checkoutMethod: "paypal"