Merge branch 'v5-develop' of https://github.com/turbo124/invoiceninja into v5-develop

This commit is contained in:
David Bomba 2022-03-07 20:06:25 +11:00
commit deb5fe832e
16 changed files with 7564 additions and 7538 deletions

View File

@ -163,7 +163,7 @@ class NinjaPlanController extends Controller
$recurring_invoice->service()->start(); $recurring_invoice->service()->start();
return redirect('/'); return redirect('https://invoicing.co');
} }

View File

@ -29,7 +29,15 @@ class TrustProxies extends Middleware
* *
* @var int * @var int
*/ */
protected $headers = Request::HEADER_X_FORWARDED_ALL; // protected $headers = Request::HEADER_X_FORWARDED_ALL;
//07-03-2022 - fixes for symfony 5.2
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |
Request::HEADER_X_FORWARDED_PORT |
Request::HEADER_X_FORWARDED_PROTO |
Request::HEADER_X_FORWARDED_AWS_ELB;
/* /*
* Instantiate trusted proxies middleware * Instantiate trusted proxies middleware

View File

@ -91,8 +91,9 @@ class ZipCredits implements ShouldQueue
foreach ($this->credits as $credit) { foreach ($this->credits as $credit) {
$download_file = file_get_contents($credit->pdf_file_path($invitation, 'url', true)); $file = $credit->service()->getCreditPdf($credit->invitations()->first());
$zipFile->addFromString(basename($credit->pdf_file_path($invitation)), $download_file); $zip_file_name = basename($file);
$zipFile->addFromString($zip_file_name, Storage::get($file));
} }

View File

@ -91,8 +91,12 @@ class ZipInvoices implements ShouldQueue
foreach ($this->invoices as $invoice) { foreach ($this->invoices as $invoice) {
$download_file = file_get_contents($invoice->pdf_file_path($invitation, 'url', true)); $file = $invoice->service()->getInvoicePdf();
$zipFile->addFromString(basename($invoice->pdf_file_path($invitation)), $download_file); $zip_file_name = basename($file);
$zipFile->addFromString($zip_file_name, Storage::get($file));
//$download_file = file_get_contents($invoice->pdf_file_path($invitation, 'url', true));
//$zipFile->addFromString(basename($invoice->pdf_file_path($invitation)), $download_file);
} }

View File

@ -92,8 +92,12 @@ class ZipQuotes implements ShouldQueue
foreach ($this->quotes as $quote) { foreach ($this->quotes as $quote) {
$download_file = file_get_contents($quote->pdf_file_path($invitation, 'url', true)); $file = $quote->service()->getQuotePdf();
$zipFile->addFromString(basename($quote->pdf_file_path($invitation)), $download_file); $zip_file_name = basename($file);
$zipFile->addFromString($zip_file_name, Storage::get($file));
// $download_file = file_get_contents($quote->pdf_file_path($invitation, 'url', true));
// $zipFile->addFromString(basename($quote->pdf_file_path($invitation)), $download_file);
} }

View File

@ -237,7 +237,8 @@ class Import implements ShouldQueue
//company size check //company size check
if ($this->company->invoices()->count() > 500 || $this->company->products()->count() > 500 || $this->company->clients()->count() > 500) { if ($this->company->invoices()->count() > 500 || $this->company->products()->count() > 500 || $this->company->clients()->count() > 500) {
$this->company->is_large = true; // $this->company->is_large = true;
$this->company->account->companies()->update(['is_large' => true]);
} }

View File

@ -15,6 +15,7 @@ namespace App\PaymentDrivers\Authorize;
use App\PaymentDrivers\AuthorizePaymentDriver; use App\PaymentDrivers\AuthorizePaymentDriver;
use net\authorize\api\contract\v1\CreateTransactionRequest; use net\authorize\api\contract\v1\CreateTransactionRequest;
use net\authorize\api\contract\v1\CustomerProfilePaymentType; use net\authorize\api\contract\v1\CustomerProfilePaymentType;
use net\authorize\api\contract\v1\OrderType;
use net\authorize\api\contract\v1\PaymentProfileType; use net\authorize\api\contract\v1\PaymentProfileType;
use net\authorize\api\contract\v1\TransactionRequestType; use net\authorize\api\contract\v1\TransactionRequestType;
use net\authorize\api\controller\CreateTransactionController; use net\authorize\api\controller\CreateTransactionController;
@ -42,9 +43,21 @@ class ChargePaymentProfile
$paymentProfile->setPaymentProfileId($payment_profile_id); $paymentProfile->setPaymentProfileId($payment_profile_id);
$profileToCharge->setPaymentProfile($paymentProfile); $profileToCharge->setPaymentProfile($paymentProfile);
$invoice_numbers = '';
if($this->authorize->payment_hash->data)
$invoice_numbers = collect($this->authorize->payment_hash->data->invoices)->pluck('invoice_number')->implode(',');
$description = "Invoices: {$invoice_numbers} for {$amount} for client {$this->authorize->client->present()->name()}";
$order = new OrderType();
$order->setInvoiceNumber($invoice_numbers);
$order->setDescription($description);
$transactionRequestType = new TransactionRequestType(); $transactionRequestType = new TransactionRequestType();
$transactionRequestType->setTransactionType('authCaptureTransaction'); $transactionRequestType->setTransactionType('authCaptureTransaction');
$transactionRequestType->setAmount($amount); $transactionRequestType->setAmount($amount);
$transactionRequestType->setOrder($order);
$transactionRequestType->setProfile($profileToCharge); $transactionRequestType->setProfile($profileToCharge);
$transactionRequestType->setCurrencyCode($this->authorize->client->currency()->code); $transactionRequestType->setCurrencyCode($this->authorize->client->currency()->code);

View File

@ -198,14 +198,6 @@ class BrowserPay implements MethodInterface
return; return;
} }
// $domain = config('ninja.app_url');
// if (Ninja::isHosted()) {
// $domain = isset($this->stripe->company_gateway->company->portal_domain)
// ? $this->stripe->company_gateway->company->portal_domain
// : $this->stripe->company_gateway->company->domain();
// }
$domain = $this->getAppleDomain(); $domain = $this->getAppleDomain();
if(!$domain) if(!$domain)
@ -244,12 +236,7 @@ class BrowserPay implements MethodInterface
$domain = config('ninja.app_url'); $domain = config('ninja.app_url');
} }
$parsed_url = parse_url($domain); return str_replace("https://", "", $domain);
if(array_key_exists('host', $parsed_url))
return $parsed_url['host'];
return false;
} }

View File

@ -34,7 +34,7 @@ class GetCreditPdf extends AbstractService
public function run() public function run()
{ {
if (! $this->contact) { if (! $this->contact) {
$this->contact = $this->credit->client->primary_contact()->first(); $this->contact = $this->credit->client->primary_contact()->first() ?: $this->credit->client->contacts()->first();
} }
$path = $this->credit->client->credit_filepath($this->invitation); $path = $this->credit->client->credit_filepath($this->invitation);

View File

@ -30,7 +30,7 @@ class GetInvoicePdf extends AbstractService
public function run() public function run()
{ {
if (! $this->contact) { if (! $this->contact) {
$this->contact = $this->invoice->client->primary_contact()->first(); $this->contact = $this->invoice->client->primary_contact()->first() ?: $this->invoice->client->contacts()->first();
} }
$invitation = $this->invoice->invitations->where('client_contact_id', $this->contact->id)->first(); $invitation = $this->invoice->invitations->where('client_contact_id', $this->contact->id)->first();

View File

@ -30,7 +30,7 @@ class GetQuotePdf extends AbstractService
public function run() public function run()
{ {
if (! $this->contact) { if (! $this->contact) {
$this->contact = $this->quote->client->primary_contact()->first(); $this->contact = $this->quote->client->primary_contact()->first() ?: $this->quote->client->contacts()->first();
} }
$invitation = $this->quote->invitations->where('client_contact_id', $this->contact->id)->first(); $invitation = $this->quote->invitations->where('client_contact_id', $this->contact->id)->first();

File diff suppressed because one or more lines are too long

15022
public/main.next.dart.js vendored

File diff suppressed because one or more lines are too long

View File

@ -27,7 +27,7 @@
"/js/clients/payments/square-credit-card.js": "/js/clients/payments/square-credit-card.js?id=8f05ce6bd2d6cae7e5f2", "/js/clients/payments/square-credit-card.js": "/js/clients/payments/square-credit-card.js?id=8f05ce6bd2d6cae7e5f2",
"/js/clients/statements/view.js": "/js/clients/statements/view.js?id=4ed4c8a09803ddd0a9a7", "/js/clients/statements/view.js": "/js/clients/statements/view.js?id=4ed4c8a09803ddd0a9a7",
"/js/clients/payments/razorpay-aio.js": "/js/clients/payments/razorpay-aio.js?id=c36ab5621413ef1de7c8", "/js/clients/payments/razorpay-aio.js": "/js/clients/payments/razorpay-aio.js?id=c36ab5621413ef1de7c8",
"/js/clients/payments/stripe-sepa.js": "/js/clients/payments/stripe-sepa.js?id=9134495bcbfdd3e25aef", "/js/clients/payments/stripe-sepa.js": "/js/clients/payments/stripe-sepa.js?id=59ccac6ad75e28e3bbf2",
"/js/clients/payment_methods/authorize-checkout-card.js": "/js/clients/payment_methods/authorize-checkout-card.js?id=61becda97682c7909f29", "/js/clients/payment_methods/authorize-checkout-card.js": "/js/clients/payment_methods/authorize-checkout-card.js?id=61becda97682c7909f29",
"/js/clients/payments/stripe-giropay.js": "/js/clients/payments/stripe-giropay.js?id=2a973971ed2b890524ee", "/js/clients/payments/stripe-giropay.js": "/js/clients/payments/stripe-giropay.js?id=2a973971ed2b890524ee",
"/js/clients/payments/stripe-acss.js": "/js/clients/payments/stripe-acss.js?id=41367f4e80e52a0ab436", "/js/clients/payments/stripe-acss.js": "/js/clients/payments/stripe-acss.js?id=41367f4e80e52a0ab436",

View File

@ -57,7 +57,7 @@
<!-- Styles --> <!-- Styles -->
<link href="{{ mix('css/app.css') }}" rel="stylesheet"> <link href="{{ mix('css/app.css') }}" rel="stylesheet">
@if(!auth()->guard('contact')->user()->user->account->isPaid()) @if(auth()->guard('contact')->user() && !auth()->guard('contact')->user()->user->account->isPaid())
<link href="{{ asset('favicon.png') }}" rel="shortcut icon" type="image/png"> <link href="{{ asset('favicon.png') }}" rel="shortcut icon" type="image/png">
@endif @endif

View File

@ -316,8 +316,8 @@ class CsvImportTest extends TestCase
$invoice = Invoice::find($invoice_id); $invoice = Invoice::find($invoice_id);
$this->assertTrue($invoice->payments()->exists()); $this->assertTrue($invoice->payments()->exists());
$this->assertEquals(1, $invoice->payments()->count()); $this->assertEquals(3, $invoice->payments()->count());
$this->assertEquals(400, $invoice->payments()->sum('payments.amount')); $this->assertEquals(1200, $invoice->payments()->sum('payments.amount'));
} }
} }