@pandait.tech/payment-nuvei 1.1.2 → 1.1.4
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/handlers/index.cjs
CHANGED
|
@@ -899,8 +899,9 @@ function createWebhookHandler(deps) {
|
|
|
899
899
|
const currentStatus = orderDoc.data()?.status;
|
|
900
900
|
const finalStatuses = ["paid", "delivered", "shipped", "refunded"];
|
|
901
901
|
const statusDetail = Number(transaction.status_detail);
|
|
902
|
-
const
|
|
903
|
-
const
|
|
902
|
+
const currentStatusRaw = transaction.current_status;
|
|
903
|
+
const isPendingNotice = typeof currentStatusRaw === "string" && currentStatusRaw.toUpperCase() === "PENDING" || [1, 31, 35, 36, 37].includes(statusDetail);
|
|
904
|
+
const shouldUpdateStatus = isApproved || !isPendingNotice && !finalStatuses.includes(currentStatus);
|
|
904
905
|
const orderData = orderDoc.data() ?? {};
|
|
905
906
|
const webhookAuthCode = transaction.authorization_code;
|
|
906
907
|
const hasValidAuthCode = typeof webhookAuthCode === "string" && webhookAuthCode.trim().length > 0 && webhookAuthCode !== "null";
|