frontend & backend update

This commit is contained in:
carodej
2020-06-22 16:46:02 +02:00
parent a2cab6198e
commit a2dfc627a7
35 changed files with 595 additions and 1080 deletions

View File

@@ -3,33 +3,44 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Http\Resources\InvoiceCollection;
use App\Http\Resources\InvoiceAdminCollection;
use App\Http\Resources\InvoiceResource;
use App\Invoice;
use App\Services\StripeService;
use Illuminate\Http\Request;
class InvoiceController extends Controller
{
/**
* PlanController constructor.
*/
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;
}
/**
* Get all invoices
*
* @return InvoiceCollection
* @return InvoiceAdminCollection
*/
public function index()
{
return new InvoiceCollection(
Invoice::all()
return new InvoiceAdminCollection(
$this->stripe->getInvoices()['data']
);
}
/**
* Get single invoice by $token
*
* @param $customer
* @param $token
* @return InvoiceResource
*/
public function show($token)
public function show($customer, $token)
{
$invoice = Invoice::where('token', $token)->firstOrFail();
$invoice = $this->stripe->getUserInvoice($customer, $token);
return view('vuefilemanager.invoice')
->with('invoice', $invoice);

View File

@@ -11,6 +11,7 @@ use App\Plan;
use App\Services\StripeService;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Rinvex\Subscriptions\Models\PlanFeature;
class PlanController extends Controller
@@ -30,9 +31,18 @@ class PlanController extends Controller
*/
public function index()
{
return new PlanCollection(
$this->stripe->getPlans()
);
// Store or Get plans to cache
if (Cache::has('plans')) {
$plans = Cache::get('plans');
} else {
$plans = Cache::rememberForever('plans', function () {
return $this->stripe->getPlans();
});
}
return new PlanCollection($plans);
}
/**
@@ -43,9 +53,18 @@ class PlanController extends Controller
*/
public function show($id)
{
return new PlanResource(
$this->stripe->getPlan($id)
);
// Store or Get plan to cache
if (Cache::has('plan-' . $id)) {
$plan = Cache::get('plan-' . $id);
} else {
$plan = Cache::rememberForever('plan-' . $id, function () use ($id) {
return $this->stripe->getPlan($id);
});
}
return new PlanResource($plan);
}
/**
@@ -56,9 +75,14 @@ class PlanController extends Controller
*/
public function store(Request $request)
{
return new PlanResource(
$plan = new PlanResource(
$this->stripe->createPlan($request)
);
// Clear cached plans
cache_forget_many(['plans', 'pricing']);
return $plan;
}
/**
@@ -72,6 +96,9 @@ class PlanController extends Controller
{
$this->stripe->updatePlan($request, $id);
// Clear cached plans
cache_forget_many(['plans', 'pricing', 'plan-' . $id]);
return response('Saved!', 204);
}
@@ -85,6 +112,9 @@ class PlanController extends Controller
{
$this->stripe->deletePlan($id);
// Clear cached plans
cache_forget_many(['plans', 'pricing']);
return response('Done!', 204);
}

View File

@@ -15,6 +15,7 @@ use App\Http\Resources\UserResource;
use App\Http\Resources\UserStorageResource;
use App\Http\Resources\UserSubscription;
use App\Http\Tools\Demo;
use App\Services\StripeService;
use App\Share;
use App\User;
use App\UserSettings;
@@ -29,6 +30,11 @@ use Storage;
class UserController extends Controller
{
public function __construct(StripeService $stripe)
{
$this->stripe = $stripe;
}
/**
* Get user details
*
@@ -58,13 +64,14 @@ class UserController extends Controller
/**
* Get user storage details
*
* @param $id
* @return InvoiceCollection
*/
public function invoices($id)
public function invoices()
{
$user = \Auth::user();
return new InvoiceCollection(
User::findOrFail($id)->invoices
$this->stripe->getUserInvoices($user)
);
}
@@ -77,7 +84,7 @@ class UserController extends Controller
public function subscription($id)
{
return new UserSubscription(
User::findOrFail($id)->subscription('main')
User::find($id)
);
}

View File

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
use App\Http\Resources\PricingCollection;
use App\Services\StripeService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class PricingController extends Controller
{
@@ -24,10 +25,22 @@ class PricingController extends Controller
*/
public function index()
{
$collection = new PricingCollection(
$this->stripe->getActivePlans()
);
if (Cache::has('pricing')) {
// Get pricing from cache
$pricing = Cache::get('pricing');
} else {
// Store pricing to cache
$pricing = Cache::rememberForever('pricing', function () {
return $this->stripe->getActivePlans();
});
}
// Format pricing to collection
$collection = new PricingCollection($pricing);
// Sort and return pricing
return $collection->sortBy('product.metadata.capacity')
->values()
->all();

View File

@@ -44,9 +44,14 @@ class AccountController extends Controller
);
}
/**
* Get user invoices
*
* @return InvoiceCollection
*/
public function invoices() {
return new InvoiceCollection(
Auth::user()->invoices
Auth::user()->invoices()
);
}

View File

@@ -1,107 +0,0 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Http\Resources\PaymentCardCollection;
use App\Http\Resources\PaymentCardResource;
use App\Http\Resources\PaymentDefaultCardResource;
use App\Services\PaymentService;
use App\UserCard;
use Auth;
use Illuminate\Http\Request;
use Laravel\Cashier\PaymentMethod;
class PaymentCardsController extends Controller
{
/**
* @var PaymentService
*/
private $payment;
/**
* PaymentCardsController constructor.
*/
public function __construct(PaymentService $payment)
{
$this->payment = $payment;
}
/**
* Update card detail
*
* @param Request $request
* @param $id
*/
public function update(Request $request, $id)
{
$user = Auth::user();
// Update DefaultPayment Method
$user->updateDefaultPaymentMethod($id);
// Sync default payment method
$user->updateDefaultPaymentMethodFromStripe();
}
/**
* Delete user credit card
*
*/
public function delete($id)
{
$user = Auth::user();
// Get payment method
$paymentMethod = $user->findPaymentMethod($id);
// Delete payment method
$paymentMethod->delete();
// Sync default payment method
$user->updateDefaultPaymentMethodFromStripe();
return response('Done!', 204);
}
/**
* Get user payment methods sorted by default and others
*
* @return array
*/
public function payment_methods()
{
$user = Auth::user();
// Get default payment method
$defaultPaymentMethodObject = $user->defaultPaymentMethod();
$defaultPaymentMethod = $defaultPaymentMethodObject instanceof PaymentMethod
? $defaultPaymentMethodObject->asStripePaymentMethod()
: $defaultPaymentMethodObject;
// filter payment methods without default payment
$paymentMethods = $user->paymentMethods()->filter(function ($paymentMethod) use ($defaultPaymentMethod) {
return $paymentMethod->id !== $defaultPaymentMethod->id;
});
// Get payment methods
$paymentMethodsMapped = $paymentMethods->map(function ($paymentMethod) {
return $paymentMethod->asStripePaymentMethod();
})->values()->all();
if (is_null($paymentMethodsMapped) && is_null($paymentMethodsMapped)) {
return [
'default' => null,
'others' => [],
];
}
return [
'default' => $defaultPaymentMethod instanceof PaymentMethod
? new PaymentCardResource($defaultPaymentMethod)
: new PaymentDefaultCardResource($defaultPaymentMethod),
'others' => new PaymentCardCollection($paymentMethodsMapped),
];
}
}

View File

@@ -0,0 +1,122 @@
<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Http\Resources\PaymentCardCollection;
use App\Http\Resources\PaymentCardResource;
use App\Http\Resources\PaymentDefaultCardResource;
use Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Laravel\Cashier\PaymentMethod;
class PaymentMethodsController extends Controller
{
/**
* Get user payment methods grouped by default and others
*
* @return array
*/
public function payment_methods()
{
$user = Auth::user();
$slug_payment_methods = 'payment-methods-user-' . $user->id;
$slug_default_payment_method = 'default-payment-methods-user-' . $user->id;
if (Cache::has($slug_payment_methods) && Cache::has($slug_default_payment_method)) {
$defaultPaymentMethod = Cache::get($slug_default_payment_method);
$paymentMethodsMapped = Cache::get($slug_payment_methods);
} else {
// Get default payment method
$defaultPaymentMethod = Cache::rememberForever($slug_default_payment_method, function () use ($user) {
$defaultPaymentMethodObject = $user->defaultPaymentMethod();
return $defaultPaymentMethodObject instanceof PaymentMethod
? $defaultPaymentMethodObject->asStripePaymentMethod()
: $defaultPaymentMethodObject;
});
// filter payment methods without default payment
$paymentMethodsMapped = Cache::rememberForever($slug_payment_methods, function () use ($defaultPaymentMethod, $user) {
$paymentMethods = $user->paymentMethods()->filter(function ($paymentMethod) use ($defaultPaymentMethod) {
return $paymentMethod->id !== $defaultPaymentMethod->id;
});
// Get payment methods
return $paymentMethods->map(function ($paymentMethod) {
return $paymentMethod->asStripePaymentMethod();
})->values()->all();
});
}
if (! $user->card_brand || ! $user->stripe_id || is_null($paymentMethodsMapped) && is_null($paymentMethodsMapped)) {
return [
'default' => null,
'others' => [],
];
}
return [
'default' => $defaultPaymentMethod instanceof PaymentMethod
? new PaymentCardResource($defaultPaymentMethod)
: new PaymentDefaultCardResource($defaultPaymentMethod),
'others' => new PaymentCardCollection($paymentMethodsMapped),
];
}
/**
* Update default payment method
*
* @param Request $request
* @param $id
*/
public function update(Request $request, $id)
{
$user = Auth::user();
// Update DefaultPayment Method
$user->updateDefaultPaymentMethod($id);
// Sync default payment method
$user->updateDefaultPaymentMethodFromStripe();
// Clear cached payment methods
cache_forget_many([
'payment-methods-user-' . $user->id,
'default-payment-methods-user-' . $user->id
]);
}
/**
* Delete user payment method
*
*/
public function delete($id)
{
$user = Auth::user();
// Get payment method
$paymentMethod = $user->findPaymentMethod($id);
// Delete payment method
$paymentMethod->delete();
// Sync default payment method
$user->updateDefaultPaymentMethodFromStripe();
// Clear cached payment methods
cache_forget_many([
'payment-methods-user-' . $user->id,
'default-payment-methods-user-' . $user->id
]);
return response('Done!', 204);
}
}

View File

@@ -6,12 +6,12 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Subscription\StoreUpgradeAccountRequest;
use App\Http\Resources\UserSubscription;
use App\Invoice;
use App\Services\PaymentService;
use App\Services\StripeService;
use Auth;
use Cartalyst\Stripe\Exception\CardErrorException;
use Illuminate\Contracts\Routing\ResponseFactory;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Laravel\Cashier\Exceptions\IncompletePayment;
use Symfony\Component\HttpKernel\Exception\HttpException;
@@ -35,21 +35,29 @@ class SubscriptionController extends Controller
*/
public function stripe_setup_intent()
{
// Get user
$user = Auth::user();
// Create stripe customer if not exist
$user->createOrGetStripeCustomer();
// Return setup intent
return $user->createSetupIntent();
return $this->stripe->getSetupIntent($user);
}
/**
* Get user subscription detail
*
* @return UserSubscription
*/
public function show()
{
return new UserSubscription(
Auth::user()
);
$slug_user_subscription = 'subscription-user-' . Auth::id();
if (Cache::has($slug_user_subscription)) {
return Cache::get($slug_user_subscription);
}
return Cache::rememberForever($slug_user_subscription, function () {
return new UserSubscription(
Auth::user()
);
});
}
/**
@@ -69,6 +77,9 @@ class SubscriptionController extends Controller
// Set user billing
$user->setBilling($request->input('billing'));
// Update stripe customer billing info
$this->stripe->updateCustomerDetails($user);
// Make subscription
$this->stripe->createOrReplaceSubscription($request, $user);
@@ -77,9 +88,6 @@ class SubscriptionController extends Controller
'storage_capacity' => $plan['product']['metadata']['capacity']
]);
// Store invoice
Invoice::create(get_invoice_data($user, $plan, 'stripe'));
return response('Done!', 204);
}

View File

@@ -27,55 +27,11 @@ function get_invoice_number()
}
}
/**
* Get data to render in invoice tempalte
* @param $user
* @param $plan
* @param $provider
* @return array
*/
function get_invoice_data($user, $plan, $provider)
function cache_forget_many($cache)
{
$subscription = $user->subscription('main');
$order_number = get_invoice_number();
$token = \Illuminate\Support\Str::random(22);
return [
'token' => $token,
'order' => $order_number,
'provider' => $provider,
'user_id' => $user->id,
'plan_id' => $plan['plan']['id'],
'total' => $plan['plan']['amount'],
'currency' => 'USD',
'bag' => [
[
'description' => 'Subscription - ' . $plan['product']['name'],
//'date' => format_date($subscription->starts_at, '%d. %B. %Y') . ' - ' . format_date($subscription->ends_at, '%d. %B. %Y'),
'date' => format_date(Carbon::now(),'%d. %B. %Y'),
'amount' => $plan['plan']['amount'],
]
],
'seller' => [
'billing_name' => 'VueFileManager',
'billing_address' => 'Somewhere 32',
'billing_state' => 'Washington',
'billing_city' => 'Manchester',
'billing_postal_code' => '04001',
'billing_country' => 'The USA',
'billing_phone_number' => '490321-6354774',
'billing_vat_number' => '7354724626246',
],
'client' => [
'billing_name' => $user->settings->billing_name,
'billing_address' => $user->settings->billing_address,
'billing_state' => $user->settings->billing_state,
'billing_city' => $user->settings->billing_city,
'billing_postal_code' => $user->settings->billing_postal_code,
'billing_country' => $user->settings->billing_country,
'billing_phone_number' => $user->settings->billing_phone_number,
],
];
foreach ($cache as $item) {
\Illuminate\Support\Facades\Cache::forget($item);
}
}
/**

View File

@@ -0,0 +1,23 @@
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\ResourceCollection;
class InvoiceAdminCollection extends ResourceCollection
{
public $collects = InvoiceAdminResource::class;
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return [
'data' => $this->collection,
];
}
}

View File

@@ -0,0 +1,65 @@
<?php
namespace App\Http\Resources;
use App\User;
use Illuminate\Http\Resources\Json\JsonResource;
use Laravel\Cashier\Cashier;
class InvoiceAdminResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
$user = User::where('stripe_id', $this['customer'])->first();
return [
'data' => [
'id' => $this['id'],
'type' => 'invoices',
'attributes' => [
'customer' => $this['customer'],
'total' => Cashier::formatAmount($this['total']),
'currency' => $this['currency'],
'created_at_formatted' => format_date($this['created']),
'created_at' => $this['created'],
'order' => $this['number'],
'user_id' => $user ? $user->id : null,
'client' => [
'billing_address' => $this['customer_address'],
'billing_name' => $this['customer_name'],
'billing_phone_number' => $this['customer_phone'],
],
'bag' => [
'amount' => $this['lines']['data'][0]['amount'],
'currency' => $this['lines']['data'][0]['currency'],
'type' => $this['lines']['data'][0]['type'],
'description' => $this['lines']['data'][0]['description'],
],
'seller' => null,
]
],
$this->mergeWhen($user, function () use ($user) {
return [
'relationships' => [
'user' => [
'data' => [
'id' => (string)$user->id,
'type' => 'user',
'attributes' => [
'name' => $user->name,
'avatar' => $user->avatar,
]
]
]
]
];
}),
];
}
}

View File

@@ -2,6 +2,7 @@
namespace App\Http\Resources;
use App\User;
use Illuminate\Http\Resources\Json\JsonResource;
class InvoiceResource extends JsonResource
@@ -14,38 +15,49 @@ class InvoiceResource extends JsonResource
*/
public function toArray($request)
{
$user = User::where('stripe_id', $this->customer)->first();
$subscription = $this->subscriptions()[0];
return [
'data' => [
'id' => (string)$this->id,
'data' => [
'id' => $this->id,
'type' => 'invoices',
'attributes' => [
'token' => $this->token,
'order' => $this->order,
'user_id' => $this->user_id,
'plan_id' => $this->plan_id,
'notes' => $this->notes,
'total' => $this->total,
'customer' => $this->customer,
'total' => $this->total(),
'currency' => $this->currency,
'seller' => $this->seller,
'client' => $this->client,
'bag' => $this->bag,
'created_at_formatted' => format_date($this->created_at),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'created_at_formatted' => format_date($this->date()),
'created_at' => $this->created,
'order' => $this->number,
'user_id' => $user ? $user->id : null,
'client' => [
'billing_address' => $this->customer_address,
'billing_name' => $this->customer_name,
'billing_phone_number' => $this->customer_phone,
],
'bag' => [
'amount' => $subscription->amount,
'currency' => $subscription->currency,
'type' => $subscription->type,
'description' => $subscription->description,
],
'seller' => null,
]
],
'relationships' => [
'user' => [
'data' => [
'id' => (string)$this->user->id,
'type' => 'user',
'attributes' => [
'name' => $this->user->name,
'avatar' => $this->user->avatar,
$this->mergeWhen($user, [
'relationships' => [
'user' => [
'data' => [
'id' => (string)$user->id,
'type' => 'user',
'attributes' => [
'name' => $user->name,
'avatar' => $user->avatar,
]
]
]
]
]
]),
];
}
}

View File

@@ -26,18 +26,19 @@ class UserResource extends JsonResource
'id' => (string)$this->id,
'type' => 'user',
'attributes' => [
'subscription' => $this->subscribed('main'),
'stripe_customer' => is_null($this->stripe_id) ? false : true,
'name' => env('APP_DEMO') ? $faker->name : $this->name,
'email' => env('APP_DEMO') ? $faker->email : $this->email,
'avatar' => $this->avatar,
'role' => $this->role,
'subscription' => $this->subscribed('main'),
'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'),
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]
],
'relationships' => [
'settings' => [
'settings' => [
'data' => [
'id' => (string)$this->settings->id,
'type' => 'settings',
@@ -52,14 +53,14 @@ class UserResource extends JsonResource
]
]
],
'storage' => [
'storage' => [
'data' => [
'id' => '1',
'type' => 'storage',
'attributes' => $this->storage
]
],
'favourites' => [
'favourites' => [
'data' => [
'id' => '1',
'type' => 'folders_favourite',
@@ -68,7 +69,7 @@ class UserResource extends JsonResource
],
],
],
'tree' => [
'tree' => [
'data' => [
'id' => '1',
'type' => 'folders_tree',
@@ -76,8 +77,7 @@ class UserResource extends JsonResource
'folders' => $this->folder_tree
],
],
],
'payment_methods' => new PaymentCardCollection($this->payment_cards)
]
]
];
}

View File

@@ -1,199 +0,0 @@
<?php
namespace App\Services;
use App\PaymentGateway;
use App\User;
use App\UserCard;
use App\UserSettings;
use Cartalyst\Stripe\Exception\CardErrorException;
use Stripe;
use Symfony\Component\HttpKernel\Exception\HttpException;
class PaymentService
{
/**
* PaymentService constructor.
*/
public function __construct()
{
$this->stripe = Stripe::make(config('services.stripe.secret'), '2020-03-02');
}
/**
* Get and charge customer
*
* @param $request
* @param $plan
* @param $user
*/
public function getAndChargeCustomer($request, $plan, $user)
{
// Get Stripe Customer
$customer = $this->findOrCreateStripeCustomer($user);
$paymentIntent = $this->stripe->paymentIntents()->create([
'amount' => $plan->price,
'currency' => 'USD',
'payment_method_types' => [
'card',
],
]);
dd($paymentIntent);
// Try charge customer
try {
if ($request->has('payment.meta.card_token')) {
// Register customer credit card
$created_card = $this->registerStripeCreditCard($customer, $request->input('payment.meta.card_token'));
// Charge with created credit card
/*$this->stripe->charges()->create([
'description' => 'Subscription ' . $plan->name,
'customer' => $customer['id'],
'amount' => $plan->price,
'currency' => 'USD',
'source' => $created_card->card_id
]);*/
} else {
// Charge with customer default creadit card
$this->stripe->charges()->create([
'description' => 'Subscription ' . $plan->name,
'customer' => $customer['id'],
'amount' => $plan->price,
'currency' => 'USD',
]);
}
} catch (CardErrorException $error) {
//dd($error);
// Remove previously registered card
if (in_array($error->getErrorCode(), ['rejected_card', 'card_declined'])
&& $request->has('payment.meta.card_token')
&& isset($error->getRawOutput()['error']['charge'])) {
// Get charge
$charge = $this->stripe->charges()->find($error->getRawOutput()['error']['charge']);
// Remove card from stripe
$this->deleteStripeCard($user->settings->stripe_customer_id, $charge['payment_method']);
// Get card
$error_card = UserCard::where('card_id', $charge['payment_method'])->first();
// Delete card
$error_card->delete();
}
throw new HttpException($error->getCode(), $error->getMessage());
}
// Increase payment processed column
PaymentGateway::where('slug', 'stripe')->first()->increment('payment_processed');
}
/**
* Find or create stripe customer
*
* @param $user
* @return array
*/
private function findOrCreateStripeCustomer($user)
{
// Get existing stripe customer
if ($user->settings->stripe_customer_id) {
return $this->stripe->customers()->find($user->settings->stripe_customer_id);
}
// Create new stripe costumer
if (!$user->settings->stripe_customer_id) {
$customer = $this->stripe->customers()->create([
'email' => $user->email,
'name' => $user->name,
'address' => [
'city' => $user->settings->billing_city,
'country' => $user->settings->billing_country,
'line1' => $user->settings->billing_address,
'state' => $user->settings->billing_state,
'postal_code' => $user->settings->billing_postal_code,
]
]);
// Store user stripe_customer_id
$user->settings()->update([
'stripe_customer_id' => $customer['id']
]);
return $customer;
}
}
/**
* Register stripe credit card
*
* @param $customer
* @param $card_id
* @return object
*/
private function registerStripeCreditCard($customer, $card_id)
{
// Register user card
$card = $this->stripe->cards()->create($customer['id'], $card_id);
// Get user settings
$user_settings = UserSettings::where('stripe_customer_id', $customer['id'])->first();
// Set default status
$default_card = UserCard::where('user_id', $user_settings->user_id)->get()->count() > 0 ? 0 : 1;
// Store user card
$card = UserCard::create([
'user_id' => $user_settings->user_id,
'status' => 'active',
'default' => $default_card,
'provider' => 'stripe',
'card_id' => $card['id'],
'brand' => $card['brand'],
'last4' => $card['last4'],
'exp_month' => $card['exp_month'],
'exp_year' => $card['exp_year'],
]);
return $card;
}
/**
* Set new default source from existing credit card
*
* @param $stripe_customer_id
* @param $card_id
*/
public function setDefaultStripeCard($stripe_customer_id, $card_id)
{
$this->stripe->customers()->update($stripe_customer_id, [
'default_source' => $card_id,
]);
}
/**
* Delete customer stripe credit card
*
* @param $stripe_customer_id
* @param $card_id
*/
public function deleteStripeCard($stripe_customer_id, $card_id)
{
$this->stripe->cards()->delete($stripe_customer_id, $card_id);
}
}

View File

@@ -3,6 +3,7 @@
namespace App\Services;
use App\User;
use Illuminate\Support\Str;
use Laravel\Cashier\Exceptions\IncompletePayment;
use Stripe;
@@ -18,6 +19,21 @@ class StripeService
$this->stripe = Stripe::make(env('STRIPE_SECRET'), '2020-03-02');
}
/**
* Get setup intent
*
* @param $user
* @return mixed
*/
public function getSetupIntent($user)
{
// Create stripe customer if not exist
$user->createOrGetStripeCustomer();
// Return setup intent
return $user->createSetupIntent();
}
/**
* Get default payment option or set new default payment
*
@@ -28,17 +44,24 @@ class StripeService
public function getOrSetDefaultPaymentMethod($request, $user)
{
// Check payment method
if (! $request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod()) {
if (!$request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod()) {
// Get default payment
return $user->defaultPaymentMethod()->paymentMethod;
}
} else if ( $request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod() ) {
// Clear cached payment methods
cache_forget_many([
'payment-methods-user-' . $user->id,
'default-payment-methods-user-' . $user->id
]);
if ($request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod()) {
// Set new payment
return $user->addPaymentMethod($request->input('payment.meta.pm'))->paymentMethod;
} else if ( $request->has('payment.meta.pm') && ! $user->hasDefaultPaymentMethod() ) {
} else if ($request->has('payment.meta.pm') && !$user->hasDefaultPaymentMethod()) {
// Set new payment
return $user->updateDefaultPaymentMethod($request->input('payment.meta.pm'))->paymentMethod;
@@ -82,80 +105,21 @@ class StripeService
}
/**
* Create plan
*
* @param $request
* @return mixed
* @param $user
*/
public function createPlan($request)
public function updateCustomerDetails($user)
{
$product = $this->stripe->products()->create([
'name' => $request->input('attributes.name'),
'description' => $request->input('attributes.description'),
'metadata' => [
'capacity' => $request->input('attributes.capacity')
$user->updateStripeCustomer([
'name' => $user->settings->billing_name,
'phone' => $user->settings->billing_phone_number,
'address' => [
'line1' => $user->settings->billing_address,
'city' => $user->settings->billing_city,
'country' => $user->settings->billing_country,
'postal_code' => $user->settings->billing_postal_code,
'state' => $user->settings->billing_state,
]
]);
$plan = $this->stripe->plans()->create([
'id' => Str::slug($request->input('attributes.name')),
'amount' => $request->input('attributes.price'),
'currency' => 'USD',
'interval' => 'month',
'product' => $product['id'],
]);
return compact('plan', 'product');
}
/**
* Update plan
*
* @param $request
* @param $id
*/
public function updatePlan($request, $id)
{
$plan_colls = ['is_active', 'price'];
$product_colls = ['name', 'description', 'capacity'];
$plan = $this->stripe->plans()->find($id);
// Update product
if (in_array($request->name, $product_colls)) {
if ($request->name === 'capacity') {
$this->stripe->products()->update($plan['product'], ['metadata' => ['capacity' => $request->value]]);
}
if ($request->name === 'name') {
$this->stripe->products()->update($plan['product'], ['name' => $request->value]);
}
if ($request->name === 'description') {
$this->stripe->products()->update($plan['product'], ['description' => $request->value]);
}
}
// Update plan
if (in_array($request->name, $plan_colls)) {
if ($request->name === 'is_active') {
$this->stripe->plans()->update($id, ['active' => $request->value]);
}
}
}
/**
* Get plan details
*
* @param $id
* @return mixed
*/
public function getPlan($id)
{
$plan = $this->stripe->plans()->find($id);
$product = $this->stripe->products()->find($plan['product']);
return compact('plan', 'product');
}
/**
@@ -217,6 +181,83 @@ class StripeService
return $plans;
}
/**
* Get plan details
*
* @param $id
* @return mixed
*/
public function getPlan($id)
{
$plan = $this->stripe->plans()->find($id);
$product = $this->stripe->products()->find($plan['product']);
return compact('plan', 'product');
}
/**
* Create plan
*
* @param $request
* @return mixed
*/
public function createPlan($request)
{
$product = $this->stripe->products()->create([
'name' => $request->input('attributes.name'),
'description' => $request->input('attributes.description'),
'metadata' => [
'capacity' => $request->input('attributes.capacity')
]
]);
$plan = $this->stripe->plans()->create([
'id' => Str::slug($request->input('attributes.name')),
'amount' => $request->input('attributes.price'),
'currency' => 'USD',
'interval' => 'month',
'product' => $product['id'],
]);
return compact('plan', 'product');
}
/**
* Update plan
*
* @param $request
* @param $id
*/
public function updatePlan($request, $id)
{
$plan_colls = ['is_active', 'price'];
$product_colls = ['name', 'description', 'capacity'];
$plan = $this->stripe->plans()->find($id);
// Update product
if (in_array($request->name, $product_colls)) {
if ($request->name === 'capacity') {
$this->stripe->products()->update($plan['product'], ['metadata' => ['capacity' => $request->value]]);
}
if ($request->name === 'name') {
$this->stripe->products()->update($plan['product'], ['name' => $request->value]);
}
if ($request->name === 'description') {
$this->stripe->products()->update($plan['product'], ['description' => $request->value]);
}
}
// Update plan
if (in_array($request->name, $plan_colls)) {
if ($request->name === 'is_active') {
$this->stripe->plans()->update($id, ['active' => $request->value]);
}
}
}
/**
* Delete plan
*
@@ -226,4 +267,38 @@ class StripeService
{
$this->stripe->plans()->delete($slug);
}
/**
* Get all user invoices
*
* @param $user
* @return mixed
*/
public function getUserInvoices($user)
{
return $user->invoices();
}
/**
* Get user invoice by id
*
* @param $id
* @return \Laravel\Cashier\Invoice|null
*/
public function getUserInvoice($customer, $id)
{
$user = User::where('stripe_id', $customer)->first();
return $user->findInvoice($id);
}
/**
* Get all invoices
*
* @return mixed
*/
public function getInvoices()
{
return $this->stripe->invoices()->all();
}
}

View File

@@ -65,7 +65,6 @@ use Rinvex\Subscriptions\Traits\HasSubscriptions;
* @property-read mixed $storage
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Invoice[] $invoices
* @property-read int|null $invoices_count
* @property-read \Illuminate\Database\Eloquent\Collection|\App\UserCard[] $payment_cards
* @property-read int|null $payment_cards_count
* @property-read \App\UserSettings|null $settings
* @property-read \Illuminate\Database\Eloquent\Collection|\Laravel\Cashier\Subscription[] $subscriptions
@@ -166,6 +165,7 @@ class User extends Authenticatable
* Set user billing info
*
* @param $billing
* @return UserSettings
*/
public function setBilling($billing)
{
@@ -178,6 +178,8 @@ class User extends Authenticatable
'billing_postal_code' => $billing['billing_postal_code'],
'billing_state' => $billing['billing_state'],
]);
return $this->settings;
}
/**
@@ -240,24 +242,4 @@ class User extends Authenticatable
{
return $this->hasOne(UserSettings::class);
}
/**
* Get user invoices
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function invoices()
{
return $this->hasMany(Invoice::class);
}
/**
* Get user payment cards
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function payment_cards()
{
return $this->hasMany(UserCard::class);
}
}

View File

@@ -1,48 +0,0 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
/**
* App\UserCard
*
* @property int $id
* @property int $user_id
* @property string $provider
* @property int $default
* @property string $status
* @property string $card_id
* @property string $brand
* @property string $last4
* @property string $exp_month
* @property string $exp_year
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\User|null $user
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereBrand($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereCardId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereDefault($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereExpMonth($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereExpYear($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereLast4($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereProvider($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereStatus($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\UserCard whereUserId($value)
* @mixin \Eloquent
*/
class UserCard extends Model
{
protected $guarded = ['id'];
public function user() {
return $this->hasOne(User::class);
}
}

View File

@@ -1,30 +0,0 @@
<?php
declare(strict_types=1);
return [
// Manage autoload migrations
'autoload_migrations' => true,
// Subscriptions Database Tables
'tables' => [
'plans' => 'plans',
'plan_features' => 'plan_features',
'plan_subscriptions' => 'plan_subscriptions',
'plan_subscription_usage' => 'plan_subscription_usage',
],
// Subscriptions Models
'models' => [
'plan' => \Rinvex\Subscriptions\Models\Plan::class,
'plan_feature' => \Rinvex\Subscriptions\Models\PlanFeature::class,
'plan_subscription' => \Rinvex\Subscriptions\Models\PlanSubscription::class,
'plan_subscription_usage' => \Rinvex\Subscriptions\Models\PlanSubscriptionUsage::class,
],
];

View File

@@ -1,12 +0,0 @@
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\UserCard;
use Faker\Generator as Faker;
$factory->define(UserCard::class, function (Faker $faker) {
return [
//
];
});

View File

@@ -1,42 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateInvoicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invoices', function (Blueprint $table) {
$table->bigIncrements('id');
$table->text('token');
$table->text('order');
$table->text('provider');
$table->text('user_id');
$table->text('plan_id');
$table->longText('seller');
$table->longText('client');
$table->longText('bag');
$table->longText('notes')->nullable();
$table->text('total');
$table->text('currency');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('invoices');
}
}

