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/NotificationService.php +27 -7 3.0.14.2 → 3.0.16 View file →
@@ -116,9 +116,17 @@
116 116 }
117 117
118 118 $vars = TransactionalEmailTemplateService::variablesFromBooking($booking);
119 119 $vars['payment_amount_formatted'] = yatra_format_price((float) ($paymentData['amount'] ?? 0));
120 - $vars['payment_method'] = (string) ($paymentData['payment_method'] ?? __('Online payment', 'yatra'));
120 + // Name the gateway the way the customer saw it at checkout (the
121 + // operator's Gateway Title), not its internal id — a Stripe capture
122 + // passes the slug "stripe" here. A manually recorded payment passes
123 + // free text ("Credit Card"), which is not a gateway id and is returned
124 + // unchanged.
125 + $vars['payment_method'] = yatra_payment_gateway_label(
126 + isset($paymentData['payment_method']) ? (string) $paymentData['payment_method'] : null,
127 + __('Online payment', 'yatra')
128 + );
121 129 $vars['transaction_id'] = (string) ($paymentData['transaction_id'] ?? '');
122 130
123 131 TransactionalEmailTemplateService::sendIfEnabled(
124 132 TransactionalEmailTemplateService::TYPE_ADMIN_PAYMENT_RECEIVED,
@@ -135,13 +143,18 @@
135 143 * until its operator opts in:
136 144 *
137 145 * 1. a balance is genuinely still outstanding on the booking,
138 146 * 2. deposits / partial payments are switched on at all, and
139 - * 3. the operator has enabled the separate part-payment template.
147 + * 3. the operator has enabled the separate part-payment template —
148 + * either the free "Partial Payment Received" toggle, or (Pro Email
149 + * Automation) the active "Partial Payment Received" DB template. On a
150 + * Pro site the Email → Templates switch only writes the Pro row, so
151 + * the free toggle stays at its default and must not be the sole gate.
140 152 */
141 153 private static function paymentTemplateTypeFor(object $booking): string
142 154 {
143 155 $full = TransactionalEmailTemplateService::TYPE_PAYMENT_CONFIRMATION;
156 + $partial = TransactionalEmailTemplateService::TYPE_PARTIAL_PAYMENT_RECEIVED;
144 157
145 158 // Nothing left to pay → this is the full-payment confirmation.
146 159 if ((float) ($booking->amount_due ?? 0) <= 0) {
147 160 return $full;
@@ -150,13 +163,12 @@
150 163 if (!yatra_partial_payments_enabled()) {
151 164 return $full;
152 165 }
153 166
154 - if (!SettingsService::isEnabled('email_template_partial_payment')) {
155 - return $full;
156 - }
167 + $partialEnabled = SettingsService::isEnabled('email_template_partial_payment')
168 + || (bool) apply_filters('yatra_pro_email_automation_owns_transactional_type', false, $partial);
157 169
158 - return TransactionalEmailTemplateService::TYPE_PARTIAL_PAYMENT_RECEIVED;
170 + return $partialEnabled ? $partial : $full;
159 171 }
160 172
161 173 /**
162 174 * Notify customer of payment received
@@ -171,9 +183,17 @@
171 183 }
172 184
173 185 $vars = TransactionalEmailTemplateService::variablesFromBooking($booking);
174 186 $vars['payment_amount_formatted'] = yatra_format_price((float) ($paymentData['amount'] ?? 0));
175 - $vars['payment_method'] = (string) ($paymentData['payment_method'] ?? __('Online payment', 'yatra'));
187 + // Name the gateway the way the customer saw it at checkout (the
188 + // operator's Gateway Title), not its internal id — a Stripe capture
189 + // passes the slug "stripe" here. A manually recorded payment passes
190 + // free text ("Credit Card"), which is not a gateway id and is returned
191 + // unchanged.
192 + $vars['payment_method'] = yatra_payment_gateway_label(
193 + isset($paymentData['payment_method']) ? (string) $paymentData['payment_method'] : null,
194 + __('Online payment', 'yatra')
195 + );
176 196 $vars['transaction_id'] = (string) ($paymentData['transaction_id'] ?? '');
177 197
178 198 TransactionalEmailTemplateService::sendIfEnabled(
179 199 self::paymentTemplateTypeFor($booking),