diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index 93df85a4c711..1c18142d390c 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -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); diff --git a/app/Jobs/Account/CreateAccount.php b/app/Jobs/Account/CreateAccount.php index ae8d645fbe80..bb11901f396d 100644 --- a/app/Jobs/Account/CreateAccount.php +++ b/app/Jobs/Account/CreateAccount.php @@ -58,6 +58,7 @@ class CreateAccount * Create company */ $company = CreateCompany::dispatchNow($this->request, $account); + $company->load('account'); /* * Set default company */ diff --git a/app/Listeners/Activity/CreatedClientActivity.php b/app/Listeners/Activity/CreatedClientActivity.php index 6910a6340df4..065b4c40c979 100644 --- a/app/Listeners/Activity/CreatedClientActivity.php +++ b/app/Listeners/Activity/CreatedClientActivity.php @@ -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; /** diff --git a/app/Listeners/Activity/PaymentCreatedActivity.php b/app/Listeners/Activity/PaymentCreatedActivity.php index 2aacfb79d897..7773b7faa217 100644 --- a/app/Listeners/Activity/PaymentCreatedActivity.php +++ b/app/Listeners/Activity/PaymentCreatedActivity.php @@ -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; /** diff --git a/app/Listeners/Contact/UpdateContactLastLogin.php b/app/Listeners/Contact/UpdateContactLastLogin.php index b7fa2d17097d..3a8f7138489d 100644 --- a/app/Listeners/Contact/UpdateContactLastLogin.php +++ b/app/Listeners/Contact/UpdateContactLastLogin.php @@ -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. diff --git a/app/Listeners/Invoice/CreateInvoiceActivity.php b/app/Listeners/Invoice/CreateInvoiceActivity.php index 84d6e2b7e883..15edf7b4f4db 100644 --- a/app/Listeners/Invoice/CreateInvoiceActivity.php +++ b/app/Listeners/Invoice/CreateInvoiceActivity.php @@ -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; /** diff --git a/app/Listeners/Invoice/UpdateInvoiceActivity.php b/app/Listeners/Invoice/UpdateInvoiceActivity.php index 5ce3d2693ae0..da9c74ec1ea2 100644 --- a/app/Listeners/Invoice/UpdateInvoiceActivity.php +++ b/app/Listeners/Invoice/UpdateInvoiceActivity.php @@ -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; /** diff --git a/app/Listeners/SendVerificationNotification.php b/app/Listeners/SendVerificationNotification.php index 27c6acfcf9ed..3094c32c06c1 100644 --- a/app/Listeners/SendVerificationNotification.php +++ b/app/Listeners/SendVerificationNotification.php @@ -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. diff --git a/app/Models/Client.php b/app/Models/Client.php index 9db671e1667e..5694dd41aaaa 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -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) diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 697e0d01d842..4e3625238da9 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -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)); } diff --git a/database/migrations/2014_10_13_000000_create_users_table.php b/database/migrations/2014_10_13_000000_create_users_table.php index 0e7e9a021453..3773e19b3479 100644 --- a/database/migrations/2014_10_13_000000_create_users_table.php +++ b/database/migrations/2014_10_13_000000_create_users_table.php @@ -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(''); diff --git a/database/seeds/RandomDataSeeder.php b/database/seeds/RandomDataSeeder.php index 7020223e0bca..6b3f1b578d90 100644 --- a/database/seeds/RandomDataSeeder.php +++ b/database/seeds/RandomDataSeeder.php @@ -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]); diff --git a/resources/views/portal/default/dashboard/index.blade.php b/resources/views/portal/default/dashboard/index.blade.php index 90da2f594a71..e5627ee650c1 100644 --- a/resources/views/portal/default/dashboard/index.blade.php +++ b/resources/views/portal/default/dashboard/index.blade.php @@ -72,7 +72,7 @@ - + diff --git a/resources/views/portal/default/gateways/stripe/create_customer.blade.php b/resources/views/portal/default/gateways/stripe/add_credit_card.blade.php similarity index 100% rename from resources/views/portal/default/gateways/stripe/create_customer.blade.php rename to resources/views/portal/default/gateways/stripe/add_credit_card.blade.php diff --git a/resources/views/portal/default/gateways/stripe/credit_card.blade.php b/resources/views/portal/default/gateways/stripe/credit_card.blade.php deleted file mode 100644 index f21b0dfd9b61..000000000000 --- a/resources/views/portal/default/gateways/stripe/credit_card.blade.php +++ /dev/null @@ -1,17 +0,0 @@ - -@if($token) - - - -@else - -
- -
- -@endif - - -@push('scripts') - -@endpush \ No newline at end of file