View File

@@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUserCardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('user_cards', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id');
$table->text('provider');
$table->text('card_id');
$table->text('brand');
$table->text('last4');
$table->text('exp_month');
$table->text('exp_year');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('user_cards');
}
}

View File

@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddStatusToUserCardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_cards', function (Blueprint $table) {
$table->text('status')->after('provider');
$table->boolean('default')->default(0)->after('provider');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_cards', function (Blueprint $table) {
$table->removeColumn('status');
$table->removeColumn('default');
});
}
}

View File

@@ -1,287 +1,4 @@
{
"/js/main.js": "/js/main.js",
"/css/app.css": "/css/app.css",
"/js/main.c592c1b513edd7534891.hot-update.js": "/js/main.c592c1b513edd7534891.hot-update.js",
"/js/main.80ad9909faceb74207f1.hot-update.js": "/js/main.80ad9909faceb74207f1.hot-update.js",
"/js/main.4b91997785e85d7d6e32.hot-update.js": "/js/main.4b91997785e85d7d6e32.hot-update.js",
"/js/main.e787780098edc245ae3c.hot-update.js": "/js/main.e787780098edc245ae3c.hot-update.js",
"/js/main.e55b17a6a5a315b93bef.hot-update.js": "/js/main.e55b17a6a5a315b93bef.hot-update.js",
"/js/main.28fdd591cc524a88c846.hot-update.js": "/js/main.28fdd591cc524a88c846.hot-update.js",
"/js/main.2b812942c78e860c03db.hot-update.js": "/js/main.2b812942c78e860c03db.hot-update.js",
"/js/main.211081d76c54b5482de5.hot-update.js": "/js/main.211081d76c54b5482de5.hot-update.js",
"/js/main.fd6434aee58e09a56ff4.hot-update.js": "/js/main.fd6434aee58e09a56ff4.hot-update.js",
"/js/main.4c1d8cba619a7927638c.hot-update.js": "/js/main.4c1d8cba619a7927638c.hot-update.js",
"/js/main.aff41805a3b84c8ebae5.hot-update.js": "/js/main.aff41805a3b84c8ebae5.hot-update.js",
"/js/main.6f72ba9701b9e19c9be0.hot-update.js": "/js/main.6f72ba9701b9e19c9be0.hot-update.js",
"/js/main.0e4c6671c2367b10695d.hot-update.js": "/js/main.0e4c6671c2367b10695d.hot-update.js",
"/js/main.1985d2920179f9a6f78f.hot-update.js": "/js/main.1985d2920179f9a6f78f.hot-update.js",
"/js/main.9f9975790f0a229f2cb2.hot-update.js": "/js/main.9f9975790f0a229f2cb2.hot-update.js",
"/js/main.0fba79cfcfa3990cf559.hot-update.js": "/js/main.0fba79cfcfa3990cf559.hot-update.js",
"/js/main.03715cbb9f7cdc53e0ff.hot-update.js": "/js/main.03715cbb9f7cdc53e0ff.hot-update.js",
"/js/main.b6aaa5a10b3ddcee7f9d.hot-update.js": "/js/main.b6aaa5a10b3ddcee7f9d.hot-update.js",
"/js/main.d7271130fb59906d5182.hot-update.js": "/js/main.d7271130fb59906d5182.hot-update.js",
"/js/main.957b7763ea3c9accc8cc.hot-update.js": "/js/main.957b7763ea3c9accc8cc.hot-update.js",
"/js/main.e23eea5ec4310f745400.hot-update.js": "/js/main.e23eea5ec4310f745400.hot-update.js",
"/js/main.6e342ea527f2c3f9b013.hot-update.js": "/js/main.6e342ea527f2c3f9b013.hot-update.js",
"/js/main.612f96382ad8ba3d109c.hot-update.js": "/js/main.612f96382ad8ba3d109c.hot-update.js",
"/js/main.aba02ea167c96d2b7634.hot-update.js": "/js/main.aba02ea167c96d2b7634.hot-update.js",
"/js/main.9d67410798c6c29f0842.hot-update.js": "/js/main.9d67410798c6c29f0842.hot-update.js",
"/js/main.e4515959db9d0f8747f2.hot-update.js": "/js/main.e4515959db9d0f8747f2.hot-update.js",
"/js/main.cb089a2ecaf1fd0be078.hot-update.js": "/js/main.cb089a2ecaf1fd0be078.hot-update.js",
"/js/main.5ba809ade4770806836a.hot-update.js": "/js/main.5ba809ade4770806836a.hot-update.js",
"/js/main.990c352366666e2ca2f2.hot-update.js": "/js/main.990c352366666e2ca2f2.hot-update.js",
"/js/main.4c12e8bb7d017220e3fa.hot-update.js": "/js/main.4c12e8bb7d017220e3fa.hot-update.js",
"/js/main.0bd1b62237741b506f57.hot-update.js": "/js/main.0bd1b62237741b506f57.hot-update.js",
"/js/main.90a24d55baa0b9e45607.hot-update.js": "/js/main.90a24d55baa0b9e45607.hot-update.js",
"/js/main.f0152d5ede68576fab2f.hot-update.js": "/js/main.f0152d5ede68576fab2f.hot-update.js",
"/js/main.f87dba2f8ad4b673eef3.hot-update.js": "/js/main.f87dba2f8ad4b673eef3.hot-update.js",
"/js/main.7738f2b3cc86dadbfcf9.hot-update.js": "/js/main.7738f2b3cc86dadbfcf9.hot-update.js",
"/js/main.a6bc9844316ff7a73a3a.hot-update.js": "/js/main.a6bc9844316ff7a73a3a.hot-update.js",
"/js/main.30f1c08c6c5c716bc99b.hot-update.js": "/js/main.30f1c08c6c5c716bc99b.hot-update.js",
"/js/main.52f9059179cdfa541c49.hot-update.js": "/js/main.52f9059179cdfa541c49.hot-update.js",
"/js/main.bd918a21f99459ac0c5a.hot-update.js": "/js/main.bd918a21f99459ac0c5a.hot-update.js",
"/js/main.cd35d127280aa3ed72bf.hot-update.js": "/js/main.cd35d127280aa3ed72bf.hot-update.js",
"/js/main.fad01e38ba0a025fff8e.hot-update.js": "/js/main.fad01e38ba0a025fff8e.hot-update.js",
"/js/main.5f401e8ed55572e305cb.hot-update.js": "/js/main.5f401e8ed55572e305cb.hot-update.js",
"/js/main.0781bb19d4803f1c18cd.hot-update.js": "/js/main.0781bb19d4803f1c18cd.hot-update.js",
"/js/main.4647329b218e437cd36f.hot-update.js": "/js/main.4647329b218e437cd36f.hot-update.js",
"/js/main.cbadabd16ec66f6c56d6.hot-update.js": "/js/main.cbadabd16ec66f6c56d6.hot-update.js",
"/js/main.2b9b5409dee799203a6c.hot-update.js": "/js/main.2b9b5409dee799203a6c.hot-update.js",
"/js/main.21dd08ba11f996085687.hot-update.js": "/js/main.21dd08ba11f996085687.hot-update.js",
"/js/main.afe5395def9a1c6bfba3.hot-update.js": "/js/main.afe5395def9a1c6bfba3.hot-update.js",
"/js/main.bce3823ed3f28958fa5f.hot-update.js": "/js/main.bce3823ed3f28958fa5f.hot-update.js",
"/js/main.6d0abf817c91fcbc246d.hot-update.js": "/js/main.6d0abf817c91fcbc246d.hot-update.js",
"/js/main.d20577f503f0d098d7d3.hot-update.js": "/js/main.d20577f503f0d098d7d3.hot-update.js",
"/js/main.609a2280828ed517bdc1.hot-update.js": "/js/main.609a2280828ed517bdc1.hot-update.js",
"/js/main.d7ad5e9d5b97bbdc37db.hot-update.js": "/js/main.d7ad5e9d5b97bbdc37db.hot-update.js",
"/js/main.66dc93a5bf413b7786be.hot-update.js": "/js/main.66dc93a5bf413b7786be.hot-update.js",
"/js/main.e616a0e15889e0865a7b.hot-update.js": "/js/main.e616a0e15889e0865a7b.hot-update.js",
"/js/main.58f7b99d0ee0f875e7dc.hot-update.js": "/js/main.58f7b99d0ee0f875e7dc.hot-update.js",
"/js/main.e79958d0a6039bd1c735.hot-update.js": "/js/main.e79958d0a6039bd1c735.hot-update.js",
"/js/main.f88db9bb087b351dc1a4.hot-update.js": "/js/main.f88db9bb087b351dc1a4.hot-update.js",
"/js/main.8a872d714e919c2818ad.hot-update.js": "/js/main.8a872d714e919c2818ad.hot-update.js",
"/js/main.8a719961322acc70e9ef.hot-update.js": "/js/main.8a719961322acc70e9ef.hot-update.js",
"/js/main.a46e2e1d1032e2bb09ac.hot-update.js": "/js/main.a46e2e1d1032e2bb09ac.hot-update.js",
"/js/main.f4e3d15c80b88b4936be.hot-update.js": "/js/main.f4e3d15c80b88b4936be.hot-update.js",
"/js/main.afca50dd54922bf43026.hot-update.js": "/js/main.afca50dd54922bf43026.hot-update.js",
"/js/main.22a33372319fe8c233e6.hot-update.js": "/js/main.22a33372319fe8c233e6.hot-update.js",
"/js/main.066da2d957bdd49143d0.hot-update.js": "/js/main.066da2d957bdd49143d0.hot-update.js",
"/js/main.1b2ebbdc84449535f397.hot-update.js": "/js/main.1b2ebbdc84449535f397.hot-update.js",
"/js/main.4ac37a1720ab1578cec3.hot-update.js": "/js/main.4ac37a1720ab1578cec3.hot-update.js",
"/js/main.623f3b31b7a87a8668b4.hot-update.js": "/js/main.623f3b31b7a87a8668b4.hot-update.js",
"/js/main.7632e72183adc326096a.hot-update.js": "/js/main.7632e72183adc326096a.hot-update.js",
"/js/main.6f007dc67a704a23e916.hot-update.js": "/js/main.6f007dc67a704a23e916.hot-update.js",
"/js/main.e553af47e4049586ac44.hot-update.js": "/js/main.e553af47e4049586ac44.hot-update.js",
"/js/main.92b31d53366c3ad8622b.hot-update.js": "/js/main.92b31d53366c3ad8622b.hot-update.js",
"/js/main.e09827aea6d23ff07c1e.hot-update.js": "/js/main.e09827aea6d23ff07c1e.hot-update.js",
"/js/main.04281820cee21428693e.hot-update.js": "/js/main.04281820cee21428693e.hot-update.js",
"/js/main.f4067ec10e4cf8bd8a64.hot-update.js": "/js/main.f4067ec10e4cf8bd8a64.hot-update.js",
"/js/main.430e98b75c1019f0292d.hot-update.js": "/js/main.430e98b75c1019f0292d.hot-update.js",
"/js/main.578582fa836e0594b831.hot-update.js": "/js/main.578582fa836e0594b831.hot-update.js",
"/js/main.0513b4f06058ecad6d0f.hot-update.js": "/js/main.0513b4f06058ecad6d0f.hot-update.js",
"/js/main.311234d50f9c449dc26b.hot-update.js": "/js/main.311234d50f9c449dc26b.hot-update.js",
"/js/main.aced0a5d0980fe602161.hot-update.js": "/js/main.aced0a5d0980fe602161.hot-update.js",
"/js/main.ad0cab16daa356d285bc.hot-update.js": "/js/main.ad0cab16daa356d285bc.hot-update.js",
"/js/main.40423454c85a1c529658.hot-update.js": "/js/main.40423454c85a1c529658.hot-update.js",
"/js/main.5f56f327d2ee898c55f5.hot-update.js": "/js/main.5f56f327d2ee898c55f5.hot-update.js",
"/js/main.d4206606dda50af813c6.hot-update.js": "/js/main.d4206606dda50af813c6.hot-update.js",
"/js/main.b2fbfa55f560e77648b4.hot-update.js": "/js/main.b2fbfa55f560e77648b4.hot-update.js",
"/js/main.e05f4750489ca893d94d.hot-update.js": "/js/main.e05f4750489ca893d94d.hot-update.js",
"/js/main.af394e802253a7191c04.hot-update.js": "/js/main.af394e802253a7191c04.hot-update.js",
"/js/main.ce416ea8ea898d2b842c.hot-update.js": "/js/main.ce416ea8ea898d2b842c.hot-update.js",
"/js/main.c1b17e139a6bffd834f5.hot-update.js": "/js/main.c1b17e139a6bffd834f5.hot-update.js",
"/js/main.46df392fd59c5498018f.hot-update.js": "/js/main.46df392fd59c5498018f.hot-update.js",
"/js/main.5b083225fa62793303a5.hot-update.js": "/js/main.5b083225fa62793303a5.hot-update.js",
"/js/main.ff1635f87e05dae40c64.hot-update.js": "/js/main.ff1635f87e05dae40c64.hot-update.js",
"/js/main.181ca1486b6c63df043a.hot-update.js": "/js/main.181ca1486b6c63df043a.hot-update.js",
"/js/main.aed85b7900a1ffb09898.hot-update.js": "/js/main.aed85b7900a1ffb09898.hot-update.js",
"/js/main.a96f14da0f826e0f73fe.hot-update.js": "/js/main.a96f14da0f826e0f73fe.hot-update.js",
"/js/main.19bc16cb52d3dc751604.hot-update.js": "/js/main.19bc16cb52d3dc751604.hot-update.js",
"/js/main.13103769e6134409fa2a.hot-update.js": "/js/main.13103769e6134409fa2a.hot-update.js",
"/js/main.a8ddc0df618dca5b1160.hot-update.js": "/js/main.a8ddc0df618dca5b1160.hot-update.js",
"/js/main.98abd09248c9893c4a30.hot-update.js": "/js/main.98abd09248c9893c4a30.hot-update.js",
"/js/main.4b42b13afb3e6e18a916.hot-update.js": "/js/main.4b42b13afb3e6e18a916.hot-update.js",
"/js/main.da8ab6e69627bbcff9a1.hot-update.js": "/js/main.da8ab6e69627bbcff9a1.hot-update.js",
"/js/main.fb5fe1c0ead4cb6c3647.hot-update.js": "/js/main.fb5fe1c0ead4cb6c3647.hot-update.js",
"/js/main.ecbde6764e0032ecaaff.hot-update.js": "/js/main.ecbde6764e0032ecaaff.hot-update.js",
"/js/main.45cdddc1e11584321f8f.hot-update.js": "/js/main.45cdddc1e11584321f8f.hot-update.js",
"/js/main.5e716c4399d6c4e7c60c.hot-update.js": "/js/main.5e716c4399d6c4e7c60c.hot-update.js",
"/js/main.85b156a9d0ebbe510f72.hot-update.js": "/js/main.85b156a9d0ebbe510f72.hot-update.js",
"/js/main.5de3358896db4e70d82d.hot-update.js": "/js/main.5de3358896db4e70d82d.hot-update.js",
"/js/main.ede66032dd422936528c.hot-update.js": "/js/main.ede66032dd422936528c.hot-update.js",
"/js/main.5465d00f698d022075f8.hot-update.js": "/js/main.5465d00f698d022075f8.hot-update.js",
"/js/main.aa025d5f6feec8c0dab2.hot-update.js": "/js/main.aa025d5f6feec8c0dab2.hot-update.js",
"/js/main.820910b8cdce9f354543.hot-update.js": "/js/main.820910b8cdce9f354543.hot-update.js",
"/js/main.d14ee47779985cb32ec0.hot-update.js": "/js/main.d14ee47779985cb32ec0.hot-update.js",
"/js/main.8d266a1d740fa389c2bf.hot-update.js": "/js/main.8d266a1d740fa389c2bf.hot-update.js",
"/js/main.99143ecd6bfafab9b677.hot-update.js": "/js/main.99143ecd6bfafab9b677.hot-update.js",
"/js/main.bbb2be0d78aaec9dfda1.hot-update.js": "/js/main.bbb2be0d78aaec9dfda1.hot-update.js",
"/js/main.76904835fe400dd9848f.hot-update.js": "/js/main.76904835fe400dd9848f.hot-update.js",
"/js/main.cafd83e6c2744baad34a.hot-update.js": "/js/main.cafd83e6c2744baad34a.hot-update.js",
"/js/main.2002a76681e8d0433941.hot-update.js": "/js/main.2002a76681e8d0433941.hot-update.js",
"/js/main.2fd100a299a791164337.hot-update.js": "/js/main.2fd100a299a791164337.hot-update.js",
"/js/main.3abd3c2a19f02f47bebc.hot-update.js": "/js/main.3abd3c2a19f02f47bebc.hot-update.js",
"/js/main.2bc80b9424efd6eadbed.hot-update.js": "/js/main.2bc80b9424efd6eadbed.hot-update.js",
"/js/main.48a8f2b34315a51837ed.hot-update.js": "/js/main.48a8f2b34315a51837ed.hot-update.js",
"/js/main.bb7c8231d66a0cb23884.hot-update.js": "/js/main.bb7c8231d66a0cb23884.hot-update.js",
"/js/main.f3c27d8639d237140393.hot-update.js": "/js/main.f3c27d8639d237140393.hot-update.js",
"/js/main.aa88aa732da3530ef6fc.hot-update.js": "/js/main.aa88aa732da3530ef6fc.hot-update.js",
"/js/main.2f10611b4cb0849baf9a.hot-update.js": "/js/main.2f10611b4cb0849baf9a.hot-update.js",
"/js/main.cdb3c9099ecd3aef1c6d.hot-update.js": "/js/main.cdb3c9099ecd3aef1c6d.hot-update.js",
"/js/main.4f6cbd01f21463974339.hot-update.js": "/js/main.4f6cbd01f21463974339.hot-update.js",
"/js/main.75e920f256de199321da.hot-update.js": "/js/main.75e920f256de199321da.hot-update.js",
"/js/main.3aa153417b65e9dd8e66.hot-update.js": "/js/main.3aa153417b65e9dd8e66.hot-update.js",
"/js/main.412dd1fb982791c51e22.hot-update.js": "/js/main.412dd1fb982791c51e22.hot-update.js",
"/js/main.f7dace814dd7cf6cd2d2.hot-update.js": "/js/main.f7dace814dd7cf6cd2d2.hot-update.js",
"/js/main.107c49051b193edea885.hot-update.js": "/js/main.107c49051b193edea885.hot-update.js",
"/js/main.b31481977f618806d60a.hot-update.js": "/js/main.b31481977f618806d60a.hot-update.js",
"/js/main.44dcaa7eb8423dcba8c0.hot-update.js": "/js/main.44dcaa7eb8423dcba8c0.hot-update.js",
"/js/main.ff751f6b0426846af09f.hot-update.js": "/js/main.ff751f6b0426846af09f.hot-update.js",
"/js/main.2b668837a746a960d470.hot-update.js": "/js/main.2b668837a746a960d470.hot-update.js",
"/js/main.c26ae7faad32e3f752f9.hot-update.js": "/js/main.c26ae7faad32e3f752f9.hot-update.js",
"/js/main.71819bd2c52cfd992c49.hot-update.js": "/js/main.71819bd2c52cfd992c49.hot-update.js",
"/js/main.b2a492cb77c7a3dbc8b8.hot-update.js": "/js/main.b2a492cb77c7a3dbc8b8.hot-update.js",
"/js/main.755b3b6f634d7ea41269.hot-update.js": "/js/main.755b3b6f634d7ea41269.hot-update.js",
"/js/main.63a686c9457eecec0aed.hot-update.js": "/js/main.63a686c9457eecec0aed.hot-update.js",
"/js/main.bc7270bc738d06bf003c.hot-update.js": "/js/main.bc7270bc738d06bf003c.hot-update.js",
"/js/main.6a812e6a9a8fdec9e0f9.hot-update.js": "/js/main.6a812e6a9a8fdec9e0f9.hot-update.js",
"/js/main.605b505026463b82cf92.hot-update.js": "/js/main.605b505026463b82cf92.hot-update.js",
"/js/main.67ec3e67dc7fe249a511.hot-update.js": "/js/main.67ec3e67dc7fe249a511.hot-update.js",
"/js/main.60f7f14041f1b1c43ba7.hot-update.js": "/js/main.60f7f14041f1b1c43ba7.hot-update.js",
"/js/main.378fefdc90168f530ced.hot-update.js": "/js/main.378fefdc90168f530ced.hot-update.js",
"/js/main.50bcdbbb6689ab1f3ff8.hot-update.js": "/js/main.50bcdbbb6689ab1f3ff8.hot-update.js",
"/js/main.bad32b198b2701141385.hot-update.js": "/js/main.bad32b198b2701141385.hot-update.js",
"/js/main.054d269f4a98578503c1.hot-update.js": "/js/main.054d269f4a98578503c1.hot-update.js",
"/js/main.41b69188f146b379f87b.hot-update.js": "/js/main.41b69188f146b379f87b.hot-update.js",
"/js/main.3e018a3648dfc61d3df3.hot-update.js": "/js/main.3e018a3648dfc61d3df3.hot-update.js",
"/js/main.2936652ac5660f94a796.hot-update.js": "/js/main.2936652ac5660f94a796.hot-update.js",
"/js/main.fcc623fc42f160e06cfe.hot-update.js": "/js/main.fcc623fc42f160e06cfe.hot-update.js",
"/js/main.93d580e0883dc95e1116.hot-update.js": "/js/main.93d580e0883dc95e1116.hot-update.js",
"/js/main.28d29c71ea1ed0a0b0b4.hot-update.js": "/js/main.28d29c71ea1ed0a0b0b4.hot-update.js",
"/js/main.2a76ff437524f4ee71c0.hot-update.js": "/js/main.2a76ff437524f4ee71c0.hot-update.js",
"/js/main.cff525ce21d6a17180c1.hot-update.js": "/js/main.cff525ce21d6a17180c1.hot-update.js",
"/js/main.160476920d84b7b64f03.hot-update.js": "/js/main.160476920d84b7b64f03.hot-update.js",
"/js/main.30dda3674a213af39664.hot-update.js": "/js/main.30dda3674a213af39664.hot-update.js",
"/js/main.c011a2db86676be81958.hot-update.js": "/js/main.c011a2db86676be81958.hot-update.js",
"/js/main.3b1eb2be045aeb2794d7.hot-update.js": "/js/main.3b1eb2be045aeb2794d7.hot-update.js",
"/js/main.06a1a0a0d13e736f4b21.hot-update.js": "/js/main.06a1a0a0d13e736f4b21.hot-update.js",
"/js/main.e01d5781e9a5c7916665.hot-update.js": "/js/main.e01d5781e9a5c7916665.hot-update.js",
"/js/main.a8be6a86ef7ea1fa09aa.hot-update.js": "/js/main.a8be6a86ef7ea1fa09aa.hot-update.js",
"/js/main.10ef93f11f9971bffcd0.hot-update.js": "/js/main.10ef93f11f9971bffcd0.hot-update.js",
"/js/main.8272060c881465e5c1b8.hot-update.js": "/js/main.8272060c881465e5c1b8.hot-update.js",
"/js/main.3c4afd1bbc5dbddbc2f5.hot-update.js": "/js/main.3c4afd1bbc5dbddbc2f5.hot-update.js",
"/js/main.5095c746248692e2fab9.hot-update.js": "/js/main.5095c746248692e2fab9.hot-update.js",
"/js/main.b7e058950b6450f5be86.hot-update.js": "/js/main.b7e058950b6450f5be86.hot-update.js",
"/js/main.0cd416bcfc7be3e736b4.hot-update.js": "/js/main.0cd416bcfc7be3e736b4.hot-update.js",
"/js/main.074d97f29afb98992021.hot-update.js": "/js/main.074d97f29afb98992021.hot-update.js",
"/js/main.b832de402f7a0bb84f16.hot-update.js": "/js/main.b832de402f7a0bb84f16.hot-update.js",
"/js/main.e2acc484ee30d5bc511b.hot-update.js": "/js/main.e2acc484ee30d5bc511b.hot-update.js",
"/js/main.6062f643e9e4b8ca338f.hot-update.js": "/js/main.6062f643e9e4b8ca338f.hot-update.js",
"/js/main.2e9db006c2bd6ed06276.hot-update.js": "/js/main.2e9db006c2bd6ed06276.hot-update.js",
"/js/main.c5440e1711c2366531e8.hot-update.js": "/js/main.c5440e1711c2366531e8.hot-update.js",
"/js/main.9621c2052cd66aab368f.hot-update.js": "/js/main.9621c2052cd66aab368f.hot-update.js",
"/js/main.0fe5939166b86f760041.hot-update.js": "/js/main.0fe5939166b86f760041.hot-update.js",
"/js/main.9a08a8a2109d7993ea97.hot-update.js": "/js/main.9a08a8a2109d7993ea97.hot-update.js",
"/js/main.bf10e2245b146a2cf6c0.hot-update.js": "/js/main.bf10e2245b146a2cf6c0.hot-update.js",
"/js/main.9c0628dcaf454d8ef45e.hot-update.js": "/js/main.9c0628dcaf454d8ef45e.hot-update.js",
"/js/main.93b39c613c426756176e.hot-update.js": "/js/main.93b39c613c426756176e.hot-update.js",
"/js/main.cddfc9fafcd6885f21e7.hot-update.js": "/js/main.cddfc9fafcd6885f21e7.hot-update.js",
"/js/main.cca75105094aa748a70d.hot-update.js": "/js/main.cca75105094aa748a70d.hot-update.js",
"/js/main.c8c27998c2b3cf45a66b.hot-update.js": "/js/main.c8c27998c2b3cf45a66b.hot-update.js",
"/js/main.329fc90f8bb0ac52ca61.hot-update.js": "/js/main.329fc90f8bb0ac52ca61.hot-update.js",
"/js/main.6f31b38bb7c9668fbbce.hot-update.js": "/js/main.6f31b38bb7c9668fbbce.hot-update.js",
"/js/main.1fd945801f700932880d.hot-update.js": "/js/main.1fd945801f700932880d.hot-update.js",
"/js/main.d4f2e81b634d134be133.hot-update.js": "/js/main.d4f2e81b634d134be133.hot-update.js",
"/js/main.b80e30c83de500fc196d.hot-update.js": "/js/main.b80e30c83de500fc196d.hot-update.js",
"/js/main.8d8063569f01acb69bc7.hot-update.js": "/js/main.8d8063569f01acb69bc7.hot-update.js",
"/js/main.d4d7a8a2373540a95962.hot-update.js": "/js/main.d4d7a8a2373540a95962.hot-update.js",
"/js/main.4b0768ce7a19f5093747.hot-update.js": "/js/main.4b0768ce7a19f5093747.hot-update.js",
"/js/main.34079aa9b29123a2083c.hot-update.js": "/js/main.34079aa9b29123a2083c.hot-update.js",
"/js/main.ec6c429db76fb2dd0212.hot-update.js": "/js/main.ec6c429db76fb2dd0212.hot-update.js",
"/js/main.2ab0c9706b0b5f27748f.hot-update.js": "/js/main.2ab0c9706b0b5f27748f.hot-update.js",
"/js/main.01b547932ef0a411f639.hot-update.js": "/js/main.01b547932ef0a411f639.hot-update.js",
"/js/main.f9d0e38a0c8267727c41.hot-update.js": "/js/main.f9d0e38a0c8267727c41.hot-update.js",
"/js/main.47a584d9a6bfa1cbaca6.hot-update.js": "/js/main.47a584d9a6bfa1cbaca6.hot-update.js",
"/js/main.a891f426506bbc45d3f6.hot-update.js": "/js/main.a891f426506bbc45d3f6.hot-update.js",
"/js/main.0ab4b48148074ad23aec.hot-update.js": "/js/main.0ab4b48148074ad23aec.hot-update.js",
"/js/main.d851fe54d559c0c439d4.hot-update.js": "/js/main.d851fe54d559c0c439d4.hot-update.js",
"/js/main.965fc731cb2a00fcde50.hot-update.js": "/js/main.965fc731cb2a00fcde50.hot-update.js",
"/js/main.7efc63569bd16d43be96.hot-update.js": "/js/main.7efc63569bd16d43be96.hot-update.js",
"/js/main.b56f81dd7b7cf2b4a9b2.hot-update.js": "/js/main.b56f81dd7b7cf2b4a9b2.hot-update.js",
"/js/main.6b538f47d7084fc5c056.hot-update.js": "/js/main.6b538f47d7084fc5c056.hot-update.js",
"/js/main.0847c2f8c76446ffc1e1.hot-update.js": "/js/main.0847c2f8c76446ffc1e1.hot-update.js",
"/js/main.fa9ded0194e51af751b4.hot-update.js": "/js/main.fa9ded0194e51af751b4.hot-update.js",
"/js/main.8e479c4cc567a7f86fbf.hot-update.js": "/js/main.8e479c4cc567a7f86fbf.hot-update.js",
"/js/main.c2131ca9020d74887a86.hot-update.js": "/js/main.c2131ca9020d74887a86.hot-update.js",
"/js/main.ae7a03f5a01e1b1fb79f.hot-update.js": "/js/main.ae7a03f5a01e1b1fb79f.hot-update.js",
"/js/main.4719a377f8009f031b35.hot-update.js": "/js/main.4719a377f8009f031b35.hot-update.js",
"/js/main.c87c48fa6a02b2403911.hot-update.js": "/js/main.c87c48fa6a02b2403911.hot-update.js",
"/js/main.47109b08d1688186ca0f.hot-update.js": "/js/main.47109b08d1688186ca0f.hot-update.js",
"/js/main.74b35f583dd235319010.hot-update.js": "/js/main.74b35f583dd235319010.hot-update.js",
"/js/main.8ad646c7fdf758fc3077.hot-update.js": "/js/main.8ad646c7fdf758fc3077.hot-update.js",
"/js/main.f43a2d4521fab4b9a94e.hot-update.js": "/js/main.f43a2d4521fab4b9a94e.hot-update.js",
"/js/main.3435832fdb3175879cf7.hot-update.js": "/js/main.3435832fdb3175879cf7.hot-update.js",
"/js/main.c58b3c90adbd372bdd97.hot-update.js": "/js/main.c58b3c90adbd372bdd97.hot-update.js",
"/js/main.c08fa8f3335ed51d3f75.hot-update.js": "/js/main.c08fa8f3335ed51d3f75.hot-update.js",
"/js/main.4c82e15c2d67b287e8f8.hot-update.js": "/js/main.4c82e15c2d67b287e8f8.hot-update.js",
"/js/main.508fada0c3ecbb174a11.hot-update.js": "/js/main.508fada0c3ecbb174a11.hot-update.js",
"/js/main.61da2361919afdd32838.hot-update.js": "/js/main.61da2361919afdd32838.hot-update.js",
"/js/main.602057bf75bb7533497a.hot-update.js": "/js/main.602057bf75bb7533497a.hot-update.js",
"/js/main.08f17d3db95a580ebcff.hot-update.js": "/js/main.08f17d3db95a580ebcff.hot-update.js",
"/js/main.fde740604ac11217991e.hot-update.js": "/js/main.fde740604ac11217991e.hot-update.js",
"/js/main.470a4e47222c5cd0ca6c.hot-update.js": "/js/main.470a4e47222c5cd0ca6c.hot-update.js",
"/js/main.78a6535c7174d7490de2.hot-update.js": "/js/main.78a6535c7174d7490de2.hot-update.js",
"/js/main.c8a4f8f465ce6970b2ea.hot-update.js": "/js/main.c8a4f8f465ce6970b2ea.hot-update.js",
"/js/main.d8e90a128296036c0c15.hot-update.js": "/js/main.d8e90a128296036c0c15.hot-update.js",
"/js/main.4f84cab5a93c6fca138b.hot-update.js": "/js/main.4f84cab5a93c6fca138b.hot-update.js",
"/js/main.ff08fabb70c77845dacf.hot-update.js": "/js/main.ff08fabb70c77845dacf.hot-update.js",
"/js/main.73b58a7269460f4044f6.hot-update.js": "/js/main.73b58a7269460f4044f6.hot-update.js",
"/js/main.bffdfdca5226e1971a1f.hot-update.js": "/js/main.bffdfdca5226e1971a1f.hot-update.js",
"/js/main.5d24f494cb656c4aea06.hot-update.js": "/js/main.5d24f494cb656c4aea06.hot-update.js",
"/js/main.284dea61b9e166ccf9f0.hot-update.js": "/js/main.284dea61b9e166ccf9f0.hot-update.js",
"/js/main.0865fc8f9bcc9f534bd5.hot-update.js": "/js/main.0865fc8f9bcc9f534bd5.hot-update.js",
"/js/main.6d388afa93af449e99fd.hot-update.js": "/js/main.6d388afa93af449e99fd.hot-update.js",
"/js/main.108d51ae66a3b2e72dbc.hot-update.js": "/js/main.108d51ae66a3b2e72dbc.hot-update.js",
"/js/main.f78ad0c36590167303c7.hot-update.js": "/js/main.f78ad0c36590167303c7.hot-update.js",
"/js/main.607a892f908136301269.hot-update.js": "/js/main.607a892f908136301269.hot-update.js",
"/js/main.85d4f345841dfbb40e07.hot-update.js": "/js/main.85d4f345841dfbb40e07.hot-update.js",
"/js/main.945083b1b0445126d561.hot-update.js": "/js/main.945083b1b0445126d561.hot-update.js",
"/js/main.b09684c47f389bcc887e.hot-update.js": "/js/main.b09684c47f389bcc887e.hot-update.js",
"/js/main.19d37869465800d743bb.hot-update.js": "/js/main.19d37869465800d743bb.hot-update.js",
"/js/main.c54cd5dfd83b055f78af.hot-update.js": "/js/main.c54cd5dfd83b055f78af.hot-update.js",
"/js/main.672249e68aa26cdc3467.hot-update.js": "/js/main.672249e68aa26cdc3467.hot-update.js",
"/js/main.784cd47e7b5a14f729ac.hot-update.js": "/js/main.784cd47e7b5a14f729ac.hot-update.js",
"/js/main.6bb6b81e129e23fb017c.hot-update.js": "/js/main.6bb6b81e129e23fb017c.hot-update.js",
"/js/main.db67acf9cd2003665508.hot-update.js": "/js/main.db67acf9cd2003665508.hot-update.js",
"/js/main.42bbb785d8bc3374175e.hot-update.js": "/js/main.42bbb785d8bc3374175e.hot-update.js",
"/js/main.0985aa644d053b57a808.hot-update.js": "/js/main.0985aa644d053b57a808.hot-update.js",
"/js/main.49338628cefc585d505e.hot-update.js": "/js/main.49338628cefc585d505e.hot-update.js",
"/js/main.efce52309183dd157590.hot-update.js": "/js/main.efce52309183dd157590.hot-update.js",
"/js/main.35aeb37a9609024aeac9.hot-update.js": "/js/main.35aeb37a9609024aeac9.hot-update.js",
"/js/main.53a1fde399bfc98f701c.hot-update.js": "/js/main.53a1fde399bfc98f701c.hot-update.js",
"/js/main.f822941031e6e082f07c.hot-update.js": "/js/main.f822941031e6e082f07c.hot-update.js",
"/js/main.ca79ce64147b6e0e55cb.hot-update.js": "/js/main.ca79ce64147b6e0e55cb.hot-update.js",
"/js/main.937e0ee30a05573041b3.hot-update.js": "/js/main.937e0ee30a05573041b3.hot-update.js",
"/js/main.e7d9b3bc53ac4b3053bc.hot-update.js": "/js/main.e7d9b3bc53ac4b3053bc.hot-update.js",
"/js/main.96bcd5ef0412bc46d1ed.hot-update.js": "/js/main.96bcd5ef0412bc46d1ed.hot-update.js",
"/js/main.b07bbcaf5c0f638640a0.hot-update.js": "/js/main.b07bbcaf5c0f638640a0.hot-update.js",
"/js/main.25e093e405cc4a690242.hot-update.js": "/js/main.25e093e405cc4a690242.hot-update.js",
"/js/main.6e0fa93bb2ee5213af77.hot-update.js": "/js/main.6e0fa93bb2ee5213af77.hot-update.js",
"/js/main.ef2172323fe57a1a3c55.hot-update.js": "/js/main.ef2172323fe57a1a3c55.hot-update.js",
"/js/main.91c8655cf52d84f6a284.hot-update.js": "/js/main.91c8655cf52d84f6a284.hot-update.js",
"/js/main.8864391e1b0b56720f7c.hot-update.js": "/js/main.8864391e1b0b56720f7c.hot-update.js",
"/js/main.bdb661bd0667afb07d42.hot-update.js": "/js/main.bdb661bd0667afb07d42.hot-update.js",
"/js/main.a907b2a57b6a2917f3da.hot-update.js": "/js/main.a907b2a57b6a2917f3da.hot-update.js",
"/js/main.8bd891d1410908be3f0b.hot-update.js": "/js/main.8bd891d1410908be3f0b.hot-update.js",
"/js/main.70b0ed0c55368738458d.hot-update.js": "/js/main.70b0ed0c55368738458d.hot-update.js",
"/js/main.0c542c7f0c6e83b4fa18.hot-update.js": "/js/main.0c542c7f0c6e83b4fa18.hot-update.js",
"/js/main.69f8ec453d307c1f58d5.hot-update.js": "/js/main.69f8ec453d307c1f58d5.hot-update.js",
"/js/main.3b0d20392d7731b198b2.hot-update.js": "/js/main.3b0d20392d7731b198b2.hot-update.js",
"/js/main.9755e76f416f1eb7566c.hot-update.js": "/js/main.9755e76f416f1eb7566c.hot-update.js",
"/js/main.8fd8b140290b7b62e8bf.hot-update.js": "/js/main.8fd8b140290b7b62e8bf.hot-update.js",
"/js/main.a61786216f1a7f65d8c4.hot-update.js": "/js/main.a61786216f1a7f65d8c4.hot-update.js",
"/js/main.ab0a2ac4fee47195d276.hot-update.js": "/js/main.ab0a2ac4fee47195d276.hot-update.js",
"/js/main.ea5986d9d962e977f388.hot-update.js": "/js/main.ea5986d9d962e977f388.hot-update.js",
"/js/main.e9ecf936319bd5e5a9ba.hot-update.js": "/js/main.e9ecf936319bd5e5a9ba.hot-update.js",
"/js/main.83747ba398461b3dae0c.hot-update.js": "/js/main.83747ba398461b3dae0c.hot-update.js"
"/css/app.css": "/css/app.css"
}

