Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117912833
D4725.1775400554.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D4725.1775400554.diff
View Options
diff --git a/src/app/Console/Commands/Wallet/ChargeCommand.php b/src/app/Console/Commands/Wallet/ChargeCommand.php
--- a/src/app/Console/Commands/Wallet/ChargeCommand.php
+++ b/src/app/Console/Commands/Wallet/ChargeCommand.php
@@ -52,30 +52,7 @@
}
foreach ($wallets as $wallet) {
- // This is a long-running process. Because another process might have modified
- // the wallet balance in meantime we have to refresh it.
- // Note: This is needed despite the use of cursor() above.
- $wallet->refresh();
-
- // Sanity check after refresh (owner deleted in meantime)
- if (!$wallet->owner) {
- continue;
- }
-
- $charge = $wallet->chargeEntitlements();
-
- if ($charge > 0) {
- $this->info("Charged wallet {$wallet->id} for user {$wallet->owner->email} with {$charge}");
-
- // Top-up the wallet if auto-payment enabled for the wallet
- \App\Jobs\WalletCharge::dispatch($wallet);
- }
-
- if ($wallet->balance < 0) {
- // Check the account balance, send notifications, (suspend, delete,) degrade
- // Also sends reminders to the degraded account owners
- \App\Jobs\WalletCheck::dispatch($wallet);
- }
+ \App\Jobs\WalletCheck::dispatch($wallet);
}
}
}
diff --git a/src/app/Jobs/WalletCheck.php b/src/app/Jobs/WalletCheck.php
--- a/src/app/Jobs/WalletCheck.php
+++ b/src/app/Jobs/WalletCheck.php
@@ -57,6 +57,18 @@
*/
public function handle()
{
+
+ $wallet->refresh();
+
+ // Sanity check after refresh (owner deleted in meantime)
+ if (!$wallet->owner) {
+ continue;
+ }
+
+ if ($wallet->chargeEntitlements() > 0) {
+ $this->topUpWallet();
+ }
+
if ($this->wallet->balance >= 0) {
return null;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 2:49 PM (16 h, 21 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18833413
Default Alt Text
D4725.1775400554.diff (1 KB)
Attached To
Mode
D4725: Fold WalletCharge and WalletCheck into one
Attached
Detach File
Event Timeline