PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
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 2.0.1 All 84 releases
← All changes | app/Services/EmailTemplateSampleData.php +90 -0 3.0.2.8 → 3.0.16 View file →
@@ -25,8 +25,48 @@
25 25 if ($tripId !== null && $tripId > 0) {
26 26 $vars = self::mergeTripContext($tripId, $vars);
27 27 }
28 28
29 + if ($templateKey === 'trip_consent_request') {
30 + $vars['recipient_name'] = $vars['customer_name'] ?? __('Alex Traveler', 'yatra');
31 + $vars['form_name'] = __('Trip liability & release', 'yatra');
32 + $vars['consent_link'] = home_url('/trip-consent/preview-token/');
33 + $vars['expiry_notice_html'] = '<strong>' . esc_html__('This link expires soon.', 'yatra') . '</strong> '
34 + . esc_html__('Request a new email from the operator if needed.', 'yatra');
35 + $vars['consent_test_notice_html'] = '';
36 + }
37 +
38 + if ($templateKey === 'customer_email_verification') {
39 + $previewTok = defined('YATRA_EMAIL_VERIFICATION_PREVIEW_TOKEN')
40 + ? (string) YATRA_EMAIL_VERIFICATION_PREVIEW_TOKEN
41 + : 'preview-verify-token';
42 + $vars['verification_link'] = function_exists('yatra_get_email_verification_url')
43 + ? yatra_get_email_verification_url($previewTok)
44 + : home_url('/?yatra_verify_email=' . rawurlencode($previewTok));
45 + $vars['intro_paragraph'] = __('Thank you for registering. Click the button below to verify your email and activate your account.', 'yatra');
46 + $vars['footer_note'] = __('If you did not create an account, you can ignore this email.', 'yatra');
47 + $vars['expiry_notice_html'] = esc_html(
48 + sprintf(
49 + /* translators: %d: hours until link expiry */
50 + __('This verification link expires in %d hours for your security.', 'yatra'),
51 + 24
52 + )
53 + );
54 + }
55 +
56 + if ($templateKey === 'account_email_change_request') {
57 + $vars['new_email'] = '[email protected]';
58 + $vars['verification_link'] = home_url('/?yatra_email_token=preview-change-token');
59 + $vars['intro_paragraph'] = __('You recently requested to change the email address on your account. To confirm this new address, click the button below.', 'yatra');
60 + $vars['footer_note'] = __('If you did not request this change, you can safely ignore this email — your address will not change.', 'yatra');
61 + }
62 +
63 + if ($templateKey === 'account_email_changed') {
64 + $vars['new_email'] = '[email protected]';
65 + $vars['intro_paragraph'] = __('The email address on your account was just changed. If this was you, no further action is needed.', 'yatra');
66 + $vars['footer_note'] = __('If you did not make this change, please contact us immediately.', 'yatra');
67 + }
68 +
29 69 /** @var array<string, string> $filtered */
30 70 $filtered = apply_filters('yatra_email_template_preview_variables', $vars, $templateKey, $tripId);
31 71
32 72 return TransactionalEmailTemplateService::mergeTemplateVariables($filtered);
@@ -38,8 +78,9 @@
38 78 private static function baseSamples(): array
39 79 {
40 80 $currency = SettingsService::getCurrency();
41 81 $travelSample = date_i18n(get_option('date_format'), strtotime('+14 days'));
82 + $specialSample = __('Late check-in after 10pm if possible.', 'yatra');
42 83
43 84 return [
44 85 'customer_name' => __('Alex Traveler', 'yatra'),
45 86 'customer_first_name' => 'Alex',
@@ -44,8 +85,9 @@
44 85 'customer_name' => __('Alex Traveler', 'yatra'),
45 86 'customer_first_name' => 'Alex',
46 87 'customer_last_name' => __('Traveler', 'yatra'),
47 88 'customer_email' => '[email protected]',
89 + 'new_email' => '[email protected]',
48 90 'customer_phone' => '+1 555 0100',
49 91 'booking_reference' => 'YTR-PREVIEW-001',
50 92 'booking_id' => '42',
51 93 'trip_id' => '101',
@@ -53,8 +95,17 @@
53 95 'travel_date' => $travelSample,
54 96 'travelers_count' => '2',
55 97 'total_amount_formatted' => yatra_format_price(2499.0, $currency),
56 98 'amount_due_formatted' => yatra_format_price(499.0, $currency),
99 + // Aliases for the same monetary values — keep the preview
100 + // consistent regardless of which spelling the template
101 + // uses ({{total_amount}} vs {{total_amount_formatted}},
102 + // {{balance_due}} vs {{amount_due_formatted}}, etc.).
103 + 'total_amount' => yatra_format_price(2499.0, $currency),
104 + 'balance_due' => yatra_format_price(499.0, $currency),
105 + 'amount_due' => yatra_format_price(499.0, $currency),
106 + 'amount_paid' => yatra_format_price(2000.0, $currency),
107 + 'amount_paid_formatted' => yatra_format_price(2000.0, $currency),
57 108 'currency' => $currency,
58 109 'booking_status' => __('confirmed', 'yatra'),
59 110 'payment_status' => __('pending', 'yatra'),
60 111 'intro_paragraph' => __('Thank you for your booking. This preview uses sample data.', 'yatra'),
@@ -72,8 +123,47 @@
72 123 'booking_url' => home_url('/my-account/bookings/42'),
73 124 'message' => __('Could you confirm whether airport pickup is included on day one?', 'yatra'),
74 125 'response' => __('Hi Alex, yes — pickup is included for all guests. Safe travels!', 'yatra'),
75 126 'original_message' => __('Interested in the April departure dates.', 'yatra'),
127 + 'expiry_policy_note' => __('Unpaid bookings are released after the deadline.', 'yatra'),
128 + 'scheduled_amount_formatted' => yatra_format_price(750.0, $currency),
129 + 'scheduled_date_formatted' => date_i18n(get_option('date_format'), strtotime('+5 days')),
130 + 'payment_type_label' => __('Installment', 'yatra'),
131 + 'scheduled_payment_id' => '9',
132 + 'balance_after_formatted' => yatra_format_price(1749.0, $currency),
133 + 'failure_reason' => __('Card declined (insufficient funds).', 'yatra'),
134 + 'failure_intro_html' => '<p style="margin:0;">'
135 + . esc_html__('We could not process your scheduled payment.', 'yatra')
136 + . '</p>',
137 + 'failure_followup_html' => esc_html__(
138 + 'Please update your payment method or contact us so we can retry before your booking is affected.',
139 + 'yatra'
140 + ),
141 + 'recovery_intro_html' => '<p style="margin:0;">'
142 + . esc_html__('You left items in your cart — your trip is still available to book.', 'yatra')
143 + . '</p>',
144 + 'recovery_reminder_label' => __('48 hours left at this price', 'yatra'),
145 + 'recovery_link' => home_url('/book/preview-recovery/'),
146 + 'payment_gateway' => 'stripe',
147 + 'payment_gateway_label' => 'Stripe',
148 + 'payment_schedule' => 'deposit',
149 + 'payment_schedule_label' => __('Deposit (balance due later)', 'yatra'),
150 + 'travelers_list' => "1. Alex Traveler (" . __('Lead', 'yatra') . ")\n2. Sam Guest",
151 + 'travelers_list_html' => '<ul style="margin:8px 0;padding-left:20px;">'
152 + . '<li style="margin:4px 0;">Alex Traveler <span style="color:#64748b;font-size:12px;">(' . esc_html__('Lead', 'yatra') . ')</span></li>'
153 + . '<li style="margin:4px 0;">Sam Guest</li></ul>',
154 + 'traveler_custom_fields_html' => '<div style="margin:12px 0 0;">'
155 + . '<p style="margin:0 0 6px;font-weight:600;">' . esc_html__('Traveler 1 — Alex Traveler', 'yatra') . '</p>'
156 + . '<table role="presentation" cellpadding="0" cellspacing="0" style="width:100%;border-collapse:collapse;">'
157 + . '<tr><td style="padding:4px 12px 4px 0;vertical-align:top;color:#64748b;width:40%;">' . esc_html__('Dietary Requirements', 'yatra') . '</td>'
158 + . '<td style="padding:4px 0;vertical-align:top;">' . esc_html__('Vegetarian', 'yatra') . '</td></tr></table></div>',
159 + 'booking_custom_fields_html' => '<div style="margin:12px 0 0;">'
160 + . '<p style="margin:0 0 6px;font-weight:600;">' . esc_html__('Additional services', 'yatra') . '</p>'
161 + . '<ul style="margin:0;padding-left:20px;">'
162 + . '<li style="margin:4px 0;">' . esc_html__('Airport transfer', 'yatra') . ' — ' . esc_html(yatra_format_price(45.0, $currency)) . '</li>'
163 + . '</ul></div>',
164 + 'special_requests' => $specialSample,
165 + 'special_requests_html' => nl2br(esc_html($specialSample)),
76 166 ];
77 167 }
78 168
79 169 /**