|
7 | 7 |
|
8 | 8 | namespace LibreCodeCoop\NfsePHP\Http; |
9 | 9 |
|
| 10 | +use LibreCodeCoop\NfsePHP\Config\CertConfig; |
| 11 | +use LibreCodeCoop\NfsePHP\Config\EnvironmentConfig; |
10 | 12 | use LibreCodeCoop\NfsePHP\Contracts\NfseClientInterface; |
11 | 13 | use LibreCodeCoop\NfsePHP\Contracts\SecretStoreInterface; |
12 | 14 | use LibreCodeCoop\NfsePHP\Contracts\XmlSignerInterface; |
|
25 | 27 | * |
26 | 28 | * Communicates with the SEFIN gateway to issue, query, and cancel NFS-e. |
27 | 29 | * All requests carry a signed DPS XML payload. |
28 | | - * |
29 | | - * Gateway sandbox base URL: https://hml.nfse.fazenda.gov.br/NFS-e/api/v1 |
30 | | - * Gateway production base URL: https://nfse.fazenda.gov.br/NFS-e/api/v1 |
31 | 30 | */ |
32 | 31 | class NfseClient implements NfseClientInterface |
33 | 32 | { |
34 | | - private const BASE_URL_PROD = 'https://nfse.fazenda.gov.br/NFS-e/api/v1'; |
35 | | - private const BASE_URL_SANDBOX = 'https://hml.nfse.fazenda.gov.br/NFS-e/api/v1'; |
36 | | - |
37 | 33 | private readonly string $baseUrl; |
38 | 34 | private readonly XmlSignerInterface $signer; |
39 | 35 |
|
40 | 36 | public function __construct( |
| 37 | + private readonly EnvironmentConfig $environment, |
| 38 | + private readonly CertConfig $cert, |
41 | 39 | private readonly SecretStoreInterface $secretStore, |
42 | | - private readonly bool $sandboxMode = false, |
43 | | - ?string $baseUrlOverride = null, |
44 | 40 | ?XmlSignerInterface $signer = null, |
45 | 41 | ) { |
46 | | - $this->baseUrl = $baseUrlOverride ?? ($sandboxMode ? self::BASE_URL_SANDBOX : self::BASE_URL_PROD); |
| 42 | + $this->baseUrl = $environment->baseUrl; |
47 | 43 | $this->signer = $signer ?? new DpsSigner($secretStore); |
48 | 44 | } |
49 | 45 |
|
|
0 commit comments