1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 16:31:33 +02:00

Merge pull request #7268 from turbo124/v5-develop

Fixes for Apple Pay
This commit is contained in:
David Bomba 2022-03-07 18:53:00 +11:00 committed by GitHub
commit e7f2582986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 49 additions and 31 deletions

View File

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

View File

@ -29,7 +29,15 @@ class TrustProxies extends Middleware
*
* @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

View File

@ -91,8 +91,9 @@ class ZipCredits implements ShouldQueue
foreach ($this->credits as $credit) {
$download_file = file_get_contents($credit->pdf_file_path($invitation, 'url', true));
$zipFile->addFromString(basename($credit->pdf_file_path($invitation)), $download_file);
$file = $credit->service()->getCreditPdf($credit->invitations()->first());
$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) {
$download_file = file_get_contents($invoice->pdf_file_path($invitation, 'url', true));
$zipFile->addFromString(basename($invoice->pdf_file_path($invitation)), $download_file);
$file = $invoice->service()->getInvoicePdf();
$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) {
$download_file = file_get_contents($quote->pdf_file_path($invitation, 'url', true));
$zipFile->addFromString(basename($quote->pdf_file_path($invitation)), $download_file);
$file = $quote->service()->getQuotePdf();
$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
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 net\authorize\api\contract\v1\CreateTransactionRequest;
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\TransactionRequestType;
use net\authorize\api\controller\CreateTransactionController;
@ -42,9 +43,21 @@ class ChargePaymentProfile
$paymentProfile->setPaymentProfileId($payment_profile_id);
$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->setTransactionType('authCaptureTransaction');
$transactionRequestType->setAmount($amount);
$transactionRequestType->setOrder($order);
$transactionRequestType->setProfile($profileToCharge);
$transactionRequestType->setCurrencyCode($this->authorize->client->currency()->code);

View File

@ -198,14 +198,6 @@ class BrowserPay implements MethodInterface
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();
if(!$domain)
@ -244,12 +236,7 @@ class BrowserPay implements MethodInterface
$domain = config('ninja.app_url');
}
$parsed_url = parse_url($domain);
if(array_key_exists('host', $parsed_url))
return $parsed_url['host'];
return false;
return str_replace("https://", "", $domain);
}

View File

@ -34,7 +34,7 @@ class GetCreditPdf extends AbstractService
public function run()
{
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);

View File

@ -30,7 +30,7 @@ class GetInvoicePdf extends AbstractService
public function run()
{
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();

View File

@ -30,7 +30,7 @@ class GetQuotePdf extends AbstractService
public function run()
{
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();

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/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/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/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",

View File

@ -57,7 +57,7 @@
<!-- Styles -->
<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">
@endif

View File

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