diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 75f6819dad5e..af2fdd3df656 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -165,7 +165,7 @@ class AccountController extends BaseController $account->company->save(); Session::flash('message', trans('texts.updated_plan')); } - } else { + } elseif (!empty($planDetails['started'])) { // Downgrade $refund_deadline = clone $planDetails['started']; $refund_deadline->modify('+30 days'); @@ -186,7 +186,7 @@ class AccountController extends BaseController $gateway = $this->paymentService->createGateway($payment->account_gateway); $refund = $gateway->refund(array( 'transactionReference' => $payment->transaction_reference, - 'amount' => $payment->amount * 100 + 'amount' => $payment->amount )); $refund->send(); $payment->delete(); @@ -238,7 +238,7 @@ class AccountController extends BaseController if (!empty($new_plan)) { $invitation = $this->accountRepo->enablePlan($new_plan['plan'], $new_plan['term'], $credit, !empty($pending_monthly)); - return Redirect::to('payment/'.$invitation->invitation_key); + return Redirect::to('view/'.$invitation->invitation_key); } return Redirect::to('/settings/'.ACCOUNT_MANAGEMENT, 301); diff --git a/resources/views/accounts/management.blade.php b/resources/views/accounts/management.blade.php index 0f74a04e829f..cf9917deb005 100644 --- a/resources/views/accounts/management.blade.php +++ b/resources/views/accounts/management.blade.php @@ -220,6 +220,11 @@ } $('#plan_term, #plan').change(updatePlanModal); updatePlanModal(); + + if(window.location.hash) { + var hash = window.location.hash; + $(hash).modal('toggle'); + } }); @stop \ No newline at end of file diff --git a/resources/views/header.blade.php b/resources/views/header.blade.php index 50999b8cc1d1..bcf8df4ccf16 100644 --- a/resources/views/header.blade.php +++ b/resources/views/header.blade.php @@ -189,15 +189,13 @@ function submitProPlan() { fbq('track', 'AddPaymentInfo'); trackEvent('/account', '/submit_pro_plan/' + NINJA.proPlanFeature); - if (NINJA.isRegistered) { - $.ajax({ - type: 'POST', - url: '{{ URL::to('account/go_pro') }}', - success: function(result) { - NINJA.formIsChanged = false; - window.location = '/payment/' + result; - } - }); + if (NINJA.isRegistered) { + if (window.showChangePlan) { + $('#proPlanModal').modal('hide'); + showChangePlan(); + } else { + window.location = '/settings/account_management#changePlanModel'; + } } else { $('#proPlanModal').modal('hide'); $('#go_pro').val('true');