mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-16 02:15:32 +00:00
Merge remote-tracking branch 'origin/next' into ghe-support-helpers
This commit is contained in:
commit
22d05c78aa
165 files changed
+2900
-344
No files matched your search
@@ -32,6 +32,8 @@ class Actions extends Component
|
||||
|
||||
public bool $refundAlreadyUsed = false;
|
||||
|
||||
public bool $refundLatestPayment = false;
|
||||
|
||||
public string $billingInterval = 'monthly';
|
||||
|
||||
public ?string $nextBillingDate = null;
|
||||
@@ -100,7 +102,7 @@ class Actions extends Component
|
||||
return 'Invalid password.';
|
||||
}
|
||||
|
||||
$result = (new RefundSubscription)->execute(currentTeam());
|
||||
$result = app(RefundSubscription::class)->execute(currentTeam());
|
||||
|
||||
if ($result['success']) {
|
||||
$this->dispatch('success', 'Subscription refunded successfully.');
|
||||
@@ -114,12 +116,28 @@ class Actions extends Component
|
||||
return true;
|
||||
}
|
||||
|
||||
public function cancelImmediately(string $password): bool|string
|
||||
public function cancelImmediately(string $password, array $selectedActions = []): bool|string
|
||||
{
|
||||
if (! shouldSkipPasswordConfirmation() && ! Hash::check($password, auth()->user()->password)) {
|
||||
return 'Invalid password.';
|
||||
}
|
||||
|
||||
if (in_array('refundLatestPayment', $selectedActions, true)) {
|
||||
// Eligibility is re-validated server-side inside RefundSubscription::execute()
|
||||
$result = app(RefundSubscription::class)->execute(currentTeam());
|
||||
|
||||
if ($result['success']) {
|
||||
$this->dispatch('success', 'Subscription refunded and cancelled successfully.');
|
||||
$this->redirect(route('subscription.index'), navigate: true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$this->dispatch('error', 'Something went wrong with the refund. Please <a href="'.config('constants.urls.contact').'" target="_blank" class="underline">contact us</a>.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
$team = currentTeam();
|
||||
$subscription = $team->subscription;
|
||||
|
||||
@@ -130,7 +148,7 @@ class Actions extends Component
|
||||
}
|
||||
|
||||
try {
|
||||
$stripe = new StripeClient(config('subscription.stripe_api_key'));
|
||||
$stripe = app(StripeClient::class);
|
||||
$stripe->subscriptions->cancel($subscription->stripe_subscription_id);
|
||||
|
||||
$subscription->update([
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Livewire\Subscription;
|
||||
use App\Models\InstanceSettings;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Livewire\Component;
|
||||
use Stripe\StripeClient;
|
||||
|
||||
class Index extends Component
|
||||
{
|
||||
@@ -52,7 +53,7 @@ class Index extends Component
|
||||
{
|
||||
try {
|
||||
$subscription = currentTeam()->subscription;
|
||||
$stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key'));
|
||||
$stripe = app(StripeClient::class);
|
||||
$customer = $stripe->customers->retrieve(currentTeam()->subscription->stripe_customer_id);
|
||||
if ($customer) {
|
||||
$subscriptions = $stripe->subscriptions->all(['customer' => $customer->id]);
|
||||
|
||||
Reference in new issue
Block a user