PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.17
Yatra – Travel Booking & Tour Operator Software v3.0.17
3.0.17 3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 All 85 releases
← All changes | resources/js/pages/PaymentForm.tsx +15 -13 3.0.5 → 3.0.17 View file →
@@ -7,8 +7,9 @@
7 7 import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
8 8 import { ArrowLeft, Save, Loader2, Info } from "lucide-react";
9 9 import { __ } from "../lib/i18n";
10 10 import { apiService } from "../lib/api-client";
11 +import { todayYmd } from "../lib/dateFormat";
11 12 import { usePermissions } from "../hooks/usePermissions";
12 13 import { Button } from "../components/ui/button";
13 14 import { Input } from "../components/ui/input";
14 15 import { Select } from "../components/ui/select";
@@ -28,9 +29,9 @@
28 29 interface PaymentFormData {
29 30 booking_id: string;
30 31 amount: string;
31 32 payment_method: string;
32 - payment_status: "pending" | "completed" | "failed" | "refunded" | "partial";
33 + payment_status: "pending" | "completed" | "failed" | "refunded";
33 34 payment_date: string;
34 35 transaction_id: string;
35 36 notes: string;
36 37 }
@@ -41,10 +42,13 @@
41 42 const [formData, setFormData] = useState<PaymentFormData>({
42 43 booking_id: "",
43 44 amount: "",
44 45 payment_method: "Credit Card",
45 - payment_status: "pending",
46 - payment_date: new Date().toISOString().split("T")[0],
46 + // A payment recorded by hand is money already received. Only completed
47 + // payments count towards the booking's paid amount / balance and trigger
48 + // the "payment received" emails and events, so that is the default.
49 + payment_status: "completed",
50 + payment_date: todayYmd(),
47 51 transaction_id: "",
48 52 notes: "",
49 53 });
50 54 const [errors, setErrors] = useState<Record<string, string>>({});
@@ -83,9 +87,9 @@
83 87 const processedAt = data.processed_at;
84 88 const processedDate =
85 89 typeof processedAt === "string" && processedAt.includes(" ")
86 90 ? processedAt.split(" ")[0]
87 - : new Date().toISOString().split("T")[0];
91 + : todayYmd();
88 92 return {
89 93 id: data.id,
90 94 booking_id: data.booking_id,
91 95 amount: data.amount,
@@ -107,11 +111,9 @@
107 111 amount: String(paymentData.amount ?? ""),
108 112 payment_method: String(paymentData.payment_method || "Credit Card"),
109 113 payment_status: (String(paymentData.payment_status || "pending") ||
110 114 "pending") as PaymentFormData["payment_status"],
111 - payment_date: String(
112 - paymentData.payment_date || new Date().toISOString().split("T")[0],
113 - ),
115 + payment_date: String(paymentData.payment_date || todayYmd()),
114 116 transaction_id: String(paymentData.transaction_id ?? ""),
115 117 notes: String(paymentData.notes ?? ""),
116 118 });
117 119 }
@@ -514,24 +516,24 @@
514 516 e.target.value as PaymentFormData["payment_status"],
515 517 )
516 518 }
517 519 >
518 - <option value="pending">{__("Pending", "yatra")}</option>
519 520 <option value="completed">
520 521 {__("Completed", "yatra")}
521 522 </option>
522 - <option value="partial">{__("Partial", "yatra")}</option>
523 + <option value="pending">{__("Pending", "yatra")}</option>
523 524 <option value="failed">{__("Failed", "yatra")}</option>
524 525 <option value="refunded">{__("Refunded", "yatra")}</option>
525 526 </Select>
526 527 <p className="text-xs text-gray-500 dark:text-gray-400">
527 528 {formData.payment_status === "completed" &&
528 - __("Payment has been successfully processed.", "yatra")}
529 + __(
530 + "Money received. Counts towards the booking's paid amount and remaining balance, and sends the payment-received emails (partial or full, depending on what is still due).",
531 + "yatra",
532 + )}
529 533 {formData.payment_status === "pending" &&
530 - __("Payment is pending confirmation.", "yatra")}
531 - {formData.payment_status === "partial" &&
532 534 __(
533 - "Partial payment recorded. Balance may be pending.",
535 + "Expected but not received yet. Does not change the booking's balance and sends nothing — mark it Completed when the money arrives.",
534 536 "yatra",
535 537 )}
536 538 {formData.payment_status === "failed" &&
537 539 __(