Merge pull request #7017 from turbo124/v5-develop

v5.3.34
This commit is contained in:
David Bomba 2021-12-08 09:00:49 +11:00 committed by GitHub
commit ada65baca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 61 additions and 65 deletions

View File

@ -1 +1 @@
5.3.33
5.3.34

View File

@ -42,16 +42,15 @@ class ContactLoginController extends Controller
if($request->has('company_key')){
MultiDB::findAndSetDbByCompanyKey($request->input('company_key'));
$company = Company::where('company_key', $request->input('company_key'))->first();
}
if (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
if($company){
$account = $company->account;
}
elseif (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
$subdomain = explode('.', $request->getHost())[0];
MultiDB::findAndSetDbByDomain(['subdomain' => $subdomain]);
$company = Company::where('subdomain', $subdomain)->first();
} elseif(Ninja::isHosted()){
@ -107,7 +106,7 @@ class ContactLoginController extends Controller
public function authenticated(Request $request, ClientContact $client)
{
Auth::guard('contact')->login($client, true);
Auth::guard('contact')->loginUsingId($client->id, true);
event(new ContactLoggedIn($client, $client->company, Ninja::eventVars()));

View File

@ -43,7 +43,7 @@ class ContactRegisterController extends Controller
$client = $this->getClient($request->all());
$client_contact = $this->getClientContact($request->all(), $client);
Auth::guard('contact')->login($client_contact, true);
Auth::guard('contact')->loginUsingId($client_contact->id, true);
return redirect()->route('client.dashboard');
}

View File

@ -25,7 +25,7 @@ class ContactHashLoginController extends Controller
*/
public function login(string $contact_key)
{
if(request()->has('subscription') && $request->subscription == 'true') {
if(request()->has('subscription') && request()->subscription == 'true') {
$recurring_invoice = RecurringInvoice::where('client_id', auth()->guard('contact')->client->id)
->whereNotNull('subscription_id')

View File

@ -94,7 +94,7 @@ class InvitationController extends Controller
$client_contact->email = Str::random(15) . "@example.com"; $client_contact->save();
if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
auth()->guard('contact')->login($client_contact, true);
auth()->guard('contact')->loginUsingId($client_contact->id, true);
} elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
$this->middleware('auth:contact');
@ -102,7 +102,7 @@ class InvitationController extends Controller
} else {
nlog("else - default - login contact");
auth()->guard('contact')->login($client_contact, true);
auth()->guard('contact')->loginUsingId($client_contact->id, true);
}
@ -201,7 +201,7 @@ class InvitationController extends Controller
if($payment->client_id != $contact->client_id)
abort(403, 'You are not authorized to view this resource');
auth()->guard('contact')->login($contact, true);
auth()->guard('contact')->loginUsingId($contact->id, true);
return redirect()->route('client.payments.show', $payment->hashed_id);
@ -213,7 +213,7 @@ class InvitationController extends Controller
->with('contact.client')
->firstOrFail();
auth()->guard('contact')->login($invitation->contact, true);
auth()->guard('contact')->loginUsingId($invitation->contact->id, true);
$invoice = $invitation->invoice;

View File

@ -50,7 +50,7 @@ class NinjaPlanController extends Controller
nlog("Ninja Plan Controller - Found and set Client Contact");
Auth::guard('contact')->login($client_contact,true);
Auth::guard('contact')->loginUsingId($client_contact->id,true);
// /* Current paid users get pushed straight to subscription overview page*/
// if($account->isPaidHostedClient())

View File

@ -27,7 +27,7 @@ class SwitchCompanyController extends Controller
->where('id', $this->transformKeys($contact))
->first();
auth()->guard('contact')->login($client_contact, true);
auth()->guard('contact')->loginUsingId($client_contact->id, true);
return redirect('/client/dashboard');
}

View File

@ -285,7 +285,7 @@ class BillingPortalPurchase extends Component
*/
protected function getPaymentMethods(ClientContact $contact): self
{
Auth::guard('contact')->login($contact, true);
Auth::guard('contact')->loginUsingId($contact->id, true);
$this->contact = $contact;

View File

@ -43,6 +43,7 @@ class InvoicesTable extends Component
$local_status = [];
$query = Invoice::query()
->with('client.gateway_tokens','company','client.contacts')
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
->where('company_id', $this->company->id)
->where('is_deleted', false);
@ -82,6 +83,7 @@ class InvoicesTable extends Component
return render('components.livewire.invoices-table', [
'invoices' => $query,
'gateway_available' => !empty(auth()->user()->client->service()->getPaymentMethods(0)),
]);
}
}

View File

@ -38,6 +38,7 @@ class QuotesTable extends Component
public function render()
{
$query = Quote::query()
->with('client.gateway_tokens','company','client.contacts')
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
if (count($this->status) > 0) {
@ -48,6 +49,7 @@ class QuotesTable extends Component
->where('company_id', $this->company->id)
->where('client_id', auth('contact')->user()->client->id)
->where('status_id', '<>', Quote::STATUS_DRAFT)
->where('is_deleted', 0)
->withTrashed()
->paginate($this->per_page);

View File

@ -29,7 +29,7 @@ class CheckClientExistence
public function handle(Request $request, Closure $next)
{
$multiple_contacts = ClientContact::query()
->with('company','client')
->with('client.gateway_tokens')
->where('email', auth('contact')->user()->email)
->whereNotNull('email')
->where('email', '<>', '')
@ -52,7 +52,7 @@ class CheckClientExistence
}
if (count($multiple_contacts) == 1) {
Auth::guard('contact')->login($multiple_contacts[0], true);
Auth::guard('contact')->loginUsingId($multiple_contacts[0]->id, true);
}
session()->put('multiple_contacts', $multiple_contacts);

View File

@ -52,7 +52,7 @@ class ContactKeyLogin
if(empty($client_contact->email))
$client_contact->email = Str::random(15) . "@example.com"; $client_contact->save();
auth()->guard('contact')->login($client_contact, true);
auth()->guard('contact')->loginUsingId($client_contact->id, true);
if ($request->query('redirect') && !empty($request->query('redirect'))) {
return redirect()->to($request->query('redirect'));
@ -70,7 +70,7 @@ class ContactKeyLogin
if(empty($client_contact->email))
$client_contact->email = Str::random(6) . "@example.com"; $client_contact->save();
auth()->guard('contact')->login($client_contact, true);
auth()->guard('contact')->loginUsingId($client_contact->id, true);
if ($request->query('next')) {
return redirect()->to($request->query('next'));
@ -86,7 +86,7 @@ class ContactKeyLogin
$client_contact->email = Str::random(6) . "@example.com"; $client_contact->save();
}
auth()->guard('contact')->login($client_contact, true);
auth()->guard('contact')->loginUsingId($client_contact->id, true);
if ($request->query('next')) {
return redirect($request->query('next'));
@ -104,7 +104,7 @@ class ContactKeyLogin
if(empty($primary_contact->email))
$primary_contact->email = Str::random(6) . "@example.com"; $primary_contact->save();
auth()->guard('contact')->login($primary_contact, true);
auth()->guard('contact')->loginUsingId($primary_contact->id, true);
return redirect()->to('client/dashboard');
}
}
@ -116,7 +116,7 @@ class ContactKeyLogin
if(empty($primary_contact->email))
$primary_contact->email = Str::random(6) . "@example.com"; $primary_contact->save();
auth()->guard('contact')->login($primary_contact, true);
auth()->guard('contact')->loginUsingId($primary_contact->id, true);
return redirect()->to('client/dashboard');
}

View File

@ -19,10 +19,11 @@ class ContactRegister
*/
public function handle($request, Closure $next)
{
$domain_name = $request->getHost();
if (strpos($request->getHost(), 'invoicing.co') !== false)
if (strpos($domain_name, 'invoicing.co') !== false)
{
$subdomain = explode('.', $request->getHost())[0];
$subdomain = explode('.', $domain_name)[0];
$query = [
'subdomain' => $subdomain,
@ -86,6 +87,6 @@ class ContactRegister
return $next($request);
}
abort(404, 'ContactRegister Middlware');
abort(404, 'ContactRegister Middleware');
}
}

View File

@ -51,7 +51,7 @@ class ContactTokenAuth
}
//stateless, don't remember the contact.
auth()->guard('contact')->login($client_contact, false);
auth()->guard('contact')->loginUsingId($client_contact->id, false);
event(new ContactLoggedIn($client_contact, $client_contact->company, Ninja::eventVars()));
} else {

View File

@ -38,10 +38,11 @@ class SetDomainNameDb
if(!config('ninja.db.multi_db_enabled'))
return $next($request);
$domain_name = $request->getHost();
if (strpos($request->getHost(), 'invoicing.co') !== false)
if (strpos($domain_name, 'invoicing.co') !== false)
{
$subdomain = explode('.', $request->getHost())[0];
$subdomain = explode('.', $domain_name)[0];
$query = [
'subdomain' => $subdomain,
@ -86,8 +87,6 @@ class SetDomainNameDb
}
// config(['app.url' => $request->getSchemeAndHttpHost()]);
return $next($request);
}
}

