/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if (Config::get("customer_portal.paypal_enabled") !== true) {
$this->error("PayPal is not enabled in the customer portal configuration.");
return;
}
$apiContext = new ApiContext(new OAuthTokenCredential(Config::get("customer_portal.paypal_api_client_id"), Config::get("customer_portal.paypal_api_client_secret")));
$apiContext->setConfig(['mode' => 'live', 'log.LogEnabled' => true, 'log.FileName' => storage_path("logs/paypal.log"), 'log.LogLevel' => 'ERROR']);
try {
Webhook::getAll($apiContext);
} catch (Exception $e) {
$this->error("Credentials failed! Please make sure this is a LIVE account and not a SANDBOX account and try again.");
$this->error("Specific error was: {$e->getMessage()}");
return;
}
$this->info("Credentials tested successfully.");
}