1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Working on tests

This commit is contained in:
Hillel Coren 2018-03-11 08:50:11 +02:00
parent bff526ade2
commit 9b9a27a38b
3 changed files with 23 additions and 8 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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