diff --git a/app/Ninja/PaymentDrivers/BasePaymentDriver.php b/app/Ninja/PaymentDrivers/BasePaymentDriver.php index 794dccd1c10c..1601f9d3d789 100644 --- a/app/Ninja/PaymentDrivers/BasePaymentDriver.php +++ b/app/Ninja/PaymentDrivers/BasePaymentDriver.php @@ -254,23 +254,18 @@ 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; } public function completeOnsitePurchase($input = false, $paymentMethod = false) { - \Log::info('completeOnsitePurchase...'); $this->input = count($input) ? $input : false; $gateway = $this->gateway(); @@ -311,7 +306,7 @@ class BasePaymentDriver if ($this->isTwoStep() || request()->capture) { return; } - \Log::info('starting paymnet...'); + // prepare and process payment $data = $this->paymentDetails($paymentMethod); // TODO move to payment driver class diff --git a/app/Ninja/Repositories/AccountRepository.php b/app/Ninja/Repositories/AccountRepository.php index 22708e69c48c..752d08d755ac 100644 --- a/app/Ninja/Repositories/AccountRepository.php +++ b/app/Ninja/Repositories/AccountRepository.php @@ -128,10 +128,18 @@ class AccountRepository private function checkForSpammer() { - $count = Account::whereIp(Request::getClientIp())->count(); - - if ($count > 1) { + $ip = Request::getClientIp(); + $count = Account::whereIp($ip)->count(); + if ($count > 1 && $errorEmail = env('ERROR_EMAIL')) { + \Mail::raw($ip, function ($message) use ($ip, $errorEmail) { + $message->to($errorEmail) + ->from(CONTACT_EMAIL) + ->subject('Duplicate company for IP: ' . $ip); + }); + if ($count >= 5) { + abort(); + } } } diff --git a/composer.json b/composer.json index 09bdcb267d22..c489805a82b6 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,7 @@ "fzaninotto/faker": "^1.5", "gatepay/FedACHdir": "dev-master@dev", "google/apiclient": "^2.0", - "guzzlehttp/guzzle": "~6.0", + "guzzlehttp/guzzle": "^6.3", "intervention/image": "dev-master", "invoiceninja/omnipay-collection": "0.7@dev", "jaybizzle/laravel-crawler-detect": "1.*", diff --git a/composer.lock b/composer.lock index 9c553acf3a95..cc6d0d079ca3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "90db9851db82d5398c2c173955211b0f", - "content-hash": "958cf422514450eb39c743ebd6c3a3c8", + "hash": "d690d598db58964feb20dbbcdce8a92f", + "content-hash": "859622bff39b3e438703dcc641ada711", "packages": [ { "name": "abdala/omnipay-pagseguro",