diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index d63f6fb9e18f..794dccd1c10c 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -254,13 +254,17 @@ class BasePaymentDriver protected function gateway() { + \Log::info('gateway...'); if ($this->gateway) { + \Log::info('g1'); return $this->gateway; } + \Log::info('g2: ' . $this->accountGateway->gateway->provider); $this->gateway = Omnipay::create($this->accountGateway->gateway->provider); + \Log::info('g3'); $this->gateway->initialize((array) $this->accountGateway->getConfig()); - + \Log::info('g4'); return $this->gateway; } @@ -269,14 +273,11 @@ class BasePaymentDriver \Log::info('completeOnsitePurchase...'); $this->input = count($input) ? $input : false; $gateway = $this->gateway(); - \Log::info('CP: 1'); + if ($input) { - \Log::info('CP: 2'); $this->updateClient(); - \Log::info('CP: 3'); } - \Log::info('CP: 4'); - + // load or create token if ($this->isGatewayType(GATEWAY_TYPE_TOKEN)) { if (! $paymentMethod) { diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 236f340e164c..22708e69c48c 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -32,6 +32,10 @@ class AccountRepository public function create($firstName = '', $lastName = '', $email = '', $password = '', $company = false) { if (! $company) { + if (Utils::isNinja()) { + $this->checkForSpammer(); + } + $company = new Company(); $company->utm_source = Input::get('utm_source'); $company->utm_medium = Input::get('utm_medium'); @@ -122,6 +126,15 @@ class AccountRepository return $account; } + private function checkForSpammer() + { + $count = Account::whereIp(Request::getClientIp())->count(); + + if ($count > 1) { + + } + } + public function getSearchData($user) { $data = $this->getAccountSearchData($user); diff --git a/app/Services/PaymentService.php b/app/Services/PaymentService.php index 386755926cbc..7d2387d1c455 100644 --- a/app/Services/PaymentService.php +++ b/app/Services/PaymentService.php @@ -137,9 +137,10 @@ class PaymentService extends BaseService try { return $paymentDriver->completeOnsitePurchase(false, $paymentMethod); } catch (Exception $exception) { + $subject = trans('texts.auto_bill_failed', ['invoice_number' => $invoice->invoice_number]); + $message = sprintf('%s: %s', ucwords($paymentDriver->providerName()), $exception->getMessage()); + Utils::logError($message, 'PHP', true); if (! Auth::check()) { - $subject = trans('texts.auto_bill_failed', ['invoice_number' => $invoice->invoice_number]); - $message = sprintf('%s: %s', ucwords($paymentDriver->providerName()), $exception->getMessage()); $mailer = app('App\Ninja\Mailers\UserMailer'); $mailer->sendMessage($invoice->user, $subject, $message, [ 'invoice' => $invoice