mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:17:34 -05:00 
			
		
		
		
	Looking into bots...
This commit is contained in:
		
							parent
							
								
									8dc1786eb2
								
							
						
					
					
						commit
						d64f18ef99
					
				
							
								
								
									
										54
									
								
								app/Console/Commands/TestBot.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								app/Console/Commands/TestBot.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,54 @@
 | 
			
		||||
<?php namespace App\Console\Commands;
 | 
			
		||||
 | 
			
		||||
use Illuminate\Console\Command;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class TestOFX
 | 
			
		||||
 */
 | 
			
		||||
class TestBot extends Command
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $name = 'ninja:test-bot';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     */
 | 
			
		||||
    protected $description = 'Test Bot';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * TestOFX constructor.
 | 
			
		||||
     *
 | 
			
		||||
     * @param BankAccountService $bankAccountService
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        parent::__construct();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function fire()
 | 
			
		||||
    {
 | 
			
		||||
        $this->info(date('Y-m-d').' Running TestBot...');
 | 
			
		||||
 | 
			
		||||
        $clientId = env('MSBOT_CLIENT_ID');
 | 
			
		||||
        $clientSecret = env('MSBOT_CLIENT_SECRET');
 | 
			
		||||
 | 
			
		||||
        $data = sprintf('grant_type=client_credentials&client_id=%s&client_secret=%s&scope=https://graph.microsoft.com/.default', $clientId, $clientSecret);
 | 
			
		||||
        $curl = curl_init();
 | 
			
		||||
 | 
			
		||||
        $opts = [
 | 
			
		||||
            CURLOPT_URL => MSBOT_LOGIN_URL,
 | 
			
		||||
            CURLOPT_RETURNTRANSFER => true,
 | 
			
		||||
            CURLOPT_POST => 'POST',
 | 
			
		||||
            CURLOPT_POSTFIELDS => $data,
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        curl_setopt_array($curl, $opts);
 | 
			
		||||
        $response = print_r(curl_exec($response));
 | 
			
		||||
        curl_close($curl);
 | 
			
		||||
 | 
			
		||||
        print_r($response);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -21,8 +21,9 @@ class Kernel extends ConsoleKernel
 | 
			
		||||
        'App\Console\Commands\SendRenewalInvoices',
 | 
			
		||||
        'App\Console\Commands\ChargeRenewalInvoices',
 | 
			
		||||
        'App\Console\Commands\SendReminders',
 | 
			
		||||
        'App\Console\Commands\TestOFX',
 | 
			
		||||
        'App\Console\Commands\GenerateResources',
 | 
			
		||||
        'App\Console\Commands\TestOFX',
 | 
			
		||||
        'App\Console\Commands\TestBot',
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 | 
			
		||||
@ -626,6 +626,7 @@ if (!defined('CONTACT_EMAIL')) {
 | 
			
		||||
    define('EMAIL_MARKUP_URL', env('EMAIL_MARKUP_URL', 'https://developers.google.com/gmail/markup'));
 | 
			
		||||
    define('OFX_HOME_URL', env('OFX_HOME_URL', 'http://www.ofxhome.com/index.php/home/directory/all'));
 | 
			
		||||
    define('GOOGLE_ANALYITCS_URL', env('GOOGLE_ANALYITCS_URL', 'https://www.google-analytics.com/collect'));
 | 
			
		||||
    define('MSBOT_LOGIN_URL', 'https://login.microsoftonline.com/common/oauth2/v2.0/token');
 | 
			
		||||
 | 
			
		||||
    define('BLANK_IMAGE', 'data:image/png;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 12 KiB  | 
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user