mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Subscriptions
This commit is contained in:
parent
1595df1b49
commit
bde5166827
@ -236,6 +236,7 @@ class CreateSingleAccount extends Command
|
||||
$webhook_config = [
|
||||
'post_purchase_url' => 'http://ninja.test:8000/api/admin/plan',
|
||||
'post_purchase_rest_method' => 'POST',
|
||||
'post_purchase_headers' => [],
|
||||
];
|
||||
|
||||
$sub = SubscriptionFactory::create($company->id, $user->id);
|
||||
|
@ -34,8 +34,15 @@ class SubscriptionPlanSwitchController extends Controller
|
||||
|
||||
$amount = $recurring_invoice->subscription->service()->calculateUpgradePrice($recurring_invoice, $target);
|
||||
|
||||
nlog($amount);
|
||||
|
||||
//if($amount == null)
|
||||
//please show account upgrade unavailable
|
||||
//@ben
|
||||
|
||||
return render('subscriptions.switch', [
|
||||
'subscription' => $subscription,
|
||||
'subscription' => $recurring_invoice->subscription,
|
||||
'recurring_invoice' => $recurring_invoice,
|
||||
'target' => $target,
|
||||
'amount' => $amount,
|
||||
]);
|
||||
|
@ -19,11 +19,21 @@ use Livewire\Component;
|
||||
|
||||
class SubscriptionPlanSwitch extends Component
|
||||
{
|
||||
/**
|
||||
* @var RecurringInvoice
|
||||
*/
|
||||
public $recurring_invoice;
|
||||
|
||||
/**
|
||||
* @var Subscription
|
||||
*/
|
||||
public $subscription;
|
||||
|
||||
/**
|
||||
* @var ?float
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var Subscription
|
||||
*/
|
||||
@ -62,7 +72,9 @@ class SubscriptionPlanSwitch extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->total = $this->subscription->service()->getPriceBetweenSubscriptions($this->subscription, $this->target);
|
||||
// $this->total = $this->subscription->service()->getPriceBetweenSubscriptions($this->subscription, $this->target);
|
||||
|
||||
$this->total = $this->amount;
|
||||
|
||||
$this->methods = $this->contact->client->service()->getPaymentMethods(100);
|
||||
|
||||
|
@ -17,7 +17,7 @@ class ShowPlanSwitchRequest extends FormRequest
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return (bool)$this->subscription->allow_plan_changes;
|
||||
return (bool)$this->recurring_invoice->subscription->allow_plan_changes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -209,7 +209,8 @@ class CheckoutComPaymentDriver extends BaseDriver
|
||||
|
||||
$payment = new \Checkout\Models\Payments\Payment($method, $this->client->getCurrencyCode());
|
||||
$payment->amount = $this->convertToCheckoutAmount($amount, $this->client->getCurrencyCode());
|
||||
$payment->reference = $cgt->meta->last4 . '-' . now();
|
||||
//$payment->reference = $cgt->meta->last4 . '-' . now();
|
||||
$payment->reference = $invoice->number . '-' . now();
|
||||
|
||||
$request = new PaymentResponseRequest();
|
||||
$request->setMethod('POST');
|
||||
|
@ -196,7 +196,8 @@ class SubscriptionService
|
||||
->where('balance', '>', 0);
|
||||
|
||||
$outstanding_amounts = $outstanding->sum('balance');
|
||||
$outstanding_invoices = $outstanding->get();
|
||||
// $outstanding_invoices = $outstanding->get();
|
||||
$outstanding_invoices = $outstanding;
|
||||
|
||||
if ($outstanding->count() == 0){
|
||||
//nothing outstanding
|
||||
|
Loading…
Reference in New Issue
Block a user