View File

@@ -1,5 +1,5 @@
<template>
<div class="plans-wrapper">
<div class="plans-wrapper" v-if="plans">
<article class="plan" v-for="(plan, i) in plans" :key="i">
<div class="plan-wrapper">
<header class="plan-header">

View File

@@ -9,18 +9,18 @@
<template scope="{ row }">
<tr>
<td>
<a :href="'/invoice/' + row.data.attributes.token" target="_blank" class="cell-item">
<a :href="'/invoice/' + row.data.id" target="_blank" class="cell-item">
{{ row.data.attributes.order }}
</a>
</td>
<td>
<span class="cell-item">
${{ row.data.attributes.total }}
{{ row.data.attributes.total }}
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.bag[0].description }}
{{ row.data.attributes.bag.description }}
</span>
</td>
<td>
@@ -29,17 +29,20 @@
</span>
</td>
<td>
<router-link :to="{name: 'UserInvoices', params: {id: row.relationships.user.data.id}}">
<router-link v-if="row.relationships" :to="{name: 'UserInvoices', params: {id: row.relationships.user.data.id}}">
<DatatableCellImage
image-size="small"
:image="row.relationships.user.data.attributes.avatar"
:title="row.relationships.user.data.attributes.name"
/>
</router-link>
<span v-else class="cell-item">
-
</span>
</td>
<td>
<div class="action-icons">
<a :href="'/invoice/' + row.data.attributes.token" target="_blank">
<a :href="'/invoice/' + row.data.id" target="_blank">
<external-link-icon size="15" class="icon"></external-link-icon>
</a>
</div>

