Page MenuHomePhorge

D4725.1775421010.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D4725.1775421010.diff

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

Mime Type
text/plain
Expires
Sun, Apr 5, 8:30 PM (13 h, 20 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18833413
Default Alt Text
D4725.1775421010.diff (1 KB)

Event Timeline