1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

client initiated payments

This commit is contained in:
David Bomba 2023-03-16 15:20:38 +11:00
parent aae986333a
commit 6729678332
36 changed files with 347 additions and 9 deletions

View File

@ -276,8 +276,6 @@ class YodleeController extends BaseController
{
//this is the main hook we use for notifications
nlog("data refresh");
nlog($request->all());
return response()->json(['message' => 'Success'], 200);

View File

@ -12,11 +12,16 @@
namespace App\Http\Controllers\ClientPortal;
use App\Utils\Number;
use Illuminate\View\View;
use App\DataMapper\InvoiceItem;
use App\Factory\InvoiceFactory;
use App\Utils\Traits\MakesHash;
use App\Utils\Traits\MakesDates;
use App\Http\Controllers\Controller;
use Illuminate\Contracts\View\Factory;
use App\Repositories\InvoiceRepository;
use App\Http\Requests\ClientPortal\PrePayments\StorePrePaymentRequest;
/**
* Class PrePaymentController.
@ -35,7 +40,67 @@ class PrePaymentController extends Controller
{
$data['minimum_amount'] = auth()->guard('contact')->user()->client->getSetting('client_initiated_payments_minimum');
$data['title'] = ctrans('texts.amount'). " " .auth()->guard('contact')->user()->client->currency()->code." (".auth()->guard('contact')->user()->client->currency()->symbol . ")";
return $this->render('pre_payments.index', $data);
}
public function process(StorePrePaymentRequest $request)
{
$invoices = collect();
$invoice = InvoiceFactory::create(auth()->guard('contact')->user()->company_id, auth()->guard('contact')->user()->user_id);
$invoice->due_date = now()->format('Y-m-d');
$invoice->is_proforma = true;
$invoice->client_id = auth()->guard('contact')->user()->client_id;
$line_item = new InvoiceItem();
$line_item->cost = $request->amount;
$line_item->quantity = 1;
$line_item->product_key = ctrans('texts.pre_payment');
$line_item->notes = $request->notes;
$line_item->type_id = 1;
$items = [];
$items[] = $line_item;
$invoice->line_items = $items;
$invoice->number = ctrans('texts.pre_payment') . " " . now()->format('Y-m-d : H:i:s');
$invoice_repo = new InvoiceRepository();
$data = [
'client_id' => $invoice->client_id,
'quantity' => 1,
'date' => now()->format('Y-m-d'),
];
$invoice = $invoice_repo->save($data, $invoice)
->service()
->markSent()
->fillDefaults()
->save();
//format totals
$formatted_total = Number::formatMoney($request->amount, auth()->guard('contact')->user()->client);
$payment_methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods($request->amount);
//if there is only one payment method -> lets return straight to the payment page
$invoices->push($invoice);
$data = [
'settings' => auth()->guard('contact')->user()->client->getMergedSettings(),
'invoices' => $invoices,
'formatted_total' => $formatted_total,
'payment_methods' => $payment_methods,
'hashed_ids' => $invoices->pluck('hashed_id'),
'total' => $request->amount,
'pre_payment' => true,
];
nlog($data);
return $this->render('invoices.payment', $data);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Http\Requests\ClientPortal\PrePayments;
use App\Http\ViewComposers\PortalComposer;
use Illuminate\Foundation\Http\FormRequest;
class StorePrePaymentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return auth()->guard('contact')->user()->company->enabled_modules & PortalComposer::MODULE_INVOICES;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'notes' => 'required|bail|',
'amount' => 'required|bail|',
];
}
}

View File

@ -138,11 +138,11 @@ class PortalComposer
$data[] = ['title' => ctrans('texts.subscriptions'), 'url' => 'client.subscriptions.index', 'icon' => 'calendar'];
}
/*
if($this->settings->client_initiated_payments) {
if(property_exists($this->settings, 'client_initiated_payments') && $this->settings->client_initiated_payments) {
$data[] = ['title' => ctrans('texts.pre_payment'), 'url' => 'client.pre_payments.index', 'icon' => 'dollar-sign'];
}
*/
return $data;
}

View File

