-
Notifications
You must be signed in to change notification settings - Fork 261
Usage by example: Accounting\Contact
phena109 edited this page May 8, 2018
·
1 revision
$contact = new \XeroPHP\Models\Accounting\Contact();
$contact
->setContactNumber($user_id)
->setFirstName($detail['fname'])
->setLastName($detail['lname'])
->setEmailAddress($detail['email'])
->setTaxNumber($detail['business_no'])
->addAddress(
(new Address())
->setAddressLine1($detail['address'])
->setCity($detail['city'])
->setRegion($detail['state'])
->setPostalCode($detail['postcode'])
->setCountry($detail['country'])
)->addPhone(
(new Phone())
->setPhoneType(Phone::PHONE_TYPE_DEFAULT)
->setPhoneNumber($detail['phone'])
)->addPhone(
(new Phone())
->setPhoneType(Phone::PHONE_TYPE_MOBILE)
->setPhoneNumber($detail['mobile'])
)->setName($ContactName);
$contact->setApplication($app);
$contact->save();
Note: ContactName is unique across the whole application, although Xero suggested not to use it as identifier. Having duplicated ContactName will get you error.