From d7368851f5edf4218b7aea9ba00d7447af8f5d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristia=CC=81n=20Feldsam?= Date: Mon, 29 Apr 2019 10:59:24 +0200 Subject: [PATCH] PaymentDriver - Convert quote to invoice on payment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristián Feldsam --- app/Ninja/PaymentDrivers/BasePaymentDriver.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index 9e672a56fbc0..8103b4f7010a 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -698,6 +698,13 @@ class BasePaymentDriver if (! $invoice->canBePaid()) { return false; } + + // check if invoice is quote and if is, them convert it + if($invoice->isQuote()) { + $invoiceService = app('App\Services\InvoiceService'); + $invoice = $invoiceService->convertQuote($invoice); + } + $invoice->markSentIfUnsent(); $payment = Payment::createNew($invitation);