+use Braango\braangoapi\BraangonumbersApi;
+use Braango\braangomodel as model;
+use Braango\braangomodel\RequestHeader as rhdr;
+require_once (__DIR__ . '/../../vendor/autoload.php');
+ * Sample code showing how to create subDealer
+// TEST auth token. Please contact
+// sales@braango.com to have one
+Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');
+$api_instance = new Braango\braangoapi\PersonnelsApi();
+// Braango\braangomodel\SubDealerRequestInput |
+$subDealerRequestInput = new \Braango\braangomodel\SubDealerRequestInput();
+$typeAdfCRMEmail = FALSE;
+ * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
+ * "account_type": "partner" }
+// Set the account type to partner for
+// virtual dealer and partner hosted
+$hdr->setAccountType("partner");
+// dealer_api_key returned
+// when partner_dealer was created
+$hdr->setApiKey("ISNMdzuNiKG7jhl9d9v");
+// ID that will be reflected back
+$hdr->setId("create-sub-dealer-s2002");
+$subDealerRequestInput->setHeader($hdr);
+// Subdealer request body
+$subDealerBody = new model\SubDealerBody();
+// Required field . Used for
+// SMS login in to the UI
+// For Braango Enterprise, this is don't care
+// unless partner implements UI with SMS login
+$subDealerBody->setSmsLogin(FALSE);
+$subDealerBody->setDealerName("test dealer s2002");
+// Create SubDealer creates full functional
+// braango personnel with added capability
+// Provide personnel name that is typical
+$subDealerBody->setPersonnelName("name of manager");
+ * This is a user name created while signing this personnel up.
+ * Typically this user name can be used to log into the braango UI.
+ * However for whitelabel product, it is expected that this will be used
+ * for single signon with respect to dealer account on partner system.
+ * i.e. it is expected that partner will pass on the same user name that
+ * dealer has on its system to give seamless integration experience.
+$subDealerBody->setUserName("subdealer2002r1");
+ * Password will be encrypted with SHA-25 and base64 encoded and stored
+ * internally within the braango system. pattern:
+ * ^(?=^.{6,10}$)(?=.*\d)(
+ * ?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()_+}{"
+ * ;:;'?/>.<,])(?!.*\s).*$
+ * Used for single sign on. needs to 6-10 characters with one capital,
+ * one numberal and one special character
+$subDealerBody->setPassword("test1T$");
+ * pattern: ^(?:Starter|Small Business|Rooftop|Franchise)$
+ * Every sub_dealer needs to have braango package
+$subDealerBody->setPackage("Small Business");
+// Required field. Indicates the
+// All internal resources, leads, personnel,
+// braango number are associated with this id
+// Needs to be unique within Braango system
+// Will return error if there is clash
+// Recommended to use unique naming convention
+$subDealerBody->setSubDealerId("subdealers2002");
+$subDealerBody->setEmail("s2002r1@subdealer2002.com");
+// If email specified is that for
+// CRM email (ADF XML compliant)
+$subDealerBody->setTypeAdfCrm($typeAdfCRMEmail);
+ * Number where dealer's root account can be reached via SMS
+ * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
+$subDealerBody->setPhoneNumber('4089763433');
+ * Number where dealer's root account can be reached via SMS
+ * pattern:^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$
+$subDealerBody->setSmsNumber('4089763433');
+// List of dealer banners. Braango will
+// randomly choose one when sending
+// message to dealer via SMS
+$subDealerBody->setDealerBanners($dealerBanners);
+// List of client banners. Braango
+// will randomly choose one when
+// sending dealer messages to client
+$subDealerBody->setClientBanners($clientBanners);
+// List of dealer footers. Braango will
+// randomly choose one when sending
+// message to dealer via SMS
+$subDealerBody->setDealerFooters($dealerFooters);
+// List of client footers. Braango
+// will randomly choose one when
+// sending dealer messages to client
+$subDealerBody->setClientFooters($clientFooters);
+// List of supervisor banners. Braango
+// will randomly choose one when
+// sending messages to supervisor
+$supervisorBanners = array(
+$subDealerBody->setSupervisorBanners($supervisorBanners);
+// List of supervisor footers. Braango
+// will randomly choose one when
+// sending messages to supervisor
+$supervisorFooters = array(
+$subDealerBody->setSupervisorFooters($supervisorFooters);
+// SubDealer's can create unique groups
+// that personnel can subscribe to
+$subDealerBody->setGroup('s2002g');
+$subDealerRequestInput->setBody($subDealerBody);
+ $result = $api_instance->createSubDealer($subDealerRequestInput);
+ // Extract out response hdr and bdy
+ $rspHdr = $result->getHeader();
+ if ($requestHdr = ! null) {
+ $rspId = $rspHdr->getId();
+ $braangoRequestId = $rspHdr->getIsnRequestId();
+ print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
+ $rspBdy = $result->getBody();
+ $status = $rspBdy->getStatus();
+ // Typically this value should be always SUCCESS else exception will be thrown
+ // Sometimes, this can be WARNING to indicate if any resource conflicted or not
+ // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
+ print_r("Status = " . $status . "\n");
+ $salesPersonId = $rspBdy->getData()->getSalesPersonId();
+ print_r("SUCCESS : SalespersonID = " . $salesPersonId);
+} catch (Exception $e) {
+ echo 'Exception when calling PersonnelsApi->createSubDealer: ', $e->getMessage(), PHP_EOL;