mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Notify end user to connect with Stripe Connect on hosted platform
This commit is contained in:
parent
413719b72c
commit
efe3f51778
@ -35,11 +35,14 @@ use App\Http\ValidationRules\ValidCompanyGatewayFeesAndLimitsRule;
|
||||
use App\Http\ValidationRules\ValidUserForCompany;
|
||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
|
||||
use App\Jobs\Company\CreateCompanyToken;
|
||||
use App\Jobs\Mail\NinjaMailerJob;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
use App\Jobs\Ninja\CheckCompanyData;
|
||||
use App\Jobs\Ninja\CompanySizeCheck;
|
||||
use App\Jobs\Util\VersionCheck;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\MigrationCompleted;
|
||||
use App\Mail\Migration\StripeConnectMigration;
|
||||
use App\Models\Activity;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
@ -87,11 +90,11 @@ use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Turbo124\Beacon\Facades\LightLogs;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class Import implements ShouldQueue
|
||||
{
|
||||
@ -1386,7 +1389,16 @@ class Import implements ShouldQueue
|
||||
$modified['fees_and_limits'] = $this->cleanFeesAndLimits($modified['fees_and_limits']);
|
||||
}
|
||||
|
||||
/* On Hosted platform we need to advise Stripe users to connect with Stripe Connect */
|
||||
if(Ninja::isHosted() && $modified['gateway_key'] == 'd14dd26a37cecc30fdd65700bfb55b23'){
|
||||
|
||||
$nmo = new NinjaMailerObject;
|
||||
$nmo->mailable = new StripeConnectMigration($this->company);
|
||||
$nmo->company = $this->company;
|
||||
$nmo->settings = $this->company->settings;
|
||||
$nmo->to_user = $this->user;
|
||||
NinjaMailerJob::dispatch($nmo);
|
||||
|
||||
$modified['gateway_key'] = 'd14dd26a47cecc30fdd65700bfb67b34';
|
||||
$modified['fees_and_limits'] = [];
|
||||
}
|
||||
|
55
app/Mail/Migration/StripeConnectMigration.php
Normal file
55
app/Mail/Migration/StripeConnectMigration.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
namespace App\Mail\Migration;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class StripeConnectMigration extends Mailable
|
||||
{
|
||||
// use Queueable, SerializesModels;
|
||||
|
||||
public $company;
|
||||
|
||||
public $settings;
|
||||
|
||||
public $logo;
|
||||
|
||||
public $whitelabel;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($company)
|
||||
{
|
||||
$this->company = $company;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$this->settings = $this->company->settings;
|
||||
$this->logo = $this->company->present()->logo();
|
||||
$this->whitelabel = $this->company->account->isPaid();
|
||||
|
||||
return $this->from(config('mail.from.address'), config('mail.from.name'))
|
||||
->subject(ctrans('texts.stripe_connect_migration_title'))
|
||||
->view('email.migration.stripe_connect');
|
||||
}
|
||||
}
|
@ -57,13 +57,10 @@ class Merge extends AbstractService
|
||||
$this->mergable_client->tasks()->update(['client_id' => $this->client->id]);
|
||||
$this->mergable_client->documents()->update(['documentable_id' => $this->client->id]);
|
||||
|
||||
nlog("count =" .$this->mergable_client->contacts->count());
|
||||
|
||||
/* Loop through contacts an only merge distinct contacts by email */
|
||||
$this->mergable_client->contacts->each(function ($contact){
|
||||
|
||||
$exist = $this->client->contacts->contains(function ($client_contact) use($contact){
|
||||
nlog("{$client_contact->email} == {$contact->email}");
|
||||
return $client_contact->email == $contact->email;
|
||||
});
|
||||
|
||||
@ -75,7 +72,6 @@ class Merge extends AbstractService
|
||||
|
||||
});
|
||||
|
||||
nlog($this->client->contacts->fresh()->count());
|
||||
$this->mergable_client->forceDelete();
|
||||
|
||||
return $this->client;
|
||||
|
@ -4287,6 +4287,8 @@ $LANG = array(
|
||||
'company_deleted' => 'Company deleted',
|
||||
'company_deleted_body' => 'Company [ :company ] was deleted by :user',
|
||||
'back_to' => 'Back to :url',
|
||||
'stripe_connect_migration_title' => 'Connect your Stripe Account',
|
||||
'stripe_connect_migration_desc' => 'Invoice Ninja v5 uses Stripe Connect to link your Stripe account to Invoice Ninja. This provides an additional layer of security for your account. Now that you data has migrated, you will need to Authorize Stripe to accept payments in v5.<br><br>To do this, navigate to Settings > Online Payments > Configure Gateways. Click on Stripe Connect and then under Settings click Setup Gateway. This will take you to Stripe to authorize Invoice Ninja and on your return your account will be successfully linked!',
|
||||
);
|
||||
|
||||
return $LANG;
|
||||
|
@ -1,6 +1,7 @@
|
||||
@component('email.template.admin', ['logo' => $logo, 'settings' => $settings])
|
||||
<div class="center">
|
||||
<h1>{{ ctrans('texts.max_companies') }}</h1>
|
||||
|
||||
<p>{{ ctrans('texts.max_companies_desc') }}</p>
|
||||
</div>
|
||||
@endcomponent
|
||||
|
7
resources/views/email/migration/stripe_connect.blade.php
Normal file
7
resources/views/email/migration/stripe_connect.blade.php
Normal file
@ -0,0 +1,7 @@
|
||||
@component('email.template.admin', ['logo' => $logo, 'settings' => $settings])
|
||||
<div class="center">
|
||||
<h1>{{ ctrans('texts.stripe_connect_migration_title') }}</h1>
|
||||
|
||||
<p>{{ ctrans('texts.stripe_connect_migration_desc') }}</p>
|
||||
</div>
|
||||
@endcomponent
|
Loading…
Reference in New Issue
Block a user