Ejemplo n.º 1
0
function libCorpSavePessoa($ctPessoaSave, $userCredential = NULL)
{
    try {
        Registry::factory()->setCredential($userCredential);
        $voPessoa = PessoaValueObject::factory()->loadData($ctPessoaSave);
        PessoaBusiness::factory(NULL, 'libcorp')->save($voPessoa);
        return sprintf(XML_RESULT, 'success', '00000', $voPessoa->toXml());
    } catch (\Exception $excp) {
        return sprintf(XML_RESULT, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
function libCorpSaveCadastroSemCPF($addCadastroSemCPF, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voCadastroSemCPF = CadastroSemCPFValueObject::factory()->loadData($addCadastroSemCPF);
        $voCadastroSemCPF = CadastroSemCPFBusiness::factory()->save($voCadastroSemCPF);
        return sprintf($xmlResult, 'success', '00000', $voCadastroSemCPF->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
Ejemplo n.º 3
0
function libCorpUpdateDocumento($updDocumento, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voDocumento = DocumentoValueObject::factory()->loadData($updDocumento);
        $voDocumento = DocumentoBusiness::factory()->updateDocumento($voDocumento);
        return sprintf($xmlResult, 'success', '00000', $voDocumento->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
Ejemplo n.º 4
0
function libCorpDeleteTelefone($delTelefone, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voTelefone = TelefoneValueObject::factory()->loadData($delTelefone);
        $voTelefone = TelefoneBusiness::factory()->deleteTelefone($voTelefone);
        return sprintf($xmlResult, 'success', '00000', 'Registro Excluido com Sucesso');
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
function libCorpSaveVinculoSistemico($sVinculoSistemico, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voVinculoSistemico = VinculoSistemicoValueObject::factory()->loadData($sVinculoSistemico);
        VinculoSistemicoBusiness::factory(NULL, 'libcorp')->save($voVinculoSistemico);
        return sprintf($xmlResult, 'success', '00000', $voVinculoSistemico->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
function libCorpSaveIntegracaoPessoaInfoconv($integracaoPessoaInfoconv, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voIntegracaoPI = IntegracaoPessoaInfoconvValueObject::factory()->loadData($integracaoPessoaInfoconv);
        $voIntegracaoPI = IntegracaoPessoaInfoconvBusiness::factory()->save($voIntegracaoPI);
        return sprintf($xmlResult, 'success', '00000', $voIntegracaoPI->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
function libCorpUpdatePessoaJuridica($ctPessoaJuridicaUpdate, $userCredential = NULL)
{
    Registry::factory()->setCredential($userCredential);
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        $voPessoa = PessoaValueObject::factory()->loadData($ctPessoaJuridicaUpdate);
        $voPessoaJuridica = PessoaJuridicaValueObject::factory()->loadData($ctPessoaJuridicaUpdate);
        $voPessoaJuridica = PessoaJuridicaBusiness::factory()->updatePessoaJuridica($voPessoa, $voPessoaJuridica);
        return sprintf($xmlResult, 'success', '00000', $voPessoaJuridica->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
function libCorpSavePessoaFisica($ctPessoaFisicaSave, $userCredential = NULL)
{
    Registry::factory()->setCredential($userCredential);
    $lcCorpPFTemplateMessage = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        $voPessoa = PessoaValueObject::factory()->loadData($ctPessoaFisicaSave);
        $voPessoaFisica = PessoaFisicaValueObject::factory()->loadData($ctPessoaFisicaSave);
        $voPessoaFisica = PessoaFisicaBusiness::factory(NULL, 'libcorp')->savePessoaFisica($voPessoa, $voPessoaFisica);
        return sprintf($lcCorpPFTemplateMessage, 'success', '00000', $voPessoaFisica->toXml());
    } catch (\Exception $excp) {
        return sprintf($lcCorpPFTemplateMessage, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
function libCorpSavePessoaJuridica($ctSavePessoaJuridica, $userCredential = NULL)
{
    Registry::factory()->setCredential($userCredential);
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        if (!isset($ctSavePessoaJuridica['inTipoEstabelecimento'])) {
            $ctSavePessoaJuridica['inTipoEstabelecimento'] = TRUE;
        }
        $voPessoa = PessoaValueObject::factory()->loadData($ctSavePessoaJuridica);
        $voPessoaJuridica = PessoaJuridicaValueObject::factory()->loadData($ctSavePessoaJuridica);
        $voPessoaJuridica = PessoaJuridicaBusiness::factory(NULL, 'libcorp')->savePessoaJuridica($voPessoa, $voPessoaJuridica);
        return sprintf($xmlResult, 'success', '00000', $voPessoaJuridica->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
Ejemplo n.º 10
0
/**
 * libCorpInfoconvByCpf
 * @param type $params
 * @param type $userCredential
 * @return json
 */
function libCorpInfoconvByCpf($ctInfoconvByCPF, $userCredential)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $nuDoc = isset($ctInfoconvByCPF['doc']) ? $ctInfoconvByCPF['doc'] : NULL;
        $nuCpf = isset($ctInfoconvByCPF['cpf']) ? $ctInfoconvByCPF['cpf'] : $nuDoc;
        BusinessException::throwsExceptionIfParamIsNull(!empty($nuCpf), "O campo CPF é de preenchimento obrigatório.");
        $voInfoconv = ConfirmDocValueObject::factory()->setDoc($nuCpf);
        $result = ConfirmDocBusiness::factory(NULL, 'libcorp')->sourceCpf($voInfoconv);
        foreach ($result as $key => $value) {
            unset($result[$key]);
            $newKey = preg_replace('/\\s/i', '_', strtolower($key));
            $result[$newKey] = $value;
        }
        return sprintf($xmlResult, 'success', '00000', Registry::factory()->arrayToXml($result));
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
Ejemplo n.º 11
0
/**
 *
 * @param type $params
 * @param type $userCredential
 * @return json
 */
function libCorpInfoconvByCnpj($ctInfoconvByCNPJ, $userCredential)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $nuDoc = isset($ctInfoconvByCPF['doc']) ? $ctInfoconvByCPF['doc'] : NULL;
        $nuCnpj = isset($ctInfoconvByCNPJ['cnpj']) ? $ctInfoconvByCNPJ['cnpj'] : $nuDoc;
        $voInfoconv = SearchCnpjValueObject::factory()->setDoc($nuCnpj);
        $result = ConfirmDocBusiness::factory(NULL, 'libcorp')->sourceCnpj($voInfoconv);
        foreach ($result as $key => $value) {
            unset($result[$key]);
            $newKey = preg_replace('/\\s/i', '_', strtolower($key));
            $result[$newKey] = $value;
        }
        return sprintf($xmlResult, 'success', '00000', Registry::factory()->arrayToXml($result));
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
    die;
}