View File

@ -49,7 +49,7 @@ class InvoiceTransformer extends BaseTransformer {
'due_date' => isset( $invoice_data['invoice.due_date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['invoice.due_date'] ) ) : null,
'terms' => $this->getString( $invoice_data, 'invoice.terms' ),
'public_notes' => $this->getString( $invoice_data, 'invoice.public_notes' ),
'is_sent' => $this->getString( $invoice_data, 'invoice.is_sent' ),
// 'is_sent' => $this->getString( $invoice_data, 'invoice.is_sent' ),
'private_notes' => $this->getString( $invoice_data, 'invoice.private_notes' ),
'tax_name1' => $this->getString( $invoice_data, 'invoice.tax_name1' ),
'tax_rate1' => $this->getFloat( $invoice_data, 'invoice.tax_rate1' ),

View File

@ -160,11 +160,11 @@ class ACH implements MethodInterface
*/
public function paymentResponse(PaymentResponseRequest $request)
{
$token = ClientGatewayToken::find(
$this->decodePrimaryKey($request->source)
)->firstOrFail();
// $token = ClientGatewayToken::find(
// $this->decodePrimaryKey($request->source)
// )->firstOrFail();
$this->go_cardless->ensureMandateIsReady($token);
$this->go_cardless->ensureMandateIsReady($request->source);
try {
$payment = $this->go_cardless->gateway->payments()->create([
@ -175,7 +175,7 @@ class ACH implements MethodInterface
'payment_hash' => $this->go_cardless->payment_hash->hash,
],
'links' => [
'mandate' => $token->token,
'mandate' => $request->source,
],
],
]);
@ -201,7 +201,6 @@ class ACH implements MethodInterface
public function processPendingPayment(\GoCardlessPro\Resources\Payment $payment, array $data = [])
{
$data = [
'payment_method' => $data['token'],
'payment_type' => PaymentType::ACH,
'amount' => $this->go_cardless->payment_hash->data->amount_with_fee,
'transaction_reference' => $payment->id,

View File

@ -190,7 +190,6 @@ class DirectDebit implements MethodInterface
public function processPendingPayment(\GoCardlessPro\Resources\Payment $payment, array $data = [])
{
$data = [
'payment_method' => $data['token'],
'payment_type' => PaymentType::DIRECT_DEBIT,
'amount' => $this->go_cardless->payment_hash->data->amount_with_fee,
'transaction_reference' => $payment->id,

View File

@ -160,11 +160,7 @@ class SEPA implements MethodInterface
*/
public function paymentResponse(PaymentResponseRequest $request)
{
$token = ClientGatewayToken::find(
$this->decodePrimaryKey($request->source)
)->firstOrFail();
$this->go_cardless->ensureMandateIsReady($token);
$this->go_cardless->ensureMandateIsReady($request->source);
try {
$payment = $this->go_cardless->gateway->payments()->create([
@ -175,13 +171,13 @@ class SEPA implements MethodInterface
'payment_hash' => $this->go_cardless->payment_hash->hash,
],
'links' => [
'mandate' => $token->token,
'mandate' => $request->source,
],
],
]);
if ($payment->status === 'pending_submission') {
return $this->processPendingPayment($payment, ['token' => $token->hashed_id]);
return $this->processPendingPayment($payment, ['token' => $request->source]);
}
return $this->processUnsuccessfulPayment($payment);
@ -200,7 +196,6 @@ class SEPA implements MethodInterface
public function processPendingPayment(\GoCardlessPro\Resources\Payment $payment, array $data = [])
{
$data = [
'payment_method' => $data['token'],
'payment_type' => PaymentType::SEPA,
'amount' => $this->go_cardless->payment_hash->data->amount_with_fee,
'transaction_reference' => $payment->id,

View File

@ -319,7 +319,7 @@ class MolliePaymentDriver extends BaseDriver
// we may not have a payment record - in these cases we need to re-construct the payment
// record from the meta data in the payment hash.
if($payment && $payment->metadata->payment_hash){
if($payment && property_exists($payment->metadata, 'payment_hash') && $payment->metadata->payment_hash){
/* Harvest Payment Hash*/
$payment_hash = PaymentHash::where('hash', $payment->metadata->hash)->first();

View File

@ -436,7 +436,7 @@ class StripePaymentDriver extends BaseDriver
//Else create a new record
$data['name'] = $this->client->present()->name();
$data['phone'] = $this->client->present()->phone();
$data['phone'] = substr($this->client->present()->phone(), 0 , 20);
if (filter_var($this->client->present()->email(), FILTER_VALIDATE_EMAIL)) {
$data['email'] = $this->client->present()->email();

View File

@ -37,7 +37,7 @@ class TriggeredActions extends AbstractService
public function run()
{
if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') {
$this->invoice = $this->invoice->service()->autoBill();
$this->invoice->service()->autoBill();
}
if ($this->request->has('paid') && $this->request->input('paid') == 'true') {

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.3.33',
'app_tag' => '5.3.33',
'app_version' => '5.3.34',
'app_tag' => '5.3.34',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"/livewire.js":"/livewire.js?id=21fa1dd78491a49255cd"}
{"/livewire.js":"/livewire.js?id=ece4c4ab4b746f6f1739"}

View File

@ -94,7 +94,7 @@
{!! App\Models\Invoice::badgeForStatus($invoice->status) !!}
</td>
<td class="flex items-center justify-end px-6 py-4 text-sm font-medium leading-5 whitespace-nowrap">
@if($invoice->isPayable() && $invoice->balance > 0 && !empty(auth()->user()->client->service()->getPaymentMethods(0)))
@if($invoice->isPayable() && $invoice->balance > 0 && $gateway_available)
<form action="{{ route('client.invoices.bulk') }}" method="post">
@csrf
<input type="hidden" name="invoices[]" value="{{ $invoice->hashed_id }}">
@ -121,7 +121,7 @@
</div>
</div>
<div class="flex justify-center mt-6 mb-6 md:justify-between">
@if($invoices->total() > 0)
@if($invoices && $invoices->total() > 0)
<span class="hidden text-sm text-gray-700 md:block mr-2">
{{ ctrans('texts.showing_x_of', ['first' => $invoices->firstItem(), 'last' => $invoices->lastItem(), 'total' => $invoices->total()]) }}
</span>

View File

@ -20,10 +20,10 @@
@if (count($tokens) > 0)
@foreach ($tokens as $token)
<label class="mr-4">
<input type="radio" data-token="{{ $token->hashed_id }}" name="payment-type"
<input type="radio" data-token="{{ $token->token }}" name="payment-type"
class="form-radio cursor-pointer toggle-payment-with-token" />
<span class="ml-1 cursor-pointer">{{ ctrans('texts.bank_transfer') }}
(#{{ $token->hashed_id }})</span>
(#{{ $token->token }})</span>
</label>
@endforeach
@endisset

View File

@ -20,10 +20,10 @@
@if (count($tokens) > 0)
@foreach ($tokens as $token)
<label class="mr-4">
<input type="radio" data-token="{{ $token->hashed_id }}" name="payment-type"
<input type="radio" data-token="{{ $token->token }}" name="payment-type"
class="form-radio cursor-pointer toggle-payment-with-token" />
<span class="ml-1 cursor-pointer">{{ ctrans('texts.payment_type_direct_debit') }}
(#{{ $token->hashed_id }})</span>
(#{{ $token->token }})</span>
</label>
@endforeach
@endisset

View File

@ -20,10 +20,10 @@
@if (count($tokens) > 0)
@foreach ($tokens as $token)
<label class="mr-4">
<input type="radio" data-token="{{ $token->hashed_id }}" name="payment-type"
<input type="radio" data-token="{{ $token->token }}" name="payment-type"
class="form-radio cursor-pointer toggle-payment-with-token" />
<span class="ml-1 cursor-pointer">{{ ctrans('texts.payment_type_SEPA') }}
(#{{ $token->hashed_id }})</span>
(#{{ $token->token }})</span>
</label>
@endforeach
@endisset

View File

@ -110,14 +110,14 @@
document.getElementById('handlePlanChange').addEventListener('click', function() {
if(document.getElementById("newPlan").value.length > 1)
location.href = 'http://devhosted.test:8000/client/subscriptions/{{ $current_recurring_id }}/plan_switch/' + document.getElementById("newPlan").value + '';
location.href = 'https://invoiceninja.invoicing.co/client/subscriptions/{{ $current_recurring_id }}/plan_switch/' + document.getElementById("newPlan").value + '';
});
@else
document.getElementById('handleNewPlan').addEventListener('click', function() {
if(document.getElementById("newPlan").value.length > 1)
location.href = 'http://devhosted.test:8000/client/subscriptions/' + document.getElementById("newPlan").value + '/purchase';
location.href = 'https://invoiceninja.invoicing.co/client/subscriptions/' + document.getElementById("newPlan").value + '/purchase';
});
@endif