diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index ac18c8ccbc4f..c34ec5d21492 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -86,8 +86,6 @@ class InvoiceController extends Controller */ public function show(ShowInvoiceRequest $request, Invoice $invoice) { - - $data = [ 'invoice' => $invoice, ]; diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 94c18469a8b3..88e740d80369 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -76,9 +76,14 @@ class PaymentController extends Controller * * @return \Illuminate\Http\Response */ - public function show(RecurringInvoice $invoice) + public function show(Request $request, Payment $payment) { + $payment->load('invoices'); + $data['payment'] = $payment; + + print_r($payment->toArray()); + //return view('portal.default.payments.show', $data); } diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 083dbeb564ca..466c1f824289 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -359,6 +359,28 @@ class StripePaymentDriver extends BasePaymentDriver $payment->invoices()->sync($invoices); $payment->save(); + +//mark all invoices as paid +//$invoices->update(['status_id' => Payment::STATUS_COMPLETED]); + + // foreach($invoices as $invoice){ + // \Log::error('invite count = '.$invoices->invitations->count()); + // foreach($invoice->invitations as $invitation) + // { + // \Log::error($invitation); + // $invitations->update(['transaction_reference' => $payment->transaction_reference]); + // } + // } + +//mark all invitations with transaction reference +$invoices->each(function ($invoice) use($payment) { + + $invoice->update(['status_id' => Payment::STATUS_COMPLETED]); + $invoice->invitations()->update(['transaction_reference' => $payment->transaction_reference]); + +}); + return redirect()->route('client.payments.show', ['id' => $this->encodePrimaryKey($payment->id)]); + } } diff --git a/resources/views/portal/default/payments/show.blade.php b/resources/views/portal/default/payments/show.blade.php new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/routes/client.php b/routes/client.php index c8028fdf3600..b9ac33d9ffcf 100644 --- a/routes/client.php +++ b/routes/client.php @@ -24,6 +24,7 @@ Route::group(['middleware' => ['auth:contact'], 'prefix' => 'client', 'as' => 'c Route::get('recurring_invoices', 'ClientPortal\RecurringInvoiceController@index')->name('recurring_invoices.index'); Route::get('payments', 'ClientPortal\PaymentController@index')->name('payments.index'); + Route::get('payments/{payment}', 'ClientPortal\PaymentController@show')->name('payments.show'); Route::post('payments/process', 'ClientPortal\PaymentController@process')->name('payments.process'); Route::post('payments/process/response', 'ClientPortal\PaymentController@response')->name('payments.response');