/home/desid573/public_html/gcdriver/payment/xero
Edit: /home/desid573/public_html/gcdriver/payment/xero/invoiceRetrieve.php (2137B)
'51DABYIYXXBZDHAZTVAXBX6TU7T3AT',
'shared_secret' => 'RE390CCDJV1VD29SUZI9VBWTVUV7VF',
// API versions
'core_version' => '2.0',
'payroll_version' => '1.0',
'file_version' => '1.0'
);
if (XRO_APP_TYPE == "Private" || XRO_APP_TYPE == "Partner") {
$signatures ['rsa_private_key'] = BASE_PATH . '/certs/privatekey.pem';
$signatures ['rsa_public_key'] = BASE_PATH . '/certs/publickey.cer';
}
$XeroOAuth = new XeroOAuth ( array_merge ( array (
'application_type' => XRO_APP_TYPE,
'oauth_callback' => OAUTH_CALLBACK,
'user_agent' => $useragent
), $signatures ) );
include 'tests/testRunner.php';
$initialCheck = $XeroOAuth->diagnostics ();
$checkErrors = count ( $initialCheck );
if ($checkErrors > 0) {
// you could handle any config errors here, or keep on truckin if you like to live dangerously
foreach ( $initialCheck as $check ) {
echo 'Error: ' . $check . PHP_EOL;
}
} else {
$session = persistSession ( array (
'oauth_token' => $XeroOAuth->config ['consumer_key'],
'oauth_token_secret' => $XeroOAuth->config ['shared_secret'],
'oauth_session_handle' => ''
) );
$oauthSession = retrieveSession ();
if (isset ( $oauthSession ['oauth_token'] )) {
$XeroOAuth->config ['access_token'] = $oauthSession ['oauth_token'];
$XeroOAuth->config ['access_token_secret'] = $oauthSession ['oauth_token_secret'];
$params = array(
'Where' => 'reference="'.$_GET['ref'].'"',
);
$response = $XeroOAuth->request('GET', $XeroOAuth->url('Invoices', 'core'), $params);
if ($XeroOAuth->response['code'] == 200) {
$invoices = $XeroOAuth->parseResponse($XeroOAuth->response['response'], $XeroOAuth->response['format']);
if(count($invoices->Invoices[0]) > 0) {
echo $invoices->Invoices[0]->Invoice->InvoiceNumber[0];
} else {
echo "none";
}
} else {
}
}
}