Партнерская платформа Intuit — я использую PHP-книгу Consolibyte PHP Quickbooks. Я получаю сообщение об ошибке после подключения к QuickBooks, что-то пошло не так при получении токена пользователя

Я использую Consolibyte PHP Quickbooks подключиться. Я получаю сообщение об ошибке после подключения к QuickBooks:

что-то пошло не так при получении токена пользователя

Если я попробую снова, я получу ошибку:

ErrorException в строке IntuitAnywhere.php 468: неопределенный индекс:
oauth_token

Я использую это почти год без проблем. Вчера мы не смогли получить данные платежа от API. Я попытался отключиться и снова подключиться, и это начало происходить. Я не уверен, что делать. У нас есть настройка mcrypt, и мы используем php 7. Я также обновился до последней версии репозитория github, чтобы посмотреть, исправит ли это, но он все еще делает то же самое.

Спасибо за помощь!

Вот мой конфигурационный файл

          error_reporting(E_ALL);
ini_set('display_errors', 1);// Your application token (Intuit will give you this when you register an Intuit Anywhere app)
$token = env('TOKEN');

// Your OAuth consumer key and secret (Intuit will give you both of these when you register an Intuit app)
//
// IMPORTANT:
//  To pass your tech review with Intuit, you'll have to AES encrypt these and
//  store them somewhere safe.
//
// The OAuth request/access tokens will be encrypted and stored for you by the
//  PHP DevKit IntuitAnywhere classes automatically.
$oauth_consumer_key = env('KEY');
$oauth_consumer_secret = env('SECRET');

// If you're using DEVELOPMENT TOKENS, you MUST USE SANDBOX MODE!!!  If you're in PRODUCTION, then DO NOT use sandbox.
$sandbox = env('SANDBOX');     // When you're using development tokens
//  $sandbox = true;    // When you're using production tokens

// This is the URL of your OAuth auth handler page
$quickbooks_oauth_url = env('OAUTH');

// This is the URL to forward the user to after they have connected to IPP/IDS via OAuth
$quickbooks_success_url = env('SUCCESS');

// This is the menu URL script
$quickbooks_menu_url = env('MENU');

// This is a database connection string that will be used to store the OAuth credentials
// $dsn = 'pgsql://username:password@hostname/database';
// $dsn = 'mysql://username:password@hostname/database';
$dsn = 'mysqli://'.env('DB_USER').':'.env('DB_PASS').'@'. env('DB_HOST').'/'.env('DB');

// You should set this to an encryption key specific to your app
$encryption_key = env('ENCRYPT');

// Do not change this unless you really know what you're doing!!!  99% of apps will not require a change to this.
$the_username = 'DO_NOT_CHANGE_ME';

// The tenant that user is accessing within your own app
$the_tenant = 12345;

// Initialize the database tables for storing OAuth information
if (!\QuickBooks_Utilities::initialized($dsn)) {
// Initialize creates the neccessary database schema for queueing up requests and logging
\QuickBooks_Utilities::initialize($dsn);
}

// Instantiate our Intuit Anywhere auth handler
//
// The parameters passed to the constructor are:
//  $dsn
//  $oauth_consumer_key     Intuit will give this to you when you create a new Intuit Anywhere application at AppCenter.Intuit.com
//  $oauth_consumer_secret  Intuit will give this to you too
//  $this_url               This is the full URL (e.g. http://path/to/this/file.php) of THIS SCRIPT
//  $that_url               After the user authenticates, they will be forwarded to this URL
//
$IntuitAnywhere = new \QuickBooks_IPP_IntuitAnywhere($dsn, $encryption_key, $oauth_consumer_key, $oauth_consumer_secret, $quickbooks_oauth_url, $quickbooks_success_url);

