mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:37:33 -05:00 
			
		
		
		
	Working on tests
This commit is contained in:
		
							parent
							
								
									bff526ade2
								
							
						
					
					
						commit
						9b9a27a38b
					
				@ -254,13 +254,17 @@ 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;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -269,13 +273,10 @@ class BasePaymentDriver
 | 
				
			|||||||
        \Log::info('completeOnsitePurchase...');
 | 
					        \Log::info('completeOnsitePurchase...');
 | 
				
			||||||
        $this->input = count($input) ? $input : false;
 | 
					        $this->input = count($input) ? $input : false;
 | 
				
			||||||
        $gateway = $this->gateway();
 | 
					        $gateway = $this->gateway();
 | 
				
			||||||
        \Log::info('CP: 1');
 | 
					
 | 
				
			||||||
        if ($input) {
 | 
					        if ($input) {
 | 
				
			||||||
            \Log::info('CP: 2');
 | 
					 | 
				
			||||||
            $this->updateClient();
 | 
					            $this->updateClient();
 | 
				
			||||||
            \Log::info('CP: 3');
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        \Log::info('CP: 4');
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // load or create token
 | 
					        // load or create token
 | 
				
			||||||
        if ($this->isGatewayType(GATEWAY_TYPE_TOKEN)) {
 | 
					        if ($this->isGatewayType(GATEWAY_TYPE_TOKEN)) {
 | 
				
			||||||
 | 
				
			|||||||
@ -32,6 +32,10 @@ class AccountRepository
 | 
				
			|||||||
    public function create($firstName = '', $lastName = '', $email = '', $password = '', $company = false)
 | 
					    public function create($firstName = '', $lastName = '', $email = '', $password = '', $company = false)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        if (! $company) {
 | 
					        if (! $company) {
 | 
				
			||||||
 | 
					            if (Utils::isNinja()) {
 | 
				
			||||||
 | 
					                $this->checkForSpammer();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $company = new Company();
 | 
					            $company = new Company();
 | 
				
			||||||
            $company->utm_source = Input::get('utm_source');
 | 
					            $company->utm_source = Input::get('utm_source');
 | 
				
			||||||
            $company->utm_medium = Input::get('utm_medium');
 | 
					            $company->utm_medium = Input::get('utm_medium');
 | 
				
			||||||
@ -122,6 +126,15 @@ class AccountRepository
 | 
				
			|||||||
        return $account;
 | 
					        return $account;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private function checkForSpammer()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        $count = Account::whereIp(Request::getClientIp())->count();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if ($count > 1) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function getSearchData($user)
 | 
					    public function getSearchData($user)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $data = $this->getAccountSearchData($user);
 | 
					        $data = $this->getAccountSearchData($user);
 | 
				
			||||||
 | 
				
			|||||||
@ -137,9 +137,10 @@ class PaymentService extends BaseService
 | 
				
			|||||||
        try {
 | 
					        try {
 | 
				
			||||||
            return $paymentDriver->completeOnsitePurchase(false, $paymentMethod);
 | 
					            return $paymentDriver->completeOnsitePurchase(false, $paymentMethod);
 | 
				
			||||||
        } catch (Exception $exception) {
 | 
					        } catch (Exception $exception) {
 | 
				
			||||||
            if (! Auth::check()) {
 | 
					 | 
				
			||||||
            $subject = trans('texts.auto_bill_failed', ['invoice_number' => $invoice->invoice_number]);
 | 
					            $subject = trans('texts.auto_bill_failed', ['invoice_number' => $invoice->invoice_number]);
 | 
				
			||||||
            $message = sprintf('%s: %s', ucwords($paymentDriver->providerName()), $exception->getMessage());
 | 
					            $message = sprintf('%s: %s', ucwords($paymentDriver->providerName()), $exception->getMessage());
 | 
				
			||||||
 | 
					            Utils::logError($message, 'PHP', true);
 | 
				
			||||||
 | 
					            if (! Auth::check()) {
 | 
				
			||||||
                $mailer = app('App\Ninja\Mailers\UserMailer');
 | 
					                $mailer = app('App\Ninja\Mailers\UserMailer');
 | 
				
			||||||
                $mailer->sendMessage($invoice->user, $subject, $message, [
 | 
					                $mailer->sendMessage($invoice->user, $subject, $message, [
 | 
				
			||||||
                    'invoice' => $invoice
 | 
					                    'invoice' => $invoice
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user