mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
63c0363f19
@ -1 +1 @@
|
|||||||
5.1.31
|
5.1.32
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace App\Console;
|
namespace App\Console;
|
||||||
|
|
||||||
use App\Jobs\Cron\BillingSubscriptionCron;
|
use App\Jobs\Cron\SubscriptionCron;
|
||||||
use App\Jobs\Cron\RecurringInvoicesCron;
|
use App\Jobs\Cron\RecurringInvoicesCron;
|
||||||
use App\Jobs\Ninja\AdjustEmailQuota;
|
use App\Jobs\Ninja\AdjustEmailQuota;
|
||||||
use App\Jobs\Ninja\CompanySizeCheck;
|
use App\Jobs\Ninja\CompanySizeCheck;
|
||||||
@ -44,7 +44,7 @@ class Kernel extends ConsoleKernel
|
|||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
|
|
||||||
$schedule->job(new VersionCheck)->daily()->withoutOverlapping();
|
$schedule->job(new VersionCheck)->daily();
|
||||||
|
|
||||||
$schedule->command('ninja:check-data')->daily()->withoutOverlapping();
|
$schedule->command('ninja:check-data')->daily()->withoutOverlapping();
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
$schedule->job(new UpdateExchangeRates)->daily()->withoutOverlapping();
|
$schedule->job(new UpdateExchangeRates)->daily()->withoutOverlapping();
|
||||||
|
|
||||||
$schedule->job(new BillingSubscriptionCron)->daily()->withoutOverlapping();
|
$schedule->job(new SubscriptionCron)->daily()->withoutOverlapping();
|
||||||
|
|
||||||
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
|
$schedule->job(new RecurringInvoicesCron)->hourly()->withoutOverlapping();
|
||||||
|
|
||||||
|
47
app/DataMapper/Billing/SubscriptionContextMapper.php
Normal file
47
app/DataMapper/Billing/SubscriptionContextMapper.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\DataMapper\Billing;
|
||||||
|
|
||||||
|
|
||||||
|
class SubscriptionContextMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $subscription_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $client_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
public $invoice_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
public $casts = [
|
||||||
|
'subscription_id' => 'integer',
|
||||||
|
'email' => 'string',
|
||||||
|
'client_id' => 'integer',
|
||||||
|
'invoice_id' => 'integer',
|
||||||
|
];
|
||||||
|
}
|
@ -109,7 +109,7 @@ class CompanySettings extends BaseSettings
|
|||||||
|
|
||||||
public $shared_invoice_quote_counter = false; //@implemented
|
public $shared_invoice_quote_counter = false; //@implemented
|
||||||
public $shared_invoice_credit_counter = false; //@implemented
|
public $shared_invoice_credit_counter = false; //@implemented
|
||||||
public $recurring_number_prefix = 'R'; //@implemented
|
public $recurring_number_prefix = ''; //@implemented
|
||||||
public $reset_counter_frequency_id = '0'; //@implemented
|
public $reset_counter_frequency_id = '0'; //@implemented
|
||||||
public $reset_counter_date = ''; //@implemented
|
public $reset_counter_date = ''; //@implemented
|
||||||
public $counter_padding = 4; //@implemented
|
public $counter_padding = 4; //@implemented
|
||||||
@ -574,7 +574,8 @@ class CompanySettings extends BaseSettings
|
|||||||
public static function notificationDefaults() :stdClass
|
public static function notificationDefaults() :stdClass
|
||||||
{
|
{
|
||||||
$notification = new stdClass;
|
$notification = new stdClass;
|
||||||
$notification->email = ['all_notifications'];
|
$notification->email = [];
|
||||||
|
// $notification->email = ['all_notifications'];
|
||||||
|
|
||||||
return $notification;
|
return $notification;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Events\BillingSubscription;
|
namespace App\Events\Subscription;
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use Illuminate\Broadcasting\Channel;
|
use Illuminate\Broadcasting\Channel;
|
||||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||||
@ -12,14 +12,14 @@ use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
|||||||
use Illuminate\Foundation\Events\Dispatchable;
|
use Illuminate\Foundation\Events\Dispatchable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
class BillingSubscriptionWasCreated
|
class SubscriptionWasCreated
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var BillingSubscription
|
* @var Subscription
|
||||||
*/
|
*/
|
||||||
public $billing_subscription;
|
public $subscription;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Company
|
* @var Company
|
||||||
@ -36,9 +36,9 @@ class BillingSubscriptionWasCreated
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(BillingSubscription $billing_subscription, Company $company, array $event_vars)
|
public function __construct(Subscription $subscription, Company $company, array $event_vars)
|
||||||
{
|
{
|
||||||
$this->billing_subscription = $billing_subscription;
|
$this->subscription = $subscription;
|
||||||
$this->company = $company;
|
$this->company = $company;
|
||||||
$this->event_vars = $event_vars;
|
$this->event_vars = $event_vars;
|
||||||
}
|
}
|
@ -11,14 +11,13 @@
|
|||||||
|
|
||||||
namespace App\Factory;
|
namespace App\Factory;
|
||||||
|
|
||||||
|
use App\Models\Subscription;
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
class SubscriptionFactory
|
||||||
|
|
||||||
class BillingSubscriptionFactory
|
|
||||||
{
|
{
|
||||||
public static function create(int $company_id, int $user_id): BillingSubscription
|
public static function create(int $company_id, int $user_id): Subscription
|
||||||
{
|
{
|
||||||
$billing_subscription = new BillingSubscription();
|
$billing_subscription = new Subscription();
|
||||||
$billing_subscription->company_id = $company_id;
|
$billing_subscription->company_id = $company_id;
|
||||||
$billing_subscription->user_id = $user_id;
|
$billing_subscription->user_id = $user_id;
|
||||||
|
|
@ -13,22 +13,23 @@
|
|||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class BillingSubscriptionPurchaseController extends Controller
|
class SubscriptionPurchaseController extends Controller
|
||||||
{
|
{
|
||||||
public function index(BillingSubscription $billing_subscription, Request $request)
|
public function index(Subscription $subscription, Request $request)
|
||||||
{
|
{
|
||||||
if ($request->has('locale')) {
|
if ($request->has('locale')) {
|
||||||
$this->setLocale($request->query('locale'));
|
$this->setLocale($request->query('locale'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('billing-portal.purchase', [
|
return view('billing-portal.purchase', [
|
||||||
'billing_subscription' => $billing_subscription,
|
'subscription' => $subscription,
|
||||||
'hash' => Str::uuid()->toString(),
|
'hash' => Str::uuid()->toString(),
|
||||||
'request_data' => $request->all(),
|
'request_data' => $request->all(),
|
||||||
]);
|
]);
|
||||||
@ -41,7 +42,9 @@ class BillingSubscriptionPurchaseController extends Controller
|
|||||||
*/
|
*/
|
||||||
private function setLocale(string $locale): void
|
private function setLocale(string $locale): void
|
||||||
{
|
{
|
||||||
$record = DB::table('languages')->where('locale', $locale)->first();
|
$record = Cache::get('languages')->filter(function ($item) use ($locale) {
|
||||||
|
return $item->locale == $locale;
|
||||||
|
})->first();
|
||||||
|
|
||||||
if ($record) {
|
if ($record) {
|
||||||
App::setLocale($record->locale);
|
App::setLocale($record->locale);
|
||||||
|
@ -115,7 +115,6 @@ class ConnectedAccountController extends BaseController
|
|||||||
$timeout = auth()->user()->company()->default_password_timeout;
|
$timeout = auth()->user()->company()->default_password_timeout;
|
||||||
Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout);
|
Cache::put(auth()->user()->hashed_id.'_logged_in', Str::random(64), $timeout);
|
||||||
|
|
||||||
|
|
||||||
return $this->itemResponse(auth()->user());
|
return $this->itemResponse(auth()->user());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -126,6 +125,8 @@ class ConnectedAccountController extends BaseController
|
|||||||
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function handleGmailOauth(Request $request)
|
public function handleGmailOauth(Request $request)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -162,6 +163,8 @@ class ConnectedAccountController extends BaseController
|
|||||||
auth()->user()->email_verified_at = now();
|
auth()->user()->email_verified_at = now();
|
||||||
auth()->user()->save();
|
auth()->user()->save();
|
||||||
|
|
||||||
|
$this->activateGmail(auth()->user());
|
||||||
|
|
||||||
return $this->itemResponse(auth()->user());
|
return $this->itemResponse(auth()->user());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -172,4 +175,19 @@ class ConnectedAccountController extends BaseController
|
|||||||
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
->header('X-Api-Version', config('ninja.minimum_client_version'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function activateGmail(User $user)
|
||||||
|
{
|
||||||
|
$company = $user->company();
|
||||||
|
$settings = $company->settings;
|
||||||
|
|
||||||
|
if($settings->email_sending_method == 'default')
|
||||||
|
{
|
||||||
|
$settings->email_sending_method = 'gmail';
|
||||||
|
$settings->gmail_sending_user_id = (string)$user->hashed_id;
|
||||||
|
|
||||||
|
$company->settings = $settings;
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ class EmailController extends BaseController
|
|||||||
|
|
||||||
$entity_obj->service()->markSent()->save();
|
$entity_obj->service()->markSent()->save();
|
||||||
|
|
||||||
EmailEntity::dispatch($invitation, $invitation->company, $template, $data)
|
EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data)
|
||||||
->delay(now()->addSeconds(5));
|
->delay(now()->addSeconds(5));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -795,6 +795,8 @@ class InvoiceController extends BaseController
|
|||||||
|
|
||||||
$file_path = $invoice->service()->getInvoicePdf($contact);
|
$file_path = $invoice->service()->getInvoicePdf($contact);
|
||||||
|
|
||||||
|
nlog($file_path);
|
||||||
|
|
||||||
return response()->download($file_path, basename($file_path));
|
return response()->download($file_path, basename($file_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
* schema="BillingSubscription",
|
* schema="Subscription",
|
||||||
* type="object",
|
* type="object",
|
||||||
* @OA\Property(property="id", type="string", example="Opnel5aKBz", description="______"),
|
* @OA\Property(property="id", type="string", example="Opnel5aKBz", description="______"),
|
||||||
* @OA\Property(property="user_id", type="string", example="Opnel5aKBz", description="______"),
|
* @OA\Property(property="user_id", type="string", example="Opnel5aKBz", description="______"),
|
||||||
|
@ -532,7 +532,7 @@ class QuoteController extends BaseController
|
|||||||
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'convert') {
|
if ($action == 'convert' || $action == 'convert_to_invoice') {
|
||||||
$this->entity_type = Quote::class;
|
$this->entity_type = Quote::class;
|
||||||
$this->entity_transformer = QuoteTransformer::class;
|
$this->entity_transformer = QuoteTransformer::class;
|
||||||
|
|
||||||
@ -572,7 +572,6 @@ class QuoteController extends BaseController
|
|||||||
* description="Performs a custom action on an Quote.
|
* description="Performs a custom action on an Quote.
|
||||||
|
|
||||||
The current range of actions are as follows
|
The current range of actions are as follows
|
||||||
- clone_to_Quote
|
|
||||||
- clone_to_quote
|
- clone_to_quote
|
||||||
- history
|
- history
|
||||||
- delivery_note
|
- delivery_note
|
||||||
@ -580,6 +579,8 @@ class QuoteController extends BaseController
|
|||||||
- download
|
- download
|
||||||
- archive
|
- archive
|
||||||
- delete
|
- delete
|
||||||
|
- convert
|
||||||
|
- convert_to_invoice
|
||||||
- email",
|
- email",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
@ -640,6 +641,14 @@ class QuoteController extends BaseController
|
|||||||
private function performAction(Quote $quote, $action, $bulk = false)
|
private function performAction(Quote $quote, $action, $bulk = false)
|
||||||
{
|
{
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
|
case 'convert':
|
||||||
|
case 'convert_to_invoice':
|
||||||
|
|
||||||
|
$this->entity_type = Invoice::class;
|
||||||
|
$this->entity_transformer = InvoiceTransformer::class;
|
||||||
|
return $this->itemResponse($quote->service()->convertToInvoice());
|
||||||
|
|
||||||
|
break;
|
||||||
case 'clone_to_invoice':
|
case 'clone_to_invoice':
|
||||||
|
|
||||||
$this->entity_type = Invoice::class;
|
$this->entity_type = Invoice::class;
|
||||||
|
@ -12,45 +12,45 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Events\BillingSubscription\BillingSubscriptionWasCreated;
|
use App\Events\Subscription\SubscriptionWasCreated;
|
||||||
use App\Factory\BillingSubscriptionFactory;
|
use App\Factory\SubscriptionFactory;
|
||||||
use App\Http\Requests\BillingSubscription\CreateBillingSubscriptionRequest;
|
use App\Http\Requests\Subscription\CreateSubscriptionRequest;
|
||||||
use App\Http\Requests\BillingSubscription\DestroyBillingSubscriptionRequest;
|
use App\Http\Requests\Subscription\DestroySubscriptionRequest;
|
||||||
use App\Http\Requests\BillingSubscription\EditBillingSubscriptionRequest;
|
use App\Http\Requests\Subscription\EditSubscriptionRequest;
|
||||||
use App\Http\Requests\BillingSubscription\ShowBillingSubscriptionRequest;
|
use App\Http\Requests\Subscription\ShowSubscriptionRequest;
|
||||||
use App\Http\Requests\BillingSubscription\StoreBillingSubscriptionRequest;
|
use App\Http\Requests\Subscription\StoreSubscriptionRequest;
|
||||||
use App\Http\Requests\BillingSubscription\UpdateBillingSubscriptionRequest;
|
use App\Http\Requests\Subscription\UpdateSubscriptionRequest;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Repositories\BillingSubscriptionRepository;
|
use App\Repositories\SubscriptionRepository;
|
||||||
use App\Transformers\BillingSubscriptionTransformer;
|
use App\Transformers\SubscriptionTransformer;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
|
|
||||||
class BillingSubscriptionController extends BaseController
|
class SubscriptionController extends BaseController
|
||||||
{
|
{
|
||||||
protected $entity_type = BillingSubscription::class;
|
protected $entity_type = Subscription::class;
|
||||||
|
|
||||||
protected $entity_transformer = BillingSubscriptionTransformer::class;
|
protected $entity_transformer = SubscriptionTransformer::class;
|
||||||
|
|
||||||
protected $billing_subscription_repo;
|
protected $subscription_repo;
|
||||||
|
|
||||||
public function __construct(BillingSubscriptionRepository $billing_subscription_repo)
|
public function __construct(SubscriptionRepository $subscription_repo)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->billing_subscription_repo = $billing_subscription_repo;
|
$this->subscription_repo = $subscription_repo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the list of BillingSubscriptions.
|
* Show the list of Subscriptions.
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/v1/billing_subscriptions",
|
* path="/api/v1/subscriptions",
|
||||||
* operationId="getBillingSubscriptions",
|
* operationId="getSubscriptions",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Gets a list of billing_subscriptions",
|
* summary="Gets a list of subscriptions",
|
||||||
* description="Lists billing_subscriptions.",
|
* description="Lists subscriptions.",
|
||||||
*
|
*
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
@ -58,11 +58,11 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
* @OA\Parameter(ref="#/components/parameters/include"),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="A list of billing_subscriptions",
|
* description="A list of subscriptions",
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
|
* @OA\JsonContent(ref="#/components/schemas/Subscription"),
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
@ -79,24 +79,24 @@ class BillingSubscriptionController extends BaseController
|
|||||||
|
|
||||||
public function index(): \Illuminate\Http\Response
|
public function index(): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
$billing_subscriptions = BillingSubscription::query()->company();
|
$subscriptions = Subscription::query()->company();
|
||||||
|
|
||||||
return $this->listResponse($billing_subscriptions);
|
return $this->listResponse($subscriptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
*
|
*
|
||||||
* @param CreateBillingSubscriptionRequest $request The request
|
* @param CreateSubscriptionRequest $request The request
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/v1/billing_subscriptions/create",
|
* path="/api/v1/subscriptions/create",
|
||||||
* operationId="getBillingSubscriptionsCreate",
|
* operationId="getSubscriptionsCreate",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Gets a new blank billing_subscriptions object",
|
* summary="Gets a new blank subscriptions object",
|
||||||
* description="Returns a blank object with default values",
|
* description="Returns a blank object with default values",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
@ -104,11 +104,11 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
* @OA\Parameter(ref="#/components/parameters/include"),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="A blank billing_subscriptions object",
|
* description="A blank subscriptions object",
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
|
* @OA\JsonContent(ref="#/components/schemas/Subscription"),
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
@ -123,38 +123,38 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function create(CreateBillingSubscriptionRequest $request): \Illuminate\Http\Response
|
public function create(CreateSubscriptionRequest $request): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
$billing_subscription = BillingSubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id);
|
$subscription = SubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id);
|
||||||
|
|
||||||
return $this->itemResponse($billing_subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @param StoreBillingSubscriptionRequest $request The request
|
* @param StoreSubscriptionRequest $request The request
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @OA\Post(
|
* @OA\Post(
|
||||||
* path="/api/v1/billing_subscriptions",
|
* path="/api/v1/subscriptions",
|
||||||
* operationId="storeBillingSubscription",
|
* operationId="storeSubscription",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Adds a billing_subscriptions",
|
* summary="Adds a subscriptions",
|
||||||
* description="Adds an billing_subscriptions to the system",
|
* description="Adds an subscriptions to the system",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/include"),
|
* @OA\Parameter(ref="#/components/parameters/include"),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Returns the saved billing_subscriptions object",
|
* description="Returns the saved subscriptions object",
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
|
* @OA\JsonContent(ref="#/components/schemas/Subscription"),
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
@ -169,30 +169,30 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function store(StoreBillingSubscriptionRequest $request): \Illuminate\Http\Response
|
public function store(StoreSubscriptionRequest $request): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
$billing_subscription = $this->billing_subscription_repo->save($request->all(), BillingSubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
$subscription = $this->subscription_repo->save($request->all(), SubscriptionFactory::create(auth()->user()->company()->id, auth()->user()->id));
|
||||||
|
|
||||||
event(new BillingsubscriptionWasCreated($billing_subscription, $billing_subscription->company, Ninja::eventVars()));
|
event(new SubscriptionWasCreated($subscription, $subscription->company, Ninja::eventVars()));
|
||||||
|
|
||||||
return $this->itemResponse($billing_subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param ShowBillingSubscriptionRequest $request The request
|
* @param ShowSubscriptionRequest $request The request
|
||||||
* @param Invoice $billing_subscription The invoice
|
* @param Invoice $subscription The invoice
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/v1/billing_subscriptions/{id}",
|
* path="/api/v1/subscriptions/{id}",
|
||||||
* operationId="showBillingSubscription",
|
* operationId="showSubscription",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Shows an billing_subscriptions",
|
* summary="Shows an subscriptions",
|
||||||
* description="Displays an billing_subscriptions by id",
|
* description="Displays an subscriptions by id",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
||||||
@ -200,7 +200,7 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* description="The BillingSubscription Hashed ID",
|
* description="The Subscription Hashed ID",
|
||||||
* example="D2J234DFA",
|
* example="D2J234DFA",
|
||||||
* required=true,
|
* required=true,
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
@ -210,11 +210,11 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Returns the BillingSubscription object",
|
* description="Returns the Subscription object",
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
|
* @OA\JsonContent(ref="#/components/schemas/Subscription"),
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
@ -229,25 +229,25 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function show(ShowBillingSubscriptionRequest $request, BillingSubscription $billing_subscription): \Illuminate\Http\Response
|
public function show(ShowSubscriptionRequest $request, Subscription $subscription): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
return $this->itemResponse($billing_subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the form for editing the specified resource.
|
* Show the form for editing the specified resource.
|
||||||
*
|
*
|
||||||
* @param EditBillingSubscriptionRequest $request The request
|
* @param EditSubscriptionRequest $request The request
|
||||||
* @param Invoice $billing_subscription The invoice
|
* @param Invoice $subscription The invoice
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
* @OA\Get(
|
* @OA\Get(
|
||||||
* path="/api/v1/billing_subscriptions/{id}/edit",
|
* path="/api/v1/subscriptions/{id}/edit",
|
||||||
* operationId="editBillingSubscription",
|
* operationId="editSubscription",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Shows an billing_subscriptions for editting",
|
* summary="Shows an subscriptions for editting",
|
||||||
* description="Displays an billing_subscriptions by id",
|
* description="Displays an subscriptions by id",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
||||||
@ -255,7 +255,7 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* description="The BillingSubscription Hashed ID",
|
* description="The Subscription Hashed ID",
|
||||||
* example="D2J234DFA",
|
* example="D2J234DFA",
|
||||||
* required=true,
|
* required=true,
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
@ -269,7 +269,7 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
|
* @OA\JsonContent(ref="#/components/schemas/Subscription"),
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
@ -284,26 +284,26 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function edit(EditBillingSubscriptionRequest $request, BillingSubscription $billing_subscription): \Illuminate\Http\Response
|
public function edit(EditSubscriptionRequest $request, Subscription $subscription): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
return $this->itemResponse($billing_subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param UpdateBillingSubscriptionRequest $request The request
|
* @param UpdateSubscriptionRequest $request The request
|
||||||
* @param BillingSubscription $billing_subscription The invoice
|
* @param Subscription $subscription The invoice
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @OA\Put(
|
* @OA\Put(
|
||||||
* path="/api/v1/billing_subscriptions/{id}",
|
* path="/api/v1/subscriptions/{id}",
|
||||||
* operationId="updateBillingSubscription",
|
* operationId="updateSubscription",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Updates an billing_subscriptions",
|
* summary="Updates an subscriptions",
|
||||||
* description="Handles the updating of an billing_subscriptions by id",
|
* description="Handles the updating of an subscriptions by id",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
||||||
@ -311,7 +311,7 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* description="The BillingSubscription Hashed ID",
|
* description="The Subscription Hashed ID",
|
||||||
* example="D2J234DFA",
|
* example="D2J234DFA",
|
||||||
* required=true,
|
* required=true,
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
@ -321,11 +321,11 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=200,
|
* response=200,
|
||||||
* description="Returns the billing_subscriptions object",
|
* description="Returns the subscriptions object",
|
||||||
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
||||||
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
||||||
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
||||||
* @OA\JsonContent(ref="#/components/schemas/BillingSubscription"),
|
* @OA\JsonContent(ref="#/components/schemas/Subscription"),
|
||||||
* ),
|
* ),
|
||||||
* @OA\Response(
|
* @OA\Response(
|
||||||
* response=422,
|
* response=422,
|
||||||
@ -340,32 +340,32 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function update(UpdateBillingSubscriptionRequest $request, BillingSubscription $billing_subscription)
|
public function update(UpdateSubscriptionRequest $request, Subscription $subscription)
|
||||||
{
|
{
|
||||||
if ($request->entityIsDeleted($billing_subscription)) {
|
if ($request->entityIsDeleted($subscription)) {
|
||||||
return $request->disallowUpdate();
|
return $request->disallowUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
$billing_subscription = $this->billing_subscription_repo->save($request->all(), $billing_subscription);
|
$subscription = $this->subscription_repo->save($request->all(), $subscription);
|
||||||
|
|
||||||
return $this->itemResponse($billing_subscription);
|
return $this->itemResponse($subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param DestroyBillingSubscriptionRequest $request
|
* @param DestroySubscriptionRequest $request
|
||||||
* @param BillingSubscription $invoice
|
* @param Subscription $invoice
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @OA\Delete(
|
* @OA\Delete(
|
||||||
* path="/api/v1/billing_subscriptions/{id}",
|
* path="/api/v1/subscriptions/{id}",
|
||||||
* operationId="deleteBillingSubscription",
|
* operationId="deleteSubscription",
|
||||||
* tags={"billing_subscriptions"},
|
* tags={"subscriptions"},
|
||||||
* summary="Deletes a billing_subscriptions",
|
* summary="Deletes a subscriptions",
|
||||||
* description="Handles the deletion of an billing_subscriptions by id",
|
* description="Handles the deletion of an subscriptions by id",
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Secret"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
* @OA\Parameter(ref="#/components/parameters/X-Api-Token"),
|
||||||
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
||||||
@ -373,7 +373,7 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* @OA\Parameter(
|
* @OA\Parameter(
|
||||||
* name="id",
|
* name="id",
|
||||||
* in="path",
|
* in="path",
|
||||||
* description="The BillingSubscription Hashed ID",
|
* description="The Subscription Hashed ID",
|
||||||
* example="D2J234DFA",
|
* example="D2J234DFA",
|
||||||
* required=true,
|
* required=true,
|
||||||
* @OA\Schema(
|
* @OA\Schema(
|
||||||
@ -401,10 +401,10 @@ class BillingSubscriptionController extends BaseController
|
|||||||
* ),
|
* ),
|
||||||
* )
|
* )
|
||||||
*/
|
*/
|
||||||
public function destroy(DestroyBillingSubscriptionRequest $request, BillingSubscription $billing_subscription): \Illuminate\Http\Response
|
public function destroy(DestroySubscriptionRequest $request, Subscription $subscription): \Illuminate\Http\Response
|
||||||
{
|
{
|
||||||
$this->billing_subscription_repo->delete($billing_subscription);
|
$this->subscription_repo->delete($subscription);
|
||||||
|
|
||||||
return $this->itemResponse($billing_subscription->fresh());
|
return $this->itemResponse($subscription->fresh());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -608,11 +608,18 @@ class UserController extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function detach(DetachCompanyUserRequest $request, User $user)
|
public function detach(DetachCompanyUserRequest $request, User $user)
|
||||||
{
|
{
|
||||||
if($user->isOwner())
|
|
||||||
return response()->json(['message', 'Cannot detach owner.'],400);
|
if ($request->entityIsDeleted($user)) {
|
||||||
|
return $request->disallowUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
$company_user = CompanyUser::whereUserId($user->id)
|
$company_user = CompanyUser::whereUserId($user->id)
|
||||||
->whereCompanyId(auth()->user()->companyId())->first();
|
->whereCompanyId(auth()->user()->companyId())
|
||||||
|
->withTrashed()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($company_user->is_owner)
|
||||||
|
return response()->json(['message', 'Cannot detach owner.'], 401);
|
||||||
|
|
||||||
$token = $company_user->token->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
|
$token = $company_user->token->where('company_id', $company_user->company_id)->where('user_id', $company_user->user_id)->first();
|
||||||
|
|
||||||
|
@ -12,11 +12,12 @@
|
|||||||
namespace App\Http\Livewire;
|
namespace App\Http\Livewire;
|
||||||
|
|
||||||
use App\Factory\ClientFactory;
|
use App\Factory\ClientFactory;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Repositories\ClientContactRepository;
|
use App\Repositories\ClientContactRepository;
|
||||||
use App\Repositories\ClientRepository;
|
use App\Repositories\ClientRepository;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
@ -54,11 +55,11 @@ class BillingPortalPurchase extends Component
|
|||||||
public $password;
|
public $password;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of billing subscription.
|
* Instance of subscription.
|
||||||
*
|
*
|
||||||
* @var BillingSubscription
|
* @var Subscription
|
||||||
*/
|
*/
|
||||||
public $billing_subscription;
|
public $subscription;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance of client contact.
|
* Instance of client contact.
|
||||||
@ -138,6 +139,13 @@ class BillingPortalPurchase extends Component
|
|||||||
*/
|
*/
|
||||||
public $request_data;
|
public $request_data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Price of product.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $price;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle user authentication
|
* Handle user authentication
|
||||||
*
|
*
|
||||||
@ -178,8 +186,8 @@ class BillingPortalPurchase extends Component
|
|||||||
*/
|
*/
|
||||||
protected function createBlankClient()
|
protected function createBlankClient()
|
||||||
{
|
{
|
||||||
$company = $this->billing_subscription->company;
|
$company = $this->subscription->company;
|
||||||
$user = $this->billing_subscription->user;
|
$user = $this->subscription->user;
|
||||||
|
|
||||||
$client_repo = new ClientRepository(new ClientContactRepository());
|
$client_repo = new ClientRepository(new ClientContactRepository());
|
||||||
|
|
||||||
@ -192,7 +200,11 @@ class BillingPortalPurchase extends Component
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (array_key_exists('locale', $this->request_data)) {
|
if (array_key_exists('locale', $this->request_data)) {
|
||||||
$record = DB::table('languages')->where('locale', $this->request_data['locale'])->first();
|
$request = $this->request_data;
|
||||||
|
|
||||||
|
$record = Cache::get('languages')->filter(function ($item) use ($request) {
|
||||||
|
return $item->locale == $request['locale'];
|
||||||
|
})->first();
|
||||||
|
|
||||||
if ($record) {
|
if ($record) {
|
||||||
$data['settings']['language_id'] = (string)$record->id;
|
$data['settings']['language_id'] = (string)$record->id;
|
||||||
@ -212,7 +224,7 @@ class BillingPortalPurchase extends Component
|
|||||||
*/
|
*/
|
||||||
protected function getPaymentMethods(ClientContact $contact): self
|
protected function getPaymentMethods(ClientContact $contact): self
|
||||||
{
|
{
|
||||||
if ($this->billing_subscription->trial_enabled) {
|
if ($this->subscription->trial_enabled) {
|
||||||
$this->heading_text = ctrans('texts.plan_trial');
|
$this->heading_text = ctrans('texts.plan_trial');
|
||||||
$this->steps['show_start_trial'] = true;
|
$this->steps['show_start_trial'] = true;
|
||||||
|
|
||||||
@ -262,11 +274,11 @@ class BillingPortalPurchase extends Component
|
|||||||
'client_contact_id' => $this->contact->hashed_id,
|
'client_contact_id' => $this->contact->hashed_id,
|
||||||
]],
|
]],
|
||||||
'user_input_promo_code' => $this->coupon,
|
'user_input_promo_code' => $this->coupon,
|
||||||
'coupon' => $this->coupon,
|
'coupon' => empty($this->subscription->promo_code) ? '' : $this->coupon,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->invoice = $this->billing_subscription
|
$this->invoice = $this->subscription
|
||||||
->service()
|
->service()
|
||||||
->createInvoice($data)
|
->createInvoice($data)
|
||||||
->service()
|
->service()
|
||||||
@ -275,12 +287,13 @@ class BillingPortalPurchase extends Component
|
|||||||
->save();
|
->save();
|
||||||
|
|
||||||
Cache::put($this->hash, [
|
Cache::put($this->hash, [
|
||||||
'billing_subscription_id' => $this->billing_subscription->id,
|
'subscription_id' => $this->subscription->id,
|
||||||
'email' => $this->email ?? $this->contact->email,
|
'email' => $this->email ?? $this->contact->email,
|
||||||
'client_id' => $this->contact->client->id,
|
'client_id' => $this->contact->client->id,
|
||||||
'invoice_id' => $this->invoice->id,
|
'invoice_id' => $this->invoice->id,
|
||||||
'subscription_id' => $this->billing_subscription->id],
|
'quantity' => $this->quantity,
|
||||||
now()->addMinutes(60)
|
'subscription_id' => $this->subscription->id,
|
||||||
|
now()->addMinutes(60)]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->emit('beforePaymentEventsCompleted');
|
$this->emit('beforePaymentEventsCompleted');
|
||||||
@ -293,8 +306,10 @@ class BillingPortalPurchase extends Component
|
|||||||
*/
|
*/
|
||||||
public function handleTrial()
|
public function handleTrial()
|
||||||
{
|
{
|
||||||
return $this->billing_subscription->service()->startTrial([
|
return $this->subscription->service()->startTrial([
|
||||||
'email' => $this->email ?? $this->contact->email,
|
'email' => $this->email ?? $this->contact->email,
|
||||||
|
'quantity' => $this->quantity,
|
||||||
|
'contact_id' => $this->contact->id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,14 +325,19 @@ class BillingPortalPurchase extends Component
|
|||||||
return $this->quantity;
|
return $this->quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Dave review.
|
if ($this->quantity >= $this->subscription->max_seats_limit && $option == 'increment') {
|
||||||
if ($this->quantity >= $this->billing_subscription->max_seats_limit) {
|
|
||||||
return $this->quantity;
|
return $this->quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $option == 'increment'
|
if ($option == 'increment') {
|
||||||
? $this->quantity++
|
$this->quantity++;
|
||||||
: $this->quantity--;
|
return $this->price = (int)$this->price + $this->subscription->product->price;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->quantity--;
|
||||||
|
$this->price = (int)$this->price - $this->subscription->product->price;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Http\Requests\BillingSubscription;
|
namespace App\Http\Requests\Subscription;
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
|
|
||||||
class CreateBillingSubscriptionRequest extends Request
|
class CreateSubscriptionRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
@ -23,7 +23,7 @@ class CreateBillingSubscriptionRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize(): bool
|
public function authorize(): bool
|
||||||
{
|
{
|
||||||
return auth()->user()->can('create', BillingSubscription::class);
|
return auth()->user()->can('create', Subscription::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -9,12 +9,12 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Http\Requests\BillingSubscription;
|
namespace App\Http\Requests\Subscription;
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class EditBillingSubscriptionRequest extends Request
|
class DestroySubscriptionRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
@ -23,7 +23,7 @@ class EditBillingSubscriptionRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return auth()->user()->can('edit', $this->billing_subscription);
|
return auth()->user()->can('edit', $this->subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -9,12 +9,12 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Http\Requests\BillingSubscription;
|
namespace App\Http\Requests\Subscription;
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class DestroyBillingSubscriptionRequest extends Request
|
class EditSubscriptionRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
@ -23,7 +23,7 @@ class DestroyBillingSubscriptionRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return auth()->user()->can('edit', $this->billing_subscription);
|
return auth()->user()->can('edit', $this->subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -9,12 +9,12 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Http\Requests\BillingSubscription;
|
namespace App\Http\Requests\Subscription;
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ShowBillingSubscriptionRequest extends Request
|
class ShowSubscriptionRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
@ -23,7 +23,7 @@ class ShowBillingSubscriptionRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize() : bool
|
public function authorize() : bool
|
||||||
{
|
{
|
||||||
return auth()->user()->can('view', $this->billing_subscription);
|
return auth()->user()->can('view', $this->subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -9,12 +9,12 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Http\Requests\BillingSubscription;
|
namespace App\Http\Requests\Subscription;
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
|
|
||||||
class StoreBillingSubscriptionRequest extends Request
|
class StoreSubscriptionRequest extends Request
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
@ -23,7 +23,7 @@ class StoreBillingSubscriptionRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return auth()->user()->can('create', BillingSubscription::class);
|
return auth()->user()->can('create', Subscription::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -9,12 +9,12 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Http\Requests\BillingSubscription;
|
namespace App\Http\Requests\Subscription;
|
||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Utils\Traits\ChecksEntityStatus;
|
use App\Utils\Traits\ChecksEntityStatus;
|
||||||
|
|
||||||
class UpdateBillingSubscriptionRequest extends Request
|
class UpdateSubscriptionRequest extends Request
|
||||||
{
|
{
|
||||||
use ChecksEntityStatus;
|
use ChecksEntityStatus;
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class UpdateBillingSubscriptionRequest extends Request
|
|||||||
*/
|
*/
|
||||||
public function authorize()
|
public function authorize()
|
||||||
{
|
{
|
||||||
return auth()->user()->can('edit', $this->billing_subscription);
|
return auth()->user()->can('edit', $this->subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -13,11 +13,13 @@ namespace App\Http\Requests\User;
|
|||||||
|
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Utils\Traits\ChecksEntityStatus;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
class DetachCompanyUserRequest extends Request
|
class DetachCompanyUserRequest extends Request
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
|
use ChecksEntityStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
|
@ -12,11 +12,10 @@
|
|||||||
namespace App\Jobs\Cron;
|
namespace App\Jobs\Cron;
|
||||||
|
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
use App\Models\ClientSubscription;
|
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Support\Carbon;
|
use Illuminate\Support\Carbon;
|
||||||
|
|
||||||
class BillingSubscriptionCron
|
class SubscriptionCron
|
||||||
{
|
{
|
||||||
use Dispatchable;
|
use Dispatchable;
|
||||||
|
|
||||||
@ -52,11 +51,13 @@ class BillingSubscriptionCron
|
|||||||
|
|
||||||
private function loopSubscriptions()
|
private function loopSubscriptions()
|
||||||
{
|
{
|
||||||
$client_subs = ClientSubscription::whereNull('deleted_at')
|
//looop recurring invoices with subscription id
|
||||||
->cursor()
|
|
||||||
->each(function ($cs){
|
// $client_subs = ClientSubscription::whereNull('deleted_at')
|
||||||
$this->processSubscription($cs);
|
// ->cursor()
|
||||||
});
|
// ->each(function ($cs){
|
||||||
|
// $this->processSubscription($cs);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Our daily cron should check
|
/* Our daily cron should check
|
@ -424,6 +424,9 @@ class Import implements ShouldQueue
|
|||||||
unset($modified['password']); //cant import passwords.
|
unset($modified['password']); //cant import passwords.
|
||||||
|
|
||||||
$user = $user_repository->save($modified, $this->fetchUser($resource['email']), true, true);
|
$user = $user_repository->save($modified, $this->fetchUser($resource['email']), true, true);
|
||||||
|
$user->email_verified_at = now();
|
||||||
|
$user->confirmation_code = '';
|
||||||
|
$user->save();
|
||||||
|
|
||||||
$user_agent = array_key_exists('token_name', $resource) ?: request()->server('HTTP_USER_AGENT');
|
$user_agent = array_key_exists('token_name', $resource) ?: request()->server('HTTP_USER_AGENT');
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class CreditEmailedNotification implements ShouldQueue
|
|||||||
|
|
||||||
// $notification = new EntitySentNotification($event->invitation, 'credit');
|
// $notification = new EntitySentNotification($event->invitation, 'credit');
|
||||||
|
|
||||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'credit', ['all_notifications', 'credit_sent']);
|
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'credit', ['all_notifications', 'credit_sent', 'credit_sent_all']);
|
||||||
|
|
||||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||||
unset($methods[$key]);
|
unset($methods[$key]);
|
||||||
|
@ -60,7 +60,7 @@ class InvoiceEmailedNotification implements ShouldQueue
|
|||||||
// $notification = new EntitySentNotification($event->invitation, 'invoice');
|
// $notification = new EntitySentNotification($event->invitation, 'invoice');
|
||||||
|
|
||||||
/* Returns an array of notification methods */
|
/* Returns an array of notification methods */
|
||||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent']);
|
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']);
|
||||||
|
|
||||||
/* If one of the methods is email then we fire the EntitySentMailer */
|
/* If one of the methods is email then we fire the EntitySentMailer */
|
||||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||||
|
@ -56,7 +56,7 @@ class InvoiceFailedEmailNotification
|
|||||||
|
|
||||||
// $notification = new EntitySentNotification($event->invitation, 'invoice');
|
// $notification = new EntitySentNotification($event->invitation, 'invoice');
|
||||||
|
|
||||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent']);
|
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'invoice', ['all_notifications', 'invoice_sent', 'invoice_sent_all']);
|
||||||
|
|
||||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||||
unset($methods[$key]);
|
unset($methods[$key]);
|
||||||
|
@ -55,7 +55,7 @@ class QuoteEmailedNotification implements ShouldQueue
|
|||||||
|
|
||||||
// $notification = new EntitySentNotification($event->invitation, 'quote');
|
// $notification = new EntitySentNotification($event->invitation, 'quote');
|
||||||
|
|
||||||
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'quote', ['all_notifications', 'quote_sent']);
|
$methods = $this->findUserNotificationTypes($event->invitation, $company_user, 'quote', ['all_notifications', 'quote_sent', 'quote_sent_all']);
|
||||||
|
|
||||||
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
if (($key = array_search('mail', $methods)) !== false && $first_notification_sent === true) {
|
||||||
unset($methods[$key]);
|
unset($methods[$key]);
|
||||||
|
@ -191,7 +191,9 @@ class BaseModel extends Model
|
|||||||
|
|
||||||
public function numberFormatter()
|
public function numberFormatter()
|
||||||
{
|
{
|
||||||
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $this->number);
|
$number = strlen($this->number) > 1 ? $this->number : class_basename($this);
|
||||||
|
|
||||||
|
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $number);
|
||||||
// Remove any runs of periods (thanks falstro!)
|
// Remove any runs of periods (thanks falstro!)
|
||||||
$formatted_number = mb_ereg_replace("([\.]{2,})", '', $formatted_number);
|
$formatted_number = mb_ereg_replace("([\.]{2,})", '', $formatted_number);
|
||||||
|
|
||||||
|
@ -160,14 +160,9 @@ class Company extends BaseModel
|
|||||||
return $this->hasMany(ExpenseCategory::class)->withTrashed();
|
return $this->hasMany(ExpenseCategory::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function client_subscriptions()
|
public function subscriptions()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ClientSubscription::class)->withTrashed();
|
return $this->hasMany(Subscription::class)->withTrashed();
|
||||||
}
|
|
||||||
|
|
||||||
public function billing_subscriptions()
|
|
||||||
{
|
|
||||||
return $this->hasMany(BillingSubscription::class)->withTrashed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function task_statuses()
|
public function task_statuses()
|
||||||
|
@ -11,21 +11,20 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Services\BillingSubscription\BillingSubscriptionService;
|
use App\Services\Subscription\SubscriptionService;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class BillingSubscription extends BaseModel
|
class Subscription extends BaseModel
|
||||||
{
|
{
|
||||||
use HasFactory, SoftDeletes;
|
use HasFactory, SoftDeletes;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
'product_id',
|
'product_ids',
|
||||||
|
'recurring_product_ids',
|
||||||
'company_id',
|
'company_id',
|
||||||
'product_id',
|
|
||||||
'is_recurring',
|
|
||||||
'frequency_id',
|
'frequency_id',
|
||||||
'auto_bill',
|
'auto_bill',
|
||||||
'promo_code',
|
'promo_code',
|
||||||
@ -43,6 +42,7 @@ class BillingSubscription extends BaseModel
|
|||||||
'refund_period',
|
'refund_period',
|
||||||
'webhook_configuration',
|
'webhook_configuration',
|
||||||
'currency_id',
|
'currency_id',
|
||||||
|
'group_id',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
@ -56,7 +56,7 @@ class BillingSubscription extends BaseModel
|
|||||||
|
|
||||||
public function service()
|
public function service()
|
||||||
{
|
{
|
||||||
return new BillingSubscriptionService($this);
|
return new SubscriptionService($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
@ -11,17 +11,17 @@
|
|||||||
|
|
||||||
namespace App\Observers;
|
namespace App\Observers;
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
|
|
||||||
class BillingSubscriptionObserver
|
class SubscriptionObserver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Handle the billing_subscription "created" event.
|
* Handle the billing_subscription "created" event.
|
||||||
*
|
*
|
||||||
* @param BillingSubscription $billing_subscription
|
* @param Subscription $billing_subscription
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function created(BillingSubscription $billing_subscription)
|
public function created(Subscription $subscription)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -29,10 +29,10 @@ class BillingSubscriptionObserver
|
|||||||
/**
|
/**
|
||||||
* Handle the billing_subscription "updated" event.
|
* Handle the billing_subscription "updated" event.
|
||||||
*
|
*
|
||||||
* @param BillingSubscription $billing_subscription
|
* @param Subscription $billing_subscription
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function updated(BillingSubscription $billing_subscription)
|
public function updated(Subscription $subscription)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -40,10 +40,10 @@ class BillingSubscriptionObserver
|
|||||||
/**
|
/**
|
||||||
* Handle the billing_subscription "deleted" event.
|
* Handle the billing_subscription "deleted" event.
|
||||||
*
|
*
|
||||||
* @param BillingSubscription $billing_subscription
|
* @param Subscription $billing_subscription
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function deleted(BillingSubscription $billing_subscription)
|
public function deleted(Subscription $subscription)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -51,10 +51,10 @@ class BillingSubscriptionObserver
|
|||||||
/**
|
/**
|
||||||
* Handle the billing_subscription "restored" event.
|
* Handle the billing_subscription "restored" event.
|
||||||
*
|
*
|
||||||
* @param BillingSubscription $billing_subscription
|
* @param Subscription $billing_subscription
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function restored(BillingSubscription $billing_subscription)
|
public function restored(Subscription $subscription)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -62,10 +62,10 @@ class BillingSubscriptionObserver
|
|||||||
/**
|
/**
|
||||||
* Handle the billing_subscription "force deleted" event.
|
* Handle the billing_subscription "force deleted" event.
|
||||||
*
|
*
|
||||||
* @param BillingSubscription $billing_subscription
|
* @param Subscription $billing_subscription
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function forceDeleted(BillingSubscription $billing_subscription)
|
public function forceDeleted(Subscription $subscription)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
@ -30,7 +30,7 @@ use App\Models\Invoice;
|
|||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
use App\Services\BillingSubscription\BillingSubscriptionService;
|
use App\Services\Subscription\SubscriptionService;
|
||||||
use App\Utils\Ninja;
|
use App\Utils\Ninja;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use App\Utils\Traits\SystemLogTrait;
|
use App\Utils\Traits\SystemLogTrait;
|
||||||
@ -242,9 +242,9 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars()));
|
||||||
|
|
||||||
if (property_exists($this->payment_hash->data, 'billing_context')) {
|
if (property_exists($this->payment_hash->data, 'billing_context')) {
|
||||||
$billing_subscription = \App\Models\BillingSubscription::find($this->payment_hash->data->billing_context->billing_subscription_id);
|
$billing_subscription = \App\Models\Subscription::find($this->payment_hash->data->billing_context->billing_subscription_id);
|
||||||
|
|
||||||
(new BillingSubscriptionService($billing_subscription))->completePurchase($this->payment_hash);
|
(new SubscriptionService($billing_subscription))->completePurchase($this->payment_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $payment->service()->applyNumber()->save();
|
return $payment->service()->applyNumber()->save();
|
||||||
|
@ -14,9 +14,9 @@ namespace App\Policies;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BillingSubscriptionPolicy.
|
* Class SubscriptionPolicy.
|
||||||
*/
|
*/
|
||||||
class BillingSubscriptionPolicy extends EntityPolicy
|
class SubscriptionPolicy extends EntityPolicy
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks if the user has create permissions.
|
* Checks if the user has create permissions.
|
||||||
@ -26,6 +26,6 @@ class BillingSubscriptionPolicy extends EntityPolicy
|
|||||||
*/
|
*/
|
||||||
public function create(User $user) : bool
|
public function create(User $user) : bool
|
||||||
{
|
{
|
||||||
return $user->isAdmin() || $user->hasPermission('create_billing_subscription') || $user->hasPermission('create_all');
|
return $user->isAdmin() || $user->hasPermission('create_subscription') || $user->hasPermission('create_all');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientSubscription;
|
use App\Models\ClientSubscription;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
@ -28,7 +28,7 @@ use App\Models\Quote;
|
|||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Observers\AccountObserver;
|
use App\Observers\AccountObserver;
|
||||||
use App\Observers\BillingSubscriptionObserver;
|
use App\Observers\SubscriptionObserver;
|
||||||
use App\Observers\ClientObserver;
|
use App\Observers\ClientObserver;
|
||||||
use App\Observers\ClientSubscriptionObserver;
|
use App\Observers\ClientSubscriptionObserver;
|
||||||
use App\Observers\CompanyGatewayObserver;
|
use App\Observers\CompanyGatewayObserver;
|
||||||
@ -80,7 +80,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
Schema::defaultStringLength(191);
|
Schema::defaultStringLength(191);
|
||||||
|
|
||||||
Account::observe(AccountObserver::class);
|
Account::observe(AccountObserver::class);
|
||||||
BillingSubscription::observe(BillingSubscriptionObserver::class);
|
Subscription::observe(SubscriptionObserver::class);
|
||||||
Client::observe(ClientObserver::class);
|
Client::observe(ClientObserver::class);
|
||||||
ClientSubscription::observe(ClientSubscriptionObserver::class);
|
ClientSubscription::observe(ClientSubscriptionObserver::class);
|
||||||
Company::observe(CompanyObserver::class);
|
Company::observe(CompanyObserver::class);
|
||||||
|
@ -12,9 +12,8 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientSubscription;
|
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
use App\Models\CompanyToken;
|
use App\Models\CompanyToken;
|
||||||
@ -39,7 +38,7 @@ use App\Models\User;
|
|||||||
use App\Models\Vendor;
|
use App\Models\Vendor;
|
||||||
use App\Models\Webhook;
|
use App\Models\Webhook;
|
||||||
use App\Policies\ActivityPolicy;
|
use App\Policies\ActivityPolicy;
|
||||||
use App\Policies\BillingSubscriptionPolicy;
|
use App\Policies\SubscriptionPolicy;
|
||||||
use App\Policies\ClientPolicy;
|
use App\Policies\ClientPolicy;
|
||||||
use App\Policies\ClientSubscriptionPolicy;
|
use App\Policies\ClientSubscriptionPolicy;
|
||||||
use App\Policies\CompanyGatewayPolicy;
|
use App\Policies\CompanyGatewayPolicy;
|
||||||
@ -77,9 +76,8 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected $policies = [
|
protected $policies = [
|
||||||
Activity::class => ActivityPolicy::class,
|
Activity::class => ActivityPolicy::class,
|
||||||
BillingSubscription::class => BillingSubscriptionPolicy::class,
|
Subscription::class => SubscriptionPolicy::class,
|
||||||
Client::class => ClientPolicy::class,
|
Client::class => ClientPolicy::class,
|
||||||
ClientSubscription::class => ClientSubscriptionPolicy::class,
|
|
||||||
Company::class => CompanyPolicy::class,
|
Company::class => CompanyPolicy::class,
|
||||||
CompanyToken::class => CompanyTokenPolicy::class,
|
CompanyToken::class => CompanyTokenPolicy::class,
|
||||||
CompanyGateway::class => CompanyGatewayPolicy::class,
|
CompanyGateway::class => CompanyGatewayPolicy::class,
|
||||||
|
@ -13,16 +13,16 @@
|
|||||||
namespace App\Repositories;
|
namespace App\Repositories;
|
||||||
|
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
|
|
||||||
class BillingSubscriptionRepository extends BaseRepository
|
class SubscriptionRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
public function save($data, BillingSubscription $billing_subscription): ?BillingSubscription
|
public function save($data, Subscription $subscription): ?Subscription
|
||||||
{
|
{
|
||||||
$billing_subscription
|
$subscription
|
||||||
->fill($data)
|
->fill($data)
|
||||||
->save();
|
->save();
|
||||||
|
|
||||||
return $billing_subscription;
|
return $subscription;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -148,9 +148,9 @@ class UserRepository extends BaseRepository
|
|||||||
|
|
||||||
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars()));
|
event(new UserWasDeleted($user, auth()->user(), $company, Ninja::eventVars()));
|
||||||
|
|
||||||
// $user->is_deleted = true;
|
$user->is_deleted = true;
|
||||||
// $user->save();
|
$user->save();
|
||||||
// $user->delete();
|
$user->delete();
|
||||||
|
|
||||||
|
|
||||||
return $user->fresh();
|
return $user->fresh();
|
||||||
@ -177,7 +177,17 @@ class UserRepository extends BaseRepository
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user->is_deleted = false;
|
||||||
|
$user->save();
|
||||||
$user->restore();
|
$user->restore();
|
||||||
|
// $user->company_user->restore();
|
||||||
|
|
||||||
|
$cu = CompanyUser::withTrashed()
|
||||||
|
->where('user_id', $user->id)
|
||||||
|
->where('company_id', auth()->user()->company()->id)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$cu->restore();
|
||||||
|
|
||||||
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
event(new UserWasRestored($user, auth()->user(), auth()->user()->company, Ninja::eventVars()));
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class PaymentMethod
|
|||||||
foreach ($child_array as $gateway_id => $gateway_type_id) {
|
foreach ($child_array as $gateway_id => $gateway_type_id) {
|
||||||
$gateway = CompanyGateway::find($gateway_id);
|
$gateway = CompanyGateway::find($gateway_id);
|
||||||
|
|
||||||
$fee_label = $gateway->calcGatewayFeeLabel($this->amount, $this->client);
|
$fee_label = $gateway->calcGatewayFeeLabel($this->amount, $this->client, $gateway_type_id);
|
||||||
|
|
||||||
if(!$gateway_type_id){
|
if(!$gateway_type_id){
|
||||||
|
|
||||||
|
@ -9,13 +9,16 @@
|
|||||||
* @license https://opensource.org/licenses/AAL
|
* @license https://opensource.org/licenses/AAL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Services\BillingSubscription;
|
namespace App\Services\Subscription;
|
||||||
|
|
||||||
use App\DataMapper\InvoiceItem;
|
use App\DataMapper\InvoiceItem;
|
||||||
use App\Factory\InvoiceFactory;
|
use App\Factory\InvoiceFactory;
|
||||||
|
use App\Factory\InvoiceToRecurringInvoiceFactory;
|
||||||
use App\Jobs\Util\SystemLogger;
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
|
use App\Models\ClientContact;
|
||||||
use App\Models\ClientSubscription;
|
use App\Models\ClientSubscription;
|
||||||
|
use App\Models\Invoice;
|
||||||
use App\Models\PaymentHash;
|
use App\Models\PaymentHash;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
@ -24,26 +27,27 @@ use App\Utils\Traits\CleanLineItems;
|
|||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use GuzzleHttp\RequestOptions;
|
use GuzzleHttp\RequestOptions;
|
||||||
|
|
||||||
class BillingSubscriptionService
|
class SubscriptionService
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
use CleanLineItems;
|
use CleanLineItems;
|
||||||
|
|
||||||
/** @var BillingSubscription */
|
/** @var subscription */
|
||||||
private $billing_subscription;
|
private $subscription;
|
||||||
|
|
||||||
|
/** @var client_subscription */
|
||||||
private $client_subscription;
|
private $client_subscription;
|
||||||
|
|
||||||
public function __construct(BillingSubscription $billing_subscription)
|
public function __construct(Subscription $subscription)
|
||||||
{
|
{
|
||||||
$this->billing_subscription = $billing_subscription;
|
$this->subscription = $subscription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function completePurchase(PaymentHash $payment_hash)
|
public function completePurchase(PaymentHash $payment_hash)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!property_exists($payment_hash, 'billing_context')) {
|
if (!property_exists($payment_hash->data, 'billing_context')) {
|
||||||
return;
|
throw new \Exception("Illegal entrypoint into method, payload must contain billing context");
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point we have some state carried from the billing page
|
// At this point we have some state carried from the billing page
|
||||||
@ -57,34 +61,48 @@ class BillingSubscriptionService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
'email' => $this->email ?? $this->contact->email,
|
||||||
|
'quantity' => $this->quantity,
|
||||||
|
'contact_id' => $this->contact->id,
|
||||||
|
*/
|
||||||
public function startTrial(array $data)
|
public function startTrial(array $data)
|
||||||
{
|
{
|
||||||
// Redirects from here work just fine. Livewire will respect it.
|
// Redirects from here work just fine. Livewire will respect it.
|
||||||
|
|
||||||
// Some magic here..
|
if(!$this->subscription->trial_enabled)
|
||||||
|
return new \Exception("Trials are disabled for this product");
|
||||||
|
|
||||||
return redirect('/trial-started');
|
$contact = ClientContact::with('client')->find($data['contact_id']);
|
||||||
|
|
||||||
|
$cs = new ClientSubscription();
|
||||||
|
$cs->subscription_id = $this->subscription->id;
|
||||||
|
$cs->company_id = $this->subscription->company_id;
|
||||||
|
$cs->trial_started = time();
|
||||||
|
$cs->trial_ends = time() + $this->subscription->trial_duration;
|
||||||
|
$cs->quantity = $data['quantity'];
|
||||||
|
$cs->client_id = $contact->client->id;
|
||||||
|
$cs->save();
|
||||||
|
|
||||||
|
$this->client_subscription = $cs;
|
||||||
|
|
||||||
|
//execute any webhooks
|
||||||
|
$this->triggerWebhook();
|
||||||
|
|
||||||
|
if(strlen($this->subscription->webhook_configuration->post_purchase_url) >=1)
|
||||||
|
return redirect($this->subscription->webhook_configuration->post_purchase_url);
|
||||||
|
|
||||||
|
return redirect('/client/subscription/'.$cs->hashed_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createInvoice($data): ?\App\Models\Invoice
|
public function createInvoice($data): ?\App\Models\Invoice
|
||||||
{
|
{
|
||||||
|
|
||||||
$invoice_repo = new InvoiceRepository();
|
$invoice_repo = new InvoiceRepository();
|
||||||
|
|
||||||
$data['line_items'] = $this->cleanItems($this->createLineItems($data));
|
$data['line_items'] = $this->cleanItems($this->createLineItems($data));
|
||||||
|
|
||||||
/*
|
return $invoice_repo->save($data, InvoiceFactory::create($this->subscription->company_id, $this->subscription->user_id));
|
||||||
If trial_enabled -> return early
|
|
||||||
|
|
||||||
-- what we need to know that we don't already
|
|
||||||
-- Has a promo code been entered, and does it match
|
|
||||||
-- Is this a recurring subscription
|
|
||||||
--
|
|
||||||
|
|
||||||
1. Is this a recurring product?
|
|
||||||
2. What is the quantity? ie is this a multi seat product ( does this mean we need this value stored in the client sub?)
|
|
||||||
*/
|
|
||||||
|
|
||||||
return $invoice_repo->save($data, InvoiceFactory::create($this->billing_subscription->company_id, $this->billing_subscription->user_id));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +112,10 @@ class BillingSubscriptionService
|
|||||||
*/
|
*/
|
||||||
private function createLineItems($data): array
|
private function createLineItems($data): array
|
||||||
{
|
{
|
||||||
|
|
||||||
$line_items = [];
|
$line_items = [];
|
||||||
|
|
||||||
$product = $this->billing_subscription->product;
|
$product = $this->subscription->product;
|
||||||
|
|
||||||
$item = new InvoiceItem;
|
$item = new InvoiceItem;
|
||||||
$item->quantity = $data['quantity'];
|
$item->quantity = $data['quantity'];
|
||||||
@ -120,10 +139,11 @@ class BillingSubscriptionService
|
|||||||
|
|
||||||
|
|
||||||
//do we have a promocode? enter this as a line item.
|
//do we have a promocode? enter this as a line item.
|
||||||
if(strlen($data['coupon']) >=1 && ($data['coupon'] == $this->billing_subscription->promo_code) && $this->billing_subscription->promo_discount > 0)
|
if(strlen($data['coupon']) >=1 && ($data['coupon'] == $this->subscription->promo_code) && $this->subscription->promo_discount > 0)
|
||||||
$line_items[] = $this->createPromoLine($data);
|
$line_items[] = $this->createPromoLine($data);
|
||||||
|
|
||||||
return $line_items;
|
return $line_items;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,16 +153,16 @@ class BillingSubscriptionService
|
|||||||
private function createPromoLine($data)
|
private function createPromoLine($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$product = $this->billing_subscription->product;
|
$product = $this->subscription->product;
|
||||||
$discounted_amount = 0;
|
$discounted_amount = 0;
|
||||||
$discount = 0;
|
$discount = 0;
|
||||||
$amount = $data['quantity'] * $product->cost;
|
$amount = $data['quantity'] * $product->cost;
|
||||||
|
|
||||||
if ($this->billing_subscription->is_amount_discount == true) {
|
if ($this->subscription->is_amount_discount == true) {
|
||||||
$discount = $this->billing_subscription->promo_discount;
|
$discount = $this->subscription->promo_discount;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$discount = round($amount * ($this->billing_subscription->promo_discount / 100), 2);
|
$discount = round($amount * ($this->subscription->promo_discount / 100), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
$discounted_amount = $amount - $discount;
|
$discounted_amount = $amount - $discount;
|
||||||
@ -166,42 +186,44 @@ class BillingSubscriptionService
|
|||||||
private function convertInvoiceToRecurring($payment_hash)
|
private function convertInvoiceToRecurring($payment_hash)
|
||||||
{
|
{
|
||||||
//The first invoice is a plain invoice - the second is fired on the recurring schedule.
|
//The first invoice is a plain invoice - the second is fired on the recurring schedule.
|
||||||
|
$invoice = Invoice::find($payment_hash->billing_context->invoice_id);
|
||||||
|
|
||||||
|
if(!$invoice)
|
||||||
|
throw new \Exception("Could not match an invoice for payment of billing subscription");
|
||||||
|
|
||||||
|
//todo - need to remove the promo code - if it exists
|
||||||
|
|
||||||
|
return InvoiceToRecurringInvoiceFactory::create($invoice);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createClientSubscription($payment_hash)
|
public function createClientSubscription($payment_hash)
|
||||||
{
|
{
|
||||||
//create the client subscription record
|
|
||||||
|
|
||||||
//are we in a trial phase?
|
|
||||||
//has money been paid?
|
|
||||||
//is this a recurring or one off subscription.
|
//is this a recurring or one off subscription.
|
||||||
|
|
||||||
$cs = new ClientSubscription();
|
$cs = new ClientSubscription();
|
||||||
$cs->subscription_id = $this->billing_subscription->id;
|
$cs->subscription_id = $this->subscription->id;
|
||||||
$cs->company_id = $this->billing_subscription->company_id;
|
$cs->company_id = $this->subscription->company_id;
|
||||||
|
|
||||||
//if is_trial
|
$cs->invoice_id = $payment_hash->billing_context->invoice_id;
|
||||||
//$cs->trial_started = time();
|
$cs->client_id = $payment_hash->billing_context->client_id;
|
||||||
//$cs->trial_duration = time() + duration period in seconds
|
$cs->quantity = $payment_hash->billing_context->quantity;
|
||||||
|
|
||||||
//trials will not have any monies paid.
|
|
||||||
|
|
||||||
//if a payment has been made
|
|
||||||
//$cs->invoice_id = xx
|
|
||||||
|
|
||||||
//if is_recurring
|
//if is_recurring
|
||||||
//create recurring invoice from invoice
|
//create recurring invoice from invoice
|
||||||
|
if($this->subscription->is_recurring)
|
||||||
|
{
|
||||||
$recurring_invoice = $this->convertInvoiceToRecurring($payment_hash);
|
$recurring_invoice = $this->convertInvoiceToRecurring($payment_hash);
|
||||||
$recurring_invoice->frequency_id = $this->billing_subscription->frequency_id;
|
$recurring_invoice->frequency_id = $this->subscription->frequency_id;
|
||||||
$recurring_invoice->next_send_date = $recurring_invoice->nextDateByFrequency(now()->format('Y-m-d'));
|
$recurring_invoice->next_send_date = $recurring_invoice->nextDateByFrequency(now()->format('Y-m-d'));
|
||||||
//$cs->recurring_invoice_id = $recurring_invoice->id;
|
$recurring_invoice->save();
|
||||||
|
$cs->recurring_invoice_id = $recurring_invoice->id;
|
||||||
|
|
||||||
//?set the recurring invoice as active - set the date here also based on the frequency?
|
//?set the recurring invoice as active - set the date here also based on the frequency?
|
||||||
|
$recurring_invoice->service()->start();
|
||||||
|
}
|
||||||
|
|
||||||
//$cs->quantity = xx
|
|
||||||
|
|
||||||
// client_id
|
|
||||||
//$cs->client_id = xx
|
|
||||||
|
|
||||||
$cs->save();
|
$cs->save();
|
||||||
|
|
||||||
@ -209,22 +231,20 @@ class BillingSubscriptionService
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function triggerWebhook($payment_hash)
|
public function triggerWebhook()
|
||||||
{
|
{
|
||||||
//hit the webhook to after a successful onboarding
|
//hit the webhook to after a successful onboarding
|
||||||
//$client = xxxxxxx
|
|
||||||
//todo webhook
|
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
'billing_subscription' => $this->billing_subscription,
|
'subscription' => $this->subscription,
|
||||||
'client_subscription' => $this->client_subscription,
|
'client_subscription' => $this->client_subscription,
|
||||||
// 'client' => $client->toArray(),
|
'client' => $this->client_subscription->client->toArray(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
$client = new \GuzzleHttp\Client(['headers' => $this->billing_subscription->webhook_configuration->post_purchase_headers]);
|
$client = new \GuzzleHttp\Client(['headers' => $this->subscription->webhook_configuration->post_purchase_headers]);
|
||||||
|
|
||||||
$response = $client->{$this->billing_subscription->webhook_configuration->post_purchase_rest_method}($this->billing_subscription->post_purchase_url,[
|
$response = $client->{$this->subscription->webhook_configuration->post_purchase_rest_method}($this->subscription->post_purchase_url,[
|
||||||
RequestOptions::JSON => ['body' => $body]
|
RequestOptions::JSON => ['body' => $body]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -233,7 +253,7 @@ class BillingSubscriptionService
|
|||||||
SystemLog::CATEGORY_WEBHOOK,
|
SystemLog::CATEGORY_WEBHOOK,
|
||||||
SystemLog::EVENT_WEBHOOK_RESPONSE,
|
SystemLog::EVENT_WEBHOOK_RESPONSE,
|
||||||
SystemLog::TYPE_WEBHOOK_RESPONSE,
|
SystemLog::TYPE_WEBHOOK_RESPONSE,
|
||||||
//$client,
|
$this->client_subscription->client,
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
@ -1,74 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
|
||||||
*
|
|
||||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
|
||||||
*
|
|
||||||
* @license https://opensource.org/licenses/AAL
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Transformers;
|
|
||||||
|
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
|
||||||
use App\Utils\Traits\MakesHash;
|
|
||||||
|
|
||||||
class BillingSubscriptionTransformer extends EntityTransformer
|
|
||||||
{
|
|
||||||
use MakesHash;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $defaultIncludes = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $availableIncludes = [
|
|
||||||
'product',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function transform(BillingSubscription $billing_subscription): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
'id' => $this->encodePrimaryKey($billing_subscription->id),
|
|
||||||
'user_id' => $this->encodePrimaryKey($billing_subscription->user_id),
|
|
||||||
'product_id' => $this->encodePrimaryKey($billing_subscription->product_id),
|
|
||||||
'assigned_user_id' => $this->encodePrimaryKey($billing_subscription->assigned_user_id),
|
|
||||||
'company_id' => $this->encodePrimaryKey($billing_subscription->company_id),
|
|
||||||
'is_recurring' => (bool)$billing_subscription->is_recurring,
|
|
||||||
'frequency_id' => (string)$billing_subscription->frequency_id,
|
|
||||||
'auto_bill' => (string)$billing_subscription->auto_bill,
|
|
||||||
'promo_code' => (string)$billing_subscription->promo_code,
|
|
||||||
'promo_discount' => (float)$billing_subscription->promo_discount,
|
|
||||||
'is_amount_discount' => (bool)$billing_subscription->is_amount_discount,
|
|
||||||
'allow_cancellation' => (bool)$billing_subscription->allow_cancellation,
|
|
||||||
'per_seat_enabled' => (bool)$billing_subscription->per_set_enabled,
|
|
||||||
'min_seats_limit' => (int)$billing_subscription->min_seats_limit,
|
|
||||||
'max_seats_limit' => (int)$billing_subscription->max_seats_limit,
|
|
||||||
'trial_enabled' => (bool)$billing_subscription->trial_enabled,
|
|
||||||
'trial_duration' => (int)$billing_subscription->trial_duration,
|
|
||||||
'allow_query_overrides' => (bool)$billing_subscription->allow_query_overrides,
|
|
||||||
'allow_plan_changes' => (bool)$billing_subscription->allow_plan_changes,
|
|
||||||
'plan_map' => (string)$billing_subscription->plan_map,
|
|
||||||
'refund_period' => (int)$billing_subscription->refund_period,
|
|
||||||
'webhook_configuration' => (string)$billing_subscription->webhook_configuration,
|
|
||||||
'purchase_page' => (string)route('client.subscription.purchase', $billing_subscription->hashed_id),
|
|
||||||
'is_deleted' => (bool)$billing_subscription->is_deleted,
|
|
||||||
'created_at' => (int)$billing_subscription->created_at,
|
|
||||||
'updated_at' => (int)$billing_subscription->updated_at,
|
|
||||||
'archived_at' => (int)$billing_subscription->deleted_at,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function includeProduct(BillingSubscription $billing_subscription): \League\Fractal\Resource\Item
|
|
||||||
{
|
|
||||||
$transformer = new ProductTransformer($this->serializer);
|
|
||||||
|
|
||||||
return $this->includeItem($billing_subscription->product, $transformer, Product::class);
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,7 @@ namespace App\Transformers;
|
|||||||
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\ClientSubscription;
|
use App\Models\ClientSubscription;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
@ -92,7 +92,7 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'system_logs',
|
'system_logs',
|
||||||
'expense_categories',
|
'expense_categories',
|
||||||
'task_statuses',
|
'task_statuses',
|
||||||
'client_subscriptions',
|
'billing_subscriptions',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -362,17 +362,10 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
return $this->includeCollection($company->system_logs, $transformer, SystemLog::class);
|
return $this->includeCollection($company->system_logs, $transformer, SystemLog::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function includeClientSubscriptions(Company $company)
|
public function includeSubscriptions(Company $company)
|
||||||
{
|
{
|
||||||
$transformer = new ClientSubscriptionTransformer($this->serializer);
|
$transformer = new SubscriptionTransformer($this->serializer);
|
||||||
|
|
||||||
return $this->includeCollection($company->client_subscriptions, $transformer, ClientSubscription::class);
|
return $this->includeCollection($company->billing_subscriptions, $transformer, Subscription::class);
|
||||||
}
|
|
||||||
|
|
||||||
public function includeBillingSubscriptions(Company $company)
|
|
||||||
{
|
|
||||||
$transformer = new BillingSubscriptionTransformer($this->serializer);
|
|
||||||
|
|
||||||
return $this->includeCollection($company->billing_subscriptions, $transformer, BillingSubscription::class);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
69
app/Transformers/SubscriptionTransformer.php
Normal file
69
app/Transformers/SubscriptionTransformer.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
|
*
|
||||||
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||||
|
*
|
||||||
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||||
|
*
|
||||||
|
* @license https://opensource.org/licenses/AAL
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace App\Transformers;
|
||||||
|
|
||||||
|
use App\Models\Subscription;
|
||||||
|
use App\Utils\Traits\MakesHash;
|
||||||
|
|
||||||
|
class SubscriptionTransformer extends EntityTransformer
|
||||||
|
{
|
||||||
|
use MakesHash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $defaultIncludes = [
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $availableIncludes = [
|
||||||
|
];
|
||||||
|
|
||||||
|
public function transform(Subscription $subscription): array
|
||||||
|
{
|
||||||
|
$std = new \stdClass;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => $this->encodePrimaryKey($subscription->id),
|
||||||
|
'user_id' => $this->encodePrimaryKey($subscription->user_id),
|
||||||
|
'product_id' => $this->encodePrimaryKey($subscription->product_id),
|
||||||
|
'assigned_user_id' => $this->encodePrimaryKey($subscription->assigned_user_id),
|
||||||
|
'company_id' => $this->encodePrimaryKey($subscription->company_id),
|
||||||
|
'is_recurring' => (bool)$subscription->is_recurring,
|
||||||
|
'frequency_id' => (string)$subscription->frequency_id,
|
||||||
|
'auto_bill' => (string)$subscription->auto_bill,
|
||||||
|
'promo_code' => (string)$subscription->promo_code,
|
||||||
|
'promo_discount' => (float)$subscription->promo_discount,
|
||||||
|
'is_amount_discount' => (bool)$subscription->is_amount_discount,
|
||||||
|
'allow_cancellation' => (bool)$subscription->allow_cancellation,
|
||||||
|
'per_seat_enabled' => (bool)$subscription->per_set_enabled,
|
||||||
|
'min_seats_limit' => (int)$subscription->min_seats_limit,
|
||||||
|
'max_seats_limit' => (int)$subscription->max_seats_limit,
|
||||||
|
'trial_enabled' => (bool)$subscription->trial_enabled,
|
||||||
|
'trial_duration' => (int)$subscription->trial_duration,
|
||||||
|
'allow_query_overrides' => (bool)$subscription->allow_query_overrides,
|
||||||
|
'allow_plan_changes' => (bool)$subscription->allow_plan_changes,
|
||||||
|
'plan_map' => (string)$subscription->plan_map,
|
||||||
|
'refund_period' => (int)$subscription->refund_period,
|
||||||
|
'webhook_configuration' => $subscription->webhook_configuration ?: $std,
|
||||||
|
'purchase_page' => (string)route('client.subscription.purchase', $subscription->hashed_id),
|
||||||
|
'is_deleted' => (bool)$subscription->is_deleted,
|
||||||
|
'created_at' => (int)$subscription->created_at,
|
||||||
|
'updated_at' => (int)$subscription->updated_at,
|
||||||
|
'archived_at' => (int)$subscription->deleted_at,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -28,7 +28,7 @@ trait CleanLineItems
|
|||||||
$cleaned_items = [];
|
$cleaned_items = [];
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
$cleaned_items[] = $this->cleanLineItem($item);
|
$cleaned_items[] = $this->cleanLineItem((array)$item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $cleaned_items;
|
return $cleaned_items;
|
||||||
|
@ -34,10 +34,12 @@ trait UserNotifies
|
|||||||
array_push($required_permissions, 'all_user_notifications');
|
array_push($required_permissions, 'all_user_notifications');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >= 1 || count(array_intersect($required_permissions, ['all_notifications'])) >= 1) {
|
if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect(['all_user_notifications'], $notifications->email)) >= 1 || count(array_intersect(['all_notifications'],$notifications->email)) >= 1) {
|
||||||
array_push($notifiable_methods, 'mail');
|
array_push($notifiable_methods, 'mail');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nlog($notifiable_methods);
|
||||||
|
|
||||||
// if(count(array_intersect($required_permissions, $notifications->slack)) >=1)
|
// if(count(array_intersect($required_permissions, $notifications->slack)) >=1)
|
||||||
// array_push($notifiable_methods, 'slack');
|
// array_push($notifiable_methods, 'slack');
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-install-cmd": [
|
"post-install-cmd": [
|
||||||
"vendor/bin/snappdf download"
|
"if [ '${IS_DOCKER:-false}' != 'true' ]; then vendor/bin/snappdf download; fi"
|
||||||
],
|
],
|
||||||
"post-update-cmd": [
|
"post-update-cmd": [
|
||||||
"vendor/bin/snappdf download"
|
"vendor/bin/snappdf download"
|
||||||
|
196
composer.lock
generated
196
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "113acad46f6d9eea9f9f5bd4501428d1",
|
"content-hash": "2307a2f3214da0d1cc772cc1a1405682",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "authorizenet/authorizenet",
|
"name": "authorizenet/authorizenet",
|
||||||
@ -55,16 +55,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "aws/aws-sdk-php",
|
"name": "aws/aws-sdk-php",
|
||||||
"version": "3.173.28",
|
"version": "3.175.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||||
"reference": "593baa5930896bb443c437032daf4016e1e3878d"
|
"reference": "fce65d31f033c39cd3615fd2d3e503e212d81a3e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/593baa5930896bb443c437032daf4016e1e3878d",
|
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/fce65d31f033c39cd3615fd2d3e503e212d81a3e",
|
||||||
"reference": "593baa5930896bb443c437032daf4016e1e3878d",
|
"reference": "fce65d31f033c39cd3615fd2d3e503e212d81a3e",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -139,9 +139,9 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
||||||
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.173.28"
|
"source": "https://github.com/aws/aws-sdk-php/tree/3.175.1"
|
||||||
},
|
},
|
||||||
"time": "2021-03-12T19:29:55+00:00"
|
"time": "2021-03-22T18:13:37+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "bacon/bacon-qr-code",
|
"name": "bacon/bacon-qr-code",
|
||||||
@ -198,16 +198,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "beganovich/snappdf",
|
"name": "beganovich/snappdf",
|
||||||
"version": "v1.5.0",
|
"version": "v1.6.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/beganovich/snappdf.git",
|
"url": "https://github.com/beganovich/snappdf.git",
|
||||||
"reference": "63ad3f1a0eec7bffc3a3c85f286769fca9a33fd5"
|
"reference": "5c0a7e2e2c33441c0dd9d1fcbfc8de71c3cc920c"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/beganovich/snappdf/zipball/63ad3f1a0eec7bffc3a3c85f286769fca9a33fd5",
|
"url": "https://api.github.com/repos/beganovich/snappdf/zipball/5c0a7e2e2c33441c0dd9d1fcbfc8de71c3cc920c",
|
||||||
"reference": "63ad3f1a0eec7bffc3a3c85f286769fca9a33fd5",
|
"reference": "5c0a7e2e2c33441c0dd9d1fcbfc8de71c3cc920c",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -245,9 +245,9 @@
|
|||||||
"description": "Convert webpages or HTML into the PDF file using Chromium or Google Chrome.",
|
"description": "Convert webpages or HTML into the PDF file using Chromium or Google Chrome.",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/beganovich/snappdf/issues",
|
"issues": "https://github.com/beganovich/snappdf/issues",
|
||||||
"source": "https://github.com/beganovich/snappdf/tree/v1.5.0"
|
"source": "https://github.com/beganovich/snappdf/tree/v1.6.0"
|
||||||
},
|
},
|
||||||
"time": "2021-01-10T17:06:47+00:00"
|
"time": "2021-03-19T21:20:07+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "brick/math",
|
"name": "brick/math",
|
||||||
@ -2010,16 +2010,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "google/apiclient-services",
|
"name": "google/apiclient-services",
|
||||||
"version": "v0.163.0",
|
"version": "v0.165.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/googleapis/google-api-php-client-services.git",
|
"url": "https://github.com/googleapis/google-api-php-client-services.git",
|
||||||
"reference": "8e326f378a1f505064912fddd19fd93bbdcc80fb"
|
"reference": "c8d7ff2c9cb6cad6e88bc5825491c47b8b2e52fd"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/8e326f378a1f505064912fddd19fd93bbdcc80fb",
|
"url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/c8d7ff2c9cb6cad6e88bc5825491c47b8b2e52fd",
|
||||||
"reference": "8e326f378a1f505064912fddd19fd93bbdcc80fb",
|
"reference": "c8d7ff2c9cb6cad6e88bc5825491c47b8b2e52fd",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2045,9 +2045,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
|
"issues": "https://github.com/googleapis/google-api-php-client-services/issues",
|
||||||
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.163.0"
|
"source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.165.0"
|
||||||
},
|
},
|
||||||
"time": "2021-03-06T12:20:02+00:00"
|
"time": "2021-03-21T11:20:02+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "google/auth",
|
"name": "google/auth",
|
||||||
@ -2331,16 +2331,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/psr7",
|
"name": "guzzlehttp/psr7",
|
||||||
"version": "1.7.0",
|
"version": "1.8.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/guzzle/psr7.git",
|
"url": "https://github.com/guzzle/psr7.git",
|
||||||
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3"
|
"reference": "35ea11d335fd638b5882ff1725228b3d35496ab1"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
"url": "https://api.github.com/repos/guzzle/psr7/zipball/35ea11d335fd638b5882ff1725228b3d35496ab1",
|
||||||
"reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3",
|
"reference": "35ea11d335fd638b5882ff1725228b3d35496ab1",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2400,9 +2400,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/guzzle/psr7/issues",
|
"issues": "https://github.com/guzzle/psr7/issues",
|
||||||
"source": "https://github.com/guzzle/psr7/tree/1.7.0"
|
"source": "https://github.com/guzzle/psr7/tree/1.8.1"
|
||||||
},
|
},
|
||||||
"time": "2020-09-30T07:37:11+00:00"
|
"time": "2021-03-21T16:25:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hashids/hashids",
|
"name": "hashids/hashids",
|
||||||
@ -2783,16 +2783,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v8.32.1",
|
"version": "v8.33.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "7c37b64f8153c16b6406f5c28cf37828ebbe8846"
|
"reference": "354c57b8cb457549114074c500944455a288d6cc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/7c37b64f8153c16b6406f5c28cf37828ebbe8846",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/354c57b8cb457549114074c500944455a288d6cc",
|
||||||
"reference": "7c37b64f8153c16b6406f5c28cf37828ebbe8846",
|
"reference": "354c57b8cb457549114074c500944455a288d6cc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -2947,7 +2947,7 @@
|
|||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2021-03-09T15:37:45+00:00"
|
"time": "2021-03-16T19:42:32+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/slack-notification-channel",
|
"name": "laravel/slack-notification-channel",
|
||||||
@ -3845,16 +3845,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "livewire/livewire",
|
"name": "livewire/livewire",
|
||||||
"version": "v2.4.0",
|
"version": "v2.4.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/livewire/livewire.git",
|
"url": "https://github.com/livewire/livewire.git",
|
||||||
"reference": "8055af7730938cd607616fde122825ed960a9b71"
|
"reference": "b0cb782674673a67ddfd5910d2fcb5308bb32857"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/livewire/livewire/zipball/8055af7730938cd607616fde122825ed960a9b71",
|
"url": "https://api.github.com/repos/livewire/livewire/zipball/b0cb782674673a67ddfd5910d2fcb5308bb32857",
|
||||||
"reference": "8055af7730938cd607616fde122825ed960a9b71",
|
"reference": "b0cb782674673a67ddfd5910d2fcb5308bb32857",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -3905,7 +3905,7 @@
|
|||||||
"description": "A front-end framework for Laravel.",
|
"description": "A front-end framework for Laravel.",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/livewire/livewire/issues",
|
"issues": "https://github.com/livewire/livewire/issues",
|
||||||
"source": "https://github.com/livewire/livewire/tree/v2.4.0"
|
"source": "https://github.com/livewire/livewire/tree/v2.4.1"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -3913,7 +3913,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-02-23T17:44:50+00:00"
|
"time": "2021-03-22T14:03:36+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "maennchen/zipstream-php",
|
"name": "maennchen/zipstream-php",
|
||||||
@ -6919,16 +6919,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "stripe/stripe-php",
|
"name": "stripe/stripe-php",
|
||||||
"version": "v7.75.0",
|
"version": "v7.76.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/stripe/stripe-php.git",
|
"url": "https://github.com/stripe/stripe-php.git",
|
||||||
"reference": "d377a667cd789b99ccab768441a5a2160cc4ea80"
|
"reference": "47e66d4186712be33c593fe820dccf270a04d5d6"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/d377a667cd789b99ccab768441a5a2160cc4ea80",
|
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/47e66d4186712be33c593fe820dccf270a04d5d6",
|
||||||
"reference": "d377a667cd789b99ccab768441a5a2160cc4ea80",
|
"reference": "47e66d4186712be33c593fe820dccf270a04d5d6",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -6974,9 +6974,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/stripe/stripe-php/issues",
|
"issues": "https://github.com/stripe/stripe-php/issues",
|
||||||
"source": "https://github.com/stripe/stripe-php/tree/v7.75.0"
|
"source": "https://github.com/stripe/stripe-php/tree/v7.76.0"
|
||||||
},
|
},
|
||||||
"time": "2021-02-22T14:31:21+00:00"
|
"time": "2021-03-22T16:50:21+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "swiftmailer/swiftmailer",
|
"name": "swiftmailer/swiftmailer",
|
||||||
@ -9664,16 +9664,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "turbo124/beacon",
|
"name": "turbo124/beacon",
|
||||||
"version": "1.0.6",
|
"version": "1.0.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/turbo124/beacon.git",
|
"url": "https://github.com/turbo124/beacon.git",
|
||||||
"reference": "2f38612c1bb4c292d154c8fba478bdf8c019fcd9"
|
"reference": "d48227fdfafc463cce055f36b149f9cb1d9b8f81"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/turbo124/beacon/zipball/2f38612c1bb4c292d154c8fba478bdf8c019fcd9",
|
"url": "https://api.github.com/repos/turbo124/beacon/zipball/d48227fdfafc463cce055f36b149f9cb1d9b8f81",
|
||||||
"reference": "2f38612c1bb4c292d154c8fba478bdf8c019fcd9",
|
"reference": "d48227fdfafc463cce055f36b149f9cb1d9b8f81",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -9721,9 +9721,9 @@
|
|||||||
"turbo124"
|
"turbo124"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/turbo124/beacon/tree/1.0.6"
|
"source": "https://github.com/turbo124/beacon/tree/1.0.7"
|
||||||
},
|
},
|
||||||
"time": "2021-03-09T09:25:50+00:00"
|
"time": "2021-03-23T09:54:29+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vlucas/phpdotenv",
|
"name": "vlucas/phpdotenv",
|
||||||
@ -9881,30 +9881,35 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webmozart/assert",
|
"name": "webmozart/assert",
|
||||||
"version": "1.9.1",
|
"version": "1.10.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/webmozarts/assert.git",
|
"url": "https://github.com/webmozarts/assert.git",
|
||||||
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
|
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
|
"url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25",
|
||||||
"reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
|
"reference": "6964c76c7804814a842473e0c8fd15bab0f18e25",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^5.3.3 || ^7.0 || ^8.0",
|
"php": "^7.2 || ^8.0",
|
||||||
"symfony/polyfill-ctype": "^1.8"
|
"symfony/polyfill-ctype": "^1.8"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpstan/phpstan": "<0.12.20",
|
"phpstan/phpstan": "<0.12.20",
|
||||||
"vimeo/psalm": "<3.9.1"
|
"vimeo/psalm": "<4.6.1 || 4.6.2"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^4.8.36 || ^7.5.13"
|
"phpunit/phpunit": "^8.5.13"
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.10-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"Webmozart\\Assert\\": "src/"
|
"Webmozart\\Assert\\": "src/"
|
||||||
@ -9928,9 +9933,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/webmozarts/assert/issues",
|
"issues": "https://github.com/webmozarts/assert/issues",
|
||||||
"source": "https://github.com/webmozarts/assert/tree/1.9.1"
|
"source": "https://github.com/webmozarts/assert/tree/1.10.0"
|
||||||
},
|
},
|
||||||
"time": "2020-07-08T17:02:28+00:00"
|
"time": "2021-03-09T10:59:23+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webpatser/laravel-countries",
|
"name": "webpatser/laravel-countries",
|
||||||
@ -11079,16 +11084,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "filp/whoops",
|
"name": "filp/whoops",
|
||||||
"version": "2.9.2",
|
"version": "2.11.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/filp/whoops.git",
|
"url": "https://github.com/filp/whoops.git",
|
||||||
"reference": "df7933820090489623ce0be5e85c7e693638e536"
|
"reference": "f6e14679f948d8a5cfb866fa7065a30c66bd64d3"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/filp/whoops/zipball/df7933820090489623ce0be5e85c7e693638e536",
|
"url": "https://api.github.com/repos/filp/whoops/zipball/f6e14679f948d8a5cfb866fa7065a30c66bd64d3",
|
||||||
"reference": "df7933820090489623ce0be5e85c7e693638e536",
|
"reference": "f6e14679f948d8a5cfb866fa7065a30c66bd64d3",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -11138,7 +11143,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/filp/whoops/issues",
|
"issues": "https://github.com/filp/whoops/issues",
|
||||||
"source": "https://github.com/filp/whoops/tree/2.9.2"
|
"source": "https://github.com/filp/whoops/tree/2.11.0"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -11146,20 +11151,20 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-01-24T12:00:00+00:00"
|
"time": "2021-03-19T12:00:00+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "friendsofphp/php-cs-fixer",
|
"name": "friendsofphp/php-cs-fixer",
|
||||||
"version": "v2.18.3",
|
"version": "v2.18.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
|
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
|
||||||
"reference": "ab99202fccff2a9f97592fbe1b5c76dd06df3513"
|
"reference": "06f764e3cb6d60822d8f5135205f9d32b5508a31"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/ab99202fccff2a9f97592fbe1b5c76dd06df3513",
|
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/06f764e3cb6d60822d8f5135205f9d32b5508a31",
|
||||||
"reference": "ab99202fccff2a9f97592fbe1b5c76dd06df3513",
|
"reference": "06f764e3cb6d60822d8f5135205f9d32b5508a31",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -11242,7 +11247,7 @@
|
|||||||
"description": "A tool to automatically fix PHP code style",
|
"description": "A tool to automatically fix PHP code style",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues",
|
"issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues",
|
||||||
"source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.3"
|
"source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.18.4"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -11250,7 +11255,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-03-10T19:39:05+00:00"
|
"time": "2021-03-20T14:52:33+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "hamcrest/hamcrest-php",
|
"name": "hamcrest/hamcrest-php",
|
||||||
@ -12016,16 +12021,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpspec/prophecy",
|
"name": "phpspec/prophecy",
|
||||||
"version": "1.12.2",
|
"version": "1.13.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpspec/prophecy.git",
|
"url": "https://github.com/phpspec/prophecy.git",
|
||||||
"reference": "245710e971a030f42e08f4912863805570f23d39"
|
"reference": "be1996ed8adc35c3fd795488a653f4b518be70ea"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39",
|
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/be1996ed8adc35c3fd795488a653f4b518be70ea",
|
||||||
"reference": "245710e971a030f42e08f4912863805570f23d39",
|
"reference": "be1996ed8adc35c3fd795488a653f4b518be70ea",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -12077,9 +12082,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/phpspec/prophecy/issues",
|
"issues": "https://github.com/phpspec/prophecy/issues",
|
||||||
"source": "https://github.com/phpspec/prophecy/tree/1.12.2"
|
"source": "https://github.com/phpspec/prophecy/tree/1.13.0"
|
||||||
},
|
},
|
||||||
"time": "2020-12-19T10:15:11+00:00"
|
"time": "2021-03-17T13:42:18+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/php-code-coverage",
|
"name": "phpunit/php-code-coverage",
|
||||||
@ -12401,16 +12406,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "9.5.2",
|
"version": "9.5.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "f661659747f2f87f9e72095bb207bceb0f151cb4"
|
"reference": "c73c6737305e779771147af66c96ca6a7ed8a741"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c73c6737305e779771147af66c96ca6a7ed8a741",
|
||||||
"reference": "f661659747f2f87f9e72095bb207bceb0f151cb4",
|
"reference": "c73c6737305e779771147af66c96ca6a7ed8a741",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@ -12488,7 +12493,7 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.4"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -12500,7 +12505,7 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2021-02-02T14:45:58+00:00"
|
"time": "2021-03-23T07:16:29+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sebastian/cli-parser",
|
"name": "sebastian/cli-parser",
|
||||||
@ -13468,16 +13473,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "swagger-api/swagger-ui",
|
"name": "swagger-api/swagger-ui",
|
||||||
"version": "v3.45.0",
|
"version": "v3.45.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/swagger-api/swagger-ui.git",
|
"url": "https://github.com/swagger-api/swagger-ui.git",
|
||||||
"reference": "1ba7af074f97c872a64a415e0507c11cf8f3601b"
|
"reference": "72506e581f860244f3c74de5a2fb9809e53d1876"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/1ba7af074f97c872a64a415e0507c11cf8f3601b",
|
"url": "https://api.github.com/repos/swagger-api/swagger-ui/zipball/72506e581f860244f3c74de5a2fb9809e53d1876",
|
||||||
"reference": "1ba7af074f97c872a64a415e0507c11cf8f3601b",
|
"reference": "72506e581f860244f3c74de5a2fb9809e53d1876",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"type": "library",
|
"type": "library",
|
||||||
@ -13523,9 +13528,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/swagger-api/swagger-ui/issues",
|
"issues": "https://github.com/swagger-api/swagger-ui/issues",
|
||||||
"source": "https://github.com/swagger-api/swagger-ui/tree/v3.45.0"
|
"source": "https://github.com/swagger-api/swagger-ui/tree/v3.45.1"
|
||||||
},
|
},
|
||||||
"time": "2021-03-11T17:20:14+00:00"
|
"time": "2021-03-19T17:14:16+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/debug",
|
"name": "symfony/debug",
|
||||||
@ -13853,20 +13858,20 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vimeo/psalm",
|
"name": "vimeo/psalm",
|
||||||
"version": "4.6.2",
|
"version": "4.6.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/vimeo/psalm.git",
|
"url": "https://github.com/vimeo/psalm.git",
|
||||||
"reference": "bca09d74adc704c4eaee36a3c3e9d379e290fc3b"
|
"reference": "97fe86c4e158b5a57c5150aa5055c38b5a809aab"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/vimeo/psalm/zipball/bca09d74adc704c4eaee36a3c3e9d379e290fc3b",
|
"url": "https://api.github.com/repos/vimeo/psalm/zipball/97fe86c4e158b5a57c5150aa5055c38b5a809aab",
|
||||||
"reference": "bca09d74adc704c4eaee36a3c3e9d379e290fc3b",
|
"reference": "97fe86c4e158b5a57c5150aa5055c38b5a809aab",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"amphp/amp": "^2.1",
|
"amphp/amp": "^2.4.2",
|
||||||
"amphp/byte-stream": "^1.5",
|
"amphp/byte-stream": "^1.5",
|
||||||
"composer/package-versions-deprecated": "^1.8.0",
|
"composer/package-versions-deprecated": "^1.8.0",
|
||||||
"composer/semver": "^1.4 || ^2.0 || ^3.0",
|
"composer/semver": "^1.4 || ^2.0 || ^3.0",
|
||||||
@ -13892,7 +13897,6 @@
|
|||||||
"psalm/psalm": "self.version"
|
"psalm/psalm": "self.version"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"amphp/amp": "^2.4.2",
|
|
||||||
"bamarni/composer-bin-plugin": "^1.2",
|
"bamarni/composer-bin-plugin": "^1.2",
|
||||||
"brianium/paratest": "^4.0||^6.0",
|
"brianium/paratest": "^4.0||^6.0",
|
||||||
"ext-curl": "*",
|
"ext-curl": "*",
|
||||||
@ -13952,9 +13956,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/vimeo/psalm/issues",
|
"issues": "https://github.com/vimeo/psalm/issues",
|
||||||
"source": "https://github.com/vimeo/psalm/tree/4.6.2"
|
"source": "https://github.com/vimeo/psalm/tree/4.6.4"
|
||||||
},
|
},
|
||||||
"time": "2021-02-26T02:24:18+00:00"
|
"time": "2021-03-16T23:28:18+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "webmozart/path-util",
|
"name": "webmozart/path-util",
|
||||||
@ -14092,7 +14096,7 @@
|
|||||||
"ext-libxml": "*"
|
"ext-libxml": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": {
|
"platform-dev": {
|
||||||
"php": "^7.4"
|
"php": "^7.3|^7.4"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.0.0"
|
"plugin-api-version": "2.0.0"
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ return [
|
|||||||
'require_https' => env('REQUIRE_HTTPS', true),
|
'require_https' => env('REQUIRE_HTTPS', true),
|
||||||
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
'app_url' => rtrim(env('APP_URL', ''), '/'),
|
||||||
'app_domain' => env('APP_DOMAIN', ''),
|
'app_domain' => env('APP_DOMAIN', ''),
|
||||||
'app_version' => '5.1.31',
|
'app_version' => '5.1.32',
|
||||||
'minimum_client_version' => '5.0.16',
|
'minimum_client_version' => '5.0.16',
|
||||||
'terms_version' => '1.0.1',
|
'terms_version' => '1.0.1',
|
||||||
'api_secret' => env('API_SECRET', false),
|
'api_secret' => env('API_SECRET', false),
|
||||||
|
@ -12,17 +12,17 @@
|
|||||||
|
|
||||||
namespace Database\Factories;
|
namespace Database\Factories;
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
class BillingSubscriptionFactory extends Factory
|
class SubscriptionFactory extends Factory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The name of the factory's corresponding model.
|
* The name of the factory's corresponding model.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $model = BillingSubscription::class;
|
protected $model = Subscription::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the model's default state.
|
* Define the model's default state.
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddNullableConstraintToRecurringInvoiceId extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('client_subscriptions', function (Blueprint $table) {
|
||||||
|
$table->unsignedInteger('recurring_invoice_id')->nullable()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class RefactorBillingScriptionsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
|
||||||
|
Schema::rename('billing_subscriptions', 'subscriptions');
|
||||||
|
|
||||||
|
Schema::table('subscriptions', function (Blueprint $table) {
|
||||||
|
$table->text('product_id')->change();
|
||||||
|
$table->text('recurring_product_ids');
|
||||||
|
$table->string('name');
|
||||||
|
$table->unique(['company_id', 'name']);
|
||||||
|
$table->unsignedInteger('group_id');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('subscriptions', function (Blueprint $table) {
|
||||||
|
$table->renameColumn('product_id', 'product_ids');
|
||||||
|
$table->dropColumn('is_recurring');
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
38
public/flutter_service_worker.js
vendored
38
public/flutter_service_worker.js
vendored
@ -3,36 +3,36 @@ const MANIFEST = 'flutter-app-manifest';
|
|||||||
const TEMP = 'flutter-temp-cache';
|
const TEMP = 'flutter-temp-cache';
|
||||||
const CACHE_NAME = 'flutter-app-cache';
|
const CACHE_NAME = 'flutter-app-cache';
|
||||||
const RESOURCES = {
|
const RESOURCES = {
|
||||||
"favicon.ico": "51636d3a390451561744c42188ccd628",
|
"assets/assets/images/google-icon.png": "0f118259ce403274f407f5e982e681c3",
|
||||||
"manifest.json": "ce1b79950eb917ea619a0a30da27c6a3",
|
|
||||||
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
|
|
||||||
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
|
|
||||||
"assets/NOTICES": "e80e999afd09f0f14597c78d582d9c7c",
|
|
||||||
"assets/assets/images/logo.png": "090f69e23311a4b6d851b3880ae52541",
|
"assets/assets/images/logo.png": "090f69e23311a4b6d851b3880ae52541",
|
||||||
"assets/assets/images/payment_types/discover.png": "6c0a386a00307f87db7bea366cca35f5",
|
|
||||||
"assets/assets/images/payment_types/carteblanche.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
|
||||||
"assets/assets/images/payment_types/visa.png": "3ddc4a4d25c946e8ad7e6998f30fd4e3",
|
|
||||||
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
|
|
||||||
"assets/assets/images/payment_types/maestro.png": "e533b92bfb50339fdbfa79e3dfe81f08",
|
|
||||||
"assets/assets/images/payment_types/mastercard.png": "6f6cdc29ee2e22e06b1ac029cb52ef71",
|
"assets/assets/images/payment_types/mastercard.png": "6f6cdc29ee2e22e06b1ac029cb52ef71",
|
||||||
"assets/assets/images/payment_types/amex.png": "c49a4247984b3732a4af50a3390aa978",
|
"assets/assets/images/payment_types/visa.png": "3ddc4a4d25c946e8ad7e6998f30fd4e3",
|
||||||
|
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
||||||
|
"assets/assets/images/payment_types/paypal.png": "8e06c094c1871376dfea1da8088c29d1",
|
||||||
|
"assets/assets/images/payment_types/ach.png": "7433f0aff779dc98a649b7a2daf777cf",
|
||||||
|
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
|
||||||
|
"assets/assets/images/payment_types/maestro.png": "e533b92bfb50339fdbfa79e3dfe81f08",
|
||||||
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
|
"assets/assets/images/payment_types/jcb.png": "07e0942d16c5592118b72e74f2f7198c",
|
||||||
"assets/assets/images/payment_types/dinerscard.png": "06d85186ba858c18ab7c9caa42c92024",
|
"assets/assets/images/payment_types/dinerscard.png": "06d85186ba858c18ab7c9caa42c92024",
|
||||||
"assets/assets/images/payment_types/ach.png": "7433f0aff779dc98a649b7a2daf777cf",
|
"assets/assets/images/payment_types/discover.png": "6c0a386a00307f87db7bea366cca35f5",
|
||||||
"assets/assets/images/payment_types/solo.png": "2030c3ccaccf5d5e87916a62f5b084d6",
|
|
||||||
"assets/assets/images/payment_types/other.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
|
||||||
"assets/assets/images/payment_types/laser.png": "b4e6e93dd35517ac429301119ff05868",
|
"assets/assets/images/payment_types/laser.png": "b4e6e93dd35517ac429301119ff05868",
|
||||||
"assets/assets/images/payment_types/switch.png": "4fa11c45327f5fdc20205821b2cfd9cc",
|
"assets/assets/images/payment_types/amex.png": "c49a4247984b3732a4af50a3390aa978",
|
||||||
"assets/assets/images/payment_types/unionpay.png": "7002f52004e0ab8cc0b7450b0208ccb2",
|
"assets/assets/images/payment_types/unionpay.png": "7002f52004e0ab8cc0b7450b0208ccb2",
|
||||||
"assets/assets/images/google-icon.png": "0f118259ce403274f407f5e982e681c3",
|
"assets/assets/images/payment_types/carteblanche.png": "d936e11fa3884b8c9f1bd5c914be8629",
|
||||||
"assets/fonts/MaterialIcons-Regular.otf": "1288c9e28052e028aba623321f7826ac",
|
"assets/assets/images/payment_types/solo.png": "2030c3ccaccf5d5e87916a62f5b084d6",
|
||||||
"assets/AssetManifest.json": "659dcf9d1baf3aed3ab1b9c42112bf8f",
|
"assets/AssetManifest.json": "659dcf9d1baf3aed3ab1b9c42112bf8f",
|
||||||
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "174c02fc4609e8fc4389f5d21f16a296",
|
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "174c02fc4609e8fc4389f5d21f16a296",
|
||||||
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
|
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
|
||||||
|
"assets/fonts/MaterialIcons-Regular.otf": "1288c9e28052e028aba623321f7826ac",
|
||||||
|
"assets/NOTICES": "e80e999afd09f0f14597c78d582d9c7c",
|
||||||
|
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
||||||
|
"main.dart.js": "44b7ad1fa4ed703c299158cb0bd49af8",
|
||||||
"/": "23224b5e03519aaa87594403d54412cf",
|
"/": "23224b5e03519aaa87594403d54412cf",
|
||||||
"main.dart.js": "0dd48578f1756e8b7519abe904995912",
|
"manifest.json": "ce1b79950eb917ea619a0a30da27c6a3",
|
||||||
|
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
|
||||||
|
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
|
||||||
"version.json": "b7c8971e1ab5b627fd2a4317c52b843e",
|
"version.json": "b7c8971e1ab5b627fd2a4317c52b843e",
|
||||||
"favicon.png": "dca91c54388f52eded692718d5a98b8b"
|
"favicon.ico": "51636d3a390451561744c42188ccd628"
|
||||||
};
|
};
|
||||||
|
|
||||||
// The application shell files that are downloaded before a service worker can
|
// The application shell files that are downloaded before a service worker can
|
||||||
|
268155
public/main.dart.js
vendored
268155
public/main.dart.js
vendored
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
|||||||
@section('meta_title', $billing_subscription->product->product_key)
|
@section('meta_title', $billing_subscription->product->product_key)
|
||||||
|
|
||||||
@section('body')
|
@section('body')
|
||||||
@livewire('billing-portal-purchase', ['billing_subscription' => $billing_subscription, 'contact' => auth('contact')->user(), 'hash' => $hash, 'request_data' => $request_data])
|
@livewire('billing-portal-purchase', ['billing_subscription' => $billing_subscription, 'contact' => auth('contact')->user(), 'hash' => $hash, 'request_data' => $request_data, 'price' => $billing_subscription->product->price])
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
|
@ -13,32 +13,35 @@
|
|||||||
<span class="text-sm uppercase font-bold">{{ ctrans('texts.price') }}:</span>
|
<span class="text-sm uppercase font-bold">{{ ctrans('texts.price') }}:</span>
|
||||||
|
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
<h1 class="text-2xl font-bold tracking-wide">{{ App\Utils\Number::formatMoney($billing_subscription->product->price, $billing_subscription->company) }}</h1>
|
<h1 class="text-2xl font-bold tracking-wide">{{ App\Utils\Number::formatMoney($price, $billing_subscription->company) }}</h1>
|
||||||
|
|
||||||
@if($billing_subscription->per_seat_enabled)
|
@if($billing_subscription->is_recurring)
|
||||||
<span class="text-sm">/unit</span>
|
<span class="text-xs uppercase">/ {{ \App\Models\RecurringInvoice::frequencyForKey($billing_subscription->frequency_id) }}</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex mt-4 space-x-4 items-center">
|
|
||||||
<span class="text-sm">{{ ctrans('texts.qty') }}</span>
|
@if($billing_subscription->per_seat_enabled && $billing_subscription->max_seats_limit > 1)
|
||||||
<button wire:click="updateQuantity('decrement')" class="bg-gray-100 border rounded p-1">
|
<div class="flex mt-4 space-x-4 items-center">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
|
<span class="text-sm">{{ ctrans('texts.qty') }}</span>
|
||||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
<button wire:click="updateQuantity('decrement')" class="bg-gray-100 border rounded p-1">
|
||||||
class="feather feather-minus">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
|
||||||
<line x1="5" y1="12" x2="19" y2="12"></line>
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||||
</svg>
|
class="feather feather-minus">
|
||||||
</button>
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
||||||
<button>{{ $quantity }}</button>
|
</svg>
|
||||||
<button wire:click="updateQuantity('increment')" class="bg-gray-100 border rounded p-1">
|
</button>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
|
<button>{{ $quantity }}</button>
|
||||||
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
<button wire:click="updateQuantity('increment')" class="bg-gray-100 border rounded p-1">
|
||||||
class="feather feather-plus">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
|
||||||
<line x1="12" y1="5" x2="12" y2="19"></line>
|
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
||||||
<line x1="5" y1="12" x2="19" y2="12"></line>
|
class="feather feather-plus">
|
||||||
</svg>
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
||||||
</button>
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
||||||
</div>
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if(auth('contact')->user())
|
@if(auth('contact')->user())
|
||||||
<a href="{{ route('client.invoices.index') }}" class="block mt-16 inline-flex items-center space-x-2">
|
<a href="{{ route('client.invoices.index') }}" class="block mt-16 inline-flex items-center space-x-2">
|
||||||
@ -137,22 +140,24 @@
|
|||||||
</form>
|
</form>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="relative mt-8">
|
@if(!empty($billing_subscription->promo_code) && !$billing_subscription->trial_enabled)
|
||||||
<div class="absolute inset-0 flex items-center">
|
<div class="relative mt-8">
|
||||||
<div class="w-full border-t border-gray-300"></div>
|
<div class="absolute inset-0 flex items-center">
|
||||||
|
<div class="w-full border-t border-gray-300"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="relative flex justify-center text-sm leading-5">
|
||||||
|
<span class="px-2 text-gray-700 bg-white">Have a coupon code?</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative flex justify-center text-sm leading-5">
|
<div class="flex items-center mt-4">
|
||||||
<span class="px-2 text-gray-700 bg-white">Have a coupon code?</span>
|
<label class="w-full mr-2">
|
||||||
|
<input type="text" wire:model.lazy="coupon" class="input w-full m-0"/>
|
||||||
|
<small class="block text-gray-900 mt-2">{{ ctrans('texts.billing_coupon_notice') }}</small>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
|
|
||||||
<div class="flex items-center mt-4">
|
|
||||||
<label class="w-full mr-2">
|
|
||||||
<input type="text" wire:model.lazy="coupon" class="input w-full m-0"/>
|
|
||||||
<small class="block text-gray-900 mt-2">{{ ctrans('texts.billing_coupon_notice') }}</small>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -176,7 +176,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
|
|||||||
// Route::post('hooks', 'SubscriptionController@subscribe')->name('hooks.subscribe');
|
// Route::post('hooks', 'SubscriptionController@subscribe')->name('hooks.subscribe');
|
||||||
// Route::delete('hooks/{subscription_id}', 'SubscriptionController@unsubscribe')->name('hooks.unsubscribe');
|
// Route::delete('hooks/{subscription_id}', 'SubscriptionController@unsubscribe')->name('hooks.unsubscribe');
|
||||||
|
|
||||||
Route::resource('billing_subscriptions', 'BillingSubscriptionController');
|
Route::resource('subscriptions', 'SubscriptionController');
|
||||||
Route::resource('cliente_subscriptions', 'ClientSubscriptionController');
|
Route::resource('cliente_subscriptions', 'ClientSubscriptionController');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Tests\Feature;
|
namespace Tests\Feature;
|
||||||
|
|
||||||
use App\Models\BillingSubscription;
|
use App\Models\Subscription;
|
||||||
use App\Models\Product;
|
use App\Models\Product;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
@ -24,9 +24,9 @@ use Tests\TestCase;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @covers App\Http\Controllers\BillingSubscriptionController
|
* @covers App\Http\Controllers\SubscriptionController
|
||||||
*/
|
*/
|
||||||
class BillingSubscriptionApiTest extends TestCase
|
class SubscriptionApiTest extends TestCase
|
||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
@ -45,27 +45,30 @@ class BillingSubscriptionApiTest extends TestCase
|
|||||||
Model::reguard();
|
Model::reguard();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBillingSubscriptionsGet()
|
public function testSubscriptionsGet()
|
||||||
{
|
{
|
||||||
$product = Product::factory()->create([
|
$product = Product::factory()->create([
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$billing_subscription = BillingSubscription::factory()->create([
|
$billing_subscription = Subscription::factory()->create([
|
||||||
'product_id' => $product->id,
|
'product_ids' => $product->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->get('/api/v1/billing_subscriptions/' . $this->encodePrimaryKey($billing_subscription->id));
|
])->get('/api/v1/subscriptions/' . $this->encodePrimaryKey($billing_subscription->id));
|
||||||
|
|
||||||
|
// nlog($response);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBillingSubscriptionsPost()
|
public function testSubscriptionsPost()
|
||||||
{
|
{
|
||||||
$product = Product::factory()->create([
|
$product = Product::factory()->create([
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
@ -75,12 +78,12 @@ class BillingSubscriptionApiTest extends TestCase
|
|||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->post('/api/v1/billing_subscriptions', ['product_id' => $product->id, 'allow_cancellation' => true]);
|
])->post('/api/v1/subscriptions', ['product_ids' => $product->id, 'allow_cancellation' => true]);
|
||||||
|
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testBillingSubscriptionPut()
|
public function testSubscriptionPut()
|
||||||
{
|
{
|
||||||
$product = Product::factory()->create([
|
$product = Product::factory()->create([
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
@ -89,13 +92,13 @@ class BillingSubscriptionApiTest extends TestCase
|
|||||||
|
|
||||||
$response1 = $this
|
$response1 = $this
|
||||||
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'),'X-API-TOKEN' => $this->token])
|
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'),'X-API-TOKEN' => $this->token])
|
||||||
->post('/api/v1/billing_subscriptions', ['product_id' => $product->id])
|
->post('/api/v1/subscriptions', ['product_ids' => $product->id])
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->json();
|
->json();
|
||||||
|
|
||||||
$response2 = $this
|
$response2 = $this
|
||||||
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'),'X-API-TOKEN' => $this->token])
|
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'),'X-API-TOKEN' => $this->token])
|
||||||
->put('/api/v1/billing_subscriptions/' . $response1['data']['id'], ['allow_cancellation' => true])
|
->put('/api/v1/subscriptions/' . $response1['data']['id'], ['allow_cancellation' => true])
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->json();
|
->json();
|
||||||
|
|
||||||
@ -103,15 +106,15 @@ class BillingSubscriptionApiTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TypeError : Argument 1 passed to App\Transformers\BillingSubscriptionTransformer::transform() must be an instance of App\Models\BillingSubscription, bool given, called in /var/www/html/vendor/league/fractal/src/Scope.php on line 407
|
TypeError : Argument 1 passed to App\Transformers\SubscriptionTransformer::transform() must be an instance of App\Models\Subscription, bool given, called in /var/www/html/vendor/league/fractal/src/Scope.php on line 407
|
||||||
/var/www/html/app/Transformers/BillingSubscriptionTransformer.php:35
|
/var/www/html/app/Transformers/SubscriptionTransformer.php:35
|
||||||
/var/www/html/vendor/league/fractal/src/Scope.php:407
|
/var/www/html/vendor/league/fractal/src/Scope.php:407
|
||||||
/var/www/html/vendor/league/fractal/src/Scope.php:349
|
/var/www/html/vendor/league/fractal/src/Scope.php:349
|
||||||
/var/www/html/vendor/league/fractal/src/Scope.php:235
|
/var/www/html/vendor/league/fractal/src/Scope.php:235
|
||||||
/var/www/html/app/Http/Controllers/BaseController.php:395
|
/var/www/html/app/Http/Controllers/BaseController.php:395
|
||||||
/var/www/html/app/Http/Controllers/BillingSubscriptionController.php:408
|
/var/www/html/app/Http/Controllers/SubscriptionController.php:408
|
||||||
*/
|
*/
|
||||||
public function testBillingSubscriptionDeleted()
|
public function testSubscriptionDeleted()
|
||||||
{
|
{
|
||||||
|
|
||||||
$product = Product::factory()->create([
|
$product = Product::factory()->create([
|
||||||
@ -119,14 +122,14 @@ class BillingSubscriptionApiTest extends TestCase
|
|||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$billing_subscription = BillingSubscription::factory()->create([
|
$billing_subscription = Subscription::factory()->create([
|
||||||
'product_id' => $product->id,
|
'product_ids' => $product->id,
|
||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response = $this
|
$response = $this
|
||||||
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token])
|
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token])
|
||||||
->delete('/api/v1/billing_subscriptions/' . $this->encodePrimaryKey($billing_subscription->id))
|
->delete('/api/v1/subscriptions/' . $this->encodePrimaryKey($billing_subscription->id))
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->json();
|
->json();
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user