| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
-
- namespace App\Mail;
-
- use App\Models\Order;
- use Illuminate\Bus\Queueable;
- use Illuminate\Mail\Mailable;
- use Illuminate\Mail\Mailables\Address;
- use Illuminate\Mail\Mailables\Content;
- use Illuminate\Mail\Mailables\Envelope;
- use Illuminate\Queue\SerializesModels;
-
- /**
- * "Complete your payment": sent once to a shopper who placed an order but left the payment page without paying
- * (PaymentDoubleCheck). Written in the store's language.
- */
- class PaymentReminder extends Mailable
- {
- use Queueable, SerializesModels;
-
- public function __construct(public Order $order) {}
-
- public function envelope(): Envelope
- {
- $store = $this->order->store;
-
- return new Envelope(
- // Sent from our address (so it is delivered), but under the store's name, with replies going to the store.
- from: new Address((string) config('mail.from.address'), $store->name),
- replyTo: $store->contact_email !== null ? [new Address($store->contact_email, $store->name)] : [],
- subject: $store->language->value === 'ms'
- ? "Lengkapkan bayaran untuk pesanan #{$this->order->number} - {$store->name}"
- : "Complete your payment for order #{$this->order->number} - {$store->name}",
- );
- }
-
- public function content(): Content
- {
- $store = $this->order->store;
- $brand = StoreBrand::for($store);
-
- return new Content(
- // In the store's own colours, fonts and corners, so shoppers see the shop they ordered from.
- view: 'mail.orders.payment-reminder',
- text: 'mail.orders.payment-reminder-text',
- with: [
- 'order' => $this->order->loadMissing('items'),
- 'store' => $store,
- 'brand' => $brand,
- 'payUrl' => $brand->payUrl($this->order),
- 'orderUrl' => $brand->orderUrl($this->order),
- 'deadline' => $this->order->payment_expires_at
- ?->timezone('Asia/Kuala_Lumpur')
- ->locale($brand->malay ? 'ms' : 'en')
- ->translatedFormat('j F, g:i a'),
- ],
- );
- }
- }
|