View File

@@ -72,7 +72,7 @@
this.isSendingRequest = true
axios
.delete(this.$store.getters.api + '/plans/' + this.$route.params.id + '/delete',
.delete(this.$store.getters.api + '/plans/' + this.$route.params.id,
{
data: {
name: this.planName
@@ -82,11 +82,11 @@
.then(() => {
this.isSendingRequest = false
// Show error message
// Show message
events.$emit('success:open', {
emoji: '👍',
title: this.$t('popup_deleted_user.title'),
message: this.$t('popup_deleted_user.message'),
title: 'Plan was deleted',
message: 'Your plan was successfully deleted.',
})
this.$router.push({name: 'Plans'})

View File

@@ -1,22 +1,22 @@
<template>
<PageTab v-if="invoices">
<PageTabGroup v-if="invoices.length > 0">
<PageTab :is-loading="isLoading">
<PageTabGroup v-if="invoices && invoices.length > 0">
<DatatableWrapper :paginator="true" :columns="columns" :data="invoices" class="table">
<template scope="{ row }">
<tr>
<td>
<a :href="'/invoice/' + row.data.attributes.token" target="_blank" class="cell-item">
<a :href="'/invoice/' + row.data.id" target="_blank" class="cell-item">
{{ row.data.attributes.order }}
</a>
</td>
<td>
<span class="cell-item">
${{ row.data.attributes.total }}
{{ row.data.attributes.total }}
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.bag[0].description }}
{{ row.data.attributes.bag.description }}
</span>
</td>
<td>
@@ -26,7 +26,7 @@
</td>
<td>
<div class="action-icons">
<a :href="'/invoice/' + row.data.attributes.token" target="_blank">
<a :href="'/invoice/' + row.data.id" target="_blank">
<external-link-icon size="15" class="icon"></external-link-icon>
</a>
</div>

View File

@@ -2,7 +2,7 @@
<PageTab v-if="storage">
<PageTabGroup>
<SetupBox
v-if="! config.isSaaS || ! user.relationships.subscription"
v-if="! config.isSaaS || ! user.data.attributes.subscription"
theme="base"
:title="$t('user_box_storage.title')"
:description="$t('user_box_storage.description')"

View File

@@ -1,5 +1,5 @@
<template>
<PageTab>
<PageTab :is-loading="isLoading">
<PageTabGroup v-if="subscription">
<!--Info about active subscription-->
@@ -65,6 +65,7 @@
data() {
return {
subscription: undefined,
isLoading: true,
}
},
created() {

View File

@@ -54,7 +54,7 @@
</div>
</router-link>
<router-link v-if="config.isSaaS" replace :to="{name: 'Subscription'}" class="menu-list-item link">
<router-link v-if="canShowSubscriptionSettings" replace :to="{name: 'Subscription'}" class="menu-list-item link">
<div class="icon">
<cloud-icon size="17"></cloud-icon>
</div>
@@ -63,7 +63,7 @@
</div>
</router-link>
<router-link v-if="config.isSaaS" replace :to="{name: 'PaymentCards'}" class="menu-list-item link">
<router-link v-if="canShowSubscriptionSettings" replace :to="{name: 'PaymentCards'}" class="menu-list-item link">
<div class="icon">
<credit-card-icon size="17"></credit-card-icon>
</div>
@@ -72,7 +72,7 @@
</div>
</router-link>
<router-link v-if="config.isSaaS" replace :to="{name: 'Invoice'}" class="menu-list-item link">
<router-link v-if="canShowSubscriptionSettings" replace :to="{name: 'Invoice'}" class="menu-list-item link">
<div class="icon">
<file-text-icon size="17"></file-text-icon>
</div>
@@ -143,6 +143,9 @@
subscriptionColor() {
return this.user.data.attributes.subscription ? 'green' : 'purple'
},
canShowSubscriptionSettings() {
return this.config.isSaaS && this.user.data.attributes.stripe_customer
}
},
data() {
return {

View File

@@ -383,8 +383,12 @@
},
},
mounted: function () {
card = elements.create('card');
card.mount(this.$refs.stripeCard);
if (!this.requestedPlan) {
this.$router.push({name: 'UpgradePlan'})
} else {
card = elements.create('card');
card.mount(this.$refs.stripeCard);
}
},
created() {
@@ -395,10 +399,6 @@
axios.get('/api/user/payments')
.then(response => {
if (!this.requestedPlan) {
this.$router.push({name: 'UpgradePlan'})
}
this.defaultPaymentCard = response.data.default
this.paymentCards = response.data.others

View File

@@ -1,22 +1,22 @@
<template>
<PageTab v-if="invoices">
<PageTabGroup v-if="invoices.length > 0">
<PageTab :is-loading="isLoading">
<PageTabGroup v-if="invoices && invoices.length > 0">
<DatatableWrapper :paginator="true" :columns="columns" :data="invoices" class="table">
<template scope="{ row }">
<tr>
<td>
<a :href="'/invoice/' + row.data.attributes.token" target="_blank" class="cell-item">
<a :href="'/invoice/' + row.data.attributes.customer + '/' + row.data.id" target="_blank" class="cell-item">
{{ row.data.attributes.order }}
</a>
</td>
<td>
<span class="cell-item">
${{ row.data.attributes.total }}
{{ row.data.attributes.total }}
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.bag[0].description }}
{{ row.data.attributes.bag.description }}
</span>
</td>
<td>
@@ -26,7 +26,7 @@
</td>
<td>
<div class="action-icons">
<a :href="'/invoice/' + row.data.attributes.token" target="_blank">
<a :href="'/invoice/' + row.data.attributes.customer + '/' + row.data.id" target="_blank">
<external-link-icon size="15" class="icon"></external-link-icon>
</a>
</div>

View File

@@ -34,7 +34,7 @@
<ul class="list">
<li class="list-item">
<b>Date:</b>
<span>{{ $invoice->created_at }}</span>
<span>{{ format_date($invoice->date()) }}</span>
</li>
<li class="list-item">
<b>Product:</b>
@@ -42,7 +42,7 @@
</li>
<li class="list-item">
<b>Invoice Number:</b>
<span>{{ $invoice->order }}</span>
<span>{{ $invoice->number }}</span>
</li>
</ul>
</section>
@@ -113,53 +113,53 @@
<h2 class="partner-title">Client:</h2>
<ul class="list">
@isset($invoice->client['billing_name'])
@isset($invoice->customer_name)
<li class="list-item">
<b>Name:</b>
<span>{{ $invoice->client['billing_name'] }}</span>
<span>{{ $invoice->customer_name }}</span>
</li>
@endisset
@isset($invoice->client['billing_phone_number'])
@isset($invoice->customer_phone)
<li class="list-item">
<b>Phone:</b>
<span>{{ $invoice->client['billing_phone_number'] }}</span>
<span>{{ $invoice->customer_phone }}</span>
</li>
@endisset
</ul>
<ul class="list">
@isset($invoice->client['billing_address'])
@isset($invoice->customer_address['line1'])
<li class="list-item">
<b>Address:</b>
<span>{{ $invoice->client['billing_address'] }}</span>
<span>{{ $invoice->customer_address['line1'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_city'])
@isset($invoice->customer_address['city'])
<li class="list-item">
<b>City:</b>
<span>{{ $invoice->client['billing_city'] }}</span>
<span>{{ $invoice->customer_address['city'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_state'])
@isset($invoice->customer_address['state'])
<li class="list-item">
<b>State:</b>
<span>{{ $invoice->client['billing_state'] }}</span>
<span>{{ $invoice->customer_address['state'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_postal_code'])
@isset($invoice->customer_address['postal_code'])
<li class="list-item">
<b>Postal code:</b>
<span>{{ $invoice->client['billing_postal_code'] }}</span>
<span>{{ $invoice->customer_address['postal_code'] }}</span>
</li>
@endisset
@isset($invoice->client['billing_country'])
@isset($invoice->customer_address['country'])
<li class="list-item">
<b>Country:</b>
<span>{{ $invoice->client['billing_country'] }}</span>
<span>{{ $invoice->customer_address['country'] }}</span>
</li>
@endisset
</ul>
@@ -175,18 +175,16 @@
</tr>
</thead>
<tbody class="table-body">
@foreach($invoice->bag as $item)
<tr>
<td>{{ $item['description'] }} (1)</td>
<td>{{ $item['date'] }}</td>
<td>{{ $item['amount'] }} {{ $invoice->currency }}</td>
<td>{{ $invoice->subscriptions()[0]->description }}</td>
<td>{{ $invoice->subscriptions()[0]->type }}</td>
<td>{{ \Laravel\Cashier\Cashier::formatAmount($invoice->subscriptions()[0]->amount) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="invoice-summary">
<b>Total {{ $invoice->total }} {{ $invoice->currency }}</b>
<b>Total {{ $invoice->total() }}</b>
</div>
</div>
</body>

View File

@@ -62,9 +62,9 @@ Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], func
Route::get('/user', 'User\AccountController@user');
// Payment cards
Route::delete('/user/payment-cards/{id}', 'User\PaymentCardsController@delete');
Route::patch('/user/payment-cards/{id}', 'User\PaymentCardsController@update');
Route::get('/user/payments', 'User\PaymentCardsController@payment_methods');
Route::delete('/user/payment-cards/{id}', 'User\PaymentMethodsController@delete');
Route::patch('/user/payment-cards/{id}', 'User\PaymentMethodsController@update');
Route::get('/user/payments', 'User\PaymentMethodsController@index');
// Subscription
Route::get('/stripe/setup-intent', 'User\SubscriptionController@stripe_setup_intent');
@@ -103,35 +103,36 @@ Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], func
Route::group(['middleware' => ['auth:api', 'auth.master', 'auth.admin', 'scope:master']], function () {
// Get users info
Route::get('/users/{id}/subscription', 'Admin\UserController@subscription');
Route::get('/users/{id}/storage', 'Admin\UserController@storage');
Route::get('/users/{id}/detail', 'Admin\UserController@details');
Route::get('/users/{id}/subscription', 'Admin\UserController@subscription');
Route::get('/users', 'Admin\UserController@users');
// Edit users
Route::post('/users/create', 'Admin\UserController@create_user');
Route::get('/users/{id}/invoices', 'Admin\UserController@invoices');
Route::patch('/users/{id}/role', 'Admin\UserController@change_role');
Route::delete('/users/{id}/delete', 'Admin\UserController@delete_user');
Route::patch('/users/{id}/capacity', 'Admin\UserController@change_storage_capacity');
Route::post('/users/{id}/send-password-email', 'Admin\UserController@send_password_reset_email');
Route::patch('/users/{id}/capacity', 'Admin\UserController@change_storage_capacity');
Route::delete('/users/{id}/delete', 'Admin\UserController@delete_user');
Route::patch('/users/{id}/role', 'Admin\UserController@change_role');
Route::get('/users/{id}/invoices', 'Admin\UserController@invoices');
Route::post('/users/create', 'Admin\UserController@create_user');
// Gateways
Route::get('/gateways', 'Admin\GatewayController@index');
Route::get('/gateways/{type}', 'Admin\GatewayController@show');
Route::patch('/gateways/{type}', 'Admin\GatewayController@update');
Route::get('/gateways/{type}/transactions', 'Admin\GatewayController@show_transactions');
Route::patch('/gateways/{type}', 'Admin\GatewayController@update');
Route::get('/gateways/{type}', 'Admin\GatewayController@show');
Route::get('/gateways', 'Admin\GatewayController@index');
// Plans
Route::get('/plans', 'Admin\PlanController@index');
Route::get('/plans/{id}', 'Admin\PlanController@show');
Route::post('/plans/store', 'Admin\PlanController@store');
Route::patch('/plans/{id}/update', 'Admin\PlanController@update');
Route::get('/plans/{id}/subscribers', 'Admin\PlanController@subscribers');
Route::patch('/plans/{id}/update', 'Admin\PlanController@update');
Route::delete('/plans/{id}', 'Admin\PlanController@delete');
Route::post('/plans/store', 'Admin\PlanController@store');
Route::get('/plans/{id}', 'Admin\PlanController@show');
Route::get('/plans', 'Admin\PlanController@index');
// Invoices
Route::get('/invoices', 'Admin\InvoiceController@index');
Route::get('/invoices/{token}', 'Admin\InvoiceController@show');
Route::get('/invoices', 'Admin\InvoiceController@index');
});
// Protected sharing routes for authenticated user

View File

@@ -14,13 +14,6 @@
use App\User;
use Rinvex\Subscriptions\Models\PlanFeature;
Route::get('/debug', function () {
$user = User::find(1);
return $user->subscription('main')->asStripeSubscription();
});
// Deployment Webhook URL
Route::post('/deploy/github', 'DeployController@github');
@@ -36,7 +29,7 @@ Route::group(['middleware' => ['auth:api', 'auth.shared', 'auth.master', 'scope:
});
Route::group(['middleware' => ['auth:api', 'auth.master', 'scope:master']], function () {
Route::get('/invoice/{token}', 'Admin\InvoiceController@show');
Route::get('/invoice/{customer}/{token}', 'Admin\InvoiceController@show');
});
// Pages