diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index 5d9a8447c2d0..6552c51a8490 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -309,6 +309,10 @@ class BaseImport ); } } catch (\Exception $ex) { + + if(\DB::connection(config('database.default'))->transactionLevel() > 0) + \DB::connection(config('database.default'))->rollBack(); + if ($ex instanceof ImportException) { $message = $ex->getMessage(); } else { diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index cc4a769be12a..30975d119ad9 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -445,7 +445,7 @@ class StripePaymentDriver extends BaseDriver if(count($searchResults) == 1){ $customer = $searchResults->data[0]; - $this->updateStripeCustomer($customer); + // $this->updateStripeCustomer($customer); return $customer; } diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index 17cfdf5e1437..36a93cc7bae3 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -105,7 +105,7 @@ class MarkPaid extends AbstractService /* Get the last record for the client and set the current balance*/ $client = Client::where('id', $this->invoice->client_id)->lockForUpdate()->first(); $client->paid_to_date += $payment->amount; - $client->balance += $payment->amount * -1; + $client->balance -= $payment->amount; $client->save(); }, 1);