Skip to content

Commit

Permalink
Merge pull request #4 from Potelo/0.9.3
Browse files Browse the repository at this point in the history
Fix folders names and fix code pattern
  • Loading branch information
jprodrigues70 authored Jan 21, 2021
2 parents 40836e4 + dbd85a9 commit f5d3f7b
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 30 deletions.
13 changes: 8 additions & 5 deletions src/MySoapClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
* Remove algumas tags para adequar a comunicação
* ao padrão Windows utilizado
*/
class MySoapClient extends \SoapClient {
class MySoapClient extends \SoapClient
{

public $soapRequest;
public function __doRequest($request, $location, $action, $version, $one_way = 0) {

public function __doRequest($request, $location, $action, $version, $one_way = 0)
{

$request = str_replace('xmlns:ns2="<anyXML>"', '', $request);
$request = str_replace(':ns1', '', $request);
Expand All @@ -27,7 +30,8 @@ public function __doRequest($request, $location, $action, $version, $one_way = 0
return (parent::__doRequest($request, $location, $action, $version));
}

function sanitizeOutput($buffer) {
function sanitizeOutput($buffer)
{

$search = array(
'/\>[^\S ]+/s', // strip whitespaces after tags, except space
Expand All @@ -47,5 +51,4 @@ function sanitizeOutput($buffer) {

return $buffer;
}

} //fim da classe NFSeSOAPClient
}
3 changes: 1 addition & 2 deletions src/NfseSsa.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,4 @@ public function consultarNfse($dados)

return $result;
}

}
}
7 changes: 4 additions & 3 deletions src/NfseSsaServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class NfseSsaServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->publishes([ __DIR__ . '/config/nfse-ssa.php' => config_path('nfse-ssa.php')]);
$this->publishes([__DIR__ . '/config/nfse-ssa.php' => config_path('nfse-ssa.php')]);

$this->loadViewsFrom(__DIR__.'/templates', 'nfse-ssa');
$this->loadViewsFrom(__DIR__ . '/templates', 'nfse-ssa');
}

/**
Expand All @@ -26,7 +26,8 @@ public function boot()
public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/config/nfse-ssa.php', 'nfse-ssa'
__DIR__ . '/config/nfse-ssa.php',
'nfse-ssa'
);
}
}
2 changes: 1 addition & 1 deletion src/request/Error.php → src/Request/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class Error
* @var
*/
public $correcao;
}
}
3 changes: 1 addition & 2 deletions src/request/Response.php → src/Request/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,4 @@ public function setData($data)
{
$this->data = $data;
}

}
}
2 changes: 1 addition & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public function setStatus($status)
{
$this->status = $status;
}
}
}
24 changes: 14 additions & 10 deletions src/services/RequestService.php → src/Services/RequestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public function __construct()
'cache_wsdl' => WSDL_CACHE_NONE,
'stream_context' => $context
];

}

/**
Expand All @@ -62,7 +61,8 @@ public function __construct()
* @param $return
* @return Response
*/
private function consult($wsdlSuffix, $xml, $method, $return){
private function consult($wsdlSuffix, $xml, $method, $return)
{
$wsdl = $this->urlBase . $wsdlSuffix;

$client = new MySoapClient($wsdl, $this->soapOptions);
Expand All @@ -88,12 +88,11 @@ private function consult($wsdlSuffix, $xml, $method, $return){
$error->correcao = $arr['Correcao'];
$response->addError($error);
}

} else {
$response->setStatus(true);

$json = json_encode($xmlObj);
$data = json_decode($json,true);
$data = json_decode($json, true);

$response->setData($data);
}
Expand Down Expand Up @@ -132,7 +131,8 @@ public function enviarLoteRps($xml)
$wsdlSuffix,
$finalXml,
'EnviarLoteRPS',
'EnviarLoteRPSResult');
'EnviarLoteRPSResult'
);

return $response;
}
Expand All @@ -151,7 +151,8 @@ public function consultarSituacaoLoteRps($xml)
$wsdlSuffix,
$finalXml,
'ConsultarSituacaoLoteRPS',
'ConsultarSituacaoLoteRPSResult');
'ConsultarSituacaoLoteRPSResult'
);

return $response;
}
Expand All @@ -170,7 +171,8 @@ public function consultarLoteRps($xml)
$wsdlSuffix,
$finalXml,
'ConsultarLoteRPS',
'ConsultarLoteRPSResult');
'ConsultarLoteRPSResult'
);

return $response;
}
Expand All @@ -189,7 +191,8 @@ public function consultarNfseRps($xml)
$wsdlSuffix,
$finalXml,
'ConsultarNfseRPS',
'ConsultarNfseRPSResult');
'ConsultarNfseRPSResult'
);

return $response;
}
Expand All @@ -204,8 +207,9 @@ public function consultarNfse($xml)
$wsdlSuffix,
$finalXml,
'ConsultarNfse',
'ConsultarNfseResult');
'ConsultarNfseResult'
);

return $response;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct()
* @return string
* @throws \Exception
*/
public function signXml($xml, $signRoot=true, $tags=[])
public function signXml($xml, $signRoot = true, $tags = [])
{
// Load the XML to be signed
$doc = new \DOMDocument();
Expand All @@ -57,7 +57,7 @@ public function signXml($xml, $signRoot=true, $tags=[])
);

// Create a new (private) Security key
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type'=>'private'));
$objKey = new XMLSecurityKey(XMLSecurityKey::RSA_SHA1, array('type' => 'private'));

// Load the private key
$objKey->loadKey($this->certificatePrivate, TRUE);
Expand All @@ -83,7 +83,5 @@ public function signXml($xml, $signRoot=true, $tags=[])

// The signed XML
return $doc->saveXML();


}
}
}
2 changes: 1 addition & 1 deletion src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ function array_xml_get($array, $key)

return null;
}
}
}

0 comments on commit f5d3f7b

Please sign in to comment.