transactionId, $this->businessId); if (! $transaction) { return; } if ($this->isDeleted) { $postingService->delete( 'sell', $this->transactionId, null, $this->businessId ); return; } $businessLocation = BusinessLocation::where('business_id', $this->businessId) ->find($transaction->location_id); if (! $businessLocation) { return; } $accountingDefaultMap = json_decode($businessLocation->accounting_default_map ?? '{}', true); $depositTo = $accountingDefaultMap['sale']['deposit_to'] ?? null; $paymentAccount = $accountingDefaultMap['sale']['payment_account'] ?? null; if (is_null($depositTo) || is_null($paymentAccount)) { return; } $postingService->post( 'sell', $this->transactionId, (int) ($this->userId ?? $transaction->created_by ?? 0), $this->businessId, (int) $depositTo, (int) $paymentAccount, (int) $transaction->location_id ); } }