@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.
|
@@ -161,6 +161,8 @@ interface NuveiWebhookPayload {
|
|
|
161
161
|
id: string;
|
|
162
162
|
status: string;
|
|
163
163
|
status_detail: number;
|
|
164
|
+
/** Desenlace en texto: APPROVED, CANCELLED, EXPIRED, REJECTED o PENDING. */
|
|
165
|
+
current_status?: string;
|
|
164
166
|
dev_reference: string;
|
|
165
167
|
amount: number;
|
|
166
168
|
authorization_code: string | null;
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -161,6 +161,8 @@ interface NuveiWebhookPayload {
|
|
|
161
161
|
id: string;
|
|
162
162
|
status: string;
|
|
163
163
|
status_detail: number;
|
|
164
|
+
/** Desenlace en texto: APPROVED, CANCELLED, EXPIRED, REJECTED o PENDING. */
|
|
165
|
+
current_status?: string;
|
|
164
166
|
dev_reference: string;
|
|
165
167
|
amount: number;
|
|
166
168
|
authorization_code: string | null;
|
package/dist/handlers/index.js
CHANGED
|
@@ -893,8 +893,9 @@ function createWebhookHandler(deps) {
|
|
|
893
893
|
const currentStatus = orderDoc.data()?.status;
|
|
894
894
|
const finalStatuses = ["paid", "delivered", "shipped", "refunded"];
|
|
895
895
|
const statusDetail = Number(transaction.status_detail);
|
|
896
|
-
const
|
|
897
|
-
const
|
|
896
|
+
const currentStatusRaw = transaction.current_status;
|
|
897
|
+
const isPendingNotice = typeof currentStatusRaw === "string" && currentStatusRaw.toUpperCase() === "PENDING" || [1, 31, 35, 36, 37].includes(statusDetail);
|
|
898
|
+
const shouldUpdateStatus = isApproved || !isPendingNotice && !finalStatuses.includes(currentStatus);
|
|
898
899
|
const orderData = orderDoc.data() ?? {};
|
|
899
900
|
const webhookAuthCode = transaction.authorization_code;
|
|
900
901
|
const hasValidAuthCode = typeof webhookAuthCode === "string" && webhookAuthCode.trim().length > 0 && webhookAuthCode !== "null";
|