Working on tests

This commit is contained in:
Hillel Coren 2018-03-11 09:20:35 +02:00
parent 9b9a27a38b
commit 5eab95f5d8
4 changed files with 16 additions and 13 deletions

View File

@ -254,23 +254,18 @@ class BasePaymentDriver
protected function gateway() protected function gateway()
{ {
\Log::info('gateway...');
if ($this->gateway) { if ($this->gateway) {
\Log::info('g1');
return $this->gateway; return $this->gateway;
} }
\Log::info('g2: ' . $this->accountGateway->gateway->provider);
$this->gateway = Omnipay::create($this->accountGateway->gateway->provider); $this->gateway = Omnipay::create($this->accountGateway->gateway->provider);
\Log::info('g3');
$this->gateway->initialize((array) $this->accountGateway->getConfig()); $this->gateway->initialize((array) $this->accountGateway->getConfig());
\Log::info('g4');
return $this->gateway; return $this->gateway;
} }
public function completeOnsitePurchase($input = false, $paymentMethod = false) public function completeOnsitePurchase($input = false, $paymentMethod = false)
{ {
\Log::info('completeOnsitePurchase...');
$this->input = count($input) ? $input : false; $this->input = count($input) ? $input : false;
$gateway = $this->gateway(); $gateway = $this->gateway();
@ -311,7 +306,7 @@ class BasePaymentDriver
if ($this->isTwoStep() || request()->capture) { if ($this->isTwoStep() || request()->capture) {
return; return;
} }
\Log::info('starting paymnet...');
// prepare and process payment // prepare and process payment
$data = $this->paymentDetails($paymentMethod); $data = $this->paymentDetails($paymentMethod);
// TODO move to payment driver class // TODO move to payment driver class

View File

@ -128,10 +128,18 @@ class AccountRepository
private function checkForSpammer() private function checkForSpammer()
{ {
$count = Account::whereIp(Request::getClientIp())->count(); $ip = Request::getClientIp();
$count = Account::whereIp($ip)->count();
if ($count > 1) {
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();
}
} }
} }

View File

@ -34,7 +34,7 @@
"fzaninotto/faker": "^1.5", "fzaninotto/faker": "^1.5",
"gatepay/FedACHdir": "dev-master@dev", "gatepay/FedACHdir": "dev-master@dev",
"google/apiclient": "^2.0", "google/apiclient": "^2.0",
"guzzlehttp/guzzle": "~6.0", "guzzlehttp/guzzle": "^6.3",
"intervention/image": "dev-master", "intervention/image": "dev-master",
"invoiceninja/omnipay-collection": "0.7@dev", "invoiceninja/omnipay-collection": "0.7@dev",
"jaybizzle/laravel-crawler-detect": "1.*", "jaybizzle/laravel-crawler-detect": "1.*",

4
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "90db9851db82d5398c2c173955211b0f", "hash": "d690d598db58964feb20dbbcdce8a92f",
"content-hash": "958cf422514450eb39c743ebd6c3a3c8", "content-hash": "859622bff39b3e438703dcc641ada711",
"packages": [ "packages": [
{ {
"name": "abdala/omnipay-pagseguro", "name": "abdala/omnipay-pagseguro",