@pandait.tech/payment-nuvei 1.1.1 → 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
|
@@ -898,7 +898,10 @@ function createWebhookHandler(deps) {
|
|
|
898
898
|
const isApproved = transaction.status === "success" && transaction.status_detail === 3;
|
|
899
899
|
const currentStatus = orderDoc.data()?.status;
|
|
900
900
|
const finalStatuses = ["paid", "delivered", "shipped", "refunded"];
|
|
901
|
-
const
|
|
901
|
+
const statusDetail = Number(transaction.status_detail);
|
|
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);
|
|
902
905
|
const orderData = orderDoc.data() ?? {};
|
|
903
906
|
const webhookAuthCode = transaction.authorization_code;
|
|
904
907
|
const hasValidAuthCode = typeof webhookAuthCode === "string" && webhookAuthCode.trim().length > 0 && webhookAuthCode !== "null";
|