Skip to content

Commit 5bd9cbf

Browse files
committed
Got back to using the new Boot phase for the authorization
1 parent 02c4fe6 commit 5bd9cbf

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

packages/till/src/Listeners/AuthorizesLedgerTransactionsListener.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class AuthorizesLedgerTransactionsListener
1616
{
17-
#[On(Phase::Authorize)]
17+
#[On(Phase::Boot)]
1818
public function authorizeLedgerTransaction(Event $event): void
1919
{
2020
$reflection = new ReflectionClass($event);

packages/till/src/Providers/TillServiceProvider.php

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public function boot(): void
3030
app(Dispatcher::class)->register(new AuthorizesLedgerTransactionsListener);
3131
app(Dispatcher::class)->register(new ProcessesLedgerTransactionsListener);
3232
app(Dispatcher::class)->register(new ResetsAbilities);
33+
3334
if ($this->app->runningInConsole()) {
3435
$this->commands([
3536
InstallCommand::class,

packages/till/src/SubscriptionPlans/Abilities/Spend.php

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function __invoke(State $state, Ledgers $ledger, int $attempted_spend = 1
6767
$wallet_balance = data_get($state->wallet, $ledger->name, 0);
6868

6969
// Don't have enough to do this even with the wallet balance
70+
7071
if ($wallet_balance + $pre_run_balance < $attempted_spend) {
7172
return false;
7273
}

packages/till/tests/LedgersTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
});
2121
describe('usage ledger on the subscriber state', function (): void {
2222
it('adds a single transaction', function (): void {
23-
2423
RickRollSent::commit(
2524
subscriber_id: 1,
2625
);
@@ -143,8 +142,7 @@
143142
});
144143

145144
it('resets when expected', function (): void {
146-
147-
FiveRickRollsSent::commit(
145+
FiveRickRollsSent::fire(
148146
subscriber_id: 1,
149147
);
150148

@@ -155,7 +153,7 @@
155153

156154
Carbon::setTestNow(now()->addMonth()->addMinute());
157155

158-
FiveRickRollsSent::commit(
156+
FiveRickRollsSent::fire(
159157
subscriber_id: 1,
160158
);
161159

0 commit comments

Comments
 (0)