PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Services/Email/EmailPreviewService.php +47 -1 1.5.2 → 1.6.5 View file →
@@ -30,8 +30,18 @@
30 30 'trial_end_date' => DateTime::gmtNow()->addDays(3)->format('Y-m-d H:i:s'),
31 31 ],
32 32 ];
33 33
34 + if (Str::startsWith($template, 'order.reminder.renewal_overdue.')) {
35 + if (Str::contains($template, '.final.')) {
36 + $previewData['reminder']['stage'] = 'overdue_7';
37 + } elseif (Str::contains($template, '.followup.')) {
38 + $previewData['reminder']['stage'] = 'overdue_3';
39 + } else {
40 + $previewData['reminder']['stage'] = 'overdue_1';
41 + }
42 + }
43 +
34 44 if (Str::startsWith($template, 'subscription.')) {
35 45 $previewData['transaction'] = $subscription->getLatestTransaction();
36 46
37 47 if (Str::contains($template, 'trial_end')) {
@@ -37,8 +47,12 @@
37 47 if (Str::contains($template, 'trial_end')) {
38 48 $previewData['reminder']['stage'] = 'trial_end_3';
39 49 }
40 50
51 + if (Str::contains($template, 'renewal_failed')) {
52 + $previewData['error'] = __('Your card was declined.', 'fluent-cart');
53 + }
54 +
41 55 if (Str::contains($template, 'canceled')) {
42 56 $previewData['reason'] = __('canceled on customer request', 'fluent-cart');
43 57 $previewData['subscription'] = $this->getDummySubscription($previewData['order']);
44 58 }
@@ -81,9 +95,9 @@
81 95 {
82 96 $customer = $this->getDummyCustomer();
83 97 $transaction = $this->getDummyTransaction();
84 98
85 - return new class($customer, $transaction, new Collection()) {
99 + $order = new class($customer, $transaction, new Collection()) {
86 100 public $id = 1001;
87 101 public $uuid = 'preview-order-uuid';
88 102 public $invoice_no = 'FC-1001';
89 103 public $customer;
@@ -103,8 +117,9 @@
103 117 public $total_amount = 4900;
104 118 public $total_paid = 0;
105 119 public $total_refund = 0;
106 120 public $payment_status = 'pending';
121 + public $config = [];
107 122 private $latestTransaction;
108 123
109 124 public function __construct($customer, $transaction, $emptyCollection)
110 125 {
@@ -144,8 +159,26 @@
144 159 {
145 160 return '#';
146 161 }
147 162
163 + public function getMeta($metaKey, $defaultValue = false)
164 + {
165 + if ($metaKey === 'due_date') {
166 + return gmdate('Y-m-d H:i:s', strtotime('+7 days'));
167 + }
168 + return $defaultValue;
169 + }
170 +
171 + public function isReverseChargeTaxOrder()
172 + {
173 + return false;
174 + }
175 +
176 + public function getOrderRcMode()
177 + {
178 + return 'fixed';
179 + }
180 +
148 181 public function getLatestTransaction()
149 182 {
150 183 return $this->latestTransaction;
151 184 }
@@ -159,8 +192,14 @@
159 192 {
160 193 return new Collection([]);
161 194 }
162 195 };
196 +
197 + // Templates reach the order through the transaction too (e.g. the
198 + // renewal admin email's $transaction->order->getViewUrl('admin')).
199 + $transaction->order = $order;
200 +
201 + return $order;
163 202 }
164 203
165 204 private function getDummySubscription($order): object
166 205 {
@@ -170,8 +209,9 @@
170 209 return new class($customer, $transaction, $order) {
171 210 public $id = 2001;
172 211 public $uuid = 'preview-subscription-uuid';
173 212 public $item_name = 'Sample Subscription';
213 + public $display_item_name = 'Sample Subscription';
174 214 public $billing_interval = 'yearly';
175 215 public $next_billing_date;
176 216 public $recurring_total = 4900;
177 217 public $status = 'active';
@@ -184,8 +224,9 @@
184 224 {
185 225 $this->customer = $customer;
186 226 $this->latestTransaction = $transaction;
187 227 $this->order = $order;
228 + $transaction->order = $order;
188 229 $this->next_billing_date = \FluentCart\App\Services\DateTime\DateTime::gmtNow()->addDays(30)->format('Y-m-d H:i:s');
189 230 $this->trial_ends_at = \FluentCart\App\Services\DateTime\DateTime::gmtNow()->addDays(3)->format('Y-m-d H:i:s');
190 231 }
191 232
@@ -201,8 +242,13 @@
201 242
202 243 public function getReactivateUrl()
203 244 {
204 245 return '#';
246 + }
247 +
248 + public function getPaymentMethodText()
249 + {
250 + return 'Visa ***4242';
205 251 }
206 252 };
207 253 }
208 254 }