// Are they connected to QuickBooks right now?
if ($IntuitAnywhere->check($the_username, $the_tenant) and
$IntuitAnywhere->test($the_username, $the_tenant)
) {
// Yes, they are
$quickbooks_is_connected = true;

// Set up the IPP instance
$IPP = new \QuickBooks_IPP($dsn);

// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);

// Tell the framework to load some data from the OAuth store
$IPP->authMode(
\QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds
);

if ($sandbox) {
// Turn on sandbox mode/URLs
$IPP->sandbox(true);
}

// Print the credentials we're using
//print_r($creds);

// This is our current realm
$realm = $creds['qb_realm'];

// Load the OAuth information from the database
$Context = $IPP->context();

// Get some company info
$CompanyInfoService = new \QuickBooks_IPP_Service_CompanyInfo();
$quickbooks_CompanyInfo = $CompanyInfoService->get($Context, $realm);

return [$realm, $Context];
} else {
// No, they are not
$quickbooks_is_connected = false;

return [$realm, $Context];
}
}

Вот мой файл подключения. Это шаблон лезвия, поэтому скрипт включен в мой нижний колонтитул:

    @extends('app')

@section('content')<?php if ($quickbooks_is_connected): ?>
<ipp:blueDot></ipp:blueDot>
<?php endif; ?>

<div>
<p>
QuickBooks connection status:

<?php if ($quickbooks_is_connected): ?>
<div style="border: 2px solid green; text-align: center; padding: 8px; color: green;">
CONNECTED!<br>
<br>

</div>

<table>
<tr>
<td>
<a href="disconnect">Disconnect from QuickBooks</a>
</td>
<td>
(If you do this, you'll have to go back through the authorization/connection process to get connected again)
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<a href="reconnect">Reconnect / refresh connection</a>
</td>
<td>
(QuickBooks connections expire after 6 months, so you have to this roughly every 5 and 1/2 months)
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<a href="diagnostics">Diagnostics about QuickBooks connection</a>
</td>
<td>
&nbsp;
</td>
</tr>
</table>

<?php else: ?>
<div style="border: 2px solid red; text-align: center; padding: 8px; color: red;">
<b>NOT</b> CONNECTED!<br>
<br>
<ipp:connectToIntuit></ipp:connectToIntuit>
<br>
<br>
You must authenticate to QuickBooks <b>once</b> before you can exchange data with it. <br>
<br>
<strong>You only have to do this once!</strong> <br><br>

After you've authenticated once, you never have to go
through this connection process again. <br>
Click the button above to
authenticate and connect.
</div>
<?php endif; ?>

</p>
</div>
@endsection
@section('scripts')
<script type="text/javascript" src="https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js"></script>
<script type="text/javascript">
intuit.ipp.anywhere.setup({
menuProxy: '<?php print($quickbooks_menu_url); ?>',
grantUrl: '<?php print($quickbooks_oauth_url); ?>'
});
</script>
@endsection

Я прошу прощения, если я не пишу правильно, я не задавал здесь никаких вопросов раньше.

Я запустил сценарии устранения неполадок, упомянутые Китом, вот вывод:

> Trying to hit URL: oauth.intuit.com/oauth/v1/get_request_token Did we disable SSL checks? false * Hostname was NOT found in DNS cache * Could not resolve host: oauth.intuit.com * Closing connection 67

Trying to hit URL: appcenter.intuit.com/api/v1/Connection/Reconnect Did we disable SSL checks? false * Hostname was NOT found in DNS cache * Could not resolve host: appcenter.intuit.com * Closing connection 68

Trying to hit URL: oauth.intuit.com/oauth/v1/get_request_token Did we disable SSL checks? true * Hostname was NOT found in DNS cache * Could not resolve host: oauth.intuit.com * Closing connection 69

Trying to hit URL: appcenter.intuit.com/api/v1/Connection/Reconnect Did we disable SSL checks? true * Hostname was NOT found in DNS cache * Could not resolve host: appcenter.intuit.com * Closing connection 70

php version: 7.0.1-4+deb.sury.org~trusty+1 mcrypt extension? true mcrypt module rijndael-256? NULL curl extension? true

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]