@ -28,11 +28,13 @@ class PlayStoreRenewSubscription implements ShouldQueue
nlog($notification);
$in_app_identifier = $event->getSubscriptionIdentifier();
MultiDB::findAndSetDbByInappTransactionId($in_app_identifier);
$parts = explode("..", $in_app_identifier);
MultiDB::findAndSetDbByInappTransactionId($parts[0]);
$expirationTime = $event->getSubscription()->getExpiryTime();
$account = Account::where('inapp_transaction_id', 'like', $in_app_identifier."%")->first();
$account = Account::where('inapp_transaction_id', 'like', $parts[0]."%")->first();
if ($account) {
$account->update(['plan_expires' => Carbon::parse($expirationTime)]);

View File

@ -130,6 +130,10 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Account whereUtmMedium($value)
* @method static \Illuminate\Database\Eloquent\Builder|Account whereUtmSource($value)
* @method static \Illuminate\Database\Eloquent\Builder|Account whereUtmTerm($value)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankIntegration> $bank_integrations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
* @mixin \Eloquent
*/
class Account extends BaseModel

View File

@ -32,6 +32,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @method static \Illuminate\Database\Eloquent\Builder|BankAccount withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankAccount withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankSubaccount> $bank_subaccounts
* @mixin \Eloquent
*/
class BankAccount extends BaseModel

View File

@ -75,6 +75,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransaction> $transactions
* @mixin \Eloquent
*/
class BankIntegration extends BaseModel

View File

@ -166,6 +166,25 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Client whereWebsite($value)
* @method static \Illuminate\Database\Eloquent\Builder|Client withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Client withoutTrashed()
* @property string $payment_balance
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Credit> $credits
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Expense> $expenses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientGatewayToken> $gateway_tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $primary_contact
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Project> $projects
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Quote> $quotes
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringExpense> $recurring_expenses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringInvoice> $recurring_invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\SystemLog> $system_logs
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @method static \Illuminate\Database\Eloquent\Builder|Client wherePaymentBalance($value)
* @mixin \Eloquent
*/
class Client extends BaseModel implements HasLocalePreference

View File

@ -123,6 +123,11 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|ClientContact whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|ClientContact withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|ClientContact withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CreditInvitation> $credit_invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\InvoiceInvitation> $invoice_invitations
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\QuoteInvitation> $quote_invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringInvoiceInvitation> $recurring_invoice_invitations
* @mixin \Eloquent
*/
class ClientContact extends Authenticatable implements HasLocalePreference

View File

@ -282,6 +282,50 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Company whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereUseCommaAsDecimalPlace($value)
* @method static \Illuminate\Database\Eloquent\Builder|Company whereUseQuoteTermsOnConversion($value)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $all_activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $all_documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankIntegration> $bank_integrations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransactionRule> $bank_transaction_rules
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransaction> $bank_transactions
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $client_contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientGatewayToken> $client_gateway_tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyGateway> $company_gateways
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Credit> $credits
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Design> $designs
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ExpenseCategory> $expense_categories
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Expense> $expenses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\GroupSetting> $group_settings
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\GroupSetting> $groups
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\PaymentTerm> $payment_terms
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Product> $products
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Project> $projects
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\PurchaseOrder> $purchase_orders
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Quote> $quotes
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringExpense> $recurring_expenses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringInvoice> $recurring_invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Scheduler> $schedulers
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Subscription> $subscriptions
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\SystemLog> $system_log_relation
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\SystemLog> $system_logs
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Scheduler> $task_schedulers
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\TaskStatus> $task_statuses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\TaxRate> $tax_rates
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens_hashed
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Design> $user_designs
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\PaymentTerm> $user_payment_terms
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Vendor> $vendors
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Webhook> $webhooks
* @mixin \Eloquent
*/
class Company extends BaseModel

View File

@ -92,6 +92,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|CompanyGateway whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|CompanyGateway withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|CompanyGateway withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientGatewayToken> $client_gateway_tokens
* @mixin \Eloquent
*/
class CompanyGateway extends BaseModel

View File

@ -67,6 +67,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|CompanyUser withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $token
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
* @mixin \Eloquent
*/
class CompanyUser extends Pivot

View File

@ -185,6 +185,13 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Credit whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Credit withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Credit withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Backup> $history
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CreditInvitation> $invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
* @mixin \Eloquent
*/
class Credit extends BaseModel

View File

@ -130,6 +130,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|Expense whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Expense withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Expense withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @mixin \Eloquent
*/
class Expense extends BaseModel

View File

@ -28,6 +28,7 @@ namespace App\Models;
* @method static \Illuminate\Database\Eloquent\Builder|GatewayType whereAlias($value)
* @method static \Illuminate\Database\Eloquent\Builder|GatewayType whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|GatewayType whereName($value)
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\PaymentType> $payment_methods
* @mixin \Eloquent
*/
class GatewayType extends StaticModel

View File

@ -54,6 +54,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|GroupSetting whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|GroupSetting withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|GroupSetting withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @mixin \Eloquent
*/
class GroupSetting extends StaticModel

View File

@ -203,6 +203,15 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Invoice whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Invoice withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Invoice withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Credit> $credits
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Expense> $expenses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Backup> $history
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\InvoiceInvitation> $invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @mixin \Eloquent
*/
class Invoice extends BaseModel

View File

@ -13,6 +13,43 @@ namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* App\Models\License
*
* @property int $id
* @property int|null $created_at
* @property int|null $updated_at
* @property int|null $deleted_at
* @property string|null $first_name
* @property string|null $last_name
* @property string|null $email
* @property string|null $license_key
* @property int|null $is_claimed
* @property string|null $transaction_reference
* @property int|null $product_id
* @property int|null $recurring_invoice_id
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel company()
* @method static \Illuminate\Database\Eloquent\Builder|StaticModel exclude($columns)
* @method static \Illuminate\Database\Eloquent\Builder|License newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|License newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|License onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|License query()
* @method static \Illuminate\Database\Eloquent\Builder|License whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereFirstName($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereIsClaimed($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereLastName($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereLicenseKey($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereProductId($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereRecurringInvoiceId($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereTransactionReference($value)
* @method static \Illuminate\Database\Eloquent\Builder|License whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|License withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|License withoutTrashed()
* @mixin \Eloquent
*/
class License extends StaticModel
{
use SoftDeletes;

View File

@ -132,6 +132,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|Payment whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Payment withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Payment withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyLedger> $company_ledger
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Credit> $credits
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Paymentable> $paymentables
* @mixin \Eloquent
*/
class Payment extends BaseModel

View File

@ -96,6 +96,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @method static \Illuminate\Database\Eloquent\Builder|Product whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Product withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Product withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @mixin \Eloquent
*/
class Product extends BaseModel

View File

@ -72,6 +72,8 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Project whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Project withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Project withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Task> $tasks
* @mixin \Eloquent
*/
class Project extends BaseModel

View File

@ -28,6 +28,7 @@ use App\Utils\Traits\MakesHash;
* @method static \Illuminate\Database\Eloquent\Builder|Proposal newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Proposal query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @mixin \Eloquent
*/
class Proposal extends BaseModel

View File

@ -180,6 +180,12 @@ use Illuminate\Support\Facades\Storage;
* @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|PurchaseOrder withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Backup> $history
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\PurchaseOrderInvitation> $invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Payment> $payments
* @mixin \Eloquent
*/
class PurchaseOrder extends BaseModel

View File

@ -181,6 +181,10 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Quote whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Quote withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Quote withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Backup> $history
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\QuoteInvitation> $invitations
* @mixin \Eloquent
*/
class Quote extends BaseModel

View File

@ -139,6 +139,7 @@ use Illuminate\Support\Carbon;
* @method static \Illuminate\Database\Eloquent\Builder|RecurringExpense whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringExpense withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringExpense withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @mixin \Eloquent
*/
class RecurringExpense extends BaseModel

View File

@ -177,6 +177,11 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoice whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoice withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringInvoice withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Backup> $history
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringInvoiceInvitation> $invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Invoice> $invoices
* @mixin \Eloquent
*/
class RecurringInvoice extends BaseModel

View File

@ -171,6 +171,11 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|RecurringQuote whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|RecurringQuote withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|RecurringQuote withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Backup> $history
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RecurringQuoteInvitation> $invitations
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Quote> $quotes
* @mixin \Eloquent
*/
class RecurringQuote extends BaseModel

View File

@ -91,6 +91,7 @@ use Illuminate\Support\Carbon;
* @method static \Illuminate\Database\Eloquent\Builder|Task whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Task withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Task withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @mixin \Eloquent
*/
class Task extends BaseModel

View File

@ -139,6 +139,13 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|User whereVerifiedPhoneNumber($value)
* @method static \Illuminate\Database\Eloquent\Builder|User withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|User withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Client> $clients
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Company> $companies
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyUser> $company_users
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\ClientContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CompanyToken> $tokens
* @mixin \Eloquent
*/
class User extends Authenticatable implements MustVerifyEmail

View File

@ -104,6 +104,10 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|Vendor whereWebsite($value)
* @method static \Illuminate\Database\Eloquent\Builder|Vendor withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|Vendor withoutTrashed()
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Activity> $activities
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\VendorContact> $contacts
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Document> $documents
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\VendorContact> $primary_contact
* @mixin \Eloquent
*/
class Vendor extends BaseModel

View File

@ -110,6 +110,8 @@ use Laracasts\Presenter\PresentableTrait;
* @method static \Illuminate\Database\Eloquent\Builder|VendorContact whereVendorId($value)
* @method static \Illuminate\Database\Eloquent\Builder|VendorContact withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|VendorContact withoutTrashed()
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\PurchaseOrderInvitation> $purchase_order_invitations
* @mixin \Eloquent
*/
class VendorContact extends Authenticatable implements HasLocalePreference

View File

@ -171,6 +171,7 @@ class EmailDefaults
if ($this->template == 'email.template.custom') {
$this->email->email_object->body = (str_replace('$body', $this->email->email_object->body, $this->email->email_object->settings->email_style_custom));
return $this;
}
if ($this->email->email_object->body) {

View File

@ -110,7 +110,6 @@
type="text"
class="input mt-0 mr-4 relative"
name="payable_invoices[{{$key}}][amount]"
dusk="underpayment-input"
value="{{ $invoice->partial > 0 ? $invoice->partial : $invoice->balance }}"/>
</label>
</div>

View File

@ -0,0 +1,60 @@
@extends('portal.ninja2020.layout.app')
@section('meta_title', ctrans('texts.pre_payment'))
@section('body')
<form action="{{ route('client.pre_payments.process') }}" method="post" id="payment-form" onkeypress="return event.keyCode != 13;">
@csrf
<input type="hidden" name="company_gateway_id" id="company_gateway_id">
<input type="hidden" name="payment_method_id" id="payment_method_id">
<input type="hidden" name="signature">
<div class="container mx-auto">
<div class="grid grid-cols-6 gap-4">
<div class="col-span-6 md:col-start-2 md:col-span-4">
<div class="flex justify-end">
</div>
<div class="mb-4 overflow-hidden bg-white shadow sm:rounded-lg">
<div class="px-4 py-5 border-b border-gray-200 sm:px-6">
<h3 class="text-lg font-medium leading-6 text-gray-900">
{{ ctrans('texts.payment') }}
</h3>
</div>
@component('portal.ninja2020.components.general.card-element', ['title' => ctrans('texts.payment_details')])
<textarea name="notes" class="focus:shadow-soft-primary-outline min-h-unset text-sm leading-5.6 ease-soft block h-auto w-full appearance-none rounded-lg border border-solid border-gray-300 bg-white bg-clip-padding px-3 py-2 font-normal text-gray-700 outline-none transition-all placeholder:text-gray-500 focus:border-fuchsia-300 focus:outline-none"></textarea>
@if($errors->has('notes'))
<p class="mt-2 text-red-900 border-red-300 px-2 py-1 bg-gray-100">{{ $errors->first('notes') }}</p>
@endif
@endcomponent
@component('portal.ninja2020.components.general.card-element', ['title' => $title])
<input
type="text"
class="input mt-0 mr-4 relative"
name="amount"
placeholder="{{ $minimum_amount }}"
min="{{ $minimum_amount }}"/>
@if($errors->has('amount'))
<p class="mt-2 text-red-900 border-red-300 px-2 py-1 bg-gray-100">{{ $errors->first('amount') }}</p>
@endif
@endcomponent
<div class="px-4 py-3 bg-gray-50 text-right sm:px-6">
<button class="button button-primary bg-primary">{{ ctrans('texts.pay_now') }}</button>
</div>
</div>
</div>
</div>
</div>
</form>
@endsection

View File

@ -65,7 +65,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'domain_db','check_clie
Route::post('payments/credit_response', [App\Http\Controllers\ClientPortal\PaymentController::class, 'credit_response'])->name('payments.credit_response');
Route::get('payments', [App\Http\Controllers\ClientPortal\PaymentController::class, 'index'])->name('payments.index')->middleware('portal_enabled');
Route::get('payments/{payment}', [App\Http\Controllers\ClientPortal\PaymentController::class, 'show'])->name('payments.show');
Route::post('payments/{payment}', [App\Http\Controllers\ClientPortal\PaymentController::class, 'show'])->name('payments.show');
Route::get('pre_payments', [PrePaymentController::class, 'index'])->name('pre_payments.index')->middleware('portal_enabled');
Route::get('pre_payments/process', [PrePaymentController::class, 'process'])->name('pre_payments.process')->middleware('portal_enabled');