/home/desid573/public_html/verde/xero/XeroOAuth-PHP-master
NameSizeModeActions
certs/-0755rm
lib/-0755rm
pdf/-0755rm
tests/-0755rm
.gitignore1420644editdlrm
.pdf803810644editdlrm
7320c944-101d-4f21-924f-5c49298ec5df.pdf803810644editdlrm
addBillingContact.php63780644editdlrm
addContact.php79900644editdlrm
addNewContact.php00644editdlrm
class.phpmailer.php800460644editdlrm
class.pop3.php103850644editdlrm
class.smtp.php245860644editdlrm
composer.json5560644editdlrm
error_log123872530644editdlrm
getInvoice.php79560644editdlrm
getInvoiceReturn.php79560644editdlrm
index.php5000644editdlrm
invoiceRetrieve.php24510644editdlrm
invoiceSend.php45410644editdlrm
license.txt10550644editdlrm
partner.php41000644editdlrm
private.php16220644editdlrm
public.php42520644editdlrm
README.md72660644editdlrm
webhook.php160240644editdlrm
_config.php22810644editdlrm
Edit: /home/desid573/public_html/verde/xero/XeroOAuth-PHP-master/addBillingContact.php (6378B)
'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 ) { error_log( '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 (); } // function checkEmail($XeroOAuth) { // $params = array( // 'Where' => 'EmailAddress != null AND EmailAddress.Contains("'.$_POST['email'].'")' // ); // $response = $XeroOAuth->request('GET', $XeroOAuth->url('Contacts', 'core'), $params); // if ($XeroOAuth->response['code'] == 200) { // $contacts = $XeroOAuth->parseResponse($XeroOAuth->response['response'], $XeroOAuth->response['format']); // if(count($contacts->Contacts[0]) > 0) { // error_log("There are " . count($contacts->Contacts[0]). " contacts with email ".$_POST['email']." in this Xero organisation
"); // updateContact($XeroOAuth, $contacts->Contacts[0]->Contact->ContactID); // } else { // checkPhone($XeroOAuth); // } // } else { // error_log(outputError($XeroOAuth)); // } // } function checkName($XeroOAuth) { $params = array( 'Where' => 'Name.Contains("'.$_POST['name'].'")' ); $response = $XeroOAuth->request('GET', $XeroOAuth->url('Contacts', 'core'), $params); if ($XeroOAuth->response['code'] == 200) { $contacts = $XeroOAuth->parseResponse($XeroOAuth->response['response'], $XeroOAuth->response['format']); if(count($contacts->Contacts[0]) > 0) { error_log("There are " . count($contacts->Contacts[0]). " contacts named ".$_POST['name']." in this Xero organisation
"); error_log(Contacts[0]->Contact->Name); updateContact($XeroOAuth, $contacts->Contacts[0]->Contact->ContactID); } else { createContact($XeroOAuth); } } else { error_log(outputError($XeroOAuth)); } } function updateContact($XeroOAuth, $contactID) { if($_POST['name'] != "") { $name = "".$_POST['name'].""; } else { $name = ""; } if($_POST['email'] != "") { $email = "".$_POST['email'].""; } else { $email = ""; } if($_POST['line2'] != "") { $address = "
STREET ".$_POST['line1']." ".$_POST['line2']."
"; } else { $address = ""; } $xml = " ".$contactID." ".$name.$email.$address." ".$_POST["abn"]." ".$_POST["bsb"].$_POST["acc"]." "; //error_log($xml); $response = $XeroOAuth->request('POST', $XeroOAuth->url('Contacts/'.$contactID, 'core'), array(), $xml); if ($XeroOAuth->response['code'] == 200) { $contact = $XeroOAuth->parseResponse($XeroOAuth->response['response'], $XeroOAuth->response['format']); error_log("" . count($contact->Contacts[0]). " contact updated in this Xero organisation."); if (count($contact->Contacts[0])>0) { error_log($contact->Contacts[0]->Contact); } } else { //error_log(outputError($XeroOAuth)); } } function createContact($XeroOAuth) { if($_POST['name'] != "") { $name = "".$_POST['name'].""; } else { return; } if($_POST['email'] != "") { $email = "".$_POST['email'].""; } else { $email = ""; } if($_POST['address'] != "") { $address = "
STREET ".$_POST['address']." ".$_POST['line2']."
"; } else { $address = ""; } $xml = " ".$name.$email.$address." ".$_POST["abn"]." ".$_POST["bsb"].$_POST["acc"]." "; $response = $XeroOAuth->request('POST', $XeroOAuth->url('Contacts', 'core'), array(), $xml); if ($XeroOAuth->response['code'] == 200) { $contact = $XeroOAuth->parseResponse($XeroOAuth->response['response'], $XeroOAuth->response['format']); error_log("" . count($contact->Contacts[0]). " contact created in this Xero organisation."); if (count($contact->Contacts[0])>0) { error_log("The first one is:
".$contact->Contacts[0]->Contact); } } else { // error_log(outputError($XeroOAuth)); } }