Fix refunds; support using stored card; change proPlanModel link

This commit is contained in:
Joshua Dwire 2016-04-20 16:53:56 -04:00
parent 71b6b6eb87
commit 9d27b68fb6
3 changed files with 15 additions and 12 deletions

View File

@ -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);

View File

@ -220,6 +220,11 @@
}
$('#plan_term, #plan').change(updatePlanModal);
updatePlanModal();
if(window.location.hash) {
var hash = window.location.hash;
$(hash).modal('toggle');
}
});
</script>
@stop

View File

@ -190,14 +190,12 @@
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 (window.showChangePlan) {
$('#proPlanModal').modal('hide');
showChangePlan();
} else {
window.location = '/settings/account_management#changePlanModel';
}
});
} else {
$('#proPlanModal').modal('hide');
$('#go_pro').val('true');