mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 20:18:33 -05:00 
			
		
		
		
	Merge pull request #8237 from turbo124/v5-develop
Refactor for Observers
This commit is contained in:
		
						commit
						4c12e023e4
					
				@ -33,7 +33,6 @@ use PDOException;
 | 
				
			|||||||
use Sentry\Laravel\Integration;
 | 
					use Sentry\Laravel\Integration;
 | 
				
			||||||
use Sentry\State\Scope;
 | 
					use Sentry\State\Scope;
 | 
				
			||||||
use Symfony\Component\Console\Exception\CommandNotFoundException;
 | 
					use Symfony\Component\Console\Exception\CommandNotFoundException;
 | 
				
			||||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
 | 
					 | 
				
			||||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
 | 
					use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
 | 
				
			||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 | 
					use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 | 
				
			||||||
use League\Flysystem\UnableToCreateDirectory;
 | 
					use League\Flysystem\UnableToCreateDirectory;
 | 
				
			||||||
@ -222,7 +221,7 @@ class Handler extends ExceptionHandler
 | 
				
			|||||||
            return response()->json(['message'=>'Too many requests'], 429);
 | 
					            return response()->json(['message'=>'Too many requests'], 429);
 | 
				
			||||||
        // } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
 | 
					        // } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) {
 | 
				
			||||||
        //     return response()->json(['message'=>'Fatal error'], 500); //@deprecated
 | 
					        //     return response()->json(['message'=>'Fatal error'], 500); //@deprecated
 | 
				
			||||||
        } elseif ($exception instanceof AuthorizationException) {
 | 
					        } elseif ($exception instanceof AuthorizationException && $request->expectsJson()) {
 | 
				
			||||||
            return response()->json(['message'=> $exception->getMessage()], 401);
 | 
					            return response()->json(['message'=> $exception->getMessage()], 401);
 | 
				
			||||||
        } elseif ($exception instanceof TokenMismatchException) {
 | 
					        } elseif ($exception instanceof TokenMismatchException) {
 | 
				
			||||||
            return redirect()
 | 
					            return redirect()
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										33
									
								
								app/Exceptions/Ninja/ClientPortalAuthorizationException.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								app/Exceptions/Ninja/ClientPortalAuthorizationException.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace App\Exceptions\Ninja;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Exception;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ClientPortalAuthorizationException extends Exception
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public function report()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // ..
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function render($request)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return view('errors.client-error', [
 | 
				
			||||||
 | 
					            'account' => auth()->guard('contact')->check() ? auth()->guard('contact')->user()->user->account : false,
 | 
				
			||||||
 | 
					            'company' => auth()->guard('contact')->check() ? auth()->guard('contact')->user()->company : false,
 | 
				
			||||||
 | 
					            'title' => ctrans('texts.error_title'),
 | 
				
			||||||
 | 
					            'message' => $this->getMessage(),
 | 
				
			||||||
 | 
					            'code' => $this->getCode(),
 | 
				
			||||||
 | 
					        ]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -73,7 +73,6 @@ class GmailTransport extends AbstractTransport
 | 
				
			|||||||
            /* Need to slow down */
 | 
					            /* Need to slow down */
 | 
				
			||||||
            if($e->getCode() == '429') {
 | 
					            if($e->getCode() == '429') {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                sleep(rand(5,10));
 | 
					 | 
				
			||||||
                nlog("429 google - retrying ");
 | 
					                nlog("429 google - retrying ");
 | 
				
			||||||
                $service->users_messages->send('me', $body, []);
 | 
					                $service->users_messages->send('me', $body, []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -859,7 +859,7 @@ class BaseController extends Controller
 | 
				
			|||||||
                'company.bank_transactions'=> function ($query) use ($created_at, $user) {
 | 
					                'company.bank_transactions'=> function ($query) use ($created_at, $user) {
 | 
				
			||||||
                    $query->where('created_at', '>=', $created_at);
 | 
					                    $query->where('created_at', '>=', $created_at);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if (! $user->hasPermission('bank_transactions')) {
 | 
					                    if (! $user->hasPermission('bank_transaction')) {
 | 
				
			||||||
                        $query->where('bank_transactions.user_id', $user->id);
 | 
					                        $query->where('bank_transactions.user_id', $user->id);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
 | 
				
			|||||||
@ -55,4 +55,9 @@ class SubscriptionPlanSwitchController extends Controller
 | 
				
			|||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function not_availabe()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        abort(404, 'ewwo');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -277,6 +277,8 @@ class ExpenseController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new ExpenseWasUpdated($expense, $expense->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new ExpenseWasUpdated($expense, $expense->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.updated: App\Models\Expense', $expense);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($expense->fresh());
 | 
					        return $this->itemResponse($expense->fresh());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -369,6 +371,8 @@ class ExpenseController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new ExpenseWasCreated($expense, $expense->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new ExpenseWasCreated($expense, $expense->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.created: App\Models\Expense', $expense);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($expense);
 | 
					        return $this->itemResponse($expense);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -422,16 +422,6 @@ class InvoiceController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // $transaction = [
 | 
					 | 
				
			||||||
        //     'invoice' => $invoice->transaction_event(),
 | 
					 | 
				
			||||||
        //     'payment' => [],
 | 
					 | 
				
			||||||
        //     'client' => $invoice->client->transaction_event(),
 | 
					 | 
				
			||||||
        //     'credit' => [],
 | 
					 | 
				
			||||||
        //     'metadata' => [],
 | 
					 | 
				
			||||||
        // ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // TransactionLog::dispatch(TransactionEvent::INVOICE_UPDATED, $transaction, $invoice->company->db);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this->itemResponse($invoice);
 | 
					        return $this->itemResponse($invoice);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -205,6 +205,8 @@ class PaymentController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $payment = $this->payment_repo->save($request->all(), PaymentFactory::create(auth()->user()->company()->id, auth()->user()->id));
 | 
					        $payment = $this->payment_repo->save($request->all(), PaymentFactory::create(auth()->user()->company()->id, auth()->user()->id));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.created: App\Models\Payment', $payment);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($payment);
 | 
					        return $this->itemResponse($payment);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -378,6 +380,8 @@ class PaymentController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new PaymentWasUpdated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new PaymentWasUpdated($payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.updated: App\Models\Payment', $payment);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($payment);
 | 
					        return $this->itemResponse($payment);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -262,12 +262,14 @@ class ProjectController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $project->fill($request->all());
 | 
					        $project->fill($request->all());
 | 
				
			||||||
        $project->number = empty($project->number) ? $this->getNextProjectNumber($project) : $project->number;
 | 
					        $project->number = empty($project->number) ? $this->getNextProjectNumber($project) : $project->number;
 | 
				
			||||||
        $project->save();
 | 
					        $project->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($request->has('documents')) {
 | 
					        if ($request->has('documents')) {
 | 
				
			||||||
            $this->saveDocuments($request->input('documents'), $project);
 | 
					            $this->saveDocuments($request->input('documents'), $project);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.updated: App\Models\Project', $project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($project->fresh());
 | 
					        return $this->itemResponse($project->fresh());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -358,17 +360,19 @@ class ProjectController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $project = ProjectFactory::create(auth()->user()->company()->id, auth()->user()->id);
 | 
					        $project = ProjectFactory::create(auth()->user()->company()->id, auth()->user()->id);
 | 
				
			||||||
        $project->fill($request->all());
 | 
					        $project->fill($request->all());
 | 
				
			||||||
        $project->save();
 | 
					        $project->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (empty($project->number)) {
 | 
					        if (empty($project->number)) {
 | 
				
			||||||
            $project->number = $this->getNextProjectNumber($project);
 | 
					            $project->number = $this->getNextProjectNumber($project);
 | 
				
			||||||
            $project->save();
 | 
					            $project->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($request->has('documents')) {
 | 
					        if ($request->has('documents')) {
 | 
				
			||||||
            $this->saveDocuments($request->input('documents'), $project);
 | 
					            $this->saveDocuments($request->input('documents'), $project);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.created: App\Models\Project', $project);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($project->fresh());
 | 
					        return $this->itemResponse($project->fresh());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -283,6 +283,8 @@ class TaskController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new TaskWasUpdated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new TaskWasUpdated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.updated: App\Models\Task', $task);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($task->fresh());
 | 
					        return $this->itemResponse($task->fresh());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -376,6 +378,9 @@ class TaskController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new TaskWasCreated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new TaskWasCreated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.created: App\Models\Task', $task);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($task);
 | 
					        return $this->itemResponse($task);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -276,6 +276,8 @@ class VendorController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new VendorWasUpdated($vendor, $vendor->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new VendorWasUpdated($vendor, $vendor->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.updated: App\Models\Vendor', $vendor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($vendor->fresh());
 | 
					        return $this->itemResponse($vendor->fresh());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -372,6 +374,8 @@ class VendorController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        event(new VendorWasCreated($vendor, $vendor->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					        event(new VendorWasCreated($vendor, $vendor->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        event('eloquent.created: App\Models\Vendor', $vendor);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->itemResponse($vendor);
 | 
					        return $this->itemResponse($vendor);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +1,21 @@
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * Invoice Ninja (https://invoiceninja.com).
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @license https://www.elastic.co/licensing/elastic-license
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace App\Http\Requests\ClientPortal\Subscriptions;
 | 
					namespace App\Http\Requests\ClientPortal\Subscriptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Subscription;
 | 
					use App\Exceptions\Ninja\ClientPortalAuthorizationException;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Http\FormRequest;
 | 
					use Illuminate\Foundation\Http\FormRequest;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ShowPlanSwitchRequest extends FormRequest
 | 
					class ShowPlanSwitchRequest extends FormRequest
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    use MakesHash;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Determine if the user is authorized to make this request.
 | 
					     * Determine if the user is authorized to make this request.
 | 
				
			||||||
@ -31,4 +38,11 @@ class ShowPlanSwitchRequest extends FormRequest
 | 
				
			|||||||
            //
 | 
					            //
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    protected function failedAuthorization()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        throw new ClientPortalAuthorizationException('Unable to change plans due to a restriction on this product.', 400);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -160,9 +160,5 @@ class AdjustProductInventory implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // $nmo->to_user = $this->company->owner();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // NinjaMailerJob::dispatch($nmo);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -75,7 +75,7 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function backoff()
 | 
					    public function backoff()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return [30, 60, 180, 240];
 | 
					        return [5, 10, 30, 240];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function handle()
 | 
					    public function handle()
 | 
				
			||||||
@ -176,21 +176,25 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
             * this merges a text string with a json object
 | 
					             * this merges a text string with a json object
 | 
				
			||||||
             * need to harvest the ->Message property using the following
 | 
					             * need to harvest the ->Message property using the following
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
            if($e instanceof ClientException) 
 | 
					            if(stripos($e->getMessage(), 'code 406') || stripos($e->getMessage(), 'code 300')) 
 | 
				
			||||||
            { 
 | 
					            { 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                $response = $e->getResponse();
 | 
					                $message = "Either Attachment too large, or recipient has been suppressed.";
 | 
				
			||||||
                $message_body = json_decode($response->getBody()->getContents());
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if($message_body && property_exists($message_body, 'Message')){
 | 
					 | 
				
			||||||
                    $message = $message_body->Message;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
                /*Do not retry if this is a postmark specific issue such as invalid recipient. */
 | 
					 | 
				
			||||||
                $this->fail();
 | 
					                $this->fail();
 | 
				
			||||||
                $this->cleanUpMailers();
 | 
					                $this->cleanUpMailers();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                // $response = $e->getResponse();
 | 
				
			||||||
 | 
					                // $message_body = json_decode($response->getBody()->getContents());
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                // if($message_body && property_exists($message_body, 'Message')){
 | 
				
			||||||
 | 
					                //     $message = $message_body->Message;
 | 
				
			||||||
 | 
					                // }
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
 | 
					                /*Do not retry if this is a postmark specific issue such as invalid recipient. */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //only report once, not on all tries
 | 
					            //only report once, not on all tries
 | 
				
			||||||
@ -445,7 +449,6 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
                $message->getHeaders()->addTextHeader('gmailtoken', $token);     
 | 
					                $message->getHeaders()->addTextHeader('gmailtoken', $token);     
 | 
				
			||||||
             });
 | 
					             });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        sleep(rand(1,3));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -472,7 +475,6 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
 | 
					            $google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            sleep(rand(1,6));
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch(\Exception $e) {
 | 
					        catch(\Exception $e) {
 | 
				
			||||||
            $this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
 | 
					            $this->logMailError('Gmail Token Invalid', $this->company->clients()->first());
 | 
				
			||||||
@ -649,8 +651,9 @@ class NinjaMailerJob implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function failed($exception = null)
 | 
					    public function failed($exception = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if($exception)
 | 
					
 | 
				
			||||||
            nlog($exception->getMessage());
 | 
					        config(['queue.failed.driver' => null]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -131,7 +131,7 @@ class UpdateOrCreateProduct implements ShouldQueue
 | 
				
			|||||||
            $product->company_id = $this->invoice->company_id;
 | 
					            $product->company_id = $this->invoice->company_id;
 | 
				
			||||||
            $product->project_id = $this->invoice->project_id;
 | 
					            $product->project_id = $this->invoice->project_id;
 | 
				
			||||||
            $product->vendor_id = $this->invoice->vendor_id;
 | 
					            $product->vendor_id = $this->invoice->vendor_id;
 | 
				
			||||||
            $product->save();
 | 
					            $product->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -68,8 +68,6 @@ class WebhookHandler implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function failed($exception = null)
 | 
					    public function failed($exception = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if($exception)
 | 
					 | 
				
			||||||
            nlog(print_r($exception->getMessage(), 1));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -15,11 +15,15 @@ use App\Jobs\Util\SystemLogger;
 | 
				
			|||||||
use App\Libraries\MultiDB;
 | 
					use App\Libraries\MultiDB;
 | 
				
			||||||
use App\Models\Client as ClientModel;
 | 
					use App\Models\Client as ClientModel;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
 | 
					use App\Models\Product;
 | 
				
			||||||
use App\Models\SystemLog;
 | 
					use App\Models\SystemLog;
 | 
				
			||||||
 | 
					use App\Models\Vendor;
 | 
				
			||||||
use App\Models\Webhook;
 | 
					use App\Models\Webhook;
 | 
				
			||||||
use App\Transformers\ArraySerializer;
 | 
					use App\Transformers\ArraySerializer;
 | 
				
			||||||
use GuzzleHttp\Client;
 | 
					use GuzzleHttp\Client;
 | 
				
			||||||
use GuzzleHttp\Exception\BadResponseException;
 | 
					use GuzzleHttp\Exception\BadResponseException;
 | 
				
			||||||
 | 
					use GuzzleHttp\Exception\ClientException;
 | 
				
			||||||
 | 
					use GuzzleHttp\Exception\ServerException;
 | 
				
			||||||
use GuzzleHttp\RequestOptions;
 | 
					use GuzzleHttp\RequestOptions;
 | 
				
			||||||
use Illuminate\Bus\Queueable;
 | 
					use Illuminate\Bus\Queueable;
 | 
				
			||||||
use Illuminate\Contracts\Queue\ShouldQueue;
 | 
					use Illuminate\Contracts\Queue\ShouldQueue;
 | 
				
			||||||
@ -28,8 +32,6 @@ use Illuminate\Queue\InteractsWithQueue;
 | 
				
			|||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
use League\Fractal\Manager;
 | 
					use League\Fractal\Manager;
 | 
				
			||||||
use League\Fractal\Resource\Item;
 | 
					use League\Fractal\Resource\Item;
 | 
				
			||||||
use GuzzleHttp\Exception\ClientException;
 | 
					 | 
				
			||||||
use GuzzleHttp\Exception\ServerException;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WebhookSingle implements ShouldQueue
 | 
					class WebhookSingle implements ShouldQueue
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -79,8 +81,14 @@ class WebhookSingle implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $subscription = Webhook::with('company')->find($this->subscription_id);
 | 
					        $subscription = Webhook::with('company')->find($this->subscription_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if($subscription)
 | 
				
			||||||
 | 
					            nlog("firing event ID {$subscription->event_id}");
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        if(!$subscription){
 | 
					        if(!$subscription){
 | 
				
			||||||
            $this->fail();
 | 
					            $this->fail();
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            nlog("failed to fire event, could not find webhook ID {$this->subscription_id}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -235,19 +243,27 @@ class WebhookSingle implements ShouldQueue
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function resolveClient()
 | 
					    private function resolveClient()
 | 
				
			||||||
    {
 | 
					    {   nlog(get_class($this->entity));
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        //make sure it isn't an instance of the Client Model
 | 
					        //make sure it isn't an instance of the Client Model
 | 
				
			||||||
        if ((! $this->entity instanceof ClientModel) && $this->entity->client()->exists()) {
 | 
					        if (!$this->entity instanceof \App\Models\Client && 
 | 
				
			||||||
 | 
					            !$this->entity instanceof \App\Models\Vendor && 
 | 
				
			||||||
 | 
					            !$this->entity instanceof \App\Models\Product && 
 | 
				
			||||||
 | 
					            !$this->entity instanceof \App\Models\PurchaseOrder &&
 | 
				
			||||||
 | 
					            $this->entity->client()->exists()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return $this->entity->client;
 | 
					            return $this->entity->client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        return $this->company->clients()->first();
 | 
					
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function failed($exception = null)
 | 
					    public function failed($exception = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if($exception)
 | 
					        
 | 
				
			||||||
            nlog($exception->getMessage());
 | 
					        config(['queue.failed.driver' => null]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -52,6 +52,5 @@ class RestoreClientActivity implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $this->activity_repo->save($fields, $event->client, $event->event_vars);
 | 
					        $this->activity_repo->save($fields, $event->client, $event->event_vars);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -38,21 +38,18 @@ class CreateInvoicePdf implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if (isset($event->invoice)) {
 | 
					        if (isset($event->invoice)) {
 | 
				
			||||||
            $event->invoice->invitations->each(function ($invitation) {
 | 
					            $event->invoice->invitations->each(function ($invitation) {
 | 
				
			||||||
                // CreateEntityPdf::dispatch($invitation->load('invoice', 'contact.client.company'));
 | 
					 | 
				
			||||||
                (new CreateEntityPdf($invitation->load('invoice', 'contact.client.company')))->handle();
 | 
					                (new CreateEntityPdf($invitation->load('invoice', 'contact.client.company')))->handle();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($event->quote)) {
 | 
					        if (isset($event->quote)) {
 | 
				
			||||||
            $event->quote->invitations->each(function ($invitation) {
 | 
					            $event->quote->invitations->each(function ($invitation) {
 | 
				
			||||||
                // CreateEntityPdf::dispatch($invitation->load('quote', 'contact.client.company'));
 | 
					 | 
				
			||||||
                (new CreateEntityPdf($invitation->load('quote', 'contact.client.company')))->handle();
 | 
					                (new CreateEntityPdf($invitation->load('quote', 'contact.client.company')))->handle();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($event->credit)) {
 | 
					        if (isset($event->credit)) {
 | 
				
			||||||
            $event->credit->invitations->each(function ($invitation) {
 | 
					            $event->credit->invitations->each(function ($invitation) {
 | 
				
			||||||
//                CreateEntityPdf::dispatch($invitation->load('credit', 'contact.client.company'));
 | 
					 | 
				
			||||||
                (new CreateEntityPdf($invitation->load('credit', 'contact.client.company')))->handle();
 | 
					                (new CreateEntityPdf($invitation->load('credit', 'contact.client.company')))->handle();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
				
			|||||||
@ -249,18 +249,18 @@ class Credit extends BaseModel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if ($this->balance == 0) {
 | 
					        if ($this->balance == 0) {
 | 
				
			||||||
            $this->status_id = self::STATUS_APPLIED;
 | 
					            $this->status_id = self::STATUS_APPLIED;
 | 
				
			||||||
            $this->save();
 | 
					            $this->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->save();
 | 
					        $this->saveQuietly();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function setStatus($status)
 | 
					    public function setStatus($status)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->status_id = $status;
 | 
					        $this->status_id = $status;
 | 
				
			||||||
        $this->save();
 | 
					        $this->saveQuietly();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false)
 | 
					    public function pdf_file_path($invitation = null, string $type = 'path', bool $portal = false)
 | 
				
			||||||
@ -313,7 +313,7 @@ class Credit extends BaseModel
 | 
				
			|||||||
        $this->invitations->each(function ($invitation) {
 | 
					        $this->invitations->each(function ($invitation) {
 | 
				
			||||||
            if (! isset($invitation->sent_date)) {
 | 
					            if (! isset($invitation->sent_date)) {
 | 
				
			||||||
                $invitation->sent_date = Carbon::now();
 | 
					                $invitation->sent_date = Carbon::now();
 | 
				
			||||||
                $invitation->save();
 | 
					                $invitation->saveQuietly();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -141,6 +141,10 @@ class PurchaseOrder extends BaseModel
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public function getEntityType()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return self::class;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function assigned_user()
 | 
					    public function assigned_user()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -186,7 +190,7 @@ class PurchaseOrder extends BaseModel
 | 
				
			|||||||
        $this->invitations->each(function ($invitation) {
 | 
					        $this->invitations->each(function ($invitation) {
 | 
				
			||||||
            if (! isset($invitation->sent_date)) {
 | 
					            if (! isset($invitation->sent_date)) {
 | 
				
			||||||
                $invitation->sent_date = Carbon::now();
 | 
					                $invitation->sent_date = Carbon::now();
 | 
				
			||||||
                $invitation->save();
 | 
					                $invitation->saveQuietly();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -212,7 +212,7 @@ class Quote extends BaseModel
 | 
				
			|||||||
        $this->invitations->each(function ($invitation) {
 | 
					        $this->invitations->each(function ($invitation) {
 | 
				
			||||||
            if (! isset($invitation->sent_date)) {
 | 
					            if (! isset($invitation->sent_date)) {
 | 
				
			||||||
                $invitation->sent_date = Carbon::now();
 | 
					                $invitation->sent_date = Carbon::now();
 | 
				
			||||||
                $invitation->save();
 | 
					                $invitation->saveQuietly();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -367,22 +367,41 @@ class User extends Authenticatable implements MustVerifyEmail
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function hasPermission($permission) : bool
 | 
					    public function hasPermission($permission) : bool
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $parts = explode('_', $permission);
 | 
					 | 
				
			||||||
        $all_permission = '____';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					       /**
 | 
				
			||||||
 | 
					        * We use the limit parameter here to ensure we don't split on permissions that have multiple underscores.
 | 
				
			||||||
 | 
					        *
 | 
				
			||||||
 | 
					        * For example view_recurring_invoice without the limit would split to view bank recurring invoice
 | 
				
			||||||
 | 
					        *
 | 
				
			||||||
 | 
					        * Using only part 0 and 1 would search for permission view_recurring / edit_recurring so this would
 | 
				
			||||||
 | 
					        * leak permissions for other recurring_* entities
 | 
				
			||||||
 | 
					        *
 | 
				
			||||||
 | 
					        * The solution here will split the word - consistently - into view _ {entity} and edit _ {entity}
 | 
				
			||||||
 | 
					        * 
 | 
				
			||||||
 | 
					        */
 | 
				
			||||||
 | 
					        $parts = explode('_', $permission, 2);
 | 
				
			||||||
 | 
					        $all_permission = '____';
 | 
				
			||||||
 | 
					        $edit_all = '____';
 | 
				
			||||||
 | 
					        $edit_entity = '____';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* If we have multiple parts, then make sure we search for the _all permission */
 | 
				
			||||||
        if (count($parts) > 1) {
 | 
					        if (count($parts) > 1) {
 | 
				
			||||||
            $all_permission = $parts[0].'_all';
 | 
					            $all_permission = $parts[0].'_all';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            /*If this is a view search, make sure we add in the edit_{entity} AND edit_all permission into the checks*/
 | 
				
			||||||
 | 
					            if($parts[0] == 'view') {
 | 
				
			||||||
 | 
					                $edit_all = 'edit_all';
 | 
				
			||||||
 | 
					                $edit_entity = "edit_{$parts[1]}";
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return  $this->isOwner() ||
 | 
					        return  $this->isOwner() ||
 | 
				
			||||||
                $this->isAdmin() ||
 | 
					                $this->isAdmin() ||
 | 
				
			||||||
 | 
					                (stripos($this->token()->cu->permissions, $permission) !== false) ||
 | 
				
			||||||
                (stripos($this->token()->cu->permissions, $all_permission) !== false) ||
 | 
					                (stripos($this->token()->cu->permissions, $all_permission) !== false) ||
 | 
				
			||||||
                (stripos($this->token()->cu->permissions, $permission) !== false);
 | 
					                (stripos($this->token()->cu->permissions, $edit_all) !== false) ||
 | 
				
			||||||
 | 
					                (stripos($this->token()->cu->permissions, $edit_entity) !== false);
 | 
				
			||||||
        // return  $this->isOwner() ||
 | 
					 | 
				
			||||||
        //         $this->isAdmin() ||
 | 
					 | 
				
			||||||
        //         (is_int(stripos($this->token()->cu->permissions, $all_permission))) ||
 | 
					 | 
				
			||||||
        //         (is_int(stripos($this->token()->cu->permissions, $permission)));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -18,47 +18,47 @@ class Webhook extends BaseModel
 | 
				
			|||||||
    use SoftDeletes;
 | 
					    use SoftDeletes;
 | 
				
			||||||
    use Filterable;
 | 
					    use Filterable;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_CLIENT = 1;
 | 
					    const EVENT_CREATE_CLIENT = 1; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_INVOICE = 2;
 | 
					    const EVENT_CREATE_INVOICE = 2; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_QUOTE = 3;
 | 
					    const EVENT_CREATE_QUOTE = 3; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_PAYMENT = 4;
 | 
					    const EVENT_CREATE_PAYMENT = 4; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_VENDOR = 5;
 | 
					    const EVENT_CREATE_VENDOR = 5; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_QUOTE = 6;
 | 
					    const EVENT_UPDATE_QUOTE = 6; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_QUOTE = 7;
 | 
					    const EVENT_DELETE_QUOTE = 7; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_INVOICE = 8;
 | 
					    const EVENT_UPDATE_INVOICE = 8; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_INVOICE = 9;
 | 
					    const EVENT_DELETE_INVOICE = 9; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_CLIENT = 10;
 | 
					    const EVENT_UPDATE_CLIENT = 10; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_CLIENT = 11;
 | 
					    const EVENT_DELETE_CLIENT = 11; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_PAYMENT = 12;
 | 
					    const EVENT_DELETE_PAYMENT = 12; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_VENDOR = 13;
 | 
					    const EVENT_UPDATE_VENDOR = 13; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_VENDOR = 14;
 | 
					    const EVENT_DELETE_VENDOR = 14; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_EXPENSE = 15;
 | 
					    const EVENT_CREATE_EXPENSE = 15; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_EXPENSE = 16;
 | 
					    const EVENT_UPDATE_EXPENSE = 16; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_EXPENSE = 17;
 | 
					    const EVENT_DELETE_EXPENSE = 17; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_TASK = 18;
 | 
					    const EVENT_CREATE_TASK = 18; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_TASK = 19;
 | 
					    const EVENT_UPDATE_TASK = 19; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_TASK = 20;
 | 
					    const EVENT_DELETE_TASK = 20; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_APPROVE_QUOTE = 21;
 | 
					    const EVENT_APPROVE_QUOTE = 21; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_LATE_INVOICE = 22;
 | 
					    const EVENT_LATE_INVOICE = 22;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -66,61 +66,86 @@ class Webhook extends BaseModel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const EVENT_REMIND_INVOICE = 24;
 | 
					    const EVENT_REMIND_INVOICE = 24;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_PROJECT_CREATE = 25;
 | 
					    const EVENT_PROJECT_CREATE = 25; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_PROJECT_UPDATE = 26;
 | 
					    const EVENT_PROJECT_UPDATE = 26; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_CREATE_CREDIT = 27;
 | 
					    const EVENT_CREATE_CREDIT = 27; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_CREDIT = 28;
 | 
					    const EVENT_UPDATE_CREDIT = 28; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_DELETE_CREDIT = 29;
 | 
					    const EVENT_DELETE_CREDIT = 29; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_PROJECT_DELETE = 30;
 | 
					    const EVENT_PROJECT_DELETE = 30; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_UPDATE_PAYMENT = 31;
 | 
					    const EVENT_UPDATE_PAYMENT = 31; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_PAYMENT = 32;
 | 
					    const EVENT_ARCHIVE_PAYMENT = 32; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_INVOICE = 33;
 | 
					    const EVENT_ARCHIVE_INVOICE = 33; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_QUOTE = 34;
 | 
					    const EVENT_ARCHIVE_QUOTE = 34; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_CREDIT = 35;
 | 
					    const EVENT_ARCHIVE_CREDIT = 35; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_TASK = 36;
 | 
					    const EVENT_ARCHIVE_TASK = 36; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_CLIENT = 37;
 | 
					    const EVENT_ARCHIVE_CLIENT = 37; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_PROJECT = 38;
 | 
					    const EVENT_ARCHIVE_PROJECT = 38; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_EXPENSE = 39;
 | 
					    const EVENT_ARCHIVE_EXPENSE = 39;  //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_PAYMENT = 40;
 | 
					    const EVENT_RESTORE_PAYMENT = 40; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_INVOICE = 41;
 | 
					    const EVENT_RESTORE_INVOICE = 41; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_QUOTE = 42;
 | 
					    const EVENT_RESTORE_QUOTE = 42; ///tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_CREDIT = 43;
 | 
					    const EVENT_RESTORE_CREDIT = 43; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_TASK = 44;
 | 
					    const EVENT_RESTORE_TASK = 44; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_CLIENT = 45;
 | 
					    const EVENT_RESTORE_CLIENT = 45; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_PROJECT = 46;
 | 
					    const EVENT_RESTORE_PROJECT = 46; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_EXPENSE = 47;
 | 
					    const EVENT_RESTORE_EXPENSE = 47; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_ARCHIVE_VENDOR = 48;
 | 
					    const EVENT_ARCHIVE_VENDOR = 48; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const EVENT_RESTORE_VENDOR = 49;
 | 
					    const EVENT_RESTORE_VENDOR = 49; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_CREATE_PRODUCT = 50; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_UPDATE_PRODUCT = 51; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_DELETE_PRODUCT = 52; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_RESTORE_PRODUCT = 53; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_ARCHIVE_PRODUCT = 54; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_CREATE_PURCHASE_ORDER = 55; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_UPDATE_PURCHASE_ORDER = 56; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_DELETE_PURCHASE_ORDER = 57; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_RESTORE_PURCHASE_ORDER = 58; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const EVENT_ARCHIVE_PURCHASE_ORDER = 59; //tested
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static $valid_events = [
 | 
					    public static $valid_events = [
 | 
				
			||||||
 | 
					        self::EVENT_CREATE_PURCHASE_ORDER,
 | 
				
			||||||
 | 
					        self::EVENT_UPDATE_PURCHASE_ORDER,
 | 
				
			||||||
 | 
					        self::EVENT_DELETE_PURCHASE_ORDER,
 | 
				
			||||||
 | 
					        self::EVENT_RESTORE_PURCHASE_ORDER,
 | 
				
			||||||
 | 
					        self::EVENT_ARCHIVE_PURCHASE_ORDER,
 | 
				
			||||||
 | 
					        self::EVENT_UPDATE_PRODUCT,
 | 
				
			||||||
 | 
					        self::EVENT_DELETE_PRODUCT,
 | 
				
			||||||
 | 
					        self::EVENT_RESTORE_PRODUCT,
 | 
				
			||||||
 | 
					        self::EVENT_ARCHIVE_PRODUCT,
 | 
				
			||||||
        self::EVENT_CREATE_CLIENT,
 | 
					        self::EVENT_CREATE_CLIENT,
 | 
				
			||||||
        self::EVENT_CREATE_INVOICE,
 | 
					        self::EVENT_CREATE_INVOICE,
 | 
				
			||||||
        self::EVENT_CREATE_QUOTE,
 | 
					        self::EVENT_CREATE_QUOTE,
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,7 @@
 | 
				
			|||||||
namespace App\Observers;
 | 
					namespace App\Observers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
 | 
					use App\Models\CreditInvitation;
 | 
				
			||||||
use App\Models\InvoiceInvitation;
 | 
					use App\Models\InvoiceInvitation;
 | 
				
			||||||
use App\Models\QuoteInvitation;
 | 
					use App\Models\QuoteInvitation;
 | 
				
			||||||
use App\Models\RecurringInvoiceInvitation;
 | 
					use App\Models\RecurringInvoiceInvitation;
 | 
				
			||||||
@ -79,7 +80,12 @@ class ClientContactObserver
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        CreditInvitation::withTrashed()->where('client_contact_id', $client_contact_id)->cursor()->each(function ($invite){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          if($invite->credits()->doesnthave('invitations'))
 | 
				
			||||||
 | 
					            $invite->credit->service()->createInvitations();
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -90,9 +96,6 @@ class ClientContactObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function restored(ClientContact $clientContact)
 | 
					    public function restored(ClientContact $clientContact)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        // $clientContact->invoice_invitations()->restore();
 | 
					 | 
				
			||||||
        // $clientContact->quote_invitations()->restore();
 | 
					 | 
				
			||||||
        // $clientContact->credit_invitations()->restore();
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,6 @@ use App\Models\Webhook;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class ClientObserver
 | 
					class ClientObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					 | 
				
			||||||
    public $afterCommit = true;
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -28,13 +27,13 @@ class ClientObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Client $client)
 | 
					    public function created(Client $client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $client->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $client->company_id)
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_CREATE_CLIENT)
 | 
					                                    ->where('event_id', Webhook::EVENT_CREATE_CLIENT)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_CLIENT, $client, $client->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -46,20 +45,22 @@ class ClientObserver
 | 
				
			|||||||
    public function updated(Client $client)
 | 
					    public function updated(Client $client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        nlog("updated event {$client->id}");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $event = Webhook::EVENT_UPDATE_CLIENT;
 | 
					        $event = Webhook::EVENT_UPDATE_CLIENT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($client->is_deleted)
 | 
					        if($client->getOriginal('deleted_at') && !$client->deleted_at)
 | 
				
			||||||
            $event = Webhook::EVENT_DELETE_CLIENT; //this event works correctly.
 | 
					            $event = Webhook::EVENT_RESTORE_CLIENT;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $client->company->id)
 | 
					        if($client->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_CLIENT; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $client->company_id)
 | 
				
			||||||
                                    ->where('event_id', $event)
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch($event, $client, $client->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch($event, $client, $client->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -74,48 +75,13 @@ class ClientObserver
 | 
				
			|||||||
        if($client->is_deleted)
 | 
					        if($client->is_deleted)
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        nlog("deleted event {$client->id}");
 | 
					        $subscriptions = Webhook::where('company_id', $client->company_id)
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $client->company->id)
 | 
					 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_ARCHIVE_CLIENT)
 | 
					                                    ->where('event_id', Webhook::EVENT_ARCHIVE_CLIENT)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_CLIENT, $client, $client->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_CLIENT, $client, $client->company)->delay(0);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Handle the client "restored" event.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param Client $client
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function restored(Client $client)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        nlog("Restored {$client->id}");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $client->company->id)
 | 
					 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_RESTORE_CLIENT)
 | 
					 | 
				
			||||||
                                    ->exists();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ($subscriptions) {
 | 
					 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_RESTORE_CLIENT, $client, $client->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * Handle the client "force deleted" event.
 | 
					 | 
				
			||||||
     *
 | 
					 | 
				
			||||||
     * @param Client $client
 | 
					 | 
				
			||||||
     * @return void
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public function forceDeleted(Client $client)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        //
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -19,6 +19,9 @@ use App\Models\Webhook;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class CreditObserver
 | 
					class CreditObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the client "created" event.
 | 
					     * Handle the client "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -27,12 +30,12 @@ class CreditObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Credit $credit)
 | 
					    public function created(Credit $credit)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $credit->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $credit->company_id)
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_CREATE_CREDIT)
 | 
					                                    ->where('event_id', Webhook::EVENT_CREATE_CREDIT)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) {
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_CREDIT, $credit, $credit->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_CREDIT, $credit, $credit->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -44,13 +47,21 @@ class CreditObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Credit $credit)
 | 
					    public function updated(Credit $credit)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $credit->company->id)
 | 
					        $event = Webhook::EVENT_UPDATE_CREDIT;
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_UPDATE_CREDIT)
 | 
					
 | 
				
			||||||
 | 
					        if($credit->getOriginal('deleted_at') && !$credit->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_CREDIT;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($credit->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_CREDIT; 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $credit->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_CREDIT, $credit, $credit->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch($event, $credit, $credit->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -61,13 +72,16 @@ class CreditObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Credit $credit)
 | 
					    public function deleted(Credit $credit)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $credit->company->id)
 | 
					        if($credit->is_deleted)
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_DELETE_CREDIT)
 | 
					            return;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $credit->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', Webhook::EVENT_ARCHIVE_CREDIT)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_CREDIT, $credit, $credit->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_CREDIT, $credit, $credit->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,8 @@ use App\Models\Webhook;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class ExpenseObserver
 | 
					class ExpenseObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the expense "created" event.
 | 
					     * Handle the expense "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -25,13 +27,13 @@ class ExpenseObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Expense $expense)
 | 
					    public function created(Expense $expense)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $expense->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $expense->company_id)
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_CREATE_EXPENSE)
 | 
					                            ->where('event_id', Webhook::EVENT_CREATE_EXPENSE)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_EXPENSE, $expense, $expense->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_EXPENSE, $expense, $expense->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -42,13 +44,22 @@ class ExpenseObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Expense $expense)
 | 
					    public function updated(Expense $expense)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $expense->company->id)
 | 
					        $event = Webhook::EVENT_UPDATE_EXPENSE;
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_UPDATE_EXPENSE)
 | 
					
 | 
				
			||||||
                            ->exists();
 | 
					        if($expense->getOriginal('deleted_at') && !$expense->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_EXPENSE;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($expense->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_EXPENSE; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $expense->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $expense, $expense->company)->delay(0);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if ($subscriptions) {
 | 
					 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_EXPENSE, $expense, $expense->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -59,13 +70,16 @@ class ExpenseObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Expense $expense)
 | 
					    public function deleted(Expense $expense)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $expense->company->id)
 | 
					        if($expense->is_deleted)
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_DELETE_EXPENSE)
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $expense->company_id)
 | 
				
			||||||
 | 
					                            ->where('event_id', Webhook::EVENT_ARCHIVE_EXPENSE)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_EXPENSE, $expense, $expense->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_EXPENSE, $expense, $expense->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -11,9 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Observers;
 | 
					namespace App\Observers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Jobs\Util\UnlinkFile;
 | 
					 | 
				
			||||||
use App\Jobs\Util\WebhookHandler;
 | 
					use App\Jobs\Util\WebhookHandler;
 | 
				
			||||||
use App\Models\Client;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\Webhook;
 | 
					use App\Models\Webhook;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -34,7 +32,7 @@ class InvoiceObserver
 | 
				
			|||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) {
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_INVOICE, $invoice, $invoice->company, 'client')->delay(0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -46,13 +44,21 @@ class InvoiceObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Invoice $invoice)
 | 
					    public function updated(Invoice $invoice)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
       $subscriptions = Webhook::where('company_id', $invoice->company_id)
 | 
					        $event = Webhook::EVENT_UPDATE_INVOICE;
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_UPDATE_INVOICE)
 | 
					 | 
				
			||||||
                            ->exists();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if($invoice->getOriginal('deleted_at') && !$invoice->deleted_at)
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					            $event = Webhook::EVENT_RESTORE_INVOICE;
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
 | 
					        if($invoice->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_INVOICE; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $invoice->company->id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $invoice, $invoice->company)->delay(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -63,13 +69,16 @@ class InvoiceObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Invoice $invoice)
 | 
					    public function deleted(Invoice $invoice)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        if($invoice->is_deleted)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $invoice->company_id)
 | 
					        $subscriptions = Webhook::where('company_id', $invoice->company_id)
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_DELETE_INVOICE)
 | 
					                            ->where('event_id', Webhook::EVENT_ARCHIVE_INVOICE)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_INVOICE, $invoice, $invoice->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_INVOICE, $invoice, $invoice->company, 'client')->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,9 @@ use App\Models\Webhook;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class PaymentObserver
 | 
					class PaymentObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the payment "created" event.
 | 
					     * Handle the payment "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -25,13 +28,13 @@ class PaymentObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Payment $payment)
 | 
					    public function created(Payment $payment)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $payment->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $payment->company_id)
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_CREATE_PAYMENT)
 | 
					                            ->where('event_id', Webhook::EVENT_CREATE_PAYMENT)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(now()->addSeconds(20));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(20);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -42,13 +45,21 @@ class PaymentObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Payment $payment)
 | 
					    public function updated(Payment $payment)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $payment->company->id)
 | 
					        $event = Webhook::EVENT_UPDATE_PAYMENT;
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_UPDATE_PAYMENT)
 | 
					 | 
				
			||||||
                            ->exists();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if($payment->getOriginal('deleted_at') && !$payment->deleted_at)
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(now()->addSeconds(20));
 | 
					            $event = Webhook::EVENT_RESTORE_PAYMENT;
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
 | 
					        if($payment->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_PAYMENT; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $payment->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $payment, $payment->company, 'invoices,client')->delay(25);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -59,12 +70,15 @@ class PaymentObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Payment $payment)
 | 
					    public function deleted(Payment $payment)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $payment->company->id)
 | 
					        if($payment->is_deleted)
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_DELETE_PAYMENT)
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $payment->company_id)
 | 
				
			||||||
 | 
					                        ->where('event_id', Webhook::EVENT_ARCHIVE_PAYMENT)
 | 
				
			||||||
                        ->exists();
 | 
					                        ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) {
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(now()->addSeconds(20));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_PAYMENT, $payment, $payment->company, 'invoices,client')->delay(20);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Observers;
 | 
					namespace App\Observers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Jobs\Util\WebhookHandler;
 | 
				
			||||||
use App\Models\Product;
 | 
					use App\Models\Product;
 | 
				
			||||||
 | 
					use App\Models\Webhook;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ProductObserver
 | 
					class ProductObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the product "created" event.
 | 
					     * Handle the product "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -23,7 +28,12 @@ class ProductObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Product $product)
 | 
					    public function created(Product $product)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //
 | 
					        $subscriptions = Webhook::where('company_id', $product->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', Webhook::EVENT_CREATE_PRODUCT)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_PRODUCT, $product, $product->company)->delay(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -34,7 +44,23 @@ class ProductObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Product $product)
 | 
					    public function updated(Product $product)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //
 | 
					
 | 
				
			||||||
 | 
					        $event = Webhook::EVENT_UPDATE_PRODUCT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if($product->getOriginal('deleted_at') && !$product->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_PRODUCT;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($product->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_PRODUCT; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $product->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $product, $product->company)->delay(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -45,7 +71,15 @@ class ProductObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Product $product)
 | 
					    public function deleted(Product $product)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //
 | 
					        if($product->is_deleted)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $product->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', Webhook::EVENT_ARCHIVE_PRODUCT)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_PRODUCT, $product, $product->company)->delay(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -31,9 +31,9 @@ class ProjectObserver
 | 
				
			|||||||
                            ->where('event_id', Webhook::EVENT_PROJECT_CREATE)
 | 
					                            ->where('event_id', Webhook::EVENT_PROJECT_CREATE)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_PROJECT_CREATE, $project, $project->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_PROJECT_CREATE, $project, $project->company, 'client')->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -44,13 +44,23 @@ class ProjectObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Project $project)
 | 
					    public function updated(Project $project)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $project->company_id)
 | 
					 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_PROJECT_UPDATE)
 | 
					 | 
				
			||||||
                            ->exists();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        $event = Webhook::EVENT_PROJECT_UPDATE;
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_PROJECT_UPDATE, $project, $project->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					
 | 
				
			||||||
        }
 | 
					        if($project->getOriginal('deleted_at') && !$project->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_PROJECT;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($project->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_PROJECT_DELETE; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $project->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $project, $project->company, 'client')->delay(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -61,14 +71,16 @@ class ProjectObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Project $project)
 | 
					    public function deleted(Project $project)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        //EVENT_PROJECT_DELETE
 | 
					        if($project->is_deleted)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $project->company_id)
 | 
					        $subscriptions = Webhook::where('company_id', $project->company_id)
 | 
				
			||||||
                            ->where('event_id', Webhook::EVENT_PROJECT_DELETE)
 | 
					                            ->where('event_id', Webhook::EVENT_ARCHIVE_PROJECT)
 | 
				
			||||||
                            ->exists();
 | 
					                            ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_PROJECT_DELETE, $project, $project->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_PROJECT, $project, $project->company, 'client')->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Observers;
 | 
					namespace App\Observers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Jobs\Util\WebhookHandler;
 | 
				
			||||||
use App\Models\PurchaseOrder;
 | 
					use App\Models\PurchaseOrder;
 | 
				
			||||||
 | 
					use App\Models\Webhook;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PurchaseOrderObserver
 | 
					class PurchaseOrderObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the client "created" event.
 | 
					     * Handle the client "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -23,6 +28,14 @@ class PurchaseOrderObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(PurchaseOrder $purchase_order)
 | 
					    public function created(PurchaseOrder $purchase_order)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $purchase_order->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', Webhook::EVENT_CREATE_PURCHASE_ORDER)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_PURCHASE_ORDER, $purchase_order, $purchase_order->company, 'vendor')->delay(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -33,6 +46,23 @@ class PurchaseOrderObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(PurchaseOrder $purchase_order)
 | 
					    public function updated(PurchaseOrder $purchase_order)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $event = Webhook::EVENT_UPDATE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if($purchase_order->getOriginal('deleted_at') && !$purchase_order->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_PURCHASE_ORDER;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($purchase_order->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_PURCHASE_ORDER; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $purchase_order->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $purchase_order, $purchase_order->company, 'vendor')->delay(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -43,6 +73,16 @@ class PurchaseOrderObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(PurchaseOrder $purchase_order)
 | 
					    public function deleted(PurchaseOrder $purchase_order)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        if($purchase_order->is_deleted)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $purchase_order->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', Webhook::EVENT_ARCHIVE_PURCHASE_ORDER)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_PURCHASE_ORDER, $purchase_order, $purchase_order->company, 'vendor')->delay(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -11,13 +11,15 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Observers;
 | 
					namespace App\Observers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Jobs\Util\UnlinkFile;
 | 
					 | 
				
			||||||
use App\Jobs\Util\WebhookHandler;
 | 
					use App\Jobs\Util\WebhookHandler;
 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
use App\Models\Webhook;
 | 
					use App\Models\Webhook;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class QuoteObserver
 | 
					class QuoteObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the quote "created" event.
 | 
					     * Handle the quote "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -26,14 +28,14 @@ class QuoteObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Quote $quote)
 | 
					    public function created(Quote $quote)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $quote->company->id)
 | 
					
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $quote->company_id)
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_CREATE_QUOTE)
 | 
					                        ->where('event_id', Webhook::EVENT_CREATE_QUOTE)
 | 
				
			||||||
                        ->exists();
 | 
					                        ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            $quote->load('client');
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company, 'client')->delay(0);
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_QUOTE, $quote, $quote->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					        
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -43,15 +45,24 @@ class QuoteObserver
 | 
				
			|||||||
     * @return void
 | 
					     * @return void
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Quote $quote)
 | 
					    public function updated(Quote $quote)
 | 
				
			||||||
    {
 | 
					    {nlog("updated");
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $quote->company->id)
 | 
					
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_UPDATE_QUOTE)
 | 
					        $event = Webhook::EVENT_UPDATE_QUOTE;
 | 
				
			||||||
                        ->exists();
 | 
					
 | 
				
			||||||
 | 
					        if($quote->getOriginal('deleted_at') && !$quote->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_QUOTE;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($quote->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_QUOTE; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $quote->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $quote, $quote->company, 'client')->delay(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					 | 
				
			||||||
            $quote->load('client');
 | 
					 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_QUOTE, $quote, $quote->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -62,14 +73,16 @@ class QuoteObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Quote $quote)
 | 
					    public function deleted(Quote $quote)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $quote->company->id)
 | 
					        if($quote->is_deleted)
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_DELETE_QUOTE)
 | 
					            return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $quote->company_id)
 | 
				
			||||||
 | 
					                        ->where('event_id', Webhook::EVENT_ARCHIVE_QUOTE)
 | 
				
			||||||
                        ->exists();
 | 
					                        ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            $quote->load('client');
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_QUOTE, $quote, $quote->company, 'client')->delay(0);
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_QUOTE, $quote, $quote->company, 'client')->delay(now()->addSeconds(rand(1,5)));
 | 
					        
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,9 @@ use App\Models\Webhook;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class TaskObserver
 | 
					class TaskObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the task "created" event.
 | 
					     * Handle the task "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -25,13 +28,13 @@ class TaskObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Task $task)
 | 
					    public function created(Task $task)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $task->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $task->company_id)
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_CREATE_TASK)
 | 
					                        ->where('event_id', Webhook::EVENT_CREATE_TASK)
 | 
				
			||||||
                        ->exists();
 | 
					                        ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_TASK, $task, $task->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_TASK, $task, $task->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -42,13 +45,21 @@ class TaskObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Task $task)
 | 
					    public function updated(Task $task)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $task->company->id)
 | 
					        $event = Webhook::EVENT_UPDATE_TASK;
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_UPDATE_TASK)
 | 
					 | 
				
			||||||
                        ->exists();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if($task->getOriginal('deleted_at') && !$task->deleted_at)
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_TASK, $task, $task->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            $event = Webhook::EVENT_RESTORE_TASK;
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
 | 
					        if($task->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_TASK; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $task->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($subscriptions) 
 | 
				
			||||||
 | 
					            WebhookHandler::dispatch($event, $task, $task->company)->delay(0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -59,13 +70,16 @@ class TaskObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Task $task)
 | 
					    public function deleted(Task $task)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $task->company->id)
 | 
					        if($task->is_deleted)
 | 
				
			||||||
                        ->where('event_id', Webhook::EVENT_DELETE_TASK)
 | 
					            return;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $task->company_id)
 | 
				
			||||||
 | 
					                        ->where('event_id', Webhook::EVENT_ARCHIVE_TASK)
 | 
				
			||||||
                        ->exists();
 | 
					                        ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_TASK, $task, $task->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_TASK, $task, $task->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,9 @@ use App\Models\Webhook;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class VendorObserver
 | 
					class VendorObserver
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public $afterCommit = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Handle the vendor "created" event.
 | 
					     * Handle the vendor "created" event.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
@ -25,13 +28,13 @@ class VendorObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function created(Vendor $vendor)
 | 
					    public function created(Vendor $vendor)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $vendor->company->id)
 | 
					        $subscriptions = Webhook::where('company_id', $vendor->company_id)
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_CREATE_VENDOR)
 | 
					                                    ->where('event_id', Webhook::EVENT_CREATE_VENDOR)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_CREATE_VENDOR, $vendor, $vendor->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_CREATE_VENDOR, $vendor, $vendor->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -42,13 +45,21 @@ class VendorObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function updated(Vendor $vendor)
 | 
					    public function updated(Vendor $vendor)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $vendor->company->id)
 | 
					        $event = Webhook::EVENT_UPDATE_VENDOR;
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_UPDATE_VENDOR)
 | 
					
 | 
				
			||||||
 | 
					        if($vendor->getOriginal('deleted_at') && !$vendor->deleted_at)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_RESTORE_VENDOR;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        if($vendor->is_deleted)
 | 
				
			||||||
 | 
					            $event = Webhook::EVENT_DELETE_VENDOR; 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $vendor->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', $event)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) 
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_UPDATE_VENDOR, $vendor, $vendor->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch($event, $vendor, $vendor->company)->delay(0);
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -59,12 +70,15 @@ class VendorObserver
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function deleted(Vendor $vendor)
 | 
					    public function deleted(Vendor $vendor)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $subscriptions = Webhook::where('company_id', $vendor->company->id)
 | 
					        if($vendor->is_deleted)
 | 
				
			||||||
                                    ->where('event_id', Webhook::EVENT_DELETE_VENDOR)
 | 
					            return;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        $subscriptions = Webhook::where('company_id', $vendor->company_id)
 | 
				
			||||||
 | 
					                                    ->where('event_id', Webhook::EVENT_ARCHIVE_VENDOR)
 | 
				
			||||||
                                    ->exists();
 | 
					                                    ->exists();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($subscriptions) {
 | 
					        if ($subscriptions) {
 | 
				
			||||||
            WebhookHandler::dispatch(Webhook::EVENT_DELETE_VENDOR, $vendor, $vendor->company)->delay(now()->addSeconds(rand(1,5)));
 | 
					            WebhookHandler::dispatch(Webhook::EVENT_ARCHIVE_VENDOR, $vendor, $vendor->company)->delay(0);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,7 @@ class CompanyPolicy extends EntityPolicy
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return ($user->isAdmin() && $entity->id == $user->companyId())
 | 
					        return ($user->isAdmin() && $entity->id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('view_'.strtolower(class_basename($entity))) && $entity->id == $user->companyId())
 | 
					            || ($user->hasPermission('view_'.strtolower(class_basename($entity))) && $entity->id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('view_all') && $entity->id == $user->companyId())
 | 
					            // || ($user->hasPermission('view_all') && $entity->id == $user->companyId())
 | 
				
			||||||
            || $user->owns($entity);
 | 
					            || $user->owns($entity);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -59,7 +59,7 @@ class CompanyPolicy extends EntityPolicy
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return ($user->isAdmin() && $entity->id == $user->companyId())
 | 
					        return ($user->isAdmin() && $entity->id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('edit_'.strtolower(class_basename($entity))) && $entity->id == $user->companyId())
 | 
					            || ($user->hasPermission('edit_'.strtolower(class_basename($entity))) && $entity->id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('edit_all') && $entity->id == $user->companyId())
 | 
					            // || ($user->hasPermission('edit_all') && $entity->id == $user->companyId())
 | 
				
			||||||
            || $user->owns($entity);
 | 
					            || $user->owns($entity);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,7 @@ class EntityPolicy
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return ($user->isAdmin() && $entity->company_id == $user->companyId())
 | 
					        return ($user->isAdmin() && $entity->company_id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('edit_'.\Illuminate\Support\Str::snake(class_basename($entity))) && $entity->company_id == $user->companyId())
 | 
					            || ($user->hasPermission('edit_'.\Illuminate\Support\Str::snake(class_basename($entity))) && $entity->company_id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('edit_all') && $entity->company_id == $user->companyId())
 | 
					            // || ($user->hasPermission('edit_all') && $entity->company_id == $user->companyId()) //this is redundant as the edit_ check covers the _all check
 | 
				
			||||||
            || ($user->owns($entity) && $entity->company_id == $user->companyId())
 | 
					            || ($user->owns($entity) && $entity->company_id == $user->companyId())
 | 
				
			||||||
            || ($user->assigned($entity) && $entity->company_id == $user->companyId());
 | 
					            || ($user->assigned($entity) && $entity->company_id == $user->companyId());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -65,7 +65,7 @@ class EntityPolicy
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return ($user->isAdmin() && $entity->company_id == $user->companyId())
 | 
					        return ($user->isAdmin() && $entity->company_id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('view_'.\Illuminate\Support\Str::snake(class_basename($entity))) && $entity->company_id == $user->companyId())
 | 
					            || ($user->hasPermission('view_'.\Illuminate\Support\Str::snake(class_basename($entity))) && $entity->company_id == $user->companyId())
 | 
				
			||||||
            || ($user->hasPermission('view_all') && $entity->company_id == $user->companyId())
 | 
					            // || ($user->hasPermission('view_all') && $entity->company_id == $user->companyId()) //this is redundant as the edit_ check covers the _all check
 | 
				
			||||||
            || ($user->owns($entity) && $entity->company_id == $user->companyId())
 | 
					            || ($user->owns($entity) && $entity->company_id == $user->companyId())
 | 
				
			||||||
            || ($user->assigned($entity) && $entity->company_id == $user->companyId());
 | 
					            || ($user->assigned($entity) && $entity->company_id == $user->companyId());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,6 @@ use Illuminate\Queue\Events\JobProcessing;
 | 
				
			|||||||
use Illuminate\Support\Facades\App;
 | 
					use Illuminate\Support\Facades\App;
 | 
				
			||||||
use Illuminate\Support\Facades\Artisan;
 | 
					use Illuminate\Support\Facades\Artisan;
 | 
				
			||||||
use Illuminate\Support\Facades\Blade;
 | 
					use Illuminate\Support\Facades\Blade;
 | 
				
			||||||
use Illuminate\Support\Facades\DB;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Mail;
 | 
					use Illuminate\Support\Facades\Mail;
 | 
				
			||||||
use Illuminate\Support\Facades\ParallelTesting;
 | 
					use Illuminate\Support\Facades\ParallelTesting;
 | 
				
			||||||
use Illuminate\Support\Facades\Queue;
 | 
					use Illuminate\Support\Facades\Queue;
 | 
				
			||||||
@ -52,6 +51,11 @@ class AppServiceProvider extends ServiceProvider
 | 
				
			|||||||
        //     );
 | 
					        //     );
 | 
				
			||||||
        // });
 | 
					        // });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Model::preventLazyLoading(
 | 
				
			||||||
 | 
					        //     !$this->app->isProduction()
 | 
				
			||||||
 | 
					        // );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Defines the name used in polymorphic tables */
 | 
				
			||||||
        Relation::morphMap([
 | 
					        Relation::morphMap([
 | 
				
			||||||
            'invoices'  => Invoice::class,
 | 
					            'invoices'  => Invoice::class,
 | 
				
			||||||
            'proposals' => Proposal::class,
 | 
					            'proposals' => Proposal::class,
 | 
				
			||||||
@ -61,6 +65,7 @@ class AppServiceProvider extends ServiceProvider
 | 
				
			|||||||
            return config('ninja.environment') === $environment;
 | 
					            return config('ninja.environment') === $environment;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Sets default varchar length */
 | 
				
			||||||
        Schema::defaultStringLength(191);
 | 
					        Schema::defaultStringLength(191);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Handles setting the correct database with livewire classes */
 | 
					        /* Handles setting the correct database with livewire classes */
 | 
				
			||||||
@ -75,11 +80,10 @@ class AppServiceProvider extends ServiceProvider
 | 
				
			|||||||
            App::forgetInstance('truthsource');
 | 
					            App::forgetInstance('truthsource');
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Always init a new instance everytime the container boots */
 | 
				
			||||||
        app()->instance(TruthSource::class, new TruthSource());
 | 
					        app()->instance(TruthSource::class, new TruthSource());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Model::preventLazyLoading(
 | 
					        /* Extension for custom mailers */
 | 
				
			||||||
        //     !$this->app->isProduction()
 | 
					 | 
				
			||||||
        // );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Mail::extend('gmail', function () {
 | 
					        Mail::extend('gmail', function () {
 | 
				
			||||||
            return new GmailTransport();
 | 
					            return new GmailTransport();
 | 
				
			||||||
@ -113,6 +117,10 @@ class AppServiceProvider extends ServiceProvider
 | 
				
			|||||||
            return $this;
 | 
					            return $this;
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Extension for custom mailers */
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /* Convenience helper for testing s*/
 | 
				
			||||||
        ParallelTesting::setUpTestDatabase(function ($database, $token) {
 | 
					        ParallelTesting::setUpTestDatabase(function ($database, $token) {
 | 
				
			||||||
            Artisan::call('db:seed');
 | 
					            Artisan::call('db:seed');
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\Providers;
 | 
					namespace App\Providers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Activity;
 | 
					use App\Models\Activity;
 | 
				
			||||||
use App\Models\Bank;
 | 
					 | 
				
			||||||
use App\Models\BankIntegration;
 | 
					use App\Models\BankIntegration;
 | 
				
			||||||
use App\Models\BankTransaction;
 | 
					use App\Models\BankTransaction;
 | 
				
			||||||
use App\Models\BankTransactionRule;
 | 
					use App\Models\BankTransactionRule;
 | 
				
			||||||
 | 
				
			|||||||
@ -69,7 +69,6 @@ class BaseRepository
 | 
				
			|||||||
            event(new $className($entity, $entity->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					            event(new $className($entity, $entity->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // $this->handleWebhook($entity, 'ARCHIVE');
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -83,78 +82,20 @@ class BaseRepository
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $fromDeleted = false;
 | 
					        $fromDeleted = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $entity->restore();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ($entity->is_deleted) {
 | 
					        if ($entity->is_deleted) {
 | 
				
			||||||
            $fromDeleted = true;
 | 
					            $fromDeleted = true;
 | 
				
			||||||
            $entity->is_deleted = false;
 | 
					            $entity->is_deleted = false;
 | 
				
			||||||
            $entity->saveQuietly();
 | 
					            $entity->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $entity->restore();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $className = $this->getEventClass($entity, 'Restored');
 | 
					        $className = $this->getEventClass($entity, 'Restored');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (class_exists($className)) {
 | 
					        if (class_exists($className)) {
 | 
				
			||||||
            event(new $className($entity, $fromDeleted, $entity->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
					            event(new $className($entity, $fromDeleted, $entity->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // $this->handleWebhook($entity, 'RESTORE');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private function handleWebhook($entity, $action): void
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $includes = '';
 | 
					 | 
				
			||||||
        $event = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        switch($entity) {
 | 
					 | 
				
			||||||
            case $entity instanceof Invoice:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_INVOICE";
 | 
					 | 
				
			||||||
                $includes = 'client';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Quote:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_QUOTE";
 | 
					 | 
				
			||||||
                $includes = 'client';
 | 
					 | 
				
			||||||
            case $entity instanceof Credit:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_CREDIT";
 | 
					 | 
				
			||||||
                $includes = 'client';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Payment:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_PAYMENT";
 | 
					 | 
				
			||||||
                $includes = 'invoices,client';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Task:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_TASK";
 | 
					 | 
				
			||||||
                $includes = '';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Project:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}PROJECT";
 | 
					 | 
				
			||||||
                $includes = 'client';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Client:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_CLIENT";
 | 
					 | 
				
			||||||
                $includes = '';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Expense:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_EXPENSE";
 | 
					 | 
				
			||||||
                $includes = '';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
            case $entity instanceof Vendor:
 | 
					 | 
				
			||||||
                $event = "EVENT_{$action}_VENDOR";
 | 
					 | 
				
			||||||
                $includes = '';
 | 
					 | 
				
			||||||
                break;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (isset($event)){
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            $subscriptions = Webhook::where('company_id', $entity->company_id)
 | 
					 | 
				
			||||||
                ->where('event_id', $event)
 | 
					 | 
				
			||||||
                ->exists();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if ($subscriptions) {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                WebhookHandler::dispatch($event, $entity, $entity->company, $includes)->delay(now()->addSeconds(rand(1,5)));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -290,8 +231,9 @@ class BaseRepository
 | 
				
			|||||||
                $invitation_class = sprintf('App\\Models\\%sInvitation', $resource);
 | 
					                $invitation_class = sprintf('App\\Models\\%sInvitation', $resource);
 | 
				
			||||||
                $invitation = $invitation_class::where('key', $invitation)->first();
 | 
					                $invitation = $invitation_class::where('key', $invitation)->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if ($invitation)
 | 
					                if ($invitation){
 | 
				
			||||||
                    $invitation->delete();
 | 
					                    $invitation->delete();
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -316,7 +258,6 @@ class BaseRepository
 | 
				
			|||||||
                                            ->first();
 | 
					                                            ->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        if ($new_invitation && $new_invitation->trashed()) {
 | 
					                        if ($new_invitation && $new_invitation->trashed()) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                            $new_invitation->restore();
 | 
					                            $new_invitation->restore();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
@ -326,7 +267,7 @@ class BaseRepository
 | 
				
			|||||||
                            $new_invitation->{$lcfirst_resource_id} = $model->id;
 | 
					                            $new_invitation->{$lcfirst_resource_id} = $model->id;
 | 
				
			||||||
                            $new_invitation->client_contact_id = $contact->id;
 | 
					                            $new_invitation->client_contact_id = $contact->id;
 | 
				
			||||||
                            $new_invitation->key = $this->createDbHash($model->company->db);
 | 
					                            $new_invitation->key = $this->createDbHash($model->company->db);
 | 
				
			||||||
                            $new_invitation->save();
 | 
					                            $new_invitation->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
@ -409,7 +350,6 @@ class BaseRepository
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $model = $model->calc()->getQuote();
 | 
					            $model = $model->calc()->getQuote();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if($this->new_model)
 | 
					            if($this->new_model)
 | 
				
			||||||
                event('eloquent.created: App\Models\Quote', $model);
 | 
					                event('eloquent.created: App\Models\Quote', $model);
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
@ -430,9 +370,7 @@ class BaseRepository
 | 
				
			|||||||
                event('eloquent.updated: App\Models\RecurringInvoice', $model);
 | 
					                event('eloquent.updated: App\Models\RecurringInvoice', $model);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $model->save();
 | 
					        $model->saveQuietly();
 | 
				
			||||||
 | 
					 | 
				
			||||||
//        nlog("save time = ". microtime(true) - $start);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $model->fresh();
 | 
					        return $model->fresh();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -48,7 +48,7 @@ class ExpenseRepository extends BaseRepository
 | 
				
			|||||||
        if (empty($expense->number))
 | 
					        if (empty($expense->number))
 | 
				
			||||||
            $expense = $this->findAndSaveNumber($expense);
 | 
					            $expense = $this->findAndSaveNumber($expense);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $expense->save();
 | 
					        $expense->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (array_key_exists('documents', $data)) {
 | 
					        if (array_key_exists('documents', $data)) {
 | 
				
			||||||
            $this->saveDocuments($data['documents'], $expense);
 | 
					            $this->saveDocuments($data['documents'], $expense);
 | 
				
			||||||
 | 
				
			|||||||
@ -85,14 +85,14 @@ class PaymentRepository extends BaseRepository {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
                    $client->service()->updatePaidToDate($data['amount'])->save();
 | 
					                    $client->service()->updatePaidToDate($data['amount'])->save();
 | 
				
			||||||
                    $client->save();
 | 
					                    $client->saveQuietly();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                else{
 | 
					                else{
 | 
				
			||||||
                    //this fixes an edge case with unapplied payments
 | 
					                    //this fixes an edge case with unapplied payments
 | 
				
			||||||
                    $client->service()->updatePaidToDate($data['amount'])->save();
 | 
					                    $client->service()->updatePaidToDate($data['amount'])->save();
 | 
				
			||||||
                    // $client->paid_to_date += $data['amount'];
 | 
					                    // $client->paid_to_date += $data['amount'];
 | 
				
			||||||
                    $client->save();
 | 
					                    $client->saveQuietly();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (array_key_exists('credits', $data) && is_array($data['credits']) && count($data['credits']) > 0) {
 | 
					                if (array_key_exists('credits', $data) && is_array($data['credits']) && count($data['credits']) > 0) {
 | 
				
			||||||
@ -100,7 +100,7 @@ class PaymentRepository extends BaseRepository {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    $client->service()->updatePaidToDate($_credit_totals)->save();
 | 
					                    $client->service()->updatePaidToDate($_credit_totals)->save();
 | 
				
			||||||
                    // $client->paid_to_date += $_credit_totals;
 | 
					                    // $client->paid_to_date += $_credit_totals;
 | 
				
			||||||
                    $client->save();
 | 
					                    $client->saveQuietly();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
             }, 1);
 | 
					             }, 1);
 | 
				
			||||||
@ -121,7 +121,7 @@ class PaymentRepository extends BaseRepository {
 | 
				
			|||||||
            
 | 
					            
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $payment->save();
 | 
					        $payment->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*Save documents*/
 | 
					        /*Save documents*/
 | 
				
			||||||
        if (array_key_exists('documents', $data)) {
 | 
					        if (array_key_exists('documents', $data)) {
 | 
				
			||||||
@ -198,17 +198,7 @@ class PaymentRepository extends BaseRepository {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
 | 
					        $payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $payment->save();
 | 
					        $payment->saveQuietly();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $transaction = [
 | 
					 | 
				
			||||||
            'invoice' => [],
 | 
					 | 
				
			||||||
            'payment' => $payment->transaction_event(),
 | 
					 | 
				
			||||||
            'client' => $payment->client->transaction_event(),
 | 
					 | 
				
			||||||
            'credit' => [],
 | 
					 | 
				
			||||||
            'metadata' => [],
 | 
					 | 
				
			||||||
        ];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        // TransactionLog::dispatch(TransactionEvent::PAYMENT_MADE, $transaction, $payment->company->db);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $payment->refresh();
 | 
					        return $payment->refresh();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -67,7 +67,7 @@ class PurchaseOrderRepository extends BaseRepository
 | 
				
			|||||||
                            $new_invitation->purchase_order_id = $purchase_order->id;
 | 
					                            $new_invitation->purchase_order_id = $purchase_order->id;
 | 
				
			||||||
                            $new_invitation->vendor_contact_id = $contact->id;
 | 
					                            $new_invitation->vendor_contact_id = $contact->id;
 | 
				
			||||||
                            $new_invitation->key = $this->createDbHash($purchase_order->company->db);
 | 
					                            $new_invitation->key = $this->createDbHash($purchase_order->company->db);
 | 
				
			||||||
                            $new_invitation->save();
 | 
					                            $new_invitation->saveQuietly();
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -42,7 +42,7 @@ class TaskRepository extends BaseRepository
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $task->fill($data);
 | 
					        $task->fill($data);
 | 
				
			||||||
        $task->save();
 | 
					        $task->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->new_task && ! $task->status_id) {
 | 
					        if ($this->new_task && ! $task->status_id) {
 | 
				
			||||||
            $this->setDefaultStatus($task);
 | 
					            $this->setDefaultStatus($task);
 | 
				
			||||||
@ -121,7 +121,7 @@ class TaskRepository extends BaseRepository
 | 
				
			|||||||
        // $task->start_time = $task->start_time ?: $task->calcStartTime();
 | 
					        // $task->start_time = $task->start_time ?: $task->calcStartTime();
 | 
				
			||||||
        // $task->duration = $task->calcDuration();
 | 
					        // $task->duration = $task->calcDuration();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $task->save();
 | 
					        $task->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (array_key_exists('documents', $data)) {
 | 
					        if (array_key_exists('documents', $data)) {
 | 
				
			||||||
            $this->saveDocuments($data['documents'], $task);
 | 
					            $this->saveDocuments($data['documents'], $task);
 | 
				
			||||||
@ -183,7 +183,7 @@ class TaskRepository extends BaseRepository
 | 
				
			|||||||
            return $key >= $index;
 | 
					            return $key >= $index;
 | 
				
			||||||
        }))->each(function ($item, $key) {
 | 
					        }))->each(function ($item, $key) {
 | 
				
			||||||
            $item->status_order = $key;
 | 
					            $item->status_order = $key;
 | 
				
			||||||
            $item->save();
 | 
					            $item->saveQuietly();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -199,7 +199,7 @@ class TaskRepository extends BaseRepository
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $log = array_merge($log, [[time(), 0]]);
 | 
					            $log = array_merge($log, [[time(), 0]]);
 | 
				
			||||||
            $task->time_log = json_encode($log);
 | 
					            $task->time_log = json_encode($log);
 | 
				
			||||||
            $task->save();
 | 
					            $task->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $log = json_decode($task->time_log, true);
 | 
					        $log = json_decode($task->time_log, true);
 | 
				
			||||||
@ -210,7 +210,7 @@ class TaskRepository extends BaseRepository
 | 
				
			|||||||
            $new = [time(), 0];
 | 
					            $new = [time(), 0];
 | 
				
			||||||
            $log = array_merge($log, [$new]);
 | 
					            $log = array_merge($log, [$new]);
 | 
				
			||||||
            $task->time_log = json_encode($log);
 | 
					            $task->time_log = json_encode($log);
 | 
				
			||||||
            $task->save();
 | 
					            $task->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $task;
 | 
					        return $task;
 | 
				
			||||||
@ -229,7 +229,7 @@ class TaskRepository extends BaseRepository
 | 
				
			|||||||
            $log = array_merge($log, [$last]);
 | 
					            $log = array_merge($log, [$last]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $task->time_log = json_encode($log);
 | 
					            $task->time_log = json_encode($log);
 | 
				
			||||||
            $task->save();
 | 
					            $task->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $task;
 | 
					        return $task;
 | 
				
			||||||
 | 
				
			|||||||
@ -67,7 +67,7 @@ class VendorContactRepository extends BaseRepository
 | 
				
			|||||||
                $update_contact->password = Hash::make($contact['password']);
 | 
					                $update_contact->password = Hash::make($contact['password']);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $update_contact->save();
 | 
					            $update_contact->saveQuietly();
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $vendor->load('contacts');
 | 
					        $vendor->load('contacts');
 | 
				
			||||||
@ -80,7 +80,7 @@ class VendorContactRepository extends BaseRepository
 | 
				
			|||||||
            $new_contact->user_id = $vendor->user_id;
 | 
					            $new_contact->user_id = $vendor->user_id;
 | 
				
			||||||
            $new_contact->contact_key = Str::random(40);
 | 
					            $new_contact->contact_key = Str::random(40);
 | 
				
			||||||
            $new_contact->is_primary = true;
 | 
					            $new_contact->is_primary = true;
 | 
				
			||||||
            $new_contact->save();
 | 
					            $new_contact->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -45,13 +45,13 @@ class VendorRepository extends BaseRepository
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $vendor->fill($data);
 | 
					        $vendor->fill($data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $vendor->save();
 | 
					        $vendor->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($vendor->number == '' || ! $vendor->number) {
 | 
					        if ($vendor->number == '' || ! $vendor->number) {
 | 
				
			||||||
            $vendor->number = $this->getNextVendorNumber($vendor);
 | 
					            $vendor->number = $this->getNextVendorNumber($vendor);
 | 
				
			||||||
        } //todo write tests for this and make sure that custom vendor numbers also works as expected from here
 | 
					        } //todo write tests for this and make sure that custom vendor numbers also works as expected from here
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $vendor->save();
 | 
					        $vendor->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (isset($data['contacts'])) {
 | 
					        if (isset($data['contacts'])) {
 | 
				
			||||||
            $this->contact_repo->save($data, $vendor);
 | 
					            $this->contact_repo->save($data, $vendor);
 | 
				
			||||||
 | 
				
			|||||||
@ -40,7 +40,7 @@ class ClientService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
 | 
					                $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
 | 
				
			||||||
                $this->client->balance += $amount;
 | 
					                $this->client->balance += $amount;
 | 
				
			||||||
                $this->client->save();
 | 
					                $this->client->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }, 2);
 | 
					            }, 2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -61,7 +61,7 @@ class ClientService
 | 
				
			|||||||
                $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
 | 
					                $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
 | 
				
			||||||
                $this->client->balance += $balance;
 | 
					                $this->client->balance += $balance;
 | 
				
			||||||
                $this->client->paid_to_date += $paid_to_date;
 | 
					                $this->client->paid_to_date += $paid_to_date;
 | 
				
			||||||
                $this->client->save();
 | 
					                $this->client->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }, 2);
 | 
					            }, 2);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -80,7 +80,7 @@ class ClientService
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
 | 
					            $this->client = Client::withTrashed()->where('id', $this->client->id)->lockForUpdate()->first();
 | 
				
			||||||
            $this->client->paid_to_date += $amount;
 | 
					            $this->client->paid_to_date += $amount;
 | 
				
			||||||
            $this->client->save();
 | 
					            $this->client->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }, 2);
 | 
					        }, 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -207,7 +207,7 @@ class ClientService
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function save() :Client
 | 
					    public function save() :Client
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->client->save();
 | 
					        $this->client->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->client->fresh();
 | 
					        return $this->client->fresh();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -59,7 +59,7 @@ class EmailMailer implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function backoff()
 | 
					    public function backoff()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return [30, 60, 180, 240];
 | 
					        return [10, 30, 60, 240];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function handle(): void
 | 
					    public function handle(): void
 | 
				
			||||||
@ -379,7 +379,6 @@ class EmailMailer implements ShouldQueue
 | 
				
			|||||||
                $message->getHeaders()->addTextHeader('gmailtoken', $token);     
 | 
					                $message->getHeaders()->addTextHeader('gmailtoken', $token);     
 | 
				
			||||||
             });
 | 
					             });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        sleep(rand(1,3));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@ -406,7 +405,6 @@ class EmailMailer implements ShouldQueue
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
 | 
					            $google->getClient()->setAccessToken(json_encode($user->oauth_user_token));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            sleep(rand(2,4));
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        catch(\Exception $e) {
 | 
					        catch(\Exception $e) {
 | 
				
			||||||
            $this->logMailError('Gmail Token Invalid', $this->email_service->company->clients()->first());
 | 
					            $this->logMailError('Gmail Token Invalid', $this->email_service->company->clients()->first());
 | 
				
			||||||
 | 
				
			|||||||
@ -139,7 +139,7 @@ class HandleRestore extends AbstractService
 | 
				
			|||||||
                $payment->applied += $payment_adjustment;
 | 
					                $payment->applied += $payment_adjustment;
 | 
				
			||||||
                $payment->is_deleted = false;
 | 
					                $payment->is_deleted = false;
 | 
				
			||||||
                $payment->restore();
 | 
					                $payment->restore();
 | 
				
			||||||
                $payment->save();
 | 
					                $payment->saveQuietly();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
 | 
				
			|||||||
@ -41,7 +41,6 @@ class MarkSent
 | 
				
			|||||||
            ->setStatus(PurchaseOrder::STATUS_SENT)
 | 
					            ->setStatus(PurchaseOrder::STATUS_SENT)
 | 
				
			||||||
            ->applyNumber()
 | 
					            ->applyNumber()
 | 
				
			||||||
            ->adjustBalance($this->purchase_order->amount) //why was this commented out previously?
 | 
					            ->adjustBalance($this->purchase_order->amount) //why was this commented out previously?
 | 
				
			||||||
            //  ->touchPdf()
 | 
					 | 
				
			||||||
            ->save();
 | 
					            ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->purchase_order;
 | 
					        return $this->purchase_order;
 | 
				
			||||||
 | 
				
			|||||||
@ -60,9 +60,10 @@ class PurchaseOrderExpense
 | 
				
			|||||||
        $expense->number = empty($expense->number) ? $this->getNextExpenseNumber($expense) : $expense->number;        
 | 
					        $expense->number = empty($expense->number) ? $this->getNextExpenseNumber($expense) : $expense->number;        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $expense->save();
 | 
					        $expense->save();
 | 
				
			||||||
 | 
					        event('eloquent.created: App\Models\Expense', $expense);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->purchase_order->expense_id = $expense->id;
 | 
					        $this->purchase_order->expense_id = $expense->id;
 | 
				
			||||||
        $this->purchase_order->save();
 | 
					        $this->purchase_order->saveQuietly();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $expense;
 | 
					        return $expense;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -37,12 +37,10 @@ class ApplyNumber
 | 
				
			|||||||
        switch ($this->client->getSetting('counter_number_applied')) {
 | 
					        switch ($this->client->getSetting('counter_number_applied')) {
 | 
				
			||||||
            case 'when_saved':
 | 
					            case 'when_saved':
 | 
				
			||||||
                $quote = $this->trySaving($quote);
 | 
					                $quote = $this->trySaving($quote);
 | 
				
			||||||
                    // $quote->number = $this->getNextQuoteNumber($this->client, $quote);
 | 
					 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            case 'when_sent':
 | 
					            case 'when_sent':
 | 
				
			||||||
                if ($quote->status_id == Quote::STATUS_SENT) {
 | 
					                if ($quote->status_id == Quote::STATUS_SENT) {
 | 
				
			||||||
                    $quote = $this->trySaving($quote);
 | 
					                    $quote = $this->trySaving($quote);
 | 
				
			||||||
                    // $quote->number = $this->getNextQuoteNumber($this->client, $quote);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -52,7 +52,7 @@ class CreateInvitations
 | 
				
			|||||||
                $ii->key = $this->createDbHash($this->quote->company->db);
 | 
					                $ii->key = $this->createDbHash($this->quote->company->db);
 | 
				
			||||||
                $ii->quote_id = $this->quote->id;
 | 
					                $ii->quote_id = $this->quote->id;
 | 
				
			||||||
                $ii->client_contact_id = $contact->id;
 | 
					                $ii->client_contact_id = $contact->id;
 | 
				
			||||||
                $ii->save();
 | 
					                $ii->saveQuietly();
 | 
				
			||||||
            } elseif ($invitation && ! $contact->send_email) {
 | 
					            } elseif ($invitation && ! $contact->send_email) {
 | 
				
			||||||
                $invitation->delete();
 | 
					                $invitation->delete();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -81,7 +81,7 @@ class CreateInvitations
 | 
				
			|||||||
            $ii->key = $this->createDbHash($this->quote->company->db);
 | 
					            $ii->key = $this->createDbHash($this->quote->company->db);
 | 
				
			||||||
            $ii->quote_id = $this->quote->id;
 | 
					            $ii->quote_id = $this->quote->id;
 | 
				
			||||||
            $ii->client_contact_id = $contact->id;
 | 
					            $ii->client_contact_id = $contact->id;
 | 
				
			||||||
            $ii->save();
 | 
					            $ii->saveQuietly();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->quote->fresh();
 | 
					        return $this->quote->fresh();
 | 
				
			||||||
@ -93,6 +93,6 @@ class CreateInvitations
 | 
				
			|||||||
        $new_contact->client_id = $this->quote->client_id;
 | 
					        $new_contact->client_id = $this->quote->client_id;
 | 
				
			||||||
        $new_contact->contact_key = Str::random(40);
 | 
					        $new_contact->contact_key = Str::random(40);
 | 
				
			||||||
        $new_contact->is_primary = true;
 | 
					        $new_contact->is_primary = true;
 | 
				
			||||||
        $new_contact->save();
 | 
					        $new_contact->saveQuietly();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -93,14 +93,14 @@ class SchedulerService
 | 
				
			|||||||
    private function calculateStartAndEndDates(): array
 | 
					    private function calculateStartAndEndDates(): array
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        return match ($this->scheduler->parameters['date_range']) {
 | 
					        return match ($this->scheduler->parameters['date_range']) {
 | 
				
			||||||
            'this_month' => [now()->firstOfMonth()->format('Y-m-d'), now()->lastOfMonth()->format('Y-m-d')],
 | 
					            'this_month' => [now()->startOfDay()->firstOfMonth()->format('Y-m-d'), now()->startOfDay()->lastOfMonth()->format('Y-m-d')],
 | 
				
			||||||
            'this_quarter' => [now()->firstOfQuarter()->format('Y-m-d'), now()->lastOfQuarter()->format('Y-m-d')],
 | 
					            'this_quarter' => [now()->startOfDay()->firstOfQuarter()->format('Y-m-d'), now()->startOfDay()->lastOfQuarter()->format('Y-m-d')],
 | 
				
			||||||
            'this_year' => [now()->firstOfYear()->format('Y-m-d'), now()->lastOfYear()->format('Y-m-d')],
 | 
					            'this_year' => [now()->startOfDay()->firstOfYear()->format('Y-m-d'), now()->startOfDay()->lastOfYear()->format('Y-m-d')],
 | 
				
			||||||
            'previous_month' => [now()->subMonth()->firstOfMonth()->format('Y-m-d'), now()->subMonth()->lastOfMonth()->format('Y-m-d')],
 | 
					            'previous_month' => [now()->startOfDay()->subMonthNoOverflow()->firstOfMonth()->format('Y-m-d'), now()->startOfDay()->subMonthNoOverflow()->lastOfMonth()->format('Y-m-d')],
 | 
				
			||||||
            'previous_quarter' => [now()->subQuarter()->firstOfQuarter()->format('Y-m-d'), now()->subQuarter()->lastOfQuarter()->format('Y-m-d')],
 | 
					            'previous_quarter' => [now()->startOfDay()->subQuarterNoOverflow()->firstOfQuarter()->format('Y-m-d'), now()->startOfDay()->subQuarterNoOverflow()->lastOfQuarter()->format('Y-m-d')],
 | 
				
			||||||
            'previous_year' => [now()->subYear()->firstOfYear()->format('Y-m-d'), now()->subYear()->lastOfYear()->format('Y-m-d')],
 | 
					            'previous_year' => [now()->startOfDay()->subYearNoOverflow()->firstOfYear()->format('Y-m-d'), now()->startOfDay()->subYearNoOverflow()->lastOfYear()->format('Y-m-d')],
 | 
				
			||||||
            'custom_range' => [$this->scheduler->parameters['start_date'], $this->scheduler->parameters['end_date']],
 | 
					            'custom_range' => [$this->scheduler->parameters['start_date'], $this->scheduler->parameters['end_date']],
 | 
				
			||||||
             default => [now()->firstOfMonth()->format('Y-m-d'), now()->lastOfMonth()->format('Y-m-d')],
 | 
					             default => [now()->startOfDay()->firstOfMonth()->format('Y-m-d'), now()->startOfDay()->lastOfMonth()->format('Y-m-d')],
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -177,6 +177,16 @@ class HtmlEngine
 | 
				
			|||||||
            $data['$custom3'] = &$data['$invoice.custom3'];
 | 
					            $data['$custom3'] = &$data['$invoice.custom3'];
 | 
				
			||||||
            $data['$custom4'] = &$data['$invoice.custom4'];
 | 
					            $data['$custom4'] = &$data['$invoice.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $data['$quote.custom1'] = &$data['$invoice.custom1'];
 | 
				
			||||||
 | 
					            $data['$quote.custom2'] = &$data['$invoice.custom2'];
 | 
				
			||||||
 | 
					            $data['$quote.custom3'] = &$data['$invoice.custom3'];
 | 
				
			||||||
 | 
					            $data['$quote.custom4'] = &$data['$invoice.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $data['$credit.custom1'] = &$data['$invoice.custom1'];
 | 
				
			||||||
 | 
					            $data['$credit.custom2'] = &$data['$invoice.custom2'];
 | 
				
			||||||
 | 
					            $data['$credit.custom3'] = &$data['$invoice.custom3'];
 | 
				
			||||||
 | 
					            $data['$credit.custom4'] = &$data['$invoice.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if($this->entity->project) {
 | 
					            if($this->entity->project) {
 | 
				
			||||||
                $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')];
 | 
					                $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')];
 | 
				
			||||||
                $data['$invoice.project'] = &$data['$project.name'];
 | 
					                $data['$invoice.project'] = &$data['$project.name'];
 | 
				
			||||||
@ -226,6 +236,16 @@ class HtmlEngine
 | 
				
			|||||||
            $data['$custom3'] = &$data['$quote.custom3'];
 | 
					            $data['$custom3'] = &$data['$quote.custom3'];
 | 
				
			||||||
            $data['$custom4'] = &$data['$quote.custom4'];
 | 
					            $data['$custom4'] = &$data['$quote.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $data['$invoice.custom1'] = &$data['$quote.custom1'];
 | 
				
			||||||
 | 
					            $data['$invoice.custom2'] = &$data['$quote.custom2'];
 | 
				
			||||||
 | 
					            $data['$invoice.custom3'] = &$data['$quote.custom3'];
 | 
				
			||||||
 | 
					            $data['$invoice.custom4'] = &$data['$quote.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $data['$credit.custom1'] = &$data['$quote.custom1'];
 | 
				
			||||||
 | 
					            $data['$credit.custom2'] = &$data['$quote.custom2'];
 | 
				
			||||||
 | 
					            $data['$credit.custom3'] = &$data['$quote.custom3'];
 | 
				
			||||||
 | 
					            $data['$credit.custom4'] = &$data['$quote.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if($this->entity->project) {
 | 
					            if($this->entity->project) {
 | 
				
			||||||
                $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
 | 
					                $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
 | 
				
			||||||
                $data['$invoice.project'] = &$data['$project.name'];
 | 
					                $data['$invoice.project'] = &$data['$project.name'];
 | 
				
			||||||
@ -261,6 +281,16 @@ class HtmlEngine
 | 
				
			|||||||
            $data['$custom3'] = &$data['$credit.custom3'];
 | 
					            $data['$custom3'] = &$data['$credit.custom3'];
 | 
				
			||||||
            $data['$custom4'] = &$data['$credit.custom4'];
 | 
					            $data['$custom4'] = &$data['$credit.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $data['$quote.custom1'] = &$data['$credit.custom1'];
 | 
				
			||||||
 | 
					            $data['$quote.custom2'] = &$data['$credit.custom2'];
 | 
				
			||||||
 | 
					            $data['$quote.custom3'] = &$data['$credit.custom3'];
 | 
				
			||||||
 | 
					            $data['$quote.custom4'] = &$data['$credit.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            $data['$invoice.custom1'] = &$data['$credit.custom1'];
 | 
				
			||||||
 | 
					            $data['$invoice.custom2'] = &$data['$credit.custom2'];
 | 
				
			||||||
 | 
					            $data['$invoice.custom3'] = &$data['$credit.custom3'];
 | 
				
			||||||
 | 
					            $data['$invoice.custom4'] = &$data['$credit.custom4'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $data['$portal_url'] = ['value' => $this->invitation->getPortalLink(), 'label' =>''];
 | 
					        $data['$portal_url'] = ['value' => $this->invitation->getPortalLink(), 'label' =>''];
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										188902
									
								
								public/css/app.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										188902
									
								
								public/css/app.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										3632
									
								
								public/js/app.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3632
									
								
								public/js/app.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										138
									
								
								public/js/clients/invoices/action-selectors.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										138
									
								
								public/js/clients/invoices/action-selectors.js
									
									
									
									
										vendored
									
									
								
							@ -1,136 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see action-selectors.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,c=function(){};return{s:c,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var r,o,c;return r=t,o=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),!1!==t.checked){var o=document.createElement("INPUT");o.setAttribute("name","invoices[]"),o.setAttribute("value",t.dataset.value),o.setAttribute("class","child-hidden-input"),o.hidden=!0,n.append(o)}else{var c,i=document.querySelectorAll("input.child-hidden-input"),a=e(i);try{for(a.s();!(c=a.n()).done;){var l=c.value;l.value==t.dataset.value&&l.remove()}}catch(e){a.e(e)}finally{a.f()}}}},{key:"handle",value:function(){var t=this;this.parentElement.addEventListener("click",(function(){t.watchCheckboxes(t.parentElement)}));var n,r=e(document.querySelectorAll(".form-check-child"));try{var o=function(){var e=n.value;e.addEventListener("click",(function(){t.processChildItem(e,t.parentForm)}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}}],o&&n(r.prototype,o),c&&n(r,c),Object.defineProperty(r,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!***********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/invoices/action-selectors.js ***!
 | 
					 | 
				
			||||||
  \***********************************************************/
 | 
					 | 
				
			||||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ActionSelectors = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function ActionSelectors() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, ActionSelectors);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.parentElement = document.querySelector('.form-check-parent');
 | 
					 | 
				
			||||||
    this.parentForm = document.getElementById('bulkActions');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(ActionSelectors, [{
 | 
					 | 
				
			||||||
    key: "watchCheckboxes",
 | 
					 | 
				
			||||||
    value: function watchCheckboxes(parentElement) {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.remove();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.querySelectorAll('.form-check-child').forEach(function (child) {
 | 
					 | 
				
			||||||
        if (parentElement.checked) {
 | 
					 | 
				
			||||||
          child.checked = parentElement.checked;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          _this.processChildItem(child, document.getElementById('bulkActions'));
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          child.checked = false;
 | 
					 | 
				
			||||||
          document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
            return element.remove();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "processChildItem",
 | 
					 | 
				
			||||||
    value: function processChildItem(element, parent) {
 | 
					 | 
				
			||||||
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (options.hasOwnProperty('single')) {
 | 
					 | 
				
			||||||
        document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
          return element.remove();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (element.checked === false) {
 | 
					 | 
				
			||||||
        var inputs = document.querySelectorAll('input.child-hidden-input');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        var _iterator = _createForOfIteratorHelper(inputs),
 | 
					 | 
				
			||||||
            _step;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
 | 
					 | 
				
			||||||
            var i = _step.value;
 | 
					 | 
				
			||||||
            if (i.value == element.dataset.value) i.remove();
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        } catch (err) {
 | 
					 | 
				
			||||||
          _iterator.e(err);
 | 
					 | 
				
			||||||
        } finally {
 | 
					 | 
				
			||||||
          _iterator.f();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var _temp = document.createElement('INPUT');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('name', 'invoices[]');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('value', element.dataset.value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('class', 'child-hidden-input');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.hidden = true;
 | 
					 | 
				
			||||||
      parent.append(_temp);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.parentElement.addEventListener('click', function () {
 | 
					 | 
				
			||||||
        _this2.watchCheckboxes(_this2.parentElement);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var _iterator2 = _createForOfIteratorHelper(document.querySelectorAll('.form-check-child')),
 | 
					 | 
				
			||||||
          _step2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      try {
 | 
					 | 
				
			||||||
        var _loop = function _loop() {
 | 
					 | 
				
			||||||
          var child = _step2.value;
 | 
					 | 
				
			||||||
          child.addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this2.processChildItem(child, _this2.parentForm);
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
 | 
					 | 
				
			||||||
          _loop();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      } catch (err) {
 | 
					 | 
				
			||||||
        _iterator2.e(err);
 | 
					 | 
				
			||||||
      } finally {
 | 
					 | 
				
			||||||
        _iterator2.f();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return ActionSelectors;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
/** @handle **/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new ActionSelectors().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										128
									
								
								public/js/clients/invoices/payment.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										128
									
								
								public/js/clients/invoices/payment.js
									
									
									
									
										vendored
									
									
								
							@ -1,126 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see payment.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplayTerms=e,this.shouldDisplaySignature=n,this.termsAccepted=!1,this.submitting=!1}var n,i,a;return n=t,(i=[{key:"handleMethodSelect",value:function(e){var t=this;document.getElementById("company_gateway_id").value=e.dataset.companyGatewayId,document.getElementById("payment_method_id").value=e.dataset.gatewayTypeId,this.shouldDisplaySignature&&!this.shouldDisplayTerms&&(this.signaturePad&&this.signaturePad.isEmpty()&&alert("Please sign"),this.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){t.termsAccepted=!0,t.submitForm()}))),!this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.submitForm()}))),this.shouldDisplaySignature&&this.shouldDisplayTerms&&(this.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){t.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=t.signaturePad.toDataURL(),t.termsAccepted=!0,t.submitForm()}))}))),this.shouldDisplaySignature||this.shouldDisplayTerms||this.submitForm()}},{key:"submitForm",value:function(){this.submitting=!0,document.getElementById("payment-form").submit()}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});e.onEnd=function(){document.getElementById("signature-next-step").disabled=!1},this.signaturePad=e}},{key:"handle",value:function(){var e=this;document.getElementById("signature-next-step").disabled=!0,document.querySelectorAll(".dropdown-gateway-button").forEach((function(t){t.addEventListener("click",(function(){e.submitting||e.handleMethodSelect(t)}))}))}}])&&e(n.prototype,i),a&&e(n,a),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-invoice-signature"]').content,i=document.querySelector('meta[name="show-invoice-terms"]').content;new t(Boolean(+n),Boolean(+i)).handle()})();
 | 
				
			||||||
/*!**************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/invoices/payment.js ***!
 | 
					 | 
				
			||||||
  \**************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var Payment = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function Payment(displayTerms, displaySignature) {
 | 
					 | 
				
			||||||
    _classCallCheck(this, Payment);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.shouldDisplayTerms = displayTerms;
 | 
					 | 
				
			||||||
    this.shouldDisplaySignature = displaySignature;
 | 
					 | 
				
			||||||
    this.termsAccepted = false;
 | 
					 | 
				
			||||||
    this.submitting = false;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(Payment, [{
 | 
					 | 
				
			||||||
    key: "handleMethodSelect",
 | 
					 | 
				
			||||||
    value: function handleMethodSelect(element) {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById("company_gateway_id").value = element.dataset.companyGatewayId;
 | 
					 | 
				
			||||||
      document.getElementById("payment_method_id").value = element.dataset.gatewayTypeId;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (this.shouldDisplaySignature && !this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
        if (this.signaturePad && this.signaturePad.isEmpty()) alert("Please sign");
 | 
					 | 
				
			||||||
        this.displayTerms();
 | 
					 | 
				
			||||||
        document.getElementById("accept-terms-button").addEventListener("click", function () {
 | 
					 | 
				
			||||||
          _this.termsAccepted = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          _this.submitForm();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!this.shouldDisplaySignature && this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
        this.displaySignature();
 | 
					 | 
				
			||||||
        document.getElementById("signature-next-step").addEventListener("click", function () {
 | 
					 | 
				
			||||||
          document.querySelector('input[name="signature"').value = _this.signaturePad.toDataURL();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          _this.submitForm();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (this.shouldDisplaySignature && this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
        this.displaySignature();
 | 
					 | 
				
			||||||
        document.getElementById("signature-next-step").addEventListener("click", function () {
 | 
					 | 
				
			||||||
          _this.displayTerms();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById("accept-terms-button").addEventListener("click", function () {
 | 
					 | 
				
			||||||
            document.querySelector('input[name="signature"').value = _this.signaturePad.toDataURL();
 | 
					 | 
				
			||||||
            _this.termsAccepted = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            _this.submitForm();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!this.shouldDisplaySignature && !this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
        this.submitForm();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "submitForm",
 | 
					 | 
				
			||||||
    value: function submitForm() {
 | 
					 | 
				
			||||||
      this.submitting = true;
 | 
					 | 
				
			||||||
      document.getElementById("payment-form").submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "displayTerms",
 | 
					 | 
				
			||||||
    value: function displayTerms() {
 | 
					 | 
				
			||||||
      var displayTermsModal = document.getElementById("displayTermsModal");
 | 
					 | 
				
			||||||
      displayTermsModal.removeAttribute("style");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "displaySignature",
 | 
					 | 
				
			||||||
    value: function displaySignature() {
 | 
					 | 
				
			||||||
      var displaySignatureModal = document.getElementById("displaySignatureModal");
 | 
					 | 
				
			||||||
      displaySignatureModal.removeAttribute("style");
 | 
					 | 
				
			||||||
      var signaturePad = new SignaturePad(document.getElementById("signature-pad"), {
 | 
					 | 
				
			||||||
        penColor: "rgb(0, 0, 0)"
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      signaturePad.onEnd = function () {
 | 
					 | 
				
			||||||
        document.getElementById("signature-next-step").disabled = false;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.signaturePad = signaturePad;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById("signature-next-step").disabled = true;
 | 
					 | 
				
			||||||
      document.querySelectorAll(".dropdown-gateway-button").forEach(function (element) {
 | 
					 | 
				
			||||||
        element.addEventListener("click", function () {
 | 
					 | 
				
			||||||
          if (!_this2.submitting) {
 | 
					 | 
				
			||||||
            _this2.handleMethodSelect(element);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return Payment;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var signature = document.querySelector('meta[name="require-invoice-signature"]').content;
 | 
					 | 
				
			||||||
var terms = document.querySelector('meta[name="show-invoice-terms"]').content;
 | 
					 | 
				
			||||||
new Payment(Boolean(+signature), Boolean(+terms)).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										377
									
								
								public/js/clients/linkify-urls.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										377
									
								
								public/js/clients/linkify-urls.js
									
									
									
									
										vendored
									
									
								
							@ -1,376 +1 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					(()=>{var e,t={2623:(e,t,r)=>{"use strict";e.exports=r(4666)},1886:(e,t)=>{"use strict";const r=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"),n=e=>e.replace(/>/g,">").replace(/</g,"<").replace(/�?39;/g,"'").replace(/"/g,'"').replace(/&/g,"&");t.T=(e,...t)=>{if("string"==typeof e)return r(e);let n=e[0];for(const[o,a]of t.entries())n=n+r(String(a))+e[o+1];return n}},2395:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});var n=r(1886);var o=r(2623);const a=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">");const i=new Set(o);function c({name:e="div",attributes:t={},html:r="",text:o}={}){if(r&&o)throw new Error("The `html` and `text` options are mutually exclusive");const c=o?function(e,...t){if("string"==typeof e)return a(e);let r=e[0];for(const[n,o]of t.entries())r=r+a(String(o))+e[n+1];return r}(o):r;let l=`<${e}${function(e){const t=[];for(let[r,o]of Object.entries(e)){if(!1===o)continue;Array.isArray(o)&&(o=o.join(" "));let e=(0,n.T)(r);!0!==o&&(e+=`="${(0,n.T)(String(o))}"`),t.push(e)}return t.length>0?" "+t.join(" "):""}(t)}>`;return i.has(e)||(l+=`${c}</${e}>`),l}const l=(e,t)=>c({name:"a",attributes:{href:"",...t.attributes,href:e},text:void 0===t.value?e:void 0,html:void 0===t.value?void 0:"function"==typeof t.value?t.value(e):t.value});function s(e,t){if("string"===(t={attributes:{},type:"string",...t}).type)return((e,t)=>e.replace(/((?<!\+)https?:\/\/(?:www\.)?(?:[-\w.]+?[.@][a-zA-Z\d]{2,}|localhost)(?:[-\w.:%+~#*$!?&/=@]*?(?:,(?!\s))*?)*)/g,(e=>l(e,t))))(e,t);if("dom"===t.type)return((e,t)=>{const r=document.createDocumentFragment();for(const[o,a]of Object.entries(e.split(/((?<!\+)https?:\/\/(?:www\.)?(?:[-\w.]+?[.@][a-zA-Z\d]{2,}|localhost)(?:[-\w.:%+~#*$!?&/=@]*?(?:,(?!\s))*?)*)/g)))o%2?r.append((n=l(a,t),document.createRange().createContextualFragment(n))):a.length>0&&r.append(a);var n;return r})(e,t);throw new TypeError("The type option must be either `dom` or `string`")}},4666:e=>{"use strict";e.exports=JSON.parse('["area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track","wbr"]')}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e=n(2395),document.querySelectorAll("[data-ref=entity-terms]").forEach((function(t){"function"===e&&(t.innerHTML=e(t.innerText,{attributes:{target:"_blank",class:"text-primary"}}))}))})();
 | 
				
			||||||
/******/ 	var __webpack_modules__ = ({
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/html-tags/void.js":
 | 
					 | 
				
			||||||
/*!****************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/html-tags/void.js ***!
 | 
					 | 
				
			||||||
  \****************************************/
 | 
					 | 
				
			||||||
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
module.exports = __webpack_require__(/*! ./html-tags-void.json */ "./node_modules/html-tags/html-tags-void.json");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ }),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/stringify-attributes/node_modules/escape-goat/index.js":
 | 
					 | 
				
			||||||
/*!*****************************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/stringify-attributes/node_modules/escape-goat/index.js ***!
 | 
					 | 
				
			||||||
  \*****************************************************************************/
 | 
					 | 
				
			||||||
/***/ ((__unused_webpack_module, exports) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const htmlEscape = string => string
 | 
					 | 
				
			||||||
	.replace(/&/g, '&')
 | 
					 | 
				
			||||||
	.replace(/"/g, '"')
 | 
					 | 
				
			||||||
	.replace(/'/g, ''')
 | 
					 | 
				
			||||||
	.replace(/</g, '<')
 | 
					 | 
				
			||||||
	.replace(/>/g, '>');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const htmlUnescape = htmlString => htmlString
 | 
					 | 
				
			||||||
	.replace(/>/g, '>')
 | 
					 | 
				
			||||||
	.replace(/</g, '<')
 | 
					 | 
				
			||||||
	.replace(/�?39;/g, '\'')
 | 
					 | 
				
			||||||
	.replace(/"/g, '"')
 | 
					 | 
				
			||||||
	.replace(/&/g, '&');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
exports.htmlEscape = (strings, ...values) => {
 | 
					 | 
				
			||||||
	if (typeof strings === 'string') {
 | 
					 | 
				
			||||||
		return htmlEscape(strings);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let output = strings[0];
 | 
					 | 
				
			||||||
	for (const [index, value] of values.entries()) {
 | 
					 | 
				
			||||||
		output = output + htmlEscape(String(value)) + strings[index + 1];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return output;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
exports.htmlUnescape = (strings, ...values) => {
 | 
					 | 
				
			||||||
	if (typeof strings === 'string') {
 | 
					 | 
				
			||||||
		return htmlUnescape(strings);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let output = strings[0];
 | 
					 | 
				
			||||||
	for (const [index, value] of values.entries()) {
 | 
					 | 
				
			||||||
		output = output + htmlUnescape(String(value)) + strings[index + 1];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return output;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ }),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/create-html-element/index.js":
 | 
					 | 
				
			||||||
/*!***************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/create-html-element/index.js ***!
 | 
					 | 
				
			||||||
  \***************************************************/
 | 
					 | 
				
			||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
__webpack_require__.r(__webpack_exports__);
 | 
					 | 
				
			||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
 | 
					 | 
				
			||||||
/* harmony export */   "default": () => (/* binding */ createHtmlElement)
 | 
					 | 
				
			||||||
/* harmony export */ });
 | 
					 | 
				
			||||||
/* harmony import */ var stringify_attributes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! stringify-attributes */ "./node_modules/stringify-attributes/index.js");
 | 
					 | 
				
			||||||
/* harmony import */ var html_tags_void_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! html-tags/void.js */ "./node_modules/html-tags/void.js");
 | 
					 | 
				
			||||||
/* harmony import */ var escape_goat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! escape-goat */ "./node_modules/escape-goat/index.js");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const voidHtmlTags = new Set(html_tags_void_js__WEBPACK_IMPORTED_MODULE_1__);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function createHtmlElement(
 | 
					 | 
				
			||||||
	{
 | 
					 | 
				
			||||||
		name = 'div',
 | 
					 | 
				
			||||||
		attributes = {},
 | 
					 | 
				
			||||||
		html = '',
 | 
					 | 
				
			||||||
		text,
 | 
					 | 
				
			||||||
	} = {},
 | 
					 | 
				
			||||||
) {
 | 
					 | 
				
			||||||
	if (html && text) {
 | 
					 | 
				
			||||||
		throw new Error('The `html` and `text` options are mutually exclusive');
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	const content = text ? (0,escape_goat__WEBPACK_IMPORTED_MODULE_2__.htmlEscape)(text) : html;
 | 
					 | 
				
			||||||
	let result = `<${name}${(0,stringify_attributes__WEBPACK_IMPORTED_MODULE_0__["default"])(attributes)}>`;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (!voidHtmlTags.has(name)) {
 | 
					 | 
				
			||||||
		result += `${content}</${name}>`;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return result;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ }),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/escape-goat/index.js":
 | 
					 | 
				
			||||||
/*!*******************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/escape-goat/index.js ***!
 | 
					 | 
				
			||||||
  \*******************************************/
 | 
					 | 
				
			||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
__webpack_require__.r(__webpack_exports__);
 | 
					 | 
				
			||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
 | 
					 | 
				
			||||||
/* harmony export */   "htmlEscape": () => (/* binding */ htmlEscape),
 | 
					 | 
				
			||||||
/* harmony export */   "htmlUnescape": () => (/* binding */ htmlUnescape)
 | 
					 | 
				
			||||||
/* harmony export */ });
 | 
					 | 
				
			||||||
const _htmlEscape = string => string
 | 
					 | 
				
			||||||
	.replace(/&/g, '&')
 | 
					 | 
				
			||||||
	.replace(/"/g, '"')
 | 
					 | 
				
			||||||
	.replace(/'/g, ''')
 | 
					 | 
				
			||||||
	.replace(/</g, '<')
 | 
					 | 
				
			||||||
	.replace(/>/g, '>');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const _htmlUnescape = htmlString => htmlString
 | 
					 | 
				
			||||||
	.replace(/>/g, '>')
 | 
					 | 
				
			||||||
	.replace(/</g, '<')
 | 
					 | 
				
			||||||
	.replace(/�?39;/g, '\'')
 | 
					 | 
				
			||||||
	.replace(/"/g, '"')
 | 
					 | 
				
			||||||
	.replace(/&/g, '&');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function htmlEscape(strings, ...values) {
 | 
					 | 
				
			||||||
	if (typeof strings === 'string') {
 | 
					 | 
				
			||||||
		return _htmlEscape(strings);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let output = strings[0];
 | 
					 | 
				
			||||||
	for (const [index, value] of values.entries()) {
 | 
					 | 
				
			||||||
		output = output + _htmlEscape(String(value)) + strings[index + 1];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return output;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function htmlUnescape(strings, ...values) {
 | 
					 | 
				
			||||||
	if (typeof strings === 'string') {
 | 
					 | 
				
			||||||
		return _htmlUnescape(strings);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let output = strings[0];
 | 
					 | 
				
			||||||
	for (const [index, value] of values.entries()) {
 | 
					 | 
				
			||||||
		output = output + _htmlUnescape(String(value)) + strings[index + 1];
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return output;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ }),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/linkify-urls/index.js":
 | 
					 | 
				
			||||||
/*!********************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/linkify-urls/index.js ***!
 | 
					 | 
				
			||||||
  \********************************************/
 | 
					 | 
				
			||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
__webpack_require__.r(__webpack_exports__);
 | 
					 | 
				
			||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
 | 
					 | 
				
			||||||
/* harmony export */   "default": () => (/* binding */ linkifyUrls)
 | 
					 | 
				
			||||||
/* harmony export */ });
 | 
					 | 
				
			||||||
/* harmony import */ var create_html_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! create-html-element */ "./node_modules/create-html-element/index.js");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Capture the whole URL in group 1 to keep `String#split()` support
 | 
					 | 
				
			||||||
const urlRegex = () => (/((?<!\+)https?:\/\/(?:www\.)?(?:[-\w.]+?[.@][a-zA-Z\d]{2,}|localhost)(?:[-\w.:%+~#*$!?&/=@]*?(?:,(?!\s))*?)*)/g);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Get `<a>` element as string
 | 
					 | 
				
			||||||
const linkify = (href, options) => (0,create_html_element__WEBPACK_IMPORTED_MODULE_0__["default"])({
 | 
					 | 
				
			||||||
	name: 'a',
 | 
					 | 
				
			||||||
	attributes: {
 | 
					 | 
				
			||||||
		href: '',
 | 
					 | 
				
			||||||
		...options.attributes,
 | 
					 | 
				
			||||||
		href, // eslint-disable-line no-dupe-keys
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
	text: typeof options.value === 'undefined' ? href : undefined,
 | 
					 | 
				
			||||||
	html: typeof options.value === 'undefined' ? undefined
 | 
					 | 
				
			||||||
		: (typeof options.value === 'function' ? options.value(href) : options.value),
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Get DOM node from HTML
 | 
					 | 
				
			||||||
const domify = html => document.createRange().createContextualFragment(html);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const getAsString = (string, options) => string.replace(urlRegex(), match => linkify(match, options));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
const getAsDocumentFragment = (string, options) => {
 | 
					 | 
				
			||||||
	const fragment = document.createDocumentFragment();
 | 
					 | 
				
			||||||
	for (const [index, text] of Object.entries(string.split(urlRegex()))) {
 | 
					 | 
				
			||||||
		if (index % 2) { // URLs are always in odd positions
 | 
					 | 
				
			||||||
			fragment.append(domify(linkify(text, options)));
 | 
					 | 
				
			||||||
		} else if (text.length > 0) {
 | 
					 | 
				
			||||||
			fragment.append(text);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return fragment;
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function linkifyUrls(string, options) {
 | 
					 | 
				
			||||||
	options = {
 | 
					 | 
				
			||||||
		attributes: {},
 | 
					 | 
				
			||||||
		type: 'string',
 | 
					 | 
				
			||||||
		...options,
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (options.type === 'string') {
 | 
					 | 
				
			||||||
		return getAsString(string, options);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (options.type === 'dom') {
 | 
					 | 
				
			||||||
		return getAsDocumentFragment(string, options);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	throw new TypeError('The type option must be either `dom` or `string`');
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ }),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/stringify-attributes/index.js":
 | 
					 | 
				
			||||||
/*!****************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/stringify-attributes/index.js ***!
 | 
					 | 
				
			||||||
  \****************************************************/
 | 
					 | 
				
			||||||
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
__webpack_require__.r(__webpack_exports__);
 | 
					 | 
				
			||||||
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
 | 
					 | 
				
			||||||
/* harmony export */   "default": () => (/* binding */ stringifyAttributes)
 | 
					 | 
				
			||||||
/* harmony export */ });
 | 
					 | 
				
			||||||
/* harmony import */ var escape_goat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! escape-goat */ "./node_modules/stringify-attributes/node_modules/escape-goat/index.js");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function stringifyAttributes(attributes) {
 | 
					 | 
				
			||||||
	const handledAttributes = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	for (let [key, value] of Object.entries(attributes)) {
 | 
					 | 
				
			||||||
		if (value === false) {
 | 
					 | 
				
			||||||
			continue;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (Array.isArray(value)) {
 | 
					 | 
				
			||||||
			value = value.join(' ');
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		let attribute = (0,escape_goat__WEBPACK_IMPORTED_MODULE_0__.htmlEscape)(key);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (value !== true) {
 | 
					 | 
				
			||||||
			attribute += `="${(0,escape_goat__WEBPACK_IMPORTED_MODULE_0__.htmlEscape)(String(value))}"`;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		handledAttributes.push(attribute);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return handledAttributes.length > 0 ? ' ' + handledAttributes.join(' ') : '';
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ }),
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ "./node_modules/html-tags/html-tags-void.json":
 | 
					 | 
				
			||||||
/*!****************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./node_modules/html-tags/html-tags-void.json ***!
 | 
					 | 
				
			||||||
  \****************************************************/
 | 
					 | 
				
			||||||
/***/ ((module) => {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
"use strict";
 | 
					 | 
				
			||||||
module.exports = JSON.parse('["area","base","br","col","embed","hr","img","input","link","menuitem","meta","param","source","track","wbr"]');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/***/ })
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/******/ 	});
 | 
					 | 
				
			||||||
/************************************************************************/
 | 
					 | 
				
			||||||
/******/ 	// The module cache
 | 
					 | 
				
			||||||
/******/ 	var __webpack_module_cache__ = {};
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/******/ 	// The require function
 | 
					 | 
				
			||||||
/******/ 	function __webpack_require__(moduleId) {
 | 
					 | 
				
			||||||
/******/ 		// Check if module is in cache
 | 
					 | 
				
			||||||
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
 | 
					 | 
				
			||||||
/******/ 		if (cachedModule !== undefined) {
 | 
					 | 
				
			||||||
/******/ 			return cachedModule.exports;
 | 
					 | 
				
			||||||
/******/ 		}
 | 
					 | 
				
			||||||
/******/ 		// Create a new module (and put it into the cache)
 | 
					 | 
				
			||||||
/******/ 		var module = __webpack_module_cache__[moduleId] = {
 | 
					 | 
				
			||||||
/******/ 			// no module.id needed
 | 
					 | 
				
			||||||
/******/ 			// no module.loaded needed
 | 
					 | 
				
			||||||
/******/ 			exports: {}
 | 
					 | 
				
			||||||
/******/ 		};
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/******/ 		// Execute the module function
 | 
					 | 
				
			||||||
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/******/ 		// Return the exports of the module
 | 
					 | 
				
			||||||
/******/ 		return module.exports;
 | 
					 | 
				
			||||||
/******/ 	}
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/************************************************************************/
 | 
					 | 
				
			||||||
/******/ 	/* webpack/runtime/define property getters */
 | 
					 | 
				
			||||||
/******/ 	(() => {
 | 
					 | 
				
			||||||
/******/ 		// define getter functions for harmony exports
 | 
					 | 
				
			||||||
/******/ 		__webpack_require__.d = (exports, definition) => {
 | 
					 | 
				
			||||||
/******/ 			for(var key in definition) {
 | 
					 | 
				
			||||||
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
 | 
					 | 
				
			||||||
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
 | 
					 | 
				
			||||||
/******/ 				}
 | 
					 | 
				
			||||||
/******/ 			}
 | 
					 | 
				
			||||||
/******/ 		};
 | 
					 | 
				
			||||||
/******/ 	})();
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
 | 
					 | 
				
			||||||
/******/ 	(() => {
 | 
					 | 
				
			||||||
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
 | 
					 | 
				
			||||||
/******/ 	})();
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/******/ 	/* webpack/runtime/make namespace object */
 | 
					 | 
				
			||||||
/******/ 	(() => {
 | 
					 | 
				
			||||||
/******/ 		// define __esModule on exports
 | 
					 | 
				
			||||||
/******/ 		__webpack_require__.r = (exports) => {
 | 
					 | 
				
			||||||
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 | 
					 | 
				
			||||||
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 | 
					 | 
				
			||||||
/******/ 			}
 | 
					 | 
				
			||||||
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
 | 
					 | 
				
			||||||
/******/ 		};
 | 
					 | 
				
			||||||
/******/ 	})();
 | 
					 | 
				
			||||||
/******/ 	
 | 
					 | 
				
			||||||
/************************************************************************/
 | 
					 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					 | 
				
			||||||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
 | 
					 | 
				
			||||||
(() => {
 | 
					 | 
				
			||||||
/*!**********************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/linkify-urls.js ***!
 | 
					 | 
				
			||||||
  \**********************************************/
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var linkifyUrls = __webpack_require__(/*! linkify-urls */ "./node_modules/linkify-urls/index.js");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
document.querySelectorAll('[data-ref=entity-terms]').forEach(function (text) {
 | 
					 | 
				
			||||||
  if (linkifyUrls === 'function') {
 | 
					 | 
				
			||||||
    text.innerHTML = linkifyUrls(text.innerText, {
 | 
					 | 
				
			||||||
      attributes: {
 | 
					 | 
				
			||||||
        target: '_blank',
 | 
					 | 
				
			||||||
        "class": 'text-primary'
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
})();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,95 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see authorize-authorize-card.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var a=0;a<t.length;a++){var r=t[a];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var t=function(){function t(e,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.publicKey=e,this.loginId=a,this.cardHolderName=document.getElementById("cardholder_name"),this.cardButton=document.getElementById("card_button")}var a,r,n;return a=t,(r=[{key:"handleAuthorization",value:function(){var e=$("#my-card"),t={};t.clientKey=this.publicKey,t.apiLoginID=this.loginId;var a={};a.cardNumber=e.CardJs("cardNumber").replace(/[^\d]/g,""),a.month=e.CardJs("expiryMonth").replace(/[^\d]/g,""),a.year=e.CardJs("expiryYear").replace(/[^\d]/g,""),a.cardCode=document.getElementById("cvv").value.replace(/[^\d]/g,"");var r={};return r.authData=t,r.cardData=a,document.getElementById("card_button").disabled=!0,document.querySelector("#card_button > svg").classList.remove("hidden"),document.querySelector("#card_button > span").classList.add("hidden"),Accept.dispatchData(r,this.responseHandler),!1}},{key:"responseHandler",value:function(e){return"Error"===e.messages.resultCode?($("#errors").show().html("<p>"+e.messages.message[0].code+": "+e.messages.message[0].text+"</p>"),document.getElementById("card_button").disabled=!1,document.querySelector("#card_button > svg").classList.add("hidden"),document.querySelector("#card_button > span").classList.remove("hidden")):"Ok"===e.messages.resultCode&&(document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue,document.getElementById("server_response").submit()),!1}},{key:"handle",value:function(){var e=this;return this.cardButton.addEventListener("click",(function(){e.cardButton.disabled=!e.cardButton.disabled,e.handleAuthorization()})),this}}])&&e(a.prototype,r),n&&e(a,n),Object.defineProperty(a,"prototype",{writable:!1}),t}();new t(document.querySelector('meta[name="authorize-public-key"]').content,document.querySelector('meta[name="authorize-login-id"]').content).handle()})();
 | 
				
			||||||
/*!**************************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payment_methods/authorize-authorize-card.js ***!
 | 
					 | 
				
			||||||
  \**************************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var AuthorizeAuthorizeCard = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function AuthorizeAuthorizeCard(publicKey, loginId) {
 | 
					 | 
				
			||||||
    _classCallCheck(this, AuthorizeAuthorizeCard);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.publicKey = publicKey;
 | 
					 | 
				
			||||||
    this.loginId = loginId;
 | 
					 | 
				
			||||||
    this.cardHolderName = document.getElementById("cardholder_name");
 | 
					 | 
				
			||||||
    this.cardButton = document.getElementById("card_button");
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(AuthorizeAuthorizeCard, [{
 | 
					 | 
				
			||||||
    key: "handleAuthorization",
 | 
					 | 
				
			||||||
    value: function handleAuthorization() {
 | 
					 | 
				
			||||||
      var myCard = $('#my-card');
 | 
					 | 
				
			||||||
      var authData = {};
 | 
					 | 
				
			||||||
      authData.clientKey = this.publicKey;
 | 
					 | 
				
			||||||
      authData.apiLoginID = this.loginId;
 | 
					 | 
				
			||||||
      var cardData = {};
 | 
					 | 
				
			||||||
      cardData.cardNumber = myCard.CardJs('cardNumber').replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      cardData.month = myCard.CardJs('expiryMonth').replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      cardData.year = myCard.CardJs('expiryYear').replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      cardData.cardCode = document.getElementById("cvv").value.replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      ;
 | 
					 | 
				
			||||||
      var secureData = {};
 | 
					 | 
				
			||||||
      secureData.authData = authData;
 | 
					 | 
				
			||||||
      secureData.cardData = cardData;
 | 
					 | 
				
			||||||
      document.getElementById('card_button').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#card_button > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#card_button > span').classList.add('hidden');
 | 
					 | 
				
			||||||
      Accept.dispatchData(secureData, this.responseHandler);
 | 
					 | 
				
			||||||
      return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "responseHandler",
 | 
					 | 
				
			||||||
    value: function responseHandler(response) {
 | 
					 | 
				
			||||||
      if (response.messages.resultCode === "Error") {
 | 
					 | 
				
			||||||
        var i = 0;
 | 
					 | 
				
			||||||
        var $errors = $('#errors'); // get the reference of the div
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $errors.show().html("<p>" + response.messages.message[i].code + ": " + response.messages.message[i].text + "</p>");
 | 
					 | 
				
			||||||
        document.getElementById('card_button').disabled = false;
 | 
					 | 
				
			||||||
        document.querySelector('#card_button > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#card_button > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
      } else if (response.messages.resultCode === "Ok") {
 | 
					 | 
				
			||||||
        document.getElementById("dataDescriptor").value = response.opaqueData.dataDescriptor;
 | 
					 | 
				
			||||||
        document.getElementById("dataValue").value = response.opaqueData.dataValue;
 | 
					 | 
				
			||||||
        document.getElementById("server_response").submit();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.cardButton.addEventListener("click", function () {
 | 
					 | 
				
			||||||
        _this.cardButton.disabled = !_this.cardButton.disabled;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this.handleAuthorization();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return AuthorizeAuthorizeCard;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publicKey = document.querySelector('meta[name="authorize-public-key"]').content;
 | 
					 | 
				
			||||||
var loginId = document.querySelector('meta[name="authorize-login-id"]').content;
 | 
					 | 
				
			||||||
/** @handle */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new AuthorizeAuthorizeCard(publicKey, loginId).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,59 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see authorize-checkout-card.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.button=document.querySelector("#pay-button")}var n,r,a;return n=t,(r=[{key:"init",value:function(){this.frames=Frames.init(document.querySelector("meta[name=public-key]").content)}},{key:"handle",value:function(){var e=this;this.init(),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(t){e.button.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e),document.getElementById("server_response").submit()})),document.querySelector("#authorization-form").addEventListener("submit",(function(t){e.button.disabled=!0,t.preventDefault(),Frames.submitCard()}))}}])&&e(n.prototype,r),a&&e(n,a),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!*************************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payment_methods/authorize-checkout-card.js ***!
 | 
					 | 
				
			||||||
  \*************************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var CheckoutCreditCardAuthorization = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function CheckoutCreditCardAuthorization() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, CheckoutCreditCardAuthorization);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.button = document.querySelector('#pay-button');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(CheckoutCreditCardAuthorization, [{
 | 
					 | 
				
			||||||
    key: "init",
 | 
					 | 
				
			||||||
    value: function init() {
 | 
					 | 
				
			||||||
      this.frames = Frames.init(document.querySelector('meta[name=public-key]').content);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.init();
 | 
					 | 
				
			||||||
      Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED, function (event) {
 | 
					 | 
				
			||||||
        _this.button.disabled = !Frames.isCardValid();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      Frames.addEventHandler(Frames.Events.CARD_TOKENIZED, function (event) {
 | 
					 | 
				
			||||||
        document.querySelector('input[name="gateway_response"]').value = JSON.stringify(event);
 | 
					 | 
				
			||||||
        document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.querySelector('#authorization-form').addEventListener('submit', function (event) {
 | 
					 | 
				
			||||||
        _this.button.disabled = true;
 | 
					 | 
				
			||||||
        event.preventDefault();
 | 
					 | 
				
			||||||
        Frames.submitCard();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return CheckoutCreditCardAuthorization;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new CheckoutCreditCardAuthorization().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,69 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see braintree-ach.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e;window.braintree.client.create({authorization:null===(e=document.querySelector('meta[name="client-token"]'))||void 0===e?void 0:e.content}).then((function(e){return braintree.usBankAccount.create({client:e})})).then((function(e){var t;null===(t=document.getElementById("authorize-bank-account"))||void 0===t||t.addEventListener("click",(function(t){t.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,document.getElementById("errors").textContent="";var n={accountNumber:document.getElementById("account-number").value,routingNumber:document.getElementById("routing-number").value,accountType:document.querySelector('input[name="account-type"]:checked').value,ownershipType:document.querySelector('input[name="ownership-type"]:checked').value,billingAddress:{streetAddress:document.getElementById("billing-street-address").value,extendedAddress:document.getElementById("billing-extended-address").value,locality:document.getElementById("billing-locality").value,region:document.getElementById("billing-region").value,postalCode:document.getElementById("billing-postal-code").value}};if("personal"===n.ownershipType){var o=document.getElementById("account-holder-name").value.split(" ",2);n.firstName=o[0],n.lastName=o[1]}else n.businessName=document.getElementById("account-holder-name").value;e.tokenize({bankDetails:n,mandateText:'By clicking ["Checkout"], I authorize Braintree, a service of PayPal, on behalf of [your business name here] (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.'}).then((function(e){document.querySelector("input[name=nonce]").value=e.nonce,document.getElementById("server_response").submit()})).catch((function(e){t.target.parentElement.disabled=!1,document.getElementById("errors").textContent="".concat(e.details.originalError.message," ").concat(e.details.originalError.details.originalError[0].message),document.getElementById("errors").hidden=!1}))}))})).catch((function(e){document.getElementById("errors").textContent=e.message,document.getElementById("errors").hidden=!1}))})();
 | 
				
			||||||
/*!***************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payment_methods/braintree-ach.js ***!
 | 
					 | 
				
			||||||
  \***************************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
window.braintree.client.create({
 | 
					 | 
				
			||||||
  authorization: (_document$querySelect = document.querySelector('meta[name="client-token"]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content
 | 
					 | 
				
			||||||
}).then(function (clientInstance) {
 | 
					 | 
				
			||||||
  return braintree.usBankAccount.create({
 | 
					 | 
				
			||||||
    client: clientInstance
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
}).then(function (usBankAccountInstance) {
 | 
					 | 
				
			||||||
  var _document$getElementB;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  (_document$getElementB = document.getElementById('authorize-bank-account')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
    e.target.parentElement.disabled = true;
 | 
					 | 
				
			||||||
    document.getElementById('errors').hidden = true;
 | 
					 | 
				
			||||||
    document.getElementById('errors').textContent = '';
 | 
					 | 
				
			||||||
    var bankDetails = {
 | 
					 | 
				
			||||||
      accountNumber: document.getElementById('account-number').value,
 | 
					 | 
				
			||||||
      routingNumber: document.getElementById('routing-number').value,
 | 
					 | 
				
			||||||
      accountType: document.querySelector('input[name="account-type"]:checked').value,
 | 
					 | 
				
			||||||
      ownershipType: document.querySelector('input[name="ownership-type"]:checked').value,
 | 
					 | 
				
			||||||
      billingAddress: {
 | 
					 | 
				
			||||||
        streetAddress: document.getElementById('billing-street-address').value,
 | 
					 | 
				
			||||||
        extendedAddress: document.getElementById('billing-extended-address').value,
 | 
					 | 
				
			||||||
        locality: document.getElementById('billing-locality').value,
 | 
					 | 
				
			||||||
        region: document.getElementById('billing-region').value,
 | 
					 | 
				
			||||||
        postalCode: document.getElementById('billing-postal-code').value
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (bankDetails.ownershipType === 'personal') {
 | 
					 | 
				
			||||||
      var name = document.getElementById('account-holder-name').value.split(' ', 2);
 | 
					 | 
				
			||||||
      bankDetails.firstName = name[0];
 | 
					 | 
				
			||||||
      bankDetails.lastName = name[1];
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      bankDetails.businessName = document.getElementById('account-holder-name').value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    usBankAccountInstance.tokenize({
 | 
					 | 
				
			||||||
      bankDetails: bankDetails,
 | 
					 | 
				
			||||||
      mandateText: 'By clicking ["Checkout"], I authorize Braintree, a service of PayPal, on behalf of [your business name here] (i) to verify my bank account information using bank information and consumer reports and (ii) to debit my bank account.'
 | 
					 | 
				
			||||||
    }).then(function (payload) {
 | 
					 | 
				
			||||||
      document.querySelector('input[name=nonce]').value = payload.nonce;
 | 
					 | 
				
			||||||
      document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
    })["catch"](function (error) {
 | 
					 | 
				
			||||||
      e.target.parentElement.disabled = false;
 | 
					 | 
				
			||||||
      document.getElementById('errors').textContent = "".concat(error.details.originalError.message, " ").concat(error.details.originalError.details.originalError[0].message);
 | 
					 | 
				
			||||||
      document.getElementById('errors').hidden = false;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
})["catch"](function (err) {
 | 
					 | 
				
			||||||
  document.getElementById('errors').textContent = err.message;
 | 
					 | 
				
			||||||
  document.getElementById('errors').hidden = false;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,77 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see wepay-bank-account.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var n=function(){function n(){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n)}var t,o,r;return t=n,(o=[{key:"initializeWePay",value:function(){var e,n=null===(e=document.querySelector('meta[name="wepay-environment"]'))||void 0===e?void 0:e.content;return WePay.set_endpoint("staging"===n?"stage":"production"),this}},{key:"showBankPopup",value:function(){var e,n;WePay.bank_account.create({client_id:null===(e=document.querySelector("meta[name=wepay-client-id]"))||void 0===e?void 0:e.content,email:null===(n=document.querySelector("meta[name=contact-email]"))||void 0===n?void 0:n.content,options:{avoidMicrodeposits:!0}},(function(e){e.error?(errors.textContent="",errors.textContent=e.error_description,errors.hidden=!1):(document.querySelector('input[name="bank_account_id"]').value=e.bank_account_id,document.getElementById("server_response").submit())}),(function(e){e.error&&(errors.textContent="",errors.textContent=e.error_description,errors.hidden=!1)}))}},{key:"handle",value:function(){this.initializeWePay().showBankPopup()}}])&&e(t.prototype,o),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),n}();document.addEventListener("DOMContentLoaded",(function(){(new n).handle()}))})();
 | 
				
			||||||
/*!********************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payment_methods/wepay-bank-account.js ***!
 | 
					 | 
				
			||||||
  \********************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var WePayBank = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function WePayBank() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, WePayBank);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(WePayBank, [{
 | 
					 | 
				
			||||||
    key: "initializeWePay",
 | 
					 | 
				
			||||||
    value: function initializeWePay() {
 | 
					 | 
				
			||||||
      var _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var environment = (_document$querySelect = document.querySelector('meta[name="wepay-environment"]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
 | 
					 | 
				
			||||||
      WePay.set_endpoint(environment === 'staging' ? 'stage' : 'production');
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "showBankPopup",
 | 
					 | 
				
			||||||
    value: function showBankPopup() {
 | 
					 | 
				
			||||||
      var _document$querySelect2, _document$querySelect3;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      WePay.bank_account.create({
 | 
					 | 
				
			||||||
        client_id: (_document$querySelect2 = document.querySelector('meta[name=wepay-client-id]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content,
 | 
					 | 
				
			||||||
        email: (_document$querySelect3 = document.querySelector('meta[name=contact-email]')) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.content,
 | 
					 | 
				
			||||||
        options: {
 | 
					 | 
				
			||||||
          avoidMicrodeposits: true
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }, function (data) {
 | 
					 | 
				
			||||||
        if (data.error) {
 | 
					 | 
				
			||||||
          errors.textContent = '';
 | 
					 | 
				
			||||||
          errors.textContent = data.error_description;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          document.querySelector('input[name="bank_account_id"]').value = data.bank_account_id;
 | 
					 | 
				
			||||||
          document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }, function (data) {
 | 
					 | 
				
			||||||
        if (data.error) {
 | 
					 | 
				
			||||||
          errors.textContent = '';
 | 
					 | 
				
			||||||
          errors.textContent = data.error_description;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      this.initializeWePay().showBankPopup();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return WePayBank;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
document.addEventListener('DOMContentLoaded', function () {
 | 
					 | 
				
			||||||
  new WePayBank().handle();
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,137 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see authorize-credit-card-payment.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var n=function(){function n(e,a){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t(this,"handleAuthorization",(function(){var e=$("#my-card"),t={};t.clientKey=r.publicKey,t.apiLoginID=r.loginId;var n={};n.cardNumber=e.CardJs("cardNumber").replace(/[^\d]/g,""),n.month=e.CardJs("expiryMonth").replace(/[^\d]/g,""),n.year=e.CardJs("expiryYear").replace(/[^\d]/g,""),n.cardCode=document.getElementById("cvv").value.replace(/[^\d]/g,"");var a={};return a.authData=t,a.cardData=n,document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),Accept.dispatchData(a,r.responseHandler),!1})),t(this,"responseHandler",(function(e){if("Error"===e.messages.resultCode){$("#errors").show().html("<p>"+e.messages.message[0].code+": "+e.messages.message[0].text+"</p>"),document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}else if("Ok"===e.messages.resultCode){document.getElementById("dataDescriptor").value=e.opaqueData.dataDescriptor,document.getElementById("dataValue").value=e.opaqueData.dataValue;var t=document.querySelector("input[name=token-billing-checkbox]:checked");t&&(document.getElementById("store_card").value=t.value),document.getElementById("server_response").submit()}return!1})),t(this,"handle",(function(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("save-card--container").style.display="none",document.getElementById("authorize--credit-card-container").style.display="none",document.getElementById("token").value=e.target.dataset.token}))}));var e=document.getElementById("toggle-payment-with-credit-card");e&&e.addEventListener("click",(function(){document.getElementById("save-card--container").style.display="grid",document.getElementById("authorize--credit-card-container").style.display="flex",document.getElementById("token").value=null}));var t=document.getElementById("pay-now");return t&&t.addEventListener("click",(function(e){var t=document.getElementById("token");t.value?r.handlePayNowAction(t.value):r.handleAuthorization()})),r})),this.publicKey=e,this.loginId=a,this.cardHolderName=document.getElementById("cardholder_name")}var a,r,o;return a=n,(r=[{key:"handlePayNowAction",value:function(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),document.getElementById("token").value=e,document.getElementById("server_response").submit()}}])&&e(a.prototype,r),o&&e(a,o),Object.defineProperty(a,"prototype",{writable:!1}),n}();new n(document.querySelector('meta[name="authorize-public-key"]').content,document.querySelector('meta[name="authorize-login-id"]').content).handle()})();
 | 
				
			||||||
/*!************************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/authorize-credit-card-payment.js ***!
 | 
					 | 
				
			||||||
  \************************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var AuthorizeAuthorizeCard = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function AuthorizeAuthorizeCard(publicKey, loginId) {
 | 
					 | 
				
			||||||
    var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, AuthorizeAuthorizeCard);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handleAuthorization", function () {
 | 
					 | 
				
			||||||
      var myCard = $('#my-card');
 | 
					 | 
				
			||||||
      var authData = {};
 | 
					 | 
				
			||||||
      authData.clientKey = _this.publicKey;
 | 
					 | 
				
			||||||
      authData.apiLoginID = _this.loginId;
 | 
					 | 
				
			||||||
      var cardData = {};
 | 
					 | 
				
			||||||
      cardData.cardNumber = myCard.CardJs('cardNumber').replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      cardData.month = myCard.CardJs('expiryMonth').replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      cardData.year = myCard.CardJs('expiryYear').replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      cardData.cardCode = document.getElementById("cvv").value.replace(/[^\d]/g, '');
 | 
					 | 
				
			||||||
      var secureData = {};
 | 
					 | 
				
			||||||
      secureData.authData = authData;
 | 
					 | 
				
			||||||
      secureData.cardData = cardData; // If using banking information instead of card information,
 | 
					 | 
				
			||||||
      // send the bankData object instead of the cardData object.
 | 
					 | 
				
			||||||
      //
 | 
					 | 
				
			||||||
      // secureData.bankData = bankData;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (payNowButton) {
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      Accept.dispatchData(secureData, _this.responseHandler);
 | 
					 | 
				
			||||||
      return false;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "responseHandler", function (response) {
 | 
					 | 
				
			||||||
      if (response.messages.resultCode === "Error") {
 | 
					 | 
				
			||||||
        var i = 0;
 | 
					 | 
				
			||||||
        var $errors = $('#errors'); // get the reference of the div
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $errors.show().html("<p>" + response.messages.message[i].code + ": " + response.messages.message[i].text + "</p>");
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
      } else if (response.messages.resultCode === "Ok") {
 | 
					 | 
				
			||||||
        document.getElementById("dataDescriptor").value = response.opaqueData.dataDescriptor;
 | 
					 | 
				
			||||||
        document.getElementById("dataValue").value = response.opaqueData.dataValue;
 | 
					 | 
				
			||||||
        var storeCard = document.querySelector('input[name=token-billing-checkbox]:checked');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (storeCard) {
 | 
					 | 
				
			||||||
          document.getElementById("store_card").value = storeCard.value;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        document.getElementById("server_response").submit();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return false;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
      Array.from(document.getElementsByClassName('toggle-payment-with-token')).forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
          document.getElementById('save-card--container').style.display = 'none';
 | 
					 | 
				
			||||||
          document.getElementById('authorize--credit-card-container').style.display = 'none';
 | 
					 | 
				
			||||||
          document.getElementById('token').value = e.target.dataset.token;
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      var payWithCreditCardToggle = document.getElementById('toggle-payment-with-credit-card');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (payWithCreditCardToggle) {
 | 
					 | 
				
			||||||
        payWithCreditCardToggle.addEventListener('click', function () {
 | 
					 | 
				
			||||||
          document.getElementById('save-card--container').style.display = 'grid';
 | 
					 | 
				
			||||||
          document.getElementById('authorize--credit-card-container').style.display = 'flex';
 | 
					 | 
				
			||||||
          document.getElementById('token').value = null;
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (payNowButton) {
 | 
					 | 
				
			||||||
        payNowButton.addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
          var token = document.getElementById('token');
 | 
					 | 
				
			||||||
          token.value ? _this.handlePayNowAction(token.value) : _this.handleAuthorization();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return _this;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.publicKey = publicKey;
 | 
					 | 
				
			||||||
    this.loginId = loginId;
 | 
					 | 
				
			||||||
    this.cardHolderName = document.getElementById("cardholder_name");
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(AuthorizeAuthorizeCard, [{
 | 
					 | 
				
			||||||
    key: "handlePayNowAction",
 | 
					 | 
				
			||||||
    value: function handlePayNowAction(token_hashed_id) {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.getElementById("token").value = token_hashed_id;
 | 
					 | 
				
			||||||
      document.getElementById("server_response").submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return AuthorizeAuthorizeCard;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publicKey = document.querySelector('meta[name="authorize-public-key"]').content;
 | 
					 | 
				
			||||||
var loginId = document.querySelector('meta[name="authorize-login-id"]').content;
 | 
					 | 
				
			||||||
/** @handle */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new AuthorizeAuthorizeCard(publicKey, loginId).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										149
									
								
								public/js/clients/payments/braintree-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										149
									
								
								public/js/clients/payments/braintree-credit-card.js
									
									
									
									
										vendored
									
									
								
							@ -1,147 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see braintree-credit-card.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,a,r;return n=t,(a=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},(function(e,t){e||(document.querySelector("input[name=client-data]").value=t.deviceData)}))}))}},{key:"mountBraintreePaymentWidget",value:function(){window.braintree.dropin.create({authorization:document.querySelector("meta[name=client-token]").content,container:"#dropin-container",threeDSecure:"true"===document.querySelector("input[name=threeds_enable]").value.toLowerCase()},this.handleCallback)}},{key:"handleCallback",value:function(e,t){if(e)console.error(e);else{var n=document.getElementById("pay-now");params=JSON.parse(document.querySelector("input[name=threeds]").value),n.addEventListener("click",(function(){t.requestPaymentMethod({threeDSecure:{challengeRequested:!0,amount:params.amount,email:params.email,billingAddress:{givenName:params.billingAddress.givenName,surname:params.billingAddress.surname,phoneNumber:params.billingAddress.phoneNumber,streetAddress:params.billingAddress.streetAddress,extendedAddress:params.billingAddress.extendedAddress,locality:params.billingAddress.locality,region:params.billingAddress.region,postalCode:params.billingAddress.postalCode,countryCodeAlpha2:params.billingAddress.countryCodeAlpha2}}},(function(e,t){if(e)return console.log(e),dropin.clearSelectedPaymentMethod(),void alert("There was a problem verifying this card, please contact your merchant");if("true"===document.querySelector("input[name=threeds_enable]").value&&!t.liabilityShifted)return console.log("Liability did not shift",t),void alert("There was a problem verifying this card, please contact your merchant");n.disabled=!0,n.querySelector("svg").classList.remove("hidden"),n.querySelector("span").classList.add("hidden"),document.querySelector("input[name=gateway_response]").value=JSON.stringify(t);var a=document.querySelector('input[name="token-billing-checkbox"]:checked');a&&(document.querySelector('input[name="store_card"]').value=a.value),document.getElementById("server-response").submit()}))}))}}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.mountBraintreePaymentWidget(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("dropin-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("dropin-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",document.getElementById("pay-now-with-token").classList.add("hidden"),document.getElementById("pay-now").classList.remove("hidden")}));var e=document.getElementById("pay-now-with-token");e.addEventListener("click",(function(t){e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}))}}])&&e(n.prototype,a),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!****************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/braintree-credit-card.js ***!
 | 
					 | 
				
			||||||
  \****************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var BraintreeCreditCard = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function BraintreeCreditCard() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, BraintreeCreditCard);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(BraintreeCreditCard, [{
 | 
					 | 
				
			||||||
    key: "initBraintreeDataCollector",
 | 
					 | 
				
			||||||
    value: function initBraintreeDataCollector() {
 | 
					 | 
				
			||||||
      window.braintree.client.create({
 | 
					 | 
				
			||||||
        authorization: document.querySelector('meta[name=client-token]').content
 | 
					 | 
				
			||||||
      }, function (err, clientInstance) {
 | 
					 | 
				
			||||||
        window.braintree.dataCollector.create({
 | 
					 | 
				
			||||||
          client: clientInstance,
 | 
					 | 
				
			||||||
          paypal: true
 | 
					 | 
				
			||||||
        }, function (err, dataCollectorInstance) {
 | 
					 | 
				
			||||||
          if (err) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.querySelector('input[name=client-data]').value = dataCollectorInstance.deviceData;
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "mountBraintreePaymentWidget",
 | 
					 | 
				
			||||||
    value: function mountBraintreePaymentWidget() {
 | 
					 | 
				
			||||||
      window.braintree.dropin.create({
 | 
					 | 
				
			||||||
        authorization: document.querySelector('meta[name=client-token]').content,
 | 
					 | 
				
			||||||
        container: '#dropin-container',
 | 
					 | 
				
			||||||
        threeDSecure: document.querySelector('input[name=threeds_enable]').value.toLowerCase() === 'true'
 | 
					 | 
				
			||||||
      }, this.handleCallback);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handleCallback",
 | 
					 | 
				
			||||||
    value: function handleCallback(error, dropinInstance) {
 | 
					 | 
				
			||||||
      if (error) {
 | 
					 | 
				
			||||||
        console.error(error);
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var payNow = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
      params = JSON.parse(document.querySelector('input[name=threeds]').value);
 | 
					 | 
				
			||||||
      payNow.addEventListener('click', function () {
 | 
					 | 
				
			||||||
        dropinInstance.requestPaymentMethod({
 | 
					 | 
				
			||||||
          threeDSecure: {
 | 
					 | 
				
			||||||
            challengeRequested: true,
 | 
					 | 
				
			||||||
            amount: params.amount,
 | 
					 | 
				
			||||||
            email: params.email,
 | 
					 | 
				
			||||||
            billingAddress: {
 | 
					 | 
				
			||||||
              givenName: params.billingAddress.givenName,
 | 
					 | 
				
			||||||
              // ASCII-printable characters required, else will throw a validation error
 | 
					 | 
				
			||||||
              surname: params.billingAddress.surname,
 | 
					 | 
				
			||||||
              // ASCII-printable characters required, else will throw a validation error
 | 
					 | 
				
			||||||
              phoneNumber: params.billingAddress.phoneNumber,
 | 
					 | 
				
			||||||
              streetAddress: params.billingAddress.streetAddress,
 | 
					 | 
				
			||||||
              extendedAddress: params.billingAddress.extendedAddress,
 | 
					 | 
				
			||||||
              locality: params.billingAddress.locality,
 | 
					 | 
				
			||||||
              region: params.billingAddress.region,
 | 
					 | 
				
			||||||
              postalCode: params.billingAddress.postalCode,
 | 
					 | 
				
			||||||
              countryCodeAlpha2: params.billingAddress.countryCodeAlpha2
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }, function (err, payload) {
 | 
					 | 
				
			||||||
          if (err) {
 | 
					 | 
				
			||||||
            console.log(err);
 | 
					 | 
				
			||||||
            dropin.clearSelectedPaymentMethod();
 | 
					 | 
				
			||||||
            alert("There was a problem verifying this card, please contact your merchant");
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          if (document.querySelector('input[name=threeds_enable]').value === 'true' && !payload.liabilityShifted) {
 | 
					 | 
				
			||||||
            console.log('Liability did not shift', payload);
 | 
					 | 
				
			||||||
            alert("There was a problem verifying this card, please contact your merchant");
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          payNow.disabled = true;
 | 
					 | 
				
			||||||
          payNow.querySelector('svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
          payNow.querySelector('span').classList.add('hidden');
 | 
					 | 
				
			||||||
          document.querySelector('input[name=gateway_response]').value = JSON.stringify(payload);
 | 
					 | 
				
			||||||
          var tokenBillingCheckbox = document.querySelector('input[name="token-billing-checkbox"]:checked');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          if (tokenBillingCheckbox) {
 | 
					 | 
				
			||||||
            document.querySelector('input[name="store_card"]').value = tokenBillingCheckbox.value;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      this.initBraintreeDataCollector();
 | 
					 | 
				
			||||||
      this.mountBraintreePaymentWidget();
 | 
					 | 
				
			||||||
      Array.from(document.getElementsByClassName('toggle-payment-with-token')).forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
          document.getElementById('dropin-container').classList.add('hidden');
 | 
					 | 
				
			||||||
          document.getElementById('save-card--container').style.display = 'none';
 | 
					 | 
				
			||||||
          document.querySelector('input[name=token]').value = element.target.dataset.token;
 | 
					 | 
				
			||||||
          document.getElementById('pay-now-with-token').classList.remove('hidden');
 | 
					 | 
				
			||||||
          document.getElementById('pay-now').classList.add('hidden');
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.getElementById('toggle-payment-with-credit-card').addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
        document.getElementById('dropin-container').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.getElementById('save-card--container').style.display = 'grid';
 | 
					 | 
				
			||||||
        document.querySelector('input[name=token]').value = "";
 | 
					 | 
				
			||||||
        document.getElementById('pay-now-with-token').classList.add('hidden');
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').classList.remove('hidden');
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      var payNowWithToken = document.getElementById('pay-now-with-token');
 | 
					 | 
				
			||||||
      payNowWithToken.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
        payNowWithToken.disabled = true;
 | 
					 | 
				
			||||||
        payNowWithToken.querySelector('svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        payNowWithToken.querySelector('span').classList.add('hidden');
 | 
					 | 
				
			||||||
        document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return BraintreeCreditCard;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new BraintreeCreditCard().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										132
									
								
								public/js/clients/payments/braintree-paypal.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										132
									
								
								public/js/clients/payments/braintree-paypal.js
									
									
									
									
										vendored
									
									
								
							@ -1,130 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see braintree-paypal.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var n,a,o;return n=t,o=[{key:"getPaymentDetails",value:function(){return{flow:"vault"}}},{key:"handleErrorMessage",value:function(e){var t=document.getElementById("errors");t.innerText=e,t.hidden=!1}}],(a=[{key:"initBraintreeDataCollector",value:function(){window.braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content},(function(e,t){window.braintree.dataCollector.create({client:t,paypal:!0},(function(e,t){e||(document.querySelector("input[name=client-data]").value=t.deviceData)}))}))}},{key:"handlePaymentWithToken",value:function(){Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("paypal-button").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token,document.getElementById("pay-now-with-token").classList.remove("hidden"),document.getElementById("pay-now").classList.add("hidden")}))}));var e=document.getElementById("pay-now-with-token");e.addEventListener("click",(function(t){e.disabled=!0,e.querySelector("svg").classList.remove("hidden"),e.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){this.initBraintreeDataCollector(),this.handlePaymentWithToken(),braintree.client.create({authorization:document.querySelector("meta[name=client-token]").content}).then((function(e){return braintree.paypalCheckout.create({client:e})})).then((function(e){return e.loadPayPalSDK({vault:!0}).then((function(e){return paypal.Buttons({fundingSource:paypal.FUNDING.PAYPAL,createBillingAgreement:function(){return e.createPayment(t.getPaymentDetails())},onApprove:function(t,n){return e.tokenizePayment(t).then((function(e){var t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.querySelector("input[name=gateway_response]").value=JSON.stringify(e),document.getElementById("server-response").submit()}))},onCancel:function(e){},onError:function(e){console.log(e.message),t.handleErrorMessage(e.message)}}).render("#paypal-button")}))})).catch((function(e){console.log(e.message),t.handleErrorMessage(e.message)}))}}])&&e(n.prototype,a),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!***********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/braintree-paypal.js ***!
 | 
					 | 
				
			||||||
  \***********************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var BraintreePayPal = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function BraintreePayPal() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, BraintreePayPal);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(BraintreePayPal, [{
 | 
					 | 
				
			||||||
    key: "initBraintreeDataCollector",
 | 
					 | 
				
			||||||
    value: function initBraintreeDataCollector() {
 | 
					 | 
				
			||||||
      window.braintree.client.create({
 | 
					 | 
				
			||||||
        authorization: document.querySelector('meta[name=client-token]').content
 | 
					 | 
				
			||||||
      }, function (err, clientInstance) {
 | 
					 | 
				
			||||||
        window.braintree.dataCollector.create({
 | 
					 | 
				
			||||||
          client: clientInstance,
 | 
					 | 
				
			||||||
          paypal: true
 | 
					 | 
				
			||||||
        }, function (err, dataCollectorInstance) {
 | 
					 | 
				
			||||||
          if (err) {
 | 
					 | 
				
			||||||
            return;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.querySelector('input[name=client-data]').value = dataCollectorInstance.deviceData;
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePaymentWithToken",
 | 
					 | 
				
			||||||
    value: function handlePaymentWithToken() {
 | 
					 | 
				
			||||||
      Array.from(document.getElementsByClassName('toggle-payment-with-token')).forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
          document.getElementById('paypal-button').classList.add('hidden');
 | 
					 | 
				
			||||||
          document.getElementById('save-card--container').style.display = 'none';
 | 
					 | 
				
			||||||
          document.querySelector('input[name=token]').value = element.target.dataset.token;
 | 
					 | 
				
			||||||
          document.getElementById('pay-now-with-token').classList.remove('hidden');
 | 
					 | 
				
			||||||
          document.getElementById('pay-now').classList.add('hidden');
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      var payNowWithToken = document.getElementById('pay-now-with-token');
 | 
					 | 
				
			||||||
      payNowWithToken.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
        payNowWithToken.disabled = true;
 | 
					 | 
				
			||||||
        payNowWithToken.querySelector('svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        payNowWithToken.querySelector('span').classList.add('hidden');
 | 
					 | 
				
			||||||
        document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      this.initBraintreeDataCollector();
 | 
					 | 
				
			||||||
      this.handlePaymentWithToken();
 | 
					 | 
				
			||||||
      braintree.client.create({
 | 
					 | 
				
			||||||
        authorization: document.querySelector('meta[name=client-token]').content
 | 
					 | 
				
			||||||
      }).then(function (clientInstance) {
 | 
					 | 
				
			||||||
        return braintree.paypalCheckout.create({
 | 
					 | 
				
			||||||
          client: clientInstance
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }).then(function (paypalCheckoutInstance) {
 | 
					 | 
				
			||||||
        return paypalCheckoutInstance.loadPayPalSDK({
 | 
					 | 
				
			||||||
          vault: true
 | 
					 | 
				
			||||||
        }).then(function (paypalCheckoutInstance) {
 | 
					 | 
				
			||||||
          return paypal.Buttons({
 | 
					 | 
				
			||||||
            fundingSource: paypal.FUNDING.PAYPAL,
 | 
					 | 
				
			||||||
            createBillingAgreement: function createBillingAgreement() {
 | 
					 | 
				
			||||||
              return paypalCheckoutInstance.createPayment(BraintreePayPal.getPaymentDetails());
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            onApprove: function onApprove(data, actions) {
 | 
					 | 
				
			||||||
              return paypalCheckoutInstance.tokenizePayment(data).then(function (payload) {
 | 
					 | 
				
			||||||
                var tokenBillingCheckbox = document.querySelector('input[name="token-billing-checkbox"]:checked');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                if (tokenBillingCheckbox) {
 | 
					 | 
				
			||||||
                  document.querySelector('input[name="store_card"]').value = tokenBillingCheckbox.value;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                document.querySelector('input[name=gateway_response]').value = JSON.stringify(payload);
 | 
					 | 
				
			||||||
                document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
              });
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            onCancel: function onCancel(data) {// ..
 | 
					 | 
				
			||||||
            },
 | 
					 | 
				
			||||||
            onError: function onError(err) {
 | 
					 | 
				
			||||||
              console.log(err.message);
 | 
					 | 
				
			||||||
              BraintreePayPal.handleErrorMessage(err.message);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          }).render('#paypal-button');
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      })["catch"](function (err) {
 | 
					 | 
				
			||||||
        console.log(err.message);
 | 
					 | 
				
			||||||
        BraintreePayPal.handleErrorMessage(err.message);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }], [{
 | 
					 | 
				
			||||||
    key: "getPaymentDetails",
 | 
					 | 
				
			||||||
    value: function getPaymentDetails() {
 | 
					 | 
				
			||||||
      return {
 | 
					 | 
				
			||||||
        flow: 'vault'
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handleErrorMessage",
 | 
					 | 
				
			||||||
    value: function handleErrorMessage(message) {
 | 
					 | 
				
			||||||
      var errorsContainer = document.getElementById('errors');
 | 
					 | 
				
			||||||
      errorsContainer.innerText = message;
 | 
					 | 
				
			||||||
      errorsContainer.hidden = false;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return BraintreePayPal;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new BraintreePayPal().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										9
									
								
								public/js/clients/payments/card-js.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								public/js/clients/payments/card-js.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										101
									
								
								public/js/clients/payments/checkout-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										101
									
								
								public/js/clients/payments/checkout-credit-card.js
									
									
									
									
										vendored
									
									
								
							@ -1,99 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see checkout-credit-card.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.tokens=[]}var n,a,o;return n=t,(a=[{key:"mountFrames",value:function(){console.log("Mount checkout frames..")}},{key:"handlePaymentUsingToken",value:function(e){document.getElementById("checkout--container").classList.add("hidden"),document.getElementById("pay-now-with-token--container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}},{key:"handlePaymentUsingCreditCard",value:function(e){var t;document.getElementById("checkout--container").classList.remove("hidden"),document.getElementById("pay-now-with-token--container").classList.add("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="";var n=document.getElementById("pay-button"),a=null!==(t=document.querySelector('meta[name="public-key"]').content)&&void 0!==t?t:"",o=document.getElementById("payment-form");Frames.init(a),Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED,(function(e){n.disabled=!Frames.isCardValid()})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED,(function(e){pay.button.disabled=!1})),Frames.addEventHandler(Frames.Events.CARD_TOKENIZED,(function(e){n.disabled=!0,document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e),document.querySelector('input[name="store_card"]').value=document.querySelector("input[name=token-billing-checkbox]:checked").value,document.getElementById("server-response").submit()})),o.addEventListener("submit",(function(e){e.preventDefault(),Frames.submitCard()}))}},{key:"completePaymentUsingToken",value:function(e){var t=document.getElementById("pay-now-with-token");t.disabled=!0,t.querySelector("svg").classList.remove("hidden"),t.querySelector("span").classList.add("hidden"),document.getElementById("server-response").submit()}},{key:"handle",value:function(){var e=this;this.handlePaymentUsingCreditCard(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(t){return t.addEventListener("click",e.handlePaymentUsingToken)})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",this.handlePaymentUsingCreditCard),document.getElementById("pay-now-with-token").addEventListener("click",this.completePaymentUsingToken)}}])&&e(n.prototype,a),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!***************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/checkout-credit-card.js ***!
 | 
					 | 
				
			||||||
  \***************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var CheckoutCreditCard = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function CheckoutCreditCard() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, CheckoutCreditCard);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.tokens = [];
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(CheckoutCreditCard, [{
 | 
					 | 
				
			||||||
    key: "mountFrames",
 | 
					 | 
				
			||||||
    value: function mountFrames() {
 | 
					 | 
				
			||||||
      console.log('Mount checkout frames..');
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePaymentUsingToken",
 | 
					 | 
				
			||||||
    value: function handlePaymentUsingToken(e) {
 | 
					 | 
				
			||||||
      document.getElementById('checkout--container').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.getElementById('pay-now-with-token--container').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.getElementById('save-card--container').style.display = 'none';
 | 
					 | 
				
			||||||
      document.querySelector('input[name=token]').value = e.target.dataset.token;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePaymentUsingCreditCard",
 | 
					 | 
				
			||||||
    value: function handlePaymentUsingCreditCard(e) {
 | 
					 | 
				
			||||||
      var _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('checkout--container').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.getElementById('pay-now-with-token--container').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.getElementById('save-card--container').style.display = 'grid';
 | 
					 | 
				
			||||||
      document.querySelector('input[name=token]').value = '';
 | 
					 | 
				
			||||||
      var payButton = document.getElementById('pay-button');
 | 
					 | 
				
			||||||
      var publicKey = (_document$querySelect = document.querySelector('meta[name="public-key"]').content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
      var form = document.getElementById('payment-form');
 | 
					 | 
				
			||||||
      Frames.init(publicKey);
 | 
					 | 
				
			||||||
      Frames.addEventHandler(Frames.Events.CARD_VALIDATION_CHANGED, function (event) {
 | 
					 | 
				
			||||||
        payButton.disabled = !Frames.isCardValid();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      Frames.addEventHandler(Frames.Events.CARD_TOKENIZATION_FAILED, function (event) {
 | 
					 | 
				
			||||||
        pay.button.disabled = false;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      Frames.addEventHandler(Frames.Events.CARD_TOKENIZED, function (event) {
 | 
					 | 
				
			||||||
        payButton.disabled = true;
 | 
					 | 
				
			||||||
        document.querySelector('input[name="gateway_response"]').value = JSON.stringify(event);
 | 
					 | 
				
			||||||
        document.querySelector('input[name="store_card"]').value = document.querySelector('input[name=token-billing-checkbox]:checked').value;
 | 
					 | 
				
			||||||
        document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      form.addEventListener('submit', function (event) {
 | 
					 | 
				
			||||||
        event.preventDefault();
 | 
					 | 
				
			||||||
        Frames.submitCard();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "completePaymentUsingToken",
 | 
					 | 
				
			||||||
    value: function completePaymentUsingToken(e) {
 | 
					 | 
				
			||||||
      var btn = document.getElementById('pay-now-with-token');
 | 
					 | 
				
			||||||
      btn.disabled = true;
 | 
					 | 
				
			||||||
      btn.querySelector('svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      btn.querySelector('span').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.handlePaymentUsingCreditCard();
 | 
					 | 
				
			||||||
      Array.from(document.getElementsByClassName('toggle-payment-with-token')).forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.addEventListener('click', _this.handlePaymentUsingToken);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.getElementById('toggle-payment-with-credit-card').addEventListener('click', this.handlePaymentUsingCreditCard);
 | 
					 | 
				
			||||||
      document.getElementById('pay-now-with-token').addEventListener('click', this.completePaymentUsingToken);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return CheckoutCreditCard;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new CheckoutCreditCard().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										380
									
								
								public/js/clients/payments/eway-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										380
									
								
								public/js/clients/payments/eway-credit-card.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										87
									
								
								public/js/clients/payments/forte-ach-payment.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										87
									
								
								public/js/clients/payments/forte-ach-payment.js
									
									
									
									
										vendored
									
									
								
							@ -1,85 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see forte-ach-payment.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,n){for(var t=0;t<n.length;t++){var o=n[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function n(n,t,o){return t&&e(n.prototype,t),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var o=n((function e(n){var o=this;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),t(this,"handleAuthorization",(function(){var e=document.getElementById("account-number").value,n=document.getElementById("routing-number").value,t={api_login_id:o.apiLoginId,account_number:e,routing_number:n,account_type:"checking"};return document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),forte.createToken(t).success(o.successResponseHandler).error(o.failedResponseHandler),!1})),t(this,"successResponseHandler",(function(e){return document.getElementById("payment_token").value=e.onetime_token,document.getElementById("server_response").submit(),!1})),t(this,"failedResponseHandler",(function(e){var n='<div class="alert alert-failure mb-4"><ul><li>'+e.response_description+"</li></ul></div>";return document.getElementById("forte_errors").innerHTML=n,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),!1})),t(this,"handle",(function(){var e=document.getElementById("pay-now");return e&&e.addEventListener("click",(function(e){o.handleAuthorization()})),o})),this.apiLoginId=n}));new o(document.querySelector('meta[name="forte-api-login-id"]').content).handle()})();
 | 
				
			||||||
/*!************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/forte-ach-payment.js ***!
 | 
					 | 
				
			||||||
  \************************************************************/
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ForteAuthorizeACH = /*#__PURE__*/_createClass(function ForteAuthorizeACH(apiLoginId) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ForteAuthorizeACH);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handleAuthorization", function () {
 | 
					 | 
				
			||||||
    var account_number = document.getElementById('account-number').value;
 | 
					 | 
				
			||||||
    var routing_number = document.getElementById('routing-number').value;
 | 
					 | 
				
			||||||
    var data = {
 | 
					 | 
				
			||||||
      api_login_id: _this.apiLoginId,
 | 
					 | 
				
			||||||
      account_number: account_number,
 | 
					 | 
				
			||||||
      routing_number: routing_number,
 | 
					 | 
				
			||||||
      account_type: 'checking'
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (payNowButton) {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
    } // console.log(data);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    forte.createToken(data).success(_this.successResponseHandler).error(_this.failedResponseHandler);
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "successResponseHandler", function (response) {
 | 
					 | 
				
			||||||
    document.getElementById('payment_token').value = response.onetime_token;
 | 
					 | 
				
			||||||
    document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "failedResponseHandler", function (response) {
 | 
					 | 
				
			||||||
    var errors = '<div class="alert alert-failure mb-4"><ul><li>' + response.response_description + '</li></ul></div>';
 | 
					 | 
				
			||||||
    document.getElementById('forte_errors').innerHTML = errors;
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
    document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
    document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (payNowButton) {
 | 
					 | 
				
			||||||
      payNowButton.addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        _this.handleAuthorization();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.apiLoginId = apiLoginId;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var apiLoginId = document.querySelector('meta[name="forte-api-login-id"]').content;
 | 
					 | 
				
			||||||
/** @handle */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new ForteAuthorizeACH(apiLoginId).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,86 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see forte-credit-card-payment.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(n,t,r){return t&&e(n.prototype,t),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),n}function t(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var r=n((function e(n){var r=this;!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),t(this,"handleAuthorization",(function(){var e=$("#my-card"),n={api_login_id:r.apiLoginId,card_number:e.CardJs("cardNumber").replace(/[^\d]/g,""),expire_year:e.CardJs("expiryYear").replace(/[^\d]/g,""),expire_month:e.CardJs("expiryMonth").replace(/[^\d]/g,""),cvv:document.getElementById("cvv").value.replace(/[^\d]/g,"")};return document.getElementById("pay-now")&&(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden")),forte.createToken(n).success(r.successResponseHandler).error(r.failedResponseHandler),!1})),t(this,"successResponseHandler",(function(e){return document.getElementById("payment_token").value=e.onetime_token,document.getElementById("card_brand").value=e.card_type,document.getElementById("server_response").submit(),!1})),t(this,"failedResponseHandler",(function(e){var n='<div class="alert alert-failure mb-4"><ul><li>'+e.response_description+"</li></ul></div>";return document.getElementById("forte_errors").innerHTML=n,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),!1})),t(this,"handle",(function(){var e=document.getElementById("pay-now");return e&&e.addEventListener("click",(function(e){r.handleAuthorization()})),r})),this.apiLoginId=n,this.cardHolderName=document.getElementById("cardholder_name")}));new r(document.querySelector('meta[name="forte-api-login-id"]').content).handle()})();
 | 
				
			||||||
/*!********************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/forte-credit-card-payment.js ***!
 | 
					 | 
				
			||||||
  \********************************************************************/
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ForteAuthorizeCard = /*#__PURE__*/_createClass(function ForteAuthorizeCard(apiLoginId) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ForteAuthorizeCard);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handleAuthorization", function () {
 | 
					 | 
				
			||||||
    var myCard = $('#my-card');
 | 
					 | 
				
			||||||
    var data = {
 | 
					 | 
				
			||||||
      api_login_id: _this.apiLoginId,
 | 
					 | 
				
			||||||
      card_number: myCard.CardJs('cardNumber').replace(/[^\d]/g, ''),
 | 
					 | 
				
			||||||
      expire_year: myCard.CardJs('expiryYear').replace(/[^\d]/g, ''),
 | 
					 | 
				
			||||||
      expire_month: myCard.CardJs('expiryMonth').replace(/[^\d]/g, ''),
 | 
					 | 
				
			||||||
      cvv: document.getElementById('cvv').value.replace(/[^\d]/g, '')
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (payNowButton) {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    forte.createToken(data).success(_this.successResponseHandler).error(_this.failedResponseHandler);
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "successResponseHandler", function (response) {
 | 
					 | 
				
			||||||
    document.getElementById('payment_token').value = response.onetime_token;
 | 
					 | 
				
			||||||
    document.getElementById('card_brand').value = response.card_type;
 | 
					 | 
				
			||||||
    document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "failedResponseHandler", function (response) {
 | 
					 | 
				
			||||||
    var errors = '<div class="alert alert-failure mb-4"><ul><li>' + response.response_description + '</li></ul></div>';
 | 
					 | 
				
			||||||
    document.getElementById('forte_errors').innerHTML = errors;
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
    document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
    document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (payNowButton) {
 | 
					 | 
				
			||||||
      payNowButton.addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        _this.handleAuthorization();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.apiLoginId = apiLoginId;
 | 
					 | 
				
			||||||
  this.cardHolderName = document.getElementById('cardholder_name');
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var apiLoginId = document.querySelector('meta[name="forte-api-login-id"]').content;
 | 
					 | 
				
			||||||
/** @handle */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new ForteAuthorizeCard(apiLoginId).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										157
									
								
								public/js/clients/payments/mollie-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										157
									
								
								public/js/clients/payments/mollie-credit-card.js
									
									
									
									
										vendored
									
									
								
							@ -1,155 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see mollie-credit-card.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){var e,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.mollie=Mollie(null===(e=document.querySelector("meta[name=mollie-profileId]"))||void 0===e?void 0:e.content,{testmode:null===(n=document.querySelector("meta[name=mollie-testmode]"))||void 0===n?void 0:n.content,locale:"en_US"})}var n,r,o;return n=t,(r=[{key:"createCardHolderInput",value:function(){var e=this.mollie.createComponent("cardHolder");e.mount("#card-holder");var t=document.getElementById("card-holder-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCardNumberInput",value:function(){var e=this.mollie.createComponent("cardNumber");e.mount("#card-number");var t=document.getElementById("card-number-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createExpiryDateInput",value:function(){var e=this.mollie.createComponent("expiryDate");e.mount("#expiry-date");var t=document.getElementById("expiry-date-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"createCvvInput",value:function(){var e=this.mollie.createComponent("verificationCode");e.mount("#cvv");var t=document.getElementById("cvv-error");return e.addEventListener("change",(function(e){e.error&&e.touched?t.textContent=e.error:t.textContent=""})),this}},{key:"handlePayNowButton",value:function(){if(document.getElementById("pay-now").disabled=!0,""!==document.querySelector("input[name=token]").value)return document.querySelector("input[name=gateway_response]").value="",document.getElementById("server-response").submit();this.mollie.createToken().then((function(e){var t=e.token,n=e.error;if(n){document.getElementById("pay-now").disabled=!1;var r=document.getElementById("errors");return r.innerText=n.message,void(r.hidden=!1)}var o=document.querySelector('input[name="token-billing-checkbox"]:checked');o&&(document.querySelector('input[name="store_card"]').value=o.value),document.querySelector("input[name=gateway_response]").value=t,document.querySelector("input[name=token]").value="",document.getElementById("server-response").submit()}))}},{key:"handle",value:function(){var e=this;this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput(),Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),document.getElementById("toggle-payment-with-credit-card").addEventListener("click",(function(e){document.getElementById("mollie--payment-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value=""})),document.getElementById("pay-now").addEventListener("click",(function(){return e.handlePayNowButton()}))}}])&&e(n.prototype,r),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!*************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/mollie-credit-card.js ***!
 | 
					 | 
				
			||||||
  \*************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var _Mollie = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function _Mollie() {
 | 
					 | 
				
			||||||
    var _document$querySelect, _document$querySelect2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, _Mollie);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.mollie = Mollie((_document$querySelect = document.querySelector('meta[name=mollie-profileId]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content, {
 | 
					 | 
				
			||||||
      testmode: (_document$querySelect2 = document.querySelector('meta[name=mollie-testmode]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content,
 | 
					 | 
				
			||||||
      locale: 'en_US'
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(_Mollie, [{
 | 
					 | 
				
			||||||
    key: "createCardHolderInput",
 | 
					 | 
				
			||||||
    value: function createCardHolderInput() {
 | 
					 | 
				
			||||||
      var cardHolder = this.mollie.createComponent('cardHolder');
 | 
					 | 
				
			||||||
      cardHolder.mount('#card-holder');
 | 
					 | 
				
			||||||
      var cardHolderError = document.getElementById('card-holder-error');
 | 
					 | 
				
			||||||
      cardHolder.addEventListener('change', function (event) {
 | 
					 | 
				
			||||||
        if (event.error && event.touched) {
 | 
					 | 
				
			||||||
          cardHolderError.textContent = event.error;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          cardHolderError.textContent = '';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "createCardNumberInput",
 | 
					 | 
				
			||||||
    value: function createCardNumberInput() {
 | 
					 | 
				
			||||||
      var cardNumber = this.mollie.createComponent('cardNumber');
 | 
					 | 
				
			||||||
      cardNumber.mount('#card-number');
 | 
					 | 
				
			||||||
      var cardNumberError = document.getElementById('card-number-error');
 | 
					 | 
				
			||||||
      cardNumber.addEventListener('change', function (event) {
 | 
					 | 
				
			||||||
        if (event.error && event.touched) {
 | 
					 | 
				
			||||||
          cardNumberError.textContent = event.error;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          cardNumberError.textContent = '';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "createExpiryDateInput",
 | 
					 | 
				
			||||||
    value: function createExpiryDateInput() {
 | 
					 | 
				
			||||||
      var expiryDate = this.mollie.createComponent('expiryDate');
 | 
					 | 
				
			||||||
      expiryDate.mount('#expiry-date');
 | 
					 | 
				
			||||||
      var expiryDateError = document.getElementById('expiry-date-error');
 | 
					 | 
				
			||||||
      expiryDate.addEventListener('change', function (event) {
 | 
					 | 
				
			||||||
        if (event.error && event.touched) {
 | 
					 | 
				
			||||||
          expiryDateError.textContent = event.error;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          expiryDateError.textContent = '';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "createCvvInput",
 | 
					 | 
				
			||||||
    value: function createCvvInput() {
 | 
					 | 
				
			||||||
      var verificationCode = this.mollie.createComponent('verificationCode');
 | 
					 | 
				
			||||||
      verificationCode.mount('#cvv');
 | 
					 | 
				
			||||||
      var verificationCodeError = document.getElementById('cvv-error');
 | 
					 | 
				
			||||||
      verificationCode.addEventListener('change', function (event) {
 | 
					 | 
				
			||||||
        if (event.error && event.touched) {
 | 
					 | 
				
			||||||
          verificationCodeError.textContent = event.error;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          verificationCodeError.textContent = '';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePayNowButton",
 | 
					 | 
				
			||||||
    value: function handlePayNowButton() {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (document.querySelector('input[name=token]').value !== '') {
 | 
					 | 
				
			||||||
        document.querySelector('input[name=gateway_response]').value = '';
 | 
					 | 
				
			||||||
        return document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.mollie.createToken().then(function (result) {
 | 
					 | 
				
			||||||
        var token = result.token;
 | 
					 | 
				
			||||||
        var error = result.error;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (error) {
 | 
					 | 
				
			||||||
          document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
          var errorsContainer = document.getElementById('errors');
 | 
					 | 
				
			||||||
          errorsContainer.innerText = error.message;
 | 
					 | 
				
			||||||
          errorsContainer.hidden = false;
 | 
					 | 
				
			||||||
          return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        var tokenBillingCheckbox = document.querySelector('input[name="token-billing-checkbox"]:checked');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (tokenBillingCheckbox) {
 | 
					 | 
				
			||||||
          document.querySelector('input[name="store_card"]').value = tokenBillingCheckbox.value;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        document.querySelector('input[name=gateway_response]').value = token;
 | 
					 | 
				
			||||||
        document.querySelector('input[name=token]').value = '';
 | 
					 | 
				
			||||||
        document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.createCardHolderInput().createCardNumberInput().createExpiryDateInput().createCvvInput();
 | 
					 | 
				
			||||||
      Array.from(document.getElementsByClassName('toggle-payment-with-token')).forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
          document.getElementById('mollie--payment-container').classList.add('hidden');
 | 
					 | 
				
			||||||
          document.getElementById('save-card--container').style.display = 'none';
 | 
					 | 
				
			||||||
          document.querySelector('input[name=token]').value = element.target.dataset.token;
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.getElementById('toggle-payment-with-credit-card').addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
        document.getElementById('mollie--payment-container').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.getElementById('save-card--container').style.display = 'grid';
 | 
					 | 
				
			||||||
        document.querySelector('input[name=token]').value = '';
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').addEventListener('click', function () {
 | 
					 | 
				
			||||||
        return _this.handlePayNowButton();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return _Mollie;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new _Mollie().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										176
									
								
								public/js/clients/payments/paytrace-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										176
									
								
								public/js/clients/payments/paytrace-credit-card.js
									
									
									
									
										vendored
									
									
								
							@ -1,174 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see paytrace-credit-card.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(new(function(){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.clientKey=null===(e=document.querySelector("meta[name=paytrace-client-key]"))||void 0===e?void 0:e.content}var n,o,r;return n=t,(o=[{key:"creditCardStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"100%"}}},{key:"codeStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"300px"}}},{key:"expStyles",get:function(){return{font_color:"#111827",border_color:"rgba(210,214,220,1)",label_color:"#111827",label_size:"12pt",background_color:"white",border_style:"solid",font_size:"15pt",height:"30px",width:"85px",type:"dropdown"}}},{key:"updatePayTraceLabels",value:function(){window.PTPayment.getControl("securityCode").label.text(document.querySelector("meta[name=ctrans-cvv]").content),window.PTPayment.getControl("creditCard").label.text(document.querySelector("meta[name=ctrans-card_number]").content),window.PTPayment.getControl("expiration").label.text(document.querySelector("meta[name=ctrans-expires]").content)}},{key:"setupPayTrace",value:function(){return window.PTPayment.setup({styles:{code:this.codeStyles,cc:this.creditCardStyles,exp:this.expStyles},authorization:{clientKey:this.clientKey}})}},{key:"handlePaymentWithCreditCard",value:function(e){var t=this;e.target.parentElement.disabled=!0,document.getElementById("errors").hidden=!0,window.PTPayment.validate((function(n){if(n.length>=1){var o=document.getElementById("errors");return o.textContent=n[0].description,o.hidden=!1,e.target.parentElement.disabled=!1}t.ptInstance.process().then((function(e){document.getElementById("HPF_Token").value=e.message.hpf_token,document.getElementById("enc_key").value=e.message.enc_key;var t=document.querySelector('input[name="token-billing-checkbox"]:checked');t&&(document.querySelector('input[name="store_card"]').value=t.value),document.getElementById("server_response").submit()})).catch((function(e){document.getElementById("errors").textContent=JSON.stringify(e),document.getElementById("errors").hidden=!1,console.log(e)}))}))}},{key:"handlePaymentWithToken",value:function(e){e.target.parentElement.disabled=!0,document.getElementById("server_response").submit()}},{key:"handle",value:function(){var e,t=this;Array.from(document.getElementsByClassName("toggle-payment-with-token")).forEach((function(e){return e.addEventListener("click",(function(e){document.getElementById("paytrace--credit-card-container").classList.add("hidden"),document.getElementById("save-card--container").style.display="none",document.querySelector("input[name=token]").value=e.target.dataset.token}))})),null===(e=document.getElementById("toggle-payment-with-credit-card"))||void 0===e||e.addEventListener("click",(function(e){document.getElementById("paytrace--credit-card-container").classList.remove("hidden"),document.getElementById("save-card--container").style.display="grid",document.querySelector("input[name=token]").value="",t.setupPayTrace().then((function(e){t.ptInstance=e,t.updatePayTraceLabels()}))})),document.getElementById("pay-now").addEventListener("click",(function(e){return""===document.querySelector("input[name=token]").value?t.handlePaymentWithCreditCard(e):t.handlePaymentWithToken(e)}))}}])&&e(n.prototype,o),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!***************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/paytrace-credit-card.js ***!
 | 
					 | 
				
			||||||
  \***************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var PayTraceCreditCard = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function PayTraceCreditCard() {
 | 
					 | 
				
			||||||
    var _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, PayTraceCreditCard);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.clientKey = (_document$querySelect = document.querySelector('meta[name=paytrace-client-key]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(PayTraceCreditCard, [{
 | 
					 | 
				
			||||||
    key: "creditCardStyles",
 | 
					 | 
				
			||||||
    get: function get() {
 | 
					 | 
				
			||||||
      return {
 | 
					 | 
				
			||||||
        font_color: '#111827',
 | 
					 | 
				
			||||||
        border_color: 'rgba(210,214,220,1)',
 | 
					 | 
				
			||||||
        label_color: '#111827',
 | 
					 | 
				
			||||||
        label_size: '12pt',
 | 
					 | 
				
			||||||
        background_color: 'white',
 | 
					 | 
				
			||||||
        border_style: 'solid',
 | 
					 | 
				
			||||||
        font_size: '15pt',
 | 
					 | 
				
			||||||
        height: '30px',
 | 
					 | 
				
			||||||
        width: '100%'
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "codeStyles",
 | 
					 | 
				
			||||||
    get: function get() {
 | 
					 | 
				
			||||||
      return {
 | 
					 | 
				
			||||||
        font_color: '#111827',
 | 
					 | 
				
			||||||
        border_color: 'rgba(210,214,220,1)',
 | 
					 | 
				
			||||||
        label_color: '#111827',
 | 
					 | 
				
			||||||
        label_size: '12pt',
 | 
					 | 
				
			||||||
        background_color: 'white',
 | 
					 | 
				
			||||||
        border_style: 'solid',
 | 
					 | 
				
			||||||
        font_size: '15pt',
 | 
					 | 
				
			||||||
        height: '30px',
 | 
					 | 
				
			||||||
        width: '300px'
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "expStyles",
 | 
					 | 
				
			||||||
    get: function get() {
 | 
					 | 
				
			||||||
      return {
 | 
					 | 
				
			||||||
        font_color: '#111827',
 | 
					 | 
				
			||||||
        border_color: 'rgba(210,214,220,1)',
 | 
					 | 
				
			||||||
        label_color: '#111827',
 | 
					 | 
				
			||||||
        label_size: '12pt',
 | 
					 | 
				
			||||||
        background_color: 'white',
 | 
					 | 
				
			||||||
        border_style: 'solid',
 | 
					 | 
				
			||||||
        font_size: '15pt',
 | 
					 | 
				
			||||||
        height: '30px',
 | 
					 | 
				
			||||||
        width: '85px',
 | 
					 | 
				
			||||||
        type: 'dropdown'
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "updatePayTraceLabels",
 | 
					 | 
				
			||||||
    value: function updatePayTraceLabels() {
 | 
					 | 
				
			||||||
      window.PTPayment.getControl('securityCode').label.text(document.querySelector('meta[name=ctrans-cvv]').content);
 | 
					 | 
				
			||||||
      window.PTPayment.getControl('creditCard').label.text(document.querySelector('meta[name=ctrans-card_number]').content);
 | 
					 | 
				
			||||||
      window.PTPayment.getControl('expiration').label.text(document.querySelector('meta[name=ctrans-expires]').content);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "setupPayTrace",
 | 
					 | 
				
			||||||
    value: function setupPayTrace() {
 | 
					 | 
				
			||||||
      return window.PTPayment.setup({
 | 
					 | 
				
			||||||
        styles: {
 | 
					 | 
				
			||||||
          code: this.codeStyles,
 | 
					 | 
				
			||||||
          cc: this.creditCardStyles,
 | 
					 | 
				
			||||||
          exp: this.expStyles
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        authorization: {
 | 
					 | 
				
			||||||
          clientKey: this.clientKey
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePaymentWithCreditCard",
 | 
					 | 
				
			||||||
    value: function handlePaymentWithCreditCard(event) {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      event.target.parentElement.disabled = true;
 | 
					 | 
				
			||||||
      document.getElementById('errors').hidden = true;
 | 
					 | 
				
			||||||
      window.PTPayment.validate(function (errors) {
 | 
					 | 
				
			||||||
        if (errors.length >= 1) {
 | 
					 | 
				
			||||||
          var errorsContainer = document.getElementById('errors');
 | 
					 | 
				
			||||||
          errorsContainer.textContent = errors[0].description;
 | 
					 | 
				
			||||||
          errorsContainer.hidden = false;
 | 
					 | 
				
			||||||
          return event.target.parentElement.disabled = false;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this.ptInstance.process().then(function (response) {
 | 
					 | 
				
			||||||
          document.getElementById('HPF_Token').value = response.message.hpf_token;
 | 
					 | 
				
			||||||
          document.getElementById('enc_key').value = response.message.enc_key;
 | 
					 | 
				
			||||||
          var tokenBillingCheckbox = document.querySelector('input[name="token-billing-checkbox"]:checked');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          if (tokenBillingCheckbox) {
 | 
					 | 
				
			||||||
            document.querySelector('input[name="store_card"]').value = tokenBillingCheckbox.value;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
        })["catch"](function (error) {
 | 
					 | 
				
			||||||
          document.getElementById('errors').textContent = JSON.stringify(error);
 | 
					 | 
				
			||||||
          document.getElementById('errors').hidden = false;
 | 
					 | 
				
			||||||
          console.log(error);
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePaymentWithToken",
 | 
					 | 
				
			||||||
    value: function handlePaymentWithToken(event) {
 | 
					 | 
				
			||||||
      event.target.parentElement.disabled = true;
 | 
					 | 
				
			||||||
      document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _document$getElementB,
 | 
					 | 
				
			||||||
          _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      Array.from(document.getElementsByClassName('toggle-payment-with-token')).forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
          document.getElementById('paytrace--credit-card-container').classList.add('hidden');
 | 
					 | 
				
			||||||
          document.getElementById('save-card--container').style.display = 'none';
 | 
					 | 
				
			||||||
          document.querySelector('input[name=token]').value = element.target.dataset.token;
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      (_document$getElementB = document.getElementById('toggle-payment-with-credit-card')) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.addEventListener('click', function (element) {
 | 
					 | 
				
			||||||
        document.getElementById('paytrace--credit-card-container').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.getElementById('save-card--container').style.display = 'grid';
 | 
					 | 
				
			||||||
        document.querySelector('input[name=token]').value = '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this2.setupPayTrace().then(function (instance) {
 | 
					 | 
				
			||||||
          _this2.ptInstance = instance;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          _this2.updatePayTraceLabels();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        if (document.querySelector('input[name=token]').value === '') {
 | 
					 | 
				
			||||||
          return _this2.handlePaymentWithCreditCard(e);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return _this2.handlePaymentWithToken(e);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return PayTraceCreditCard;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new PayTraceCreditCard().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										40
									
								
								public/js/clients/payments/razorpay-aio.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										40
									
								
								public/js/clients/payments/razorpay-aio.js
									
									
									
									
										vendored
									
									
								
							@ -1,38 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see razorpay-aio.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,n=JSON.parse(null===(e=document.querySelector("meta[name=razorpay-options]"))||void 0===e?void 0:e.content);n.handler=function(e){document.getElementById("razorpay_payment_id").value=e.razorpay_payment_id,document.getElementById("razorpay_signature").value=e.razorpay_signature,document.getElementById("server-response").submit()},n.modal={ondismiss:function(){o.disabled=!1}};var a=new Razorpay(n),o=document.getElementById("pay-now");o.onclick=function(e){o.disabled=!0,a.open()}})();
 | 
				
			||||||
/*!*******************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/razorpay-aio.js ***!
 | 
					 | 
				
			||||||
  \*******************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var options = JSON.parse((_document$querySelect = document.querySelector('meta[name=razorpay-options]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
options.handler = function (response) {
 | 
					 | 
				
			||||||
  document.getElementById('razorpay_payment_id').value = response.razorpay_payment_id;
 | 
					 | 
				
			||||||
  document.getElementById('razorpay_signature').value = response.razorpay_signature;
 | 
					 | 
				
			||||||
  document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
options.modal = {
 | 
					 | 
				
			||||||
  ondismiss: function ondismiss() {
 | 
					 | 
				
			||||||
    payNowButton.disabled = false;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
var razorpay = new Razorpay(options);
 | 
					 | 
				
			||||||
var payNowButton = document.getElementById('pay-now');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
payNowButton.onclick = function (event) {
 | 
					 | 
				
			||||||
  payNowButton.disabled = true;
 | 
					 | 
				
			||||||
  razorpay.open();
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										309
									
								
								public/js/clients/payments/square-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										309
									
								
								public/js/clients/payments/square-credit-card.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										114
									
								
								public/js/clients/payments/stripe-ach.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										114
									
								
								public/js/clients/payments/stripe-ach.js
									
									
									
									
										vendored
									
									
								
							@ -1,112 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-ach.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}(new(function(){function n(){var e,r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),t(this,"getFormData",(function(){return{country:document.getElementById("country").value,currency:document.getElementById("currency").value,routing_number:document.getElementById("routing-number").value,account_number:document.getElementById("account-number").value,account_holder_name:document.getElementById("account-holder-name").value,account_holder_type:document.querySelector('input[name="account-holder-type"]:checked').value}})),t(this,"handleError",(function(e){document.getElementById("save-button").disabled=!1,document.querySelector("#save-button > svg").classList.add("hidden"),document.querySelector("#save-button > span").classList.remove("hidden"),r.errors.textContent="",r.errors.textContent=e,r.errors.hidden=!1})),t(this,"handleSuccess",(function(e){document.getElementById("gateway_response").value=JSON.stringify(e),document.getElementById("server_response").submit()})),t(this,"handleSubmit",(function(e){if(!document.getElementById("accept-terms").checked)return errors.textContent="You must accept the mandate terms prior to making payment.",void(errors.hidden=!1);document.getElementById("save-button").disabled=!0,document.querySelector("#save-button > svg").classList.remove("hidden"),document.querySelector("#save-button > span").classList.add("hidden"),e.preventDefault(),r.errors.textContent="",r.errors.hidden=!0,r.stripe.createToken("bank_account",r.getFormData()).then((function(e){return e.hasOwnProperty("error")?r.handleError(e.error.message):r.handleSuccess(e)}))})),this.errors=document.getElementById("errors"),this.key=document.querySelector('meta[name="stripe-publishable-key"]').content,this.stripe_connect=null===(e=document.querySelector('meta[name="stripe-account-id"]'))||void 0===e?void 0:e.content}var r,o,u;return r=n,(o=[{key:"handle",value:function(){var e=this;document.getElementById("save-button").addEventListener("click",(function(t){return e.handleSubmit(t)}))}}])&&e(r.prototype,o),u&&e(r,u),Object.defineProperty(r,"prototype",{writable:!1}),n}())).setupStripe().handle()})();
 | 
				
			||||||
/*!*****************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-ach.js ***!
 | 
					 | 
				
			||||||
  \*****************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var AuthorizeACH = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function AuthorizeACH() {
 | 
					 | 
				
			||||||
    var _this = this,
 | 
					 | 
				
			||||||
        _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, AuthorizeACH);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
      if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
        // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
          stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return _this;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "getFormData", function () {
 | 
					 | 
				
			||||||
      return {
 | 
					 | 
				
			||||||
        country: document.getElementById('country').value,
 | 
					 | 
				
			||||||
        currency: document.getElementById('currency').value,
 | 
					 | 
				
			||||||
        routing_number: document.getElementById('routing-number').value,
 | 
					 | 
				
			||||||
        account_number: document.getElementById('account-number').value,
 | 
					 | 
				
			||||||
        account_holder_name: document.getElementById('account-holder-name').value,
 | 
					 | 
				
			||||||
        account_holder_type: document.querySelector('input[name="account-holder-type"]:checked').value
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handleError", function (message) {
 | 
					 | 
				
			||||||
      document.getElementById('save-button').disabled = false;
 | 
					 | 
				
			||||||
      document.querySelector('#save-button > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#save-button > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
      _this.errors.textContent = '';
 | 
					 | 
				
			||||||
      _this.errors.textContent = message;
 | 
					 | 
				
			||||||
      _this.errors.hidden = false;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handleSuccess", function (response) {
 | 
					 | 
				
			||||||
      document.getElementById('gateway_response').value = JSON.stringify(response);
 | 
					 | 
				
			||||||
      document.getElementById('server_response').submit();
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handleSubmit", function (e) {
 | 
					 | 
				
			||||||
      if (!document.getElementById('accept-terms').checked) {
 | 
					 | 
				
			||||||
        errors.textContent = "You must accept the mandate terms prior to making payment.";
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('save-button').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#save-button > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#save-button > span').classList.add('hidden');
 | 
					 | 
				
			||||||
      e.preventDefault();
 | 
					 | 
				
			||||||
      _this.errors.textContent = '';
 | 
					 | 
				
			||||||
      _this.errors.hidden = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.createToken('bank_account', _this.getFormData()).then(function (result) {
 | 
					 | 
				
			||||||
        if (result.hasOwnProperty('error')) {
 | 
					 | 
				
			||||||
          return _this.handleError(result.error.message);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return _this.handleSuccess(result);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
    this.key = document.querySelector('meta[name="stripe-publishable-key"]').content;
 | 
					 | 
				
			||||||
    this.stripe_connect = (_document$querySelect = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(AuthorizeACH, [{
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('save-button').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        return _this2.handleSubmit(e);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return AuthorizeACH;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new AuthorizeACH().setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										116
									
								
								public/js/clients/payments/stripe-acss.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										116
									
								
								public/js/clients/payments/stripe-acss.js
									
									
									
									
										vendored
									
									
								
							@ -1,114 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-acss.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");return""===document.getElementById("acss-name").value?(document.getElementById("acss-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-required]").content,void(t.hidden=!1)):""===document.getElementById("acss-email-address").value?(document.getElementById("acss-email-address").focus(),t.textContent=document.querySelector("meta[name=translation-email-required]").content,void(t.hidden=!1)):(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void r.stripe.confirmAcssDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("acss-name").value,email:document.getElementById("acss-email-address").value}}}).then((function(e){return e.error?r.handleFailure(e.error.message):r.handleSuccess(e)})))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,r;return t=e,(n=[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&o(t.prototype,n),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();new i(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!******************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-acss.js ***!
 | 
					 | 
				
			||||||
  \******************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessACSS = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function ProcessACSS(key, stripeConnect) {
 | 
					 | 
				
			||||||
    var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, ProcessACSS);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
      if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
        // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
          stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return _this;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (document.getElementById('acss-name').value === "") {
 | 
					 | 
				
			||||||
          document.getElementById('acss-name').focus();
 | 
					 | 
				
			||||||
          errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
          return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (document.getElementById('acss-email-address').value === "") {
 | 
					 | 
				
			||||||
          document.getElementById('acss-email-address').focus();
 | 
					 | 
				
			||||||
          errors.textContent = document.querySelector('meta[name=translation-email-required]').content;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
          return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this.stripe.confirmAcssDebitPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
          payment_method: {
 | 
					 | 
				
			||||||
            billing_details: {
 | 
					 | 
				
			||||||
              name: document.getElementById("acss-name").value,
 | 
					 | 
				
			||||||
              email: document.getElementById("acss-email-address").value
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }).then(function (result) {
 | 
					 | 
				
			||||||
          if (result.error) {
 | 
					 | 
				
			||||||
            return _this.handleFailure(result.error.message);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          return _this.handleSuccess(result);
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.key = key;
 | 
					 | 
				
			||||||
    this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
    this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(ProcessACSS, [{
 | 
					 | 
				
			||||||
    key: "handleSuccess",
 | 
					 | 
				
			||||||
    value: function handleSuccess(result) {
 | 
					 | 
				
			||||||
      document.querySelector('input[name="gateway_response"]').value = JSON.stringify(result.paymentIntent);
 | 
					 | 
				
			||||||
      document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handleFailure",
 | 
					 | 
				
			||||||
    value: function handleFailure(message) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
      errors.textContent = '';
 | 
					 | 
				
			||||||
      errors.textContent = message;
 | 
					 | 
				
			||||||
      errors.hidden = false;
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return ProcessACSS;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessACSS(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										83
									
								
								public/js/clients/payments/stripe-alipay.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										83
									
								
								public/js/clients/payments/stripe-alipay.js
									
									
									
									
										vendored
									
									
								
							@ -1,81 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-alipay.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=i((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),c(this,"handle",(function(){var e={type:"alipay",amount:document.querySelector('meta[name="amount"]').content,currency:document.querySelector('meta[name="currency"]').content,redirect:{return_url:document.querySelector('meta[name="return-url"]').content}};document.getElementById("pay-now").addEventListener("click",(function(t){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),r.stripe.createSource(e).then((function(e){if(e.hasOwnProperty("source"))return window.location=e.source.redirect.url;document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),this.errors.textContent="",this.errors.textContent=e.error.message,this.errors.hidden=!1}))}))})),this.key=t,this.stripeConnect=n,this.errors=document.getElementById("errors")}));new u(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-alipay.js ***!
 | 
					 | 
				
			||||||
  \********************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessAlipay = /*#__PURE__*/_createClass(function ProcessAlipay(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessAlipay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    var data = {
 | 
					 | 
				
			||||||
      type: 'alipay',
 | 
					 | 
				
			||||||
      amount: document.querySelector('meta[name="amount"]').content,
 | 
					 | 
				
			||||||
      currency: document.querySelector('meta[name="currency"]').content,
 | 
					 | 
				
			||||||
      redirect: {
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.createSource(data).then(function (result) {
 | 
					 | 
				
			||||||
        if (result.hasOwnProperty('source')) {
 | 
					 | 
				
			||||||
          return window.location = result.source.redirect.url;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
        this.errors.textContent = '';
 | 
					 | 
				
			||||||
        this.errors.textContent = result.error.message;
 | 
					 | 
				
			||||||
        this.errors.hidden = false;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessAlipay(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										80
									
								
								public/js/clients/payments/stripe-bancontact.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										80
									
								
								public/js/clients/payments/stripe-bancontact.js
									
									
									
									
										vendored
									
									
								
							@ -1,78 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-bancontact.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=i((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("bancontact-name").value)return t.textContent=document.querySelector("meta[name=translation-name-required]").content,t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmBancontactPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("bancontact-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new c(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-bancontact.js ***!
 | 
					 | 
				
			||||||
  \************************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessBANCONTACTPay = /*#__PURE__*/_createClass(function ProcessBANCONTACTPay(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessBANCONTACTPay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!document.getElementById('bancontact-name').value) {
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        console.log("name");
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.confirmBancontactPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
        payment_method: {
 | 
					 | 
				
			||||||
          billing_details: {
 | 
					 | 
				
			||||||
            name: document.getElementById("bancontact-name").value
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessBANCONTACTPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										157
									
								
								public/js/clients/payments/stripe-becs.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										157
									
								
								public/js/clients/payments/stripe-becs.js
									
									
									
									
										vendored
									
									
								
							@ -1,155 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-becs.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,o;function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(){function e(t,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r(this,"setupStripe",(function(){o.stripeConnect?o.stripe=Stripe(o.key,{stripeAccount:o.stripeConnect}):o.stripe=Stripe(o.key);var e=o.stripe.elements(),t={style:{base:{color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"},":-webkit-autofill":{color:"#32325d"}},invalid:{color:"#fa755a",iconColor:"#fa755a",":-webkit-autofill":{color:"#fa755a"}}},disabled:!1,hideIcon:!1,iconStyle:"default"};return o.auBankAccount=e.create("auBankAccount",t),o.auBankAccount.mount("#becs-iban"),o})),r(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");return""===document.getElementById("becs-name").value?(document.getElementById("becs-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-required]").content,void(t.hidden=!1)):""===document.getElementById("becs-email-address").value?(document.getElementById("becs-email-address").focus(),t.textContent=document.querySelector("meta[name=translation-email-required]").content,void(t.hidden=!1)):document.getElementById("becs-mandate-acceptance").checked?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void o.stripe.confirmAuBecsDebitPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{au_becs_debit:o.auBankAccount,billing_details:{name:document.getElementById("becs-name").value,email:document.getElementById("becs-email-address").value}}}).then((function(e){return e.error?o.handleFailure(e.error.message):o.handleSuccess(e)}))):(document.getElementById("becs-mandate-acceptance").focus(),t.textContent=document.querySelector("meta[name=translation-terms-required]").content,t.hidden=!1,void console.log("Terms"))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,o;return t=e,(n=[{key:"handleSuccess",value:function(e){document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit()}},{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&a(t.prototype,n),o&&a(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}();new c(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(o=document.querySelector('meta[name="stripe-account-id"]'))||void 0===o?void 0:o.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!******************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-becs.js ***!
 | 
					 | 
				
			||||||
  \******************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessBECS = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function ProcessBECS(key, stripeConnect) {
 | 
					 | 
				
			||||||
    var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, ProcessBECS);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
      if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
        // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
          stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var elements = _this.stripe.elements();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var style = {
 | 
					 | 
				
			||||||
        base: {
 | 
					 | 
				
			||||||
          color: '#32325d',
 | 
					 | 
				
			||||||
          fontSize: '16px',
 | 
					 | 
				
			||||||
          '::placeholder': {
 | 
					 | 
				
			||||||
            color: '#aab7c4'
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          ':-webkit-autofill': {
 | 
					 | 
				
			||||||
            color: '#32325d'
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        invalid: {
 | 
					 | 
				
			||||||
          color: '#fa755a',
 | 
					 | 
				
			||||||
          iconColor: '#fa755a',
 | 
					 | 
				
			||||||
          ':-webkit-autofill': {
 | 
					 | 
				
			||||||
            color: '#fa755a'
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
      var options = {
 | 
					 | 
				
			||||||
        style: style,
 | 
					 | 
				
			||||||
        disabled: false,
 | 
					 | 
				
			||||||
        hideIcon: false,
 | 
					 | 
				
			||||||
        iconStyle: "default" // or "solid"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
      _this.auBankAccount = elements.create("auBankAccount", options);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.auBankAccount.mount("#becs-iban");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return _this;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (document.getElementById('becs-name').value === "") {
 | 
					 | 
				
			||||||
          document.getElementById('becs-name').focus();
 | 
					 | 
				
			||||||
          errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
          return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (document.getElementById('becs-email-address').value === "") {
 | 
					 | 
				
			||||||
          document.getElementById('becs-email-address').focus();
 | 
					 | 
				
			||||||
          errors.textContent = document.querySelector('meta[name=translation-email-required]').content;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
          return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!document.getElementById('becs-mandate-acceptance').checked) {
 | 
					 | 
				
			||||||
          document.getElementById('becs-mandate-acceptance').focus();
 | 
					 | 
				
			||||||
          errors.textContent = document.querySelector('meta[name=translation-terms-required]').content;
 | 
					 | 
				
			||||||
          errors.hidden = false;
 | 
					 | 
				
			||||||
          console.log("Terms");
 | 
					 | 
				
			||||||
          return;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this.stripe.confirmAuBecsDebitPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
          payment_method: {
 | 
					 | 
				
			||||||
            au_becs_debit: _this.auBankAccount,
 | 
					 | 
				
			||||||
            billing_details: {
 | 
					 | 
				
			||||||
              name: document.getElementById("becs-name").value,
 | 
					 | 
				
			||||||
              email: document.getElementById("becs-email-address").value
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }).then(function (result) {
 | 
					 | 
				
			||||||
          if (result.error) {
 | 
					 | 
				
			||||||
            return _this.handleFailure(result.error.message);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          return _this.handleSuccess(result);
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.key = key;
 | 
					 | 
				
			||||||
    this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
    this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(ProcessBECS, [{
 | 
					 | 
				
			||||||
    key: "handleSuccess",
 | 
					 | 
				
			||||||
    value: function handleSuccess(result) {
 | 
					 | 
				
			||||||
      document.querySelector('input[name="gateway_response"]').value = JSON.stringify(result.paymentIntent);
 | 
					 | 
				
			||||||
      document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handleFailure",
 | 
					 | 
				
			||||||
    value: function handleFailure(message) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
      errors.textContent = '';
 | 
					 | 
				
			||||||
      errors.textContent = message;
 | 
					 | 
				
			||||||
      errors.hidden = false;
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return ProcessBECS;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessBECS(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										124
									
								
								public/js/clients/payments/stripe-browserpay.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										124
									
								
								public/js/clients/payments/stripe-browserpay.js
									
									
									
									
										vendored
									
									
								
							@ -1,122 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-browserpay.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.clientSecret=null===(e=document.querySelector("meta[name=stripe-pi-client-secret]"))||void 0===e?void 0:e.content}var n,r,o;return n=t,(r=[{key:"init",value:function(){var e,t,n={};return document.querySelector("meta[name=stripe-account-id]")&&(n.apiVersion="2020-08-27",n.stripeAccount=null===(t=document.querySelector("meta[name=stripe-account-id]"))||void 0===t?void 0:t.content),this.stripe=Stripe(null===(e=document.querySelector("meta[name=stripe-publishable-key]"))||void 0===e?void 0:e.content,n),this.elements=this.stripe.elements(),this}},{key:"createPaymentRequest",value:function(){return this.paymentRequest=this.stripe.paymentRequest(JSON.parse(document.querySelector("meta[name=payment-request-data").content)),this}},{key:"createPaymentRequestButton",value:function(){this.paymentRequestButton=this.elements.create("paymentRequestButton",{paymentRequest:this.paymentRequest})}},{key:"handlePaymentRequestEvents",value:function(e,t){document.querySelector("#errors").hidden=!0,this.paymentRequest.on("paymentmethod",(function(n){e.confirmCardPayment(t,{payment_method:n.paymentMethod.id},{handleActions:!1}).then((function(r){r.error?(document.querySelector("#errors").innerText=r.error.message,document.querySelector("#errors").hidden=!1,n.complete("fail")):(n.complete("success"),"requires_action"===r.paymentIntent.status?e.confirmCardPayment(t).then((function(e){e.error?(n.complete("fail"),document.querySelector("#errors").innerText=e.error.message,document.querySelector("#errors").hidden=!1):(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(e.paymentIntent),document.getElementById("server-response").submit())})):(document.querySelector('input[name="gateway_response"]').value=JSON.stringify(r.paymentIntent),document.getElementById("server-response").submit()))}))}))}},{key:"handle",value:function(){var e=this;this.init().createPaymentRequest().createPaymentRequestButton(),this.paymentRequest.canMakePayment().then((function(t){var n;if(t)return e.paymentRequestButton.mount("#payment-request-button");document.querySelector("#errors").innerHTML=JSON.parse(null===(n=document.querySelector("meta[name=no-available-methods]"))||void 0===n?void 0:n.content),document.querySelector("#errors").hidden=!1})),this.handlePaymentRequestEvents(this.stripe,this.clientSecret)}}])&&e(n.prototype,r),o&&e(n,o),Object.defineProperty(n,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-browserpay.js ***!
 | 
					 | 
				
			||||||
  \************************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var StripeBrowserPay = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function StripeBrowserPay() {
 | 
					 | 
				
			||||||
    var _document$querySelect;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, StripeBrowserPay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.clientSecret = (_document$querySelect = document.querySelector('meta[name=stripe-pi-client-secret]')) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.content;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(StripeBrowserPay, [{
 | 
					 | 
				
			||||||
    key: "init",
 | 
					 | 
				
			||||||
    value: function init() {
 | 
					 | 
				
			||||||
      var _document$querySelect3;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var config = {};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (document.querySelector('meta[name=stripe-account-id]')) {
 | 
					 | 
				
			||||||
        var _document$querySelect2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        config.apiVersion = '2020-08-27';
 | 
					 | 
				
			||||||
        config.stripeAccount = (_document$querySelect2 = document.querySelector('meta[name=stripe-account-id]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.stripe = Stripe((_document$querySelect3 = document.querySelector('meta[name=stripe-publishable-key]')) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.content, config);
 | 
					 | 
				
			||||||
      this.elements = this.stripe.elements();
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "createPaymentRequest",
 | 
					 | 
				
			||||||
    value: function createPaymentRequest() {
 | 
					 | 
				
			||||||
      this.paymentRequest = this.stripe.paymentRequest(JSON.parse(document.querySelector('meta[name=payment-request-data').content));
 | 
					 | 
				
			||||||
      return this;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "createPaymentRequestButton",
 | 
					 | 
				
			||||||
    value: function createPaymentRequestButton() {
 | 
					 | 
				
			||||||
      this.paymentRequestButton = this.elements.create('paymentRequestButton', {
 | 
					 | 
				
			||||||
        paymentRequest: this.paymentRequest
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handlePaymentRequestEvents",
 | 
					 | 
				
			||||||
    value: function handlePaymentRequestEvents(stripe, clientSecret) {
 | 
					 | 
				
			||||||
      document.querySelector('#errors').hidden = true;
 | 
					 | 
				
			||||||
      this.paymentRequest.on('paymentmethod', function (ev) {
 | 
					 | 
				
			||||||
        stripe.confirmCardPayment(clientSecret, {
 | 
					 | 
				
			||||||
          payment_method: ev.paymentMethod.id
 | 
					 | 
				
			||||||
        }, {
 | 
					 | 
				
			||||||
          handleActions: false
 | 
					 | 
				
			||||||
        }).then(function (confirmResult) {
 | 
					 | 
				
			||||||
          if (confirmResult.error) {
 | 
					 | 
				
			||||||
            document.querySelector('#errors').innerText = confirmResult.error.message;
 | 
					 | 
				
			||||||
            document.querySelector('#errors').hidden = false;
 | 
					 | 
				
			||||||
            ev.complete('fail');
 | 
					 | 
				
			||||||
          } else {
 | 
					 | 
				
			||||||
            ev.complete('success');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (confirmResult.paymentIntent.status === 'requires_action') {
 | 
					 | 
				
			||||||
              stripe.confirmCardPayment(clientSecret).then(function (result) {
 | 
					 | 
				
			||||||
                if (result.error) {
 | 
					 | 
				
			||||||
                  ev.complete('fail');
 | 
					 | 
				
			||||||
                  document.querySelector('#errors').innerText = result.error.message;
 | 
					 | 
				
			||||||
                  document.querySelector('#errors').hidden = false;
 | 
					 | 
				
			||||||
                } else {
 | 
					 | 
				
			||||||
                  document.querySelector('input[name="gateway_response"]').value = JSON.stringify(result.paymentIntent);
 | 
					 | 
				
			||||||
                  document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
              });
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
              document.querySelector('input[name="gateway_response"]').value = JSON.stringify(confirmResult.paymentIntent);
 | 
					 | 
				
			||||||
              document.getElementById('server-response').submit();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.init().createPaymentRequest().createPaymentRequestButton();
 | 
					 | 
				
			||||||
      this.paymentRequest.canMakePayment().then(function (result) {
 | 
					 | 
				
			||||||
        var _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (result) {
 | 
					 | 
				
			||||||
          return _this.paymentRequestButton.mount('#payment-request-button');
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        document.querySelector('#errors').innerHTML = JSON.parse((_document$querySelect4 = document.querySelector('meta[name=no-available-methods]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content);
 | 
					 | 
				
			||||||
        document.querySelector('#errors').hidden = false;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      this.handlePaymentRequestEvents(this.stripe, this.clientSecret);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return StripeBrowserPay;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new StripeBrowserPay().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										221
									
								
								public/js/clients/payments/stripe-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										221
									
								
								public/js/clients/payments/stripe-credit-card.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										99
									
								
								public/js/clients/payments/stripe-eps.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										99
									
								
								public/js/clients/payments/stripe-eps.js
									
									
									
									
										vendored
									
									
								
							@ -1,97 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-eps.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=i((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key);var e=r.stripe.elements();return r.eps=e.create("epsBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),r.eps.mount("#eps-bank-element"),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("eps-name").value)return t.textContent=document.querySelector("meta[name=translation-name-required]").content,t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmEpsPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{eps:r.eps,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new c(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!*****************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-eps.js ***!
 | 
					 | 
				
			||||||
  \*****************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessEPSPay = /*#__PURE__*/_createClass(function ProcessEPSPay(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessEPSPay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var elements = _this.stripe.elements();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var options = {
 | 
					 | 
				
			||||||
      style: {
 | 
					 | 
				
			||||||
        base: {
 | 
					 | 
				
			||||||
          padding: '10px 12px',
 | 
					 | 
				
			||||||
          color: '#32325d',
 | 
					 | 
				
			||||||
          fontSize: '16px',
 | 
					 | 
				
			||||||
          '::placeholder': {
 | 
					 | 
				
			||||||
            color: '#aab7c4'
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    _this.eps = elements.create('epsBank', options);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _this.eps.mount("#eps-bank-element");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!document.getElementById('eps-name').value) {
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        console.log("name");
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.confirmEpsPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
        payment_method: {
 | 
					 | 
				
			||||||
          eps: _this.eps,
 | 
					 | 
				
			||||||
          billing_details: {
 | 
					 | 
				
			||||||
            name: document.getElementById("ideal-name").value
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessEPSPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										109
									
								
								public/js/clients/payments/stripe-fpx.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										109
									
								
								public/js/clients/payments/stripe-fpx.js
									
									
									
									
										vendored
									
									
								
							@ -1,107 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-fpx.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=function(){function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"setupStripe",(function(){r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key);var e=r.stripe.elements();return r.fpx=e.create("fpxBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px"}},accountHolderType:"individual"}),r.fpx.mount("#fpx-bank-element"),r})),i(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmFpxPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{fpx:r.fpx},return_url:document.querySelector('meta[name="return-url"]').content}).then((function(e){e.error&&r.handleFailure(e.error.message)}))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}var t,n,r;return t=e,(n=[{key:"handleFailure",value:function(e){var t=document.getElementById("errors");t.textContent="",t.textContent=e,t.hidden=!1,document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden")}}])&&o(t.prototype,n),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),e}();new a(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!*****************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-fpx.js ***!
 | 
					 | 
				
			||||||
  \*****************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessFPXPay = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function ProcessFPXPay(key, stripeConnect) {
 | 
					 | 
				
			||||||
    var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _classCallCheck(this, ProcessFPXPay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
      if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
        // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
          stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var elements = _this.stripe.elements();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var style = {
 | 
					 | 
				
			||||||
        base: {
 | 
					 | 
				
			||||||
          // Add your base input styles here. For example:
 | 
					 | 
				
			||||||
          padding: '10px 12px',
 | 
					 | 
				
			||||||
          color: '#32325d',
 | 
					 | 
				
			||||||
          fontSize: '16px'
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
      _this.fpx = elements.create('fpxBank', {
 | 
					 | 
				
			||||||
        style: style,
 | 
					 | 
				
			||||||
        accountHolderType: 'individual'
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.fpx.mount("#fpx-bank-element");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      return _this;
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this.stripe.confirmFpxPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
          payment_method: {
 | 
					 | 
				
			||||||
            fpx: _this.fpx
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
        }).then(function (result) {
 | 
					 | 
				
			||||||
          if (result.error) {
 | 
					 | 
				
			||||||
            _this.handleFailure(result.error.message);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.key = key;
 | 
					 | 
				
			||||||
    this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
    this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(ProcessFPXPay, [{
 | 
					 | 
				
			||||||
    key: "handleFailure",
 | 
					 | 
				
			||||||
    value: function handleFailure(message) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
      errors.textContent = '';
 | 
					 | 
				
			||||||
      errors.textContent = message;
 | 
					 | 
				
			||||||
      errors.hidden = false;
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return ProcessFPXPay;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessFPXPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										80
									
								
								public/js/clients/payments/stripe-giropay.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										80
									
								
								public/js/clients/payments/stripe-giropay.js
									
									
									
									
										vendored
									
									
								
							@ -1,78 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-giropay.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=i((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("giropay-mandate-acceptance").checked)return t.textContent=document.querySelector("meta[name=translation-terms-required]").content,t.hidden=!1,void console.log("Terms");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmGiropayPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:document.getElementById("giropay-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new c(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!*********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-giropay.js ***!
 | 
					 | 
				
			||||||
  \*********************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessGiroPay = /*#__PURE__*/_createClass(function ProcessGiroPay(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessGiroPay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!document.getElementById('giropay-mandate-acceptance').checked) {
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-terms-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        console.log("Terms");
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.confirmGiropayPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
        payment_method: {
 | 
					 | 
				
			||||||
          billing_details: {
 | 
					 | 
				
			||||||
            name: document.getElementById("giropay-name").value
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessGiroPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										99
									
								
								public/js/clients/payments/stripe-ideal.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										99
									
								
								public/js/clients/payments/stripe-ideal.js
									
									
									
									
										vendored
									
									
								
							@ -1,97 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-ideal.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l=i((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"setupStripe",(function(){r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key);var e=r.stripe.elements();return r.ideal=e.create("idealBank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),r.ideal.mount("#ideal-bank-element"),r})),a(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");if(!document.getElementById("ideal-name").value)return t.textContent=document.querySelector("meta[name=translation-name-required]").content,t.hidden=!1,void console.log("name");document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmIdealPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{ideal:r.ideal,billing_details:{name:document.getElementById("ideal-name").value}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new l(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!*******************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-ideal.js ***!
 | 
					 | 
				
			||||||
  \*******************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessIDEALPay = /*#__PURE__*/_createClass(function ProcessIDEALPay(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessIDEALPay);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var elements = _this.stripe.elements();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var options = {
 | 
					 | 
				
			||||||
      style: {
 | 
					 | 
				
			||||||
        base: {
 | 
					 | 
				
			||||||
          padding: '10px 12px',
 | 
					 | 
				
			||||||
          color: '#32325d',
 | 
					 | 
				
			||||||
          fontSize: '16px',
 | 
					 | 
				
			||||||
          '::placeholder': {
 | 
					 | 
				
			||||||
            color: '#aab7c4'
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    _this.ideal = elements.create('idealBank', options);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _this.ideal.mount("#ideal-bank-element");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!document.getElementById('ideal-name').value) {
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        console.log("name");
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.confirmIdealPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
        payment_method: {
 | 
					 | 
				
			||||||
          ideal: _this.ideal,
 | 
					 | 
				
			||||||
          billing_details: {
 | 
					 | 
				
			||||||
            name: document.getElementById("ideal-name").value
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessIDEALPay(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										104
									
								
								public/js/clients/payments/stripe-klarna.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										104
									
								
								public/js/clients/payments/stripe-klarna.js
									
									
									
									
										vendored
									
									
								
							@ -1,102 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-klarna.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=a((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),c(this,"handleError",(function(e){document.getElementById("pay-now").disabled=!1,document.querySelector("#pay-now > svg").classList.add("hidden"),document.querySelector("#pay-now > span").classList.remove("hidden"),r.errors.textContent="",r.errors.textContent=e,r.errors.hidden=!1})),c(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors"),n=document.getElementById("klarna-name").value;/^[A-Za-z\s]*$/.test(n)?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmKlarnaPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{billing_details:{name:n,email:document.querySelector("meta[name=email]").content,address:{line1:document.querySelector("meta[name=address-1]").content,line2:document.querySelector("meta[name=address-2]").content,city:document.querySelector("meta[name=city]").content,postal_code:document.querySelector("meta[name=postal_code]").content,state:document.querySelector("meta[name=state]").content,country:document.querySelector("meta[name=country]").content}}},return_url:document.querySelector('meta[name="return-url"]').content}).then((function(e){if(e.hasOwnProperty("error"))return r.handleError(e.error.message)}))):(document.getElementById("klarna-name-correction").hidden=!1,document.getElementById("klarna-name").textContent=n.replace(/^[A-Za-z\s]*$/,""),document.getElementById("klarna-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-without-special-characters]").content,t.hidden=!1)}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new i(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-klarna.js ***!
 | 
					 | 
				
			||||||
  \********************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessKlarna = /*#__PURE__*/_createClass(function ProcessKlarna(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessKlarna);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handleError", function (message) {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').disabled = false;
 | 
					 | 
				
			||||||
    document.querySelector('#pay-now > svg').classList.add('hidden');
 | 
					 | 
				
			||||||
    document.querySelector('#pay-now > span').classList.remove('hidden');
 | 
					 | 
				
			||||||
    _this.errors.textContent = '';
 | 
					 | 
				
			||||||
    _this.errors.textContent = message;
 | 
					 | 
				
			||||||
    _this.errors.hidden = false;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
      var name = document.getElementById("klarna-name").value;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!/^[A-Za-z\s]*$/.test(name)) {
 | 
					 | 
				
			||||||
        document.getElementById('klarna-name-correction').hidden = false;
 | 
					 | 
				
			||||||
        document.getElementById('klarna-name').textContent = name.replace(/^[A-Za-z\s]*$/, "");
 | 
					 | 
				
			||||||
        document.getElementById('klarna-name').focus();
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-name-without-special-characters]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
        document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _this.stripe.confirmKlarnaPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
          payment_method: {
 | 
					 | 
				
			||||||
            billing_details: {
 | 
					 | 
				
			||||||
              name: name,
 | 
					 | 
				
			||||||
              email: document.querySelector('meta[name=email]').content,
 | 
					 | 
				
			||||||
              address: {
 | 
					 | 
				
			||||||
                line1: document.querySelector('meta[name=address-1]').content,
 | 
					 | 
				
			||||||
                line2: document.querySelector('meta[name=address-2]').content,
 | 
					 | 
				
			||||||
                city: document.querySelector('meta[name=city]').content,
 | 
					 | 
				
			||||||
                postal_code: document.querySelector('meta[name=postal_code]').content,
 | 
					 | 
				
			||||||
                state: document.querySelector('meta[name=state]').content,
 | 
					 | 
				
			||||||
                country: document.querySelector('meta[name=country]').content
 | 
					 | 
				
			||||||
              }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
          },
 | 
					 | 
				
			||||||
          return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
        }).then(function (result) {
 | 
					 | 
				
			||||||
          if (result.hasOwnProperty('error')) {
 | 
					 | 
				
			||||||
            return _this.handleError(result.error.message);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessKlarna(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										120
									
								
								public/js/clients/payments/stripe-przelewy24.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										120
									
								
								public/js/clients/payments/stripe-przelewy24.js
									
									
									
									
										vendored
									
									
								
							@ -1,118 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-przelewy24.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,o;function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var d=r((function e(t,n){var o=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"setupStripe",(function(){o.stripeConnect?o.stripe=Stripe(o.key,{stripeAccount:o.stripeConnect}):o.stripe=Stripe(o.key);var e=o.stripe.elements();return o.p24bank=e.create("p24Bank",{style:{base:{padding:"10px 12px",color:"#32325d",fontSize:"16px","::placeholder":{color:"#aab7c4"}}}}),o.p24bank.mount("#p24-bank-element"),o})),c(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){var t=document.getElementById("errors");return""===document.getElementById("p24-name").value?(document.getElementById("p24-name").focus(),t.textContent=document.querySelector("meta[name=translation-name-required]").content,void(t.hidden=!1)):""===document.getElementById("p24-email-address").value?(document.getElementById("p24-email-address").focus(),t.textContent=document.querySelector("meta[name=translation-email-required]").content,void(t.hidden=!1)):document.getElementById("p24-mandate-acceptance").checked?(document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),void o.stripe.confirmP24Payment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{p24:o.p24bank,billing_details:{name:document.getElementById("p24-name").value,email:document.getElementById("p24-email-address").value}},payment_method_options:{p24:{tos_shown_and_accepted:document.getElementById("p24-mandate-acceptance").checked}},return_url:document.querySelector('meta[name="return-url"]').content})):(document.getElementById("p24-mandate-acceptance").focus(),t.textContent=document.querySelector("meta[name=translation-terms-required]").content,void(t.hidden=!1))}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new d(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(o=document.querySelector('meta[name="stripe-account-id"]'))||void 0===o?void 0:o.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-przelewy24.js ***!
 | 
					 | 
				
			||||||
  \************************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessPRZELEWY24 = /*#__PURE__*/_createClass(function ProcessPRZELEWY24(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessPRZELEWY24);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var elements = _this.stripe.elements();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    var options = {
 | 
					 | 
				
			||||||
      // Custom styling can be passed to options when creating an Element
 | 
					 | 
				
			||||||
      style: {
 | 
					 | 
				
			||||||
        base: {
 | 
					 | 
				
			||||||
          padding: '10px 12px',
 | 
					 | 
				
			||||||
          color: '#32325d',
 | 
					 | 
				
			||||||
          fontSize: '16px',
 | 
					 | 
				
			||||||
          '::placeholder': {
 | 
					 | 
				
			||||||
            color: '#aab7c4'
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
    _this.p24bank = elements.create('p24Bank', options);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    _this.p24bank.mount('#p24-bank-element');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      var errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (document.getElementById('p24-name').value === "") {
 | 
					 | 
				
			||||||
        document.getElementById('p24-name').focus();
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-name-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (document.getElementById('p24-email-address').value === "") {
 | 
					 | 
				
			||||||
        document.getElementById('p24-email-address').focus();
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-email-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (!document.getElementById('p24-mandate-acceptance').checked) {
 | 
					 | 
				
			||||||
        document.getElementById('p24-mandate-acceptance').focus();
 | 
					 | 
				
			||||||
        errors.textContent = document.querySelector('meta[name=translation-terms-required]').content;
 | 
					 | 
				
			||||||
        errors.hidden = false;
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.confirmP24Payment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
        payment_method: {
 | 
					 | 
				
			||||||
          p24: _this.p24bank,
 | 
					 | 
				
			||||||
          billing_details: {
 | 
					 | 
				
			||||||
            name: document.getElementById('p24-name').value,
 | 
					 | 
				
			||||||
            email: document.getElementById('p24-email-address').value
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        payment_method_options: {
 | 
					 | 
				
			||||||
          p24: {
 | 
					 | 
				
			||||||
            tos_shown_and_accepted: document.getElementById('p24-mandate-acceptance').checked
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessPRZELEWY24(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										196
									
								
								public/js/clients/payments/stripe-sepa.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										196
									
								
								public/js/clients/payments/stripe-sepa.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										71
									
								
								public/js/clients/payments/stripe-sofort.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										71
									
								
								public/js/clients/payments/stripe-sofort.js
									
									
									
									
										vendored
									
									
								
							@ -1,69 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see stripe-sofort.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{var e,t,n,r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function i(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var u=i((function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),c(this,"setupStripe",(function(){return r.stripeConnect?r.stripe=Stripe(r.key,{stripeAccount:r.stripeConnect}):r.stripe=Stripe(r.key),r})),c(this,"handle",(function(){document.getElementById("pay-now").addEventListener("click",(function(e){document.getElementById("pay-now").disabled=!0,document.querySelector("#pay-now > svg").classList.remove("hidden"),document.querySelector("#pay-now > span").classList.add("hidden"),r.stripe.confirmSofortPayment(document.querySelector("meta[name=pi-client-secret").content,{payment_method:{sofort:{country:document.querySelector('meta[name="country"]').content}},return_url:document.querySelector('meta[name="return-url"]').content})}))})),this.key=t,this.errors=document.getElementById("errors"),this.stripeConnect=n}));new u(null!==(e=null===(t=document.querySelector('meta[name="stripe-publishable-key"]'))||void 0===t?void 0:t.content)&&void 0!==e?e:"",null!==(n=null===(r=document.querySelector('meta[name="stripe-account-id"]'))||void 0===r?void 0:r.content)&&void 0!==n?n:"").setupStripe().handle()})();
 | 
				
			||||||
/*!********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/payments/stripe-sofort.js ***!
 | 
					 | 
				
			||||||
  \********************************************************/
 | 
					 | 
				
			||||||
var _document$querySelect, _document$querySelect2, _document$querySelect3, _document$querySelect4;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ProcessSOFORT = /*#__PURE__*/_createClass(function ProcessSOFORT(key, stripeConnect) {
 | 
					 | 
				
			||||||
  var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _classCallCheck(this, ProcessSOFORT);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "setupStripe", function () {
 | 
					 | 
				
			||||||
    if (_this.stripeConnect) {
 | 
					 | 
				
			||||||
      // this.stripe.stripeAccount = this.stripeConnect;
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key, {
 | 
					 | 
				
			||||||
        stripeAccount: _this.stripeConnect
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
      _this.stripe = Stripe(_this.key);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return _this;
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _defineProperty(this, "handle", function () {
 | 
					 | 
				
			||||||
    document.getElementById('pay-now').addEventListener('click', function (e) {
 | 
					 | 
				
			||||||
      document.getElementById('pay-now').disabled = true;
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > svg').classList.remove('hidden');
 | 
					 | 
				
			||||||
      document.querySelector('#pay-now > span').classList.add('hidden');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _this.stripe.confirmSofortPayment(document.querySelector('meta[name=pi-client-secret').content, {
 | 
					 | 
				
			||||||
        payment_method: {
 | 
					 | 
				
			||||||
          sofort: {
 | 
					 | 
				
			||||||
            country: document.querySelector('meta[name="country"]').content
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        return_url: document.querySelector('meta[name="return-url"]').content
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  this.key = key;
 | 
					 | 
				
			||||||
  this.errors = document.getElementById('errors');
 | 
					 | 
				
			||||||
  this.stripeConnect = stripeConnect;
 | 
					 | 
				
			||||||
});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var publishableKey = (_document$querySelect = (_document$querySelect2 = document.querySelector('meta[name="stripe-publishable-key"]')) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.content) !== null && _document$querySelect !== void 0 ? _document$querySelect : '';
 | 
					 | 
				
			||||||
var stripeConnect = (_document$querySelect3 = (_document$querySelect4 = document.querySelector('meta[name="stripe-account-id"]')) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.content) !== null && _document$querySelect3 !== void 0 ? _document$querySelect3 : '';
 | 
					 | 
				
			||||||
new ProcessSOFORT(publishableKey, stripeConnect).setupStripe().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										224
									
								
								public/js/clients/payments/wepay-credit-card.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										224
									
								
								public/js/clients/payments/wepay-credit-card.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										114
									
								
								public/js/clients/purchase_orders/accept.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										114
									
								
								public/js/clients/purchase_orders/accept.js
									
									
									
									
										vendored
									
									
								
							@ -1,112 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see accept.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplaySignature=e,this.shouldDisplayTerms=n,this.termsAccepted=!1}var n,a,r;return n=t,(a=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});e.onEnd=function(){document.getElementById("signature-next-step").disabled=!1},this.signaturePad=e}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"handle",value:function(){var e=this;document.getElementById("signature-next-step").disabled=!0,document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.termsAccepted=!0,e.submitForm()}))}))),e.shouldDisplaySignature&&!e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.submitForm()}))),!e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){e.termsAccepted=!0,e.submitForm()}))),e.shouldDisplaySignature||e.shouldDisplayTerms||e.submitForm()}))}}])&&e(n.prototype,a),r&&e(n,r),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-purchase_order-signature"]').content,a=document.querySelector('meta[name="show-purchase_order-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();
 | 
				
			||||||
/*!********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/purchase_orders/accept.js ***!
 | 
					 | 
				
			||||||
  \********************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var Accept = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function Accept(displaySignature, displayTerms) {
 | 
					 | 
				
			||||||
    _classCallCheck(this, Accept);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.shouldDisplaySignature = displaySignature;
 | 
					 | 
				
			||||||
    this.shouldDisplayTerms = displayTerms;
 | 
					 | 
				
			||||||
    this.termsAccepted = false;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(Accept, [{
 | 
					 | 
				
			||||||
    key: "submitForm",
 | 
					 | 
				
			||||||
    value: function submitForm() {
 | 
					 | 
				
			||||||
      document.getElementById('approve-form').submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "displaySignature",
 | 
					 | 
				
			||||||
    value: function displaySignature() {
 | 
					 | 
				
			||||||
      var displaySignatureModal = document.getElementById('displaySignatureModal');
 | 
					 | 
				
			||||||
      displaySignatureModal.removeAttribute('style');
 | 
					 | 
				
			||||||
      var signaturePad = new SignaturePad(document.getElementById('signature-pad'), {
 | 
					 | 
				
			||||||
        penColor: 'rgb(0, 0, 0)'
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      signaturePad.onEnd = function () {
 | 
					 | 
				
			||||||
        document.getElementById("signature-next-step").disabled = false;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.signaturePad = signaturePad;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "displayTerms",
 | 
					 | 
				
			||||||
    value: function displayTerms() {
 | 
					 | 
				
			||||||
      var displayTermsModal = document.getElementById("displayTermsModal");
 | 
					 | 
				
			||||||
      displayTermsModal.removeAttribute("style");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById("signature-next-step").disabled = true;
 | 
					 | 
				
			||||||
      document.getElementById('approve-button').addEventListener('click', function () {
 | 
					 | 
				
			||||||
        if (_this.shouldDisplaySignature && _this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.displaySignature();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('signature-next-step').addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this.displayTerms();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            document.getElementById('accept-terms-button').addEventListener('click', function () {
 | 
					 | 
				
			||||||
              document.querySelector('input[name="signature"').value = _this.signaturePad.toDataURL();
 | 
					 | 
				
			||||||
              _this.termsAccepted = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
              _this.submitForm();
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (_this.shouldDisplaySignature && !_this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.displaySignature();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('signature-next-step').addEventListener('click', function () {
 | 
					 | 
				
			||||||
            document.querySelector('input[name="signature"').value = _this.signaturePad.toDataURL();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            _this.submitForm();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!_this.shouldDisplaySignature && _this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.displayTerms();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('accept-terms-button').addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this.termsAccepted = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            _this.submitForm();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!_this.shouldDisplaySignature && !_this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.submitForm();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return Accept;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var signature = document.querySelector('meta[name="require-purchase_order-signature"]').content;
 | 
					 | 
				
			||||||
var terms = document.querySelector('meta[name="show-purchase_order-terms"]').content;
 | 
					 | 
				
			||||||
new Accept(Boolean(+signature), Boolean(+terms)).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
@ -1,136 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see action-selectors.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,c=function(){};return{s:c,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var r,o,c;return r=t,o=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),!1!==t.checked){var o=document.createElement("INPUT");o.setAttribute("name","purchase_orders[]"),o.setAttribute("value",t.dataset.value),o.setAttribute("class","child-hidden-input"),o.hidden=!0,n.append(o)}else{var c,i=document.querySelectorAll("input.child-hidden-input"),a=e(i);try{for(a.s();!(c=a.n()).done;){var l=c.value;l.value==t.dataset.value&&l.remove()}}catch(e){a.e(e)}finally{a.f()}}}},{key:"handle",value:function(){var t=this;this.parentElement.addEventListener("click",(function(){t.watchCheckboxes(t.parentElement)}));var n,r=e(document.querySelectorAll(".form-check-child"));try{var o=function(){var e=n.value;e.addEventListener("click",(function(){t.processChildItem(e,t.parentForm)}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}}],o&&n(r.prototype,o),c&&n(r,c),Object.defineProperty(r,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!******************************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/purchase_orders/action-selectors.js ***!
 | 
					 | 
				
			||||||
  \******************************************************************/
 | 
					 | 
				
			||||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ActionSelectors = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function ActionSelectors() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, ActionSelectors);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.parentElement = document.querySelector('.form-check-parent');
 | 
					 | 
				
			||||||
    this.parentForm = document.getElementById('bulkActions');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(ActionSelectors, [{
 | 
					 | 
				
			||||||
    key: "watchCheckboxes",
 | 
					 | 
				
			||||||
    value: function watchCheckboxes(parentElement) {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.remove();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.querySelectorAll('.form-check-child').forEach(function (child) {
 | 
					 | 
				
			||||||
        if (parentElement.checked) {
 | 
					 | 
				
			||||||
          child.checked = parentElement.checked;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          _this.processChildItem(child, document.getElementById('bulkActions'));
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          child.checked = false;
 | 
					 | 
				
			||||||
          document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
            return element.remove();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "processChildItem",
 | 
					 | 
				
			||||||
    value: function processChildItem(element, parent) {
 | 
					 | 
				
			||||||
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (options.hasOwnProperty('single')) {
 | 
					 | 
				
			||||||
        document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
          return element.remove();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (element.checked === false) {
 | 
					 | 
				
			||||||
        var inputs = document.querySelectorAll('input.child-hidden-input');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        var _iterator = _createForOfIteratorHelper(inputs),
 | 
					 | 
				
			||||||
            _step;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
 | 
					 | 
				
			||||||
            var i = _step.value;
 | 
					 | 
				
			||||||
            if (i.value == element.dataset.value) i.remove();
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        } catch (err) {
 | 
					 | 
				
			||||||
          _iterator.e(err);
 | 
					 | 
				
			||||||
        } finally {
 | 
					 | 
				
			||||||
          _iterator.f();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var _temp = document.createElement('INPUT');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('name', 'purchase_orders[]');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('value', element.dataset.value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('class', 'child-hidden-input');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.hidden = true;
 | 
					 | 
				
			||||||
      parent.append(_temp);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.parentElement.addEventListener('click', function () {
 | 
					 | 
				
			||||||
        _this2.watchCheckboxes(_this2.parentElement);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var _iterator2 = _createForOfIteratorHelper(document.querySelectorAll('.form-check-child')),
 | 
					 | 
				
			||||||
          _step2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      try {
 | 
					 | 
				
			||||||
        var _loop = function _loop() {
 | 
					 | 
				
			||||||
          var child = _step2.value;
 | 
					 | 
				
			||||||
          child.addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this2.processChildItem(child, _this2.parentForm);
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
 | 
					 | 
				
			||||||
          _loop();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      } catch (err) {
 | 
					 | 
				
			||||||
        _iterator2.e(err);
 | 
					 | 
				
			||||||
      } finally {
 | 
					 | 
				
			||||||
        _iterator2.f();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return ActionSelectors;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
/** @handle **/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new ActionSelectors().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										138
									
								
								public/js/clients/quotes/action-selectors.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										138
									
								
								public/js/clients/quotes/action-selectors.js
									
									
									
									
										vendored
									
									
								
							@ -1,136 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see action-selectors.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,n){if(!e)return;if("string"==typeof e)return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return t(e,n)}(e))||n&&e&&"number"==typeof e.length){r&&(e=r);var o=0,c=function(){};return{s:c,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.parentElement=document.querySelector(".form-check-parent"),this.parentForm=document.getElementById("bulkActions")}var r,o,c;return r=t,o=[{key:"watchCheckboxes",value:function(e){var t=this;document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),document.querySelectorAll(".form-check-child").forEach((function(n){e.checked?(n.checked=e.checked,t.processChildItem(n,document.getElementById("bulkActions"))):(n.checked=!1,document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})))}))}},{key:"processChildItem",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r.hasOwnProperty("single")&&document.querySelectorAll(".child-hidden-input").forEach((function(e){return e.remove()})),!1!==t.checked){var o=document.createElement("INPUT");o.setAttribute("name","quotes[]"),o.setAttribute("value",t.dataset.value),o.setAttribute("class","child-hidden-input"),o.hidden=!0,n.append(o)}else{var c,i=document.querySelectorAll("input.child-hidden-input"),a=e(i);try{for(a.s();!(c=a.n()).done;){var l=c.value;l.value==t.dataset.value&&l.remove()}}catch(e){a.e(e)}finally{a.f()}}}},{key:"handle",value:function(){var t=this;this.parentElement.addEventListener("click",(function(){t.watchCheckboxes(t.parentElement)}));var n,r=e(document.querySelectorAll(".form-check-child"));try{var o=function(){var e=n.value;e.addEventListener("click",(function(){t.processChildItem(e,t.parentForm)}))};for(r.s();!(n=r.n()).done;)o()}catch(e){r.e(e)}finally{r.f()}}}],o&&n(r.prototype,o),c&&n(r,c),Object.defineProperty(r,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!*********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/quotes/action-selectors.js ***!
 | 
					 | 
				
			||||||
  \*********************************************************/
 | 
					 | 
				
			||||||
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var ActionSelectors = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function ActionSelectors() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, ActionSelectors);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.parentElement = document.querySelector('.form-check-parent');
 | 
					 | 
				
			||||||
    this.parentForm = document.getElementById('bulkActions');
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(ActionSelectors, [{
 | 
					 | 
				
			||||||
    key: "watchCheckboxes",
 | 
					 | 
				
			||||||
    value: function watchCheckboxes(parentElement) {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
        return element.remove();
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.querySelectorAll('.form-check-child').forEach(function (child) {
 | 
					 | 
				
			||||||
        if (parentElement.checked) {
 | 
					 | 
				
			||||||
          child.checked = parentElement.checked;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          _this.processChildItem(child, document.getElementById('bulkActions'));
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
          child.checked = false;
 | 
					 | 
				
			||||||
          document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
            return element.remove();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "processChildItem",
 | 
					 | 
				
			||||||
    value: function processChildItem(element, parent) {
 | 
					 | 
				
			||||||
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (options.hasOwnProperty('single')) {
 | 
					 | 
				
			||||||
        document.querySelectorAll('.child-hidden-input').forEach(function (element) {
 | 
					 | 
				
			||||||
          return element.remove();
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (element.checked === false) {
 | 
					 | 
				
			||||||
        var inputs = document.querySelectorAll('input.child-hidden-input');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        var _iterator = _createForOfIteratorHelper(inputs),
 | 
					 | 
				
			||||||
            _step;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
          for (_iterator.s(); !(_step = _iterator.n()).done;) {
 | 
					 | 
				
			||||||
            var i = _step.value;
 | 
					 | 
				
			||||||
            if (i.value == element.dataset.value) i.remove();
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        } catch (err) {
 | 
					 | 
				
			||||||
          _iterator.e(err);
 | 
					 | 
				
			||||||
        } finally {
 | 
					 | 
				
			||||||
          _iterator.f();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var _temp = document.createElement('INPUT');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('name', 'quotes[]');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('value', element.dataset.value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.setAttribute('class', 'child-hidden-input');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      _temp.hidden = true;
 | 
					 | 
				
			||||||
      parent.append(_temp);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.parentElement.addEventListener('click', function () {
 | 
					 | 
				
			||||||
        _this2.watchCheckboxes(_this2.parentElement);
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      var _iterator2 = _createForOfIteratorHelper(document.querySelectorAll('.form-check-child')),
 | 
					 | 
				
			||||||
          _step2;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      try {
 | 
					 | 
				
			||||||
        var _loop = function _loop() {
 | 
					 | 
				
			||||||
          var child = _step2.value;
 | 
					 | 
				
			||||||
          child.addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this2.processChildItem(child, _this2.parentForm);
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
 | 
					 | 
				
			||||||
          _loop();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      } catch (err) {
 | 
					 | 
				
			||||||
        _iterator2.e(err);
 | 
					 | 
				
			||||||
      } finally {
 | 
					 | 
				
			||||||
        _iterator2.f();
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return ActionSelectors;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
/** @handle **/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new ActionSelectors().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										118
									
								
								public/js/clients/quotes/approve.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										118
									
								
								public/js/clients/quotes/approve.js
									
									
									
									
										vendored
									
									
								
							@ -1,116 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see approve.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}var t=function(){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.shouldDisplaySignature=e,this.shouldDisplayTerms=n,this.termsAccepted=!1}var n,a,u;return n=t,(a=[{key:"submitForm",value:function(){document.getElementById("approve-form").submit()}},{key:"displaySignature",value:function(){document.getElementById("displaySignatureModal").removeAttribute("style");var e=new SignaturePad(document.getElementById("signature-pad"),{penColor:"rgb(0, 0, 0)"});e.onEnd=function(){document.getElementById("signature-next-step").disabled=!1},this.signaturePad=e}},{key:"displayTerms",value:function(){document.getElementById("displayTermsModal").removeAttribute("style")}},{key:"handle",value:function(){var e=this;document.getElementById("signature-next-step").disabled=!0,document.getElementById("close_button").addEventListener("click",(function(){var e=document.getElementById("approve-button");e&&(e.disabled=!1)})),document.getElementById("approve-button").addEventListener("click",(function(){e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.termsAccepted=!0,e.submitForm()}))}))),e.shouldDisplaySignature&&!e.shouldDisplayTerms&&(e.displaySignature(),document.getElementById("signature-next-step").addEventListener("click",(function(){document.querySelector('input[name="signature"').value=e.signaturePad.toDataURL(),e.submitForm()}))),!e.shouldDisplaySignature&&e.shouldDisplayTerms&&(e.displayTerms(),document.getElementById("accept-terms-button").addEventListener("click",(function(){e.termsAccepted=!0,e.submitForm()}))),e.shouldDisplaySignature||e.shouldDisplayTerms||e.submitForm()}))}}])&&e(n.prototype,a),u&&e(n,u),Object.defineProperty(n,"prototype",{writable:!1}),t}(),n=document.querySelector('meta[name="require-quote-signature"]').content,a=document.querySelector('meta[name="show-quote-terms"]').content;new t(Boolean(+n),Boolean(+a)).handle()})();
 | 
				
			||||||
/*!************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/quotes/approve.js ***!
 | 
					 | 
				
			||||||
  \************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var Approve = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function Approve(displaySignature, displayTerms) {
 | 
					 | 
				
			||||||
    _classCallCheck(this, Approve);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.shouldDisplaySignature = displaySignature;
 | 
					 | 
				
			||||||
    this.shouldDisplayTerms = displayTerms;
 | 
					 | 
				
			||||||
    this.termsAccepted = false;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(Approve, [{
 | 
					 | 
				
			||||||
    key: "submitForm",
 | 
					 | 
				
			||||||
    value: function submitForm() {
 | 
					 | 
				
			||||||
      document.getElementById('approve-form').submit();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "displaySignature",
 | 
					 | 
				
			||||||
    value: function displaySignature() {
 | 
					 | 
				
			||||||
      var displaySignatureModal = document.getElementById('displaySignatureModal');
 | 
					 | 
				
			||||||
      displaySignatureModal.removeAttribute('style');
 | 
					 | 
				
			||||||
      var signaturePad = new SignaturePad(document.getElementById('signature-pad'), {
 | 
					 | 
				
			||||||
        penColor: 'rgb(0, 0, 0)'
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      signaturePad.onEnd = function () {
 | 
					 | 
				
			||||||
        document.getElementById("signature-next-step").disabled = false;
 | 
					 | 
				
			||||||
      };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.signaturePad = signaturePad;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "displayTerms",
 | 
					 | 
				
			||||||
    value: function displayTerms() {
 | 
					 | 
				
			||||||
      var displayTermsModal = document.getElementById("displayTermsModal");
 | 
					 | 
				
			||||||
      displayTermsModal.removeAttribute("style");
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.getElementById("signature-next-step").disabled = true;
 | 
					 | 
				
			||||||
      document.getElementById("close_button").addEventListener('click', function () {
 | 
					 | 
				
			||||||
        var approveButton = document.getElementById("approve-button");
 | 
					 | 
				
			||||||
        if (approveButton) approveButton.disabled = false;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
      document.getElementById('approve-button').addEventListener('click', function () {
 | 
					 | 
				
			||||||
        if (_this.shouldDisplaySignature && _this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.displaySignature();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('signature-next-step').addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this.displayTerms();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            document.getElementById('accept-terms-button').addEventListener('click', function () {
 | 
					 | 
				
			||||||
              document.querySelector('input[name="signature"').value = _this.signaturePad.toDataURL();
 | 
					 | 
				
			||||||
              _this.termsAccepted = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
              _this.submitForm();
 | 
					 | 
				
			||||||
            });
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (_this.shouldDisplaySignature && !_this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.displaySignature();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('signature-next-step').addEventListener('click', function () {
 | 
					 | 
				
			||||||
            document.querySelector('input[name="signature"').value = _this.signaturePad.toDataURL();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            _this.submitForm();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!_this.shouldDisplaySignature && _this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.displayTerms();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          document.getElementById('accept-terms-button').addEventListener('click', function () {
 | 
					 | 
				
			||||||
            _this.termsAccepted = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            _this.submitForm();
 | 
					 | 
				
			||||||
          });
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!_this.shouldDisplaySignature && !_this.shouldDisplayTerms) {
 | 
					 | 
				
			||||||
          _this.submitForm();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return Approve;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
var signature = document.querySelector('meta[name="require-quote-signature"]').content;
 | 
					 | 
				
			||||||
var terms = document.querySelector('meta[name="show-quote-terms"]').content;
 | 
					 | 
				
			||||||
new Approve(Boolean(+signature), Boolean(+terms)).handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										38
									
								
								public/js/clients/shared/multiple-downloads.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								public/js/clients/shared/multiple-downloads.js
									
									
									
									
										vendored
									
									
								
							@ -1,37 +1 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					window.appendToElement=function(e,t){var n=document.getElementById(e),a=n.querySelector('input[value="'.concat(t,'"]'));if(a)return a.remove();var r=document.createElement("INPUT");r.setAttribute("name","file_hash[]"),r.setAttribute("value",t),r.hidden=!0,n.append(r)};
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					 | 
				
			||||||
/*!***********************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/shared/multiple-downloads.js ***!
 | 
					 | 
				
			||||||
  \***********************************************************/
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license 
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var appendToElement = function appendToElement(parent, value) {
 | 
					 | 
				
			||||||
  var _parent = document.getElementById(parent);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  var _possibleElement = _parent.querySelector("input[value=\"".concat(value, "\"]"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if (_possibleElement) {
 | 
					 | 
				
			||||||
    return _possibleElement.remove();
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  var _temp = document.createElement('INPUT');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _temp.setAttribute('name', 'file_hash[]');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _temp.setAttribute('value', value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _temp.hidden = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _parent.append(_temp);
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
window.appendToElement = appendToElement;
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
							
								
								
									
										186
									
								
								public/js/clients/shared/pdf.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										186
									
								
								public/js/clients/shared/pdf.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										106
									
								
								public/js/clients/statements/view.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										106
									
								
								public/js/clients/statements/view.js
									
									
									
									
										vendored
									
									
								
							@ -1,104 +1,2 @@
 | 
				
			|||||||
/******/ (() => { // webpackBootstrap
 | 
					/*! For license information please see view.js.LICENSE.txt */
 | 
				
			||||||
var __webpack_exports__ = {};
 | 
					(()=>{function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(new(function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.url=new URL(document.querySelector("meta[name=pdf-url]").content),this.startDate="",this.endDate="",this.showPaymentsTable=!1,this.showAgingTable=!1,this.status=""}var a,n,r;return a=t,(n=[{key:"bindEventListeners",value:function(){var e=this;["#date-from","#date-to","#show-payments-table","#show-aging-table","#status"].forEach((function(t){document.querySelector(t).addEventListener("change",(function(t){return e.handleValueChange(t)}))}))}},{key:"handleValueChange",value:function(e){"checkbox"===e.target.type?this[e.target.dataset.field]=e.target.checked:this[e.target.dataset.field]=e.target.value,this.updatePdf()}},{key:"composedUrl",get:function(){return this.url.search="",this.startDate.length>0&&this.url.searchParams.append("start_date",this.startDate),this.endDate.length>0&&this.url.searchParams.append("end_date",this.endDate),this.url.searchParams.append("status",document.getElementById("status").value),this.url.searchParams.append("show_payments_table",+this.showPaymentsTable),this.url.searchParams.append("show_aging_table",+this.showAgingTable),this.url.href}},{key:"updatePdf",value:function(){document.querySelector("meta[name=pdf-url]").content=this.composedUrl;var e=document.querySelector("#pdf-iframe");e&&(e.src=this.composedUrl),document.querySelector("meta[name=pdf-url]").dispatchEvent(new Event("change"))}},{key:"handle",value:function(){var e=this;this.bindEventListeners(),document.querySelector("#pdf-download").addEventListener("click",(function(){var t=new URL(e.composedUrl);t.searchParams.append("download",1),window.location.href=t.href}))}}])&&e(a.prototype,n),r&&e(a,r),Object.defineProperty(a,"prototype",{writable:!1}),t}())).handle()})();
 | 
				
			||||||
/*!*************************************************!*\
 | 
					 | 
				
			||||||
  !*** ./resources/js/clients/statements/view.js ***!
 | 
					 | 
				
			||||||
  \*************************************************/
 | 
					 | 
				
			||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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://www.elastic.co/licensing/elastic-license
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
var Statement = /*#__PURE__*/function () {
 | 
					 | 
				
			||||||
  function Statement() {
 | 
					 | 
				
			||||||
    _classCallCheck(this, Statement);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    this.url = new URL(document.querySelector('meta[name=pdf-url]').content);
 | 
					 | 
				
			||||||
    this.startDate = '';
 | 
					 | 
				
			||||||
    this.endDate = '';
 | 
					 | 
				
			||||||
    this.showPaymentsTable = false;
 | 
					 | 
				
			||||||
    this.showAgingTable = false;
 | 
					 | 
				
			||||||
    this.status = '';
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  _createClass(Statement, [{
 | 
					 | 
				
			||||||
    key: "bindEventListeners",
 | 
					 | 
				
			||||||
    value: function bindEventListeners() {
 | 
					 | 
				
			||||||
      var _this = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      ['#date-from', '#date-to', '#show-payments-table', '#show-aging-table', '#status'].forEach(function (selector) {
 | 
					 | 
				
			||||||
        document.querySelector(selector).addEventListener('change', function (event) {
 | 
					 | 
				
			||||||
          return _this.handleValueChange(event);
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handleValueChange",
 | 
					 | 
				
			||||||
    value: function handleValueChange(event) {
 | 
					 | 
				
			||||||
      if (event.target.type === 'checkbox') {
 | 
					 | 
				
			||||||
        this[event.target.dataset.field] = event.target.checked;
 | 
					 | 
				
			||||||
      } else {
 | 
					 | 
				
			||||||
        this[event.target.dataset.field] = event.target.value;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.updatePdf();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "composedUrl",
 | 
					 | 
				
			||||||
    get: function get() {
 | 
					 | 
				
			||||||
      this.url.search = '';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (this.startDate.length > 0) {
 | 
					 | 
				
			||||||
        this.url.searchParams.append('start_date', this.startDate);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (this.endDate.length > 0) {
 | 
					 | 
				
			||||||
        this.url.searchParams.append('end_date', this.endDate);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.url.searchParams.append('status', document.getElementById("status").value);
 | 
					 | 
				
			||||||
      this.url.searchParams.append('show_payments_table', +this.showPaymentsTable);
 | 
					 | 
				
			||||||
      this.url.searchParams.append('show_aging_table', +this.showAgingTable);
 | 
					 | 
				
			||||||
      return this.url.href;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "updatePdf",
 | 
					 | 
				
			||||||
    value: function updatePdf() {
 | 
					 | 
				
			||||||
      document.querySelector('meta[name=pdf-url]').content = this.composedUrl;
 | 
					 | 
				
			||||||
      var iframe = document.querySelector('#pdf-iframe');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (iframe) {
 | 
					 | 
				
			||||||
        iframe.src = this.composedUrl;
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      document.querySelector('meta[name=pdf-url]').dispatchEvent(new Event('change'));
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }, {
 | 
					 | 
				
			||||||
    key: "handle",
 | 
					 | 
				
			||||||
    value: function handle() {
 | 
					 | 
				
			||||||
      var _this2 = this;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.bindEventListeners();
 | 
					 | 
				
			||||||
      document.querySelector('#pdf-download').addEventListener('click', function () {
 | 
					 | 
				
			||||||
        var url = new URL(_this2.composedUrl);
 | 
					 | 
				
			||||||
        url.searchParams.append('download', 1);
 | 
					 | 
				
			||||||
        window.location.href = url.href;
 | 
					 | 
				
			||||||
      });
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return Statement;
 | 
					 | 
				
			||||||
}();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
new Statement().handle();
 | 
					 | 
				
			||||||
/******/ })()
 | 
					 | 
				
			||||||
;
 | 
					 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user