Пример #1
0
 /**
  * @covers Nash\Client\Services\ClienteService::create
  */
 public function testCreate()
 {
     $cliente = $this->getCliente();
     $result = $this->object->create($cliente);
     $this->assertEquals(Result::SUCCESS, $result->getStatus());
     $this->assertNotNull($result->getModel());
     $this->assertGreaterThan(0, $result->getModel()->Id);
     return $result->getModel();
 }
Пример #2
0
<?php

require_once '../bootstrap.php';
$config = (require '../config.php');
$config = $config[$config['running']];
$servicePath = $config['servicePath'];
$authenticationPath = $config['authenticationPath'];
$session = new NashEarlySession($authenticationPath, $servicePath);
$service = new ClienteService($session);
$empresaService = new EmpresaService($session);
$session->login($config);
//var_dump($session);
$empresas = $empresaService->getEmpresasSelecionaveis(1, 0);
$empresaService->selecionaEmpresa($empresas[0]->getId());
$cliente = getCliente($session);
$result = $service->create($cliente);
print_r($result->getStatus());
print_r($result->getModel());
function getMunicipio($session1)
{
    $service1 = new MunicipioService($session1);
    $result1 = $service1->retrieve(1, 0);
    $municipio = $result1->getModel()->Data[0];
    return $municipio;
}
function getCliente($session2)
{
    $cliente = new Cliente();
    $cliente->setNomeFantasia("Nome do Cliente");
    $cliente->setRazaoSocial("Nome do Cliente");
    $cliente->setCPFCNPJ("00000000000000");
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     return $this->service->create($request->all());
 }