Skip to content

fix: read the merchant name from lunar.checkout.merchant - #1

Merged
alecritson merged 1 commit into
mainfrom
fix/merchant-config-key
Sep 29, 2026
Merged

alecritson merged 1 commit into
mainfrom
fix/merchant-config-key

Conversation

@alecritson

Copy link
Copy Markdown
Contributor

Problem

CheckoutServiceProvider merges config/checkout.php under lunar.checkout, but three places read checkout.merchant:

  • the checkout header prop (CheckoutController::projectCheckout)
  • the root view's tab title (app.blade.php)
  • spec 0008

So CHECKOUT_MERCHANT, and a merchant set in a published config/lunar/checkout.php, were never used. The header always fell back to app.name. It only worked in Edwardes because the app sets config(['checkout.merchant' => ...]) directly. The tests set the same wrong key, so they passed anyway.

The processing page was separate: it rendered config('app.name', 'Store') and ignored the setting, so its header could show a different name from the checkout's.

Change

  • One private merchant() helper on the controller: lunar.checkout.merchant, falling back to app.name. Used by both the checkout and processing pages.
  • The root view's tab title reads lunar.checkout.merchant.
  • The tests and spec 0008 now use the real key.

Payment methods

I also checked what happens when a store installs checkout before it registers any payment method. It already behaves well: the page renders, the payment section shows "No payment methods are available." with pay disabled, and pay returns 422. A new test covers that, since none did.

Testing

  • The existing merchant tests now set lunar.checkout.merchant. On the old code, the header test fails.
  • New: the processing page shows the configured merchant. It fails on the old code and passes with the fix.
  • New: the checkout renders with no payment methods registered, and pay refuses with 422.
  • Full suite: 268 passed, 1 skipped. pint and phpstan are clean.

🤖 Generated with Claude Code

The package merges its config under `lunar.checkout`, but the checkout
header and the root view's tab title read `checkout.merchant`, so
CHECKOUT_MERCHANT and a published config value were never used. The
processing page ignored the setting altogether and showed `app.name`.

Both pages now resolve the name from one helper, and the tab title reads
the same key. Also pins that the checkout renders, and refuses to pay,
before any payment method is registered.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@alecritson
alecritson marked this pull request as ready for review September 29, 2026 13:11
@alecritson
alecritson merged commit 73bab22 into main Sep 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant