Feat: Show bank transfer instructions on order confirmation page
This commit is contained in:
@@ -190,6 +190,10 @@ class CheckoutTranslationsSeeder extends Seeder
|
||||
'Θέλεις να παρακολουθείς την παραγγελία σου; Δημιούργησε λογαριασμό ή',
|
||||
],
|
||||
'page.confirmation_billing' => ['Billing', 'Χρέωση'],
|
||||
'page.confirmation_bank_transfer_heading' => [
|
||||
'Bank transfer details',
|
||||
'Στοιχεία τραπεζικής μεταφοράς',
|
||||
],
|
||||
'page.confirmation_continue' => ['Continue shopping', 'Συνέχεια αγορών'],
|
||||
'page.box_now_locker_label' => [
|
||||
'Choose a Box Now locker',
|
||||
|
||||
@@ -28,6 +28,7 @@ use Modules\Core\Customer\Services\CustomerAccountService;
|
||||
use Modules\Core\Payment\Enums\PaymentResultStatus;
|
||||
use Modules\Core\Payment\Models\PaymentMethod;
|
||||
use Modules\Core\Shipping\Carriers\BoxNow\BoxNowClient;
|
||||
use Modules\Core\Store\Services\StoreDetailsService;
|
||||
|
||||
/**
|
||||
* The checkout page — one page, sections (contact / billing / shipping /
|
||||
@@ -554,6 +555,8 @@ class CheckoutController extends Controller
|
||||
return view('checkout::confirmation', [
|
||||
'order' => $order,
|
||||
'paymentMethodName' => $paymentMethodName,
|
||||
'bankTransferInstructions' => app(StoreDetailsService::class)
|
||||
->bankTransferInstructionsFor($order, $locale),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Event;
|
||||
use Lunar\Models\Language;
|
||||
use Lunar\Models\Order;
|
||||
use Modules\Core\Order\Services\OrderStatusFlow;
|
||||
use Modules\Core\Order\Support\OrderReferenceDisplay;
|
||||
use Modules\Core\Store\Events\StoreDetailsUpdated;
|
||||
use Modules\Core\Store\Models\StoreDetails;
|
||||
|
||||
@@ -39,8 +40,8 @@ class StoreDetailsService
|
||||
}
|
||||
|
||||
/**
|
||||
* Null for any non-bank-transfer order — the confirmation email only
|
||||
* shows this block when there's actually a wire to send (see
|
||||
* Null for any non-bank-transfer order — the confirmation email and page
|
||||
* only show this block when there's actually a wire to send (see
|
||||
* BankTransferPaymentDriver's own docblock for why a bank transfer
|
||||
* order stays at 'awaiting_payment' until staff confirm the wire
|
||||
* arrived). Null also when the store hasn't filled the field in for
|
||||
@@ -66,7 +67,30 @@ class StoreDetailsService
|
||||
return null;
|
||||
}
|
||||
|
||||
return RichContentRenderer::make($content)->toHtml();
|
||||
return $this->fillOrderReference(
|
||||
RichContentRenderer::make($content)->toHtml(),
|
||||
$order,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces a `{order_reference}` (or `{{ order_reference }}`) the shop
|
||||
* owner typed into the instructions with the order's display reference
|
||||
* (OrderReferenceDisplay — same form as the email subject).
|
||||
*
|
||||
* A plain text replace rather than RichContentRenderer::mergeTags():
|
||||
* that only fills genuine Tiptap mergeTag nodes, which this editor never
|
||||
* creates — Lunar's TranslatedText can't pass mergeTags() through to its
|
||||
* per-locale RichEditors, so the placeholder is always stored as
|
||||
* ordinary typed text.
|
||||
*/
|
||||
private function fillOrderReference(string $html, Order $order): string
|
||||
{
|
||||
return preg_replace(
|
||||
'/\{\{?\s*order_reference\s*\}\}?/',
|
||||
e(OrderReferenceDisplay::resolve($order)),
|
||||
$html,
|
||||
);
|
||||
}
|
||||
|
||||
public function update(array $attributes): StoreDetails
|
||||
|
||||
Reference in New Issue
Block a user