/** * Send request to PB API to register new merchant * * @return void */ protected function doActionRequestCredentials() { $data = array('name' => array('humanName' => 'Name', 'value' => \XLite\Core\Request::getInstance()->name), 'company' => array('humanName' => 'Company name', 'value' => \XLite\Core\Request::getInstance()->company), 'email' => array('humanName' => 'Email', 'value' => \XLite\Core\Request::getInstance()->email), 'phone' => array('humanName' => 'Phone number', 'value' => \XLite\Core\Request::getInstance()->phone), 'businessAddress' => array('humanName' => 'Business Address', 'value' => \XLite\Core\Request::getInstance()->businessAddress), 'siteUrl' => array('humanName' => 'Site URL', 'value' => \XLite\Core\Request::getInstance()->siteUrl), 'xcartVersion' => array('humanName' => 'Current X-Cart Version', 'value' => \XLite::getInstance()->getVersion())); $errors = array(); $errors['customer'] = \XLite\Core\Mailer::sendCredentialsRequestNotificationToCustomer($data); $errors['pitneybowes'] = \XLite\Core\Mailer::sendCredentialsRequestToPB($data); $requestSucceed = false; if (false === $errors['customer'] || false === $errors['pitneybowes']) { \XLite\Core\TopMessage::getInstance()->addError(static::t('Something went wrong.')); } else { \XLite\Core\TopMessage::getInstance()->addInfo(static::t('Your request has been successfully submitted for PB International Shipping. The PB team will be reaching out to you shortly with your credentials. Please check you emails. Thank you and speak soon.')); $requestSucceed = true; } \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->createOption(array('category' => $this->getOptionsCategory(), 'name' => 'credentials_requested', 'value' => $requestSucceed)); $this->setReturnURL(\XLite\Core\Converter::buildURL($this->getTarget())); }