@pandait.tech/payment-nuvei 1.1.0 → 1.1.2

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.
@@ -891,8 +891,10 @@ function createWebhookHandler(deps) {
891
891
  }
892
892
  const isApproved = transaction.status === "success" && transaction.status_detail === 3;
893
893
  const currentStatus = orderDoc.data()?.status;
894
- const finalStatuses = ["paid", "delivered", "shipped"];
895
- const shouldUpdateStatus = isApproved || !finalStatuses.includes(currentStatus);
894
+ const finalStatuses = ["paid", "delivered", "shipped", "refunded"];
895
+ const statusDetail = Number(transaction.status_detail);
896
+ const isAuthPending = statusDetail === 36 || statusDetail === 37;
897
+ const shouldUpdateStatus = isApproved || !isAuthPending && !finalStatuses.includes(currentStatus);
896
898
  const orderData = orderDoc.data() ?? {};
897
899
  const webhookAuthCode = transaction.authorization_code;
898
900
  const hasValidAuthCode = typeof webhookAuthCode === "string" && webhookAuthCode.trim().length > 0 && webhookAuthCode !== "null";