mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Client payment flow
This commit is contained in:
parent
6037e30887
commit
4fd41dbe1d
@ -130,7 +130,6 @@ class InvoiceController extends Controller
|
||||
return $invoice;
|
||||
});
|
||||
|
||||
|
||||
$formatted_total = Number::formatMoney($total, auth()->user()->client);
|
||||
|
||||
$payment_methods = auth()->user()->client->getPaymentMethods($total);
|
||||
|
@ -58,6 +58,7 @@ class CreateAccount
|
||||
* Create company
|
||||
*/
|
||||
$company = CreateCompany::dispatchNow($this->request, $account);
|
||||
$company->load('account');
|
||||
/*
|
||||
* Set default company
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class CreatedClientActivity
|
||||
class CreatedClientActivity implements ShouldQueue
|
||||
{
|
||||
protected $activity_repo;
|
||||
/**
|
||||
|
@ -18,7 +18,7 @@ use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class PaymentCreatedActivity
|
||||
class PaymentCreatedActivity implements ShouldQueue
|
||||
{
|
||||
protected $activityRepo;
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ use App\Repositories\ActivityRepository;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class UpdateContactLastLogin
|
||||
class UpdateContactLastLogin implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
|
@ -20,7 +20,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreateInvoiceActivity
|
||||
class CreateInvoiceActivity implements ShouldQueue
|
||||
{
|
||||
protected $activity_repo;
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdateInvoiceActivity
|
||||
class UpdateInvoiceActivity implements ShouldQueue
|
||||
{
|
||||
protected $activity_repo;
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class SendVerificationNotification
|
||||
class SendVerificationNotification implements ShouldQueue
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
|
@ -278,7 +278,12 @@ class Client extends BaseModel
|
||||
*/
|
||||
public function getPaymentMethods($amount) :array
|
||||
{
|
||||
|
||||
//this method will get all the possible gateways a client can pay with
|
||||
//but we also need to consider payment methods that are already stored
|
||||
//so we MUST filter the company gateways and remove duplicates.
|
||||
//
|
||||
//Also need to harvest the list of client gateway tokens and present these
|
||||
//for instant payment
|
||||
$company_gateways = $this->getSetting('company_gateways');
|
||||
|
||||
if($company_gateways)
|
||||
|
@ -132,7 +132,7 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
{
|
||||
$intent['intent'] = $this->getSetupIntent();
|
||||
|
||||
return view('portal.default.gateways.stripe.create_customer', array_merge($data, $intent));
|
||||
return view('portal.default.gateways.stripe.add_credit_card', array_merge($data, $intent));
|
||||
|
||||
}
|
||||
|
||||
|
@ -239,9 +239,9 @@ class CreateUsersTable extends Migration
|
||||
|
||||
Schema::create('company_tokens', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('company_id');
|
||||
$table->unsignedInteger('company_id')->index();
|
||||
$table->unsignedInteger('account_id');
|
||||
$table->unsignedInteger('user_id')->index();
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->string('token')->nullable();
|
||||
$table->string('name')->default('');
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\DataMapper\CompanySettings;
|
||||
use App\DataMapper\DefaultSettings;
|
||||
use App\Events\Invoice\InvoiceWasUpdated;
|
||||
use App\Helpers\Invoice\InvoiceCalc;
|
||||
use App\Models\Account;
|
||||
use App\Models\Client;
|
||||
use App\Models\ClientContact;
|
||||
@ -10,6 +12,7 @@ use App\Models\CompanyGateway;
|
||||
use App\Models\CompanyToken;
|
||||
use App\Models\GatewayType;
|
||||
use App\Models\GroupSetting;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\User;
|
||||
use App\Models\UserAccount;
|
||||
use Illuminate\Database\Seeder;
|
||||
@ -104,6 +107,17 @@ class RandomDataSeeder extends Seeder
|
||||
/** Invoice Factory */
|
||||
factory(\App\Models\Invoice::class,500)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id, 'settings' => ClientSettings::buildClientSettings($company->settings, $client->settings)]);
|
||||
|
||||
$invoices = Invoice::all();
|
||||
|
||||
$invoices->each(function ($invoice){
|
||||
|
||||
$invoice_calc = new InvoiceCalc($invoice, $invoice->settings);
|
||||
|
||||
$invoice = $invoice_calc->build()->getInvoice();
|
||||
|
||||
$invoice->save();
|
||||
});
|
||||
|
||||
/** Recurring Invoice Factory */
|
||||
factory(\App\Models\RecurringInvoice::class,20)->create(['user_id' => $user->id, 'company_id' => $company->id, 'client_id' => $client->id]);
|
||||
|
||||
|
@ -72,7 +72,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- update payment methods -->
|
||||
<!-- update payment methods
|
||||
<div class="row" style="margin-top: 30px;">
|
||||
<div class="col-sm-6 col-lg-3">
|
||||
<div class="card text-white bg-warning h-100">
|
||||
@ -100,7 +100,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<!-- Stripe Credit Card TOKEN Form-->
|
||||
@if($token)
|
||||
|
||||
<!-- Stripe Credit Card TOKEN Form-->
|
||||
|
||||
@else
|
||||
<!-- Stripe Credit Card Payment Form-->
|
||||
<div class="py-md-5">
|
||||
|
||||
</div>
|
||||
<!-- Stripe Credit Card Payment Form-->
|
||||
@endif
|
||||
|
||||
|
||||
@push('scripts')
|
||||
<script src="https://js.stripe.com/v3/"></script>
|
||||
@endpush
|
Loading…
x
Reference in New Issue
Block a user