@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.
package/dist/handlers/index.cjs
CHANGED
|
@@ -897,8 +897,10 @@ function createWebhookHandler(deps) {
|
|
|
897
897
|
}
|
|
898
898
|
const isApproved = transaction.status === "success" && transaction.status_detail === 3;
|
|
899
899
|
const currentStatus = orderDoc.data()?.status;
|
|
900
|
-
const finalStatuses = ["paid", "delivered", "shipped"];
|
|
901
|
-
const
|
|
900
|
+
const finalStatuses = ["paid", "delivered", "shipped", "refunded"];
|
|
901
|
+
const statusDetail = Number(transaction.status_detail);
|
|
902
|
+
const isAuthPending = statusDetail === 36 || statusDetail === 37;
|
|
903
|
+
const shouldUpdateStatus = isApproved || !isAuthPending && !finalStatuses.includes(currentStatus);
|
|
902
904
|
const orderData = orderDoc.data() ?? {};
|
|
903
905
|
const webhookAuthCode = transaction.authorization_code;
|
|
904
906
|
const hasValidAuthCode = typeof webhookAuthCode === "string" && webhookAuthCode.trim().length > 0 && webhookAuthCode !== "null";
|