/home/desid573/public_html/payment/xero
NameSizeModeActions
certs/-0755rm
lib/-0755rm
tests/-0755rm
.gitignore1420644editdlrm
.pdf803810644editdlrm
7320c944-101d-4f21-924f-5c49298ec5df.pdf803810644editdlrm
addContact.php79560644editdlrm
addNewContact.php00644editdlrm
class.phpmailer.php800460644editdlrm
class.pop3.php103850644editdlrm
class.smtp.php245860644editdlrm
composer.json5560644editdlrm
error_log10921950644editdlrm
getInvoice.php79560644editdlrm
getInvoiceReturn.php79560644editdlrm
index.php5000644editdlrm
invoiceRetrieve.php21370644editdlrm
invoiceSend.php104750644editdlrm
license.txt10550644editdlrm
partner.php41000644editdlrm
private.php16220644editdlrm
public.php42520644editdlrm
README.md72660644editdlrm
webhook.php16410644editdlrm
_config.php22810644editdlrm
Edit: /home/desid573/public_html/payment/xero/getInvoice.php (7956B)
'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']; if($_GET['email'] != "") { checkEmail($XeroOAuth); } else if($_GET['phone'] != "") { checkPhone($XeroOAuth); } else if($_GET['name'] != "") { checkName($XeroOAuth); } else { echo "error no data"; } } } function checkEmail($XeroOAuth) { $params = array( 'Where' => 'EmailAddress != null AND EmailAddress.Contains("'.$_GET['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 ".$_GET['email']." in this Xero organisation
"); updateContact($XeroOAuth, $contacts->Contacts[0]->Contact->ContactID); } else { checkPhone($XeroOAuth); } } else { error_log(outputError($XeroOAuth)); } } function checkPhone($XeroOAuth) { $params = array( 'Where' => 'Phones[1].PhoneNumber.Contains("'.substr($_GET['phone'], -9).'")' ); $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 phone number ".$_GET['phone']." in this Xero organisation
"); if($contacts->Contacts[0]->Contact->Name == $_GET['name']) { updateContact($XeroOAuth, $contacts->Contacts[0]->Contact->ContactID); } else { checkName($XeroOAuth); } } else { checkName($XeroOAuth); } } else { error_log(outputError($XeroOAuth)); } } function checkName($XeroOAuth) { $params = array( 'Where' => 'Name.Contains("'.$_GET['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 ".$_GET['name']." in this Xero organisation
"); updateContact($XeroOAuth, $contacts->Contacts[0]->Contact->ContactID); } else { createContact($XeroOAuth); } } else { error_log(outputError($XeroOAuth)); } } function updateContact($XeroOAuth, $contactID) { if($_GET['name'] != "") { $name = "".$_GET['name'].""; } else { $name = ""; } if($_GET['email'] != "") { $email = "".$_GET['email'].""; } else { $email = ""; } if($_GET['phone'] != "") { $phone = " DEFAULT ".$_GET['phone']." "; } else { $phone = ""; } if($_GET['address'] != "") { $address = "
STREET ".$_GET['address']."
"; } else { $address = ""; } $xml = " ".$name.$email.$phone.$address." "; $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 created/updated in this Xero organisation."); if (count($contact->Contacts[0])>0) { error_log($contact->Contacts[0]->Contact); echo "OK"; } } else { error_log(outputError($XeroOAuth)); echo "error"; } } function createContact($XeroOAuth) { if($_GET['name'] != "") { $name = "".$_GET['name'].""; } else { echo "No name"; return; } if($_GET['email'] != "") { $email = "".$_GET['email'].""; } else { $email = ""; } if($_GET['phone'] != "") { $phone = " DEFAULT ".$_GET['phone']." "; } else { $phone = ""; } if($_GET['address'] != "") { $address = "
STREET ".$_GET['address']."
"; } else { $address = ""; } $xml = " ".$name.$email.$phone.$address." "; $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/updated in this Xero organisation."); if (count($contact->Contacts[0])>0) { error_log("The first one is:
".$contact->Contacts[0]->Contact); echo "OK"; } } else { error_log(outputError($XeroOAuth)); echo "error"; } }