Activation Set
Enable or configure tax communication for your account with the Portuguese Tax Authority (AT).
Operation
TaxCommunicationActivationSet
Request
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:mag="http://magnifinance.com/api/v2.1"
xmlns:auth="http://magnifinance.com/auth">
<soapenv:Header>
<auth:Credentials>
<auth:ClientId>your_client_id</auth:ClientId>
<auth:ClientSecret>your_client_secret</auth:ClientSecret>
</auth:Credentials>
</soapenv:Header>
<soapenv:Body>
<mag:TaxCommunicationActivationSet>
<mag:ActivationRequest>
<mag:Enabled>true</mag:Enabled>
<mag:ATUsername>your_at_username</mag:ATUsername>
<mag:ATPassword>your_at_password</mag:ATPassword>
<mag:AutoCommunicate>true</mag:AutoCommunicate>
</mag:ActivationRequest>
</mag:TaxCommunicationActivationSet>
</soapenv:Body>
</soapenv:Envelope>
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
Enabled | boolean | Yes | Enable or disable tax communication |
ATUsername | string | Yes | Username for the Portuguese Tax Authority web services |
ATPassword | string | Yes | Password for the Portuguese Tax Authority web services |
AutoCommunicate | boolean | No | Automatically communicate documents when created (default: false) |
Response
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<mag:TaxCommunicationActivationSetResponse xmlns:mag="http://magnifinance.com/api/v2.1">
<mag:Result>
<mag:Success>true</mag:Success>
<mag:Message>Tax communication has been successfully activated</mag:Message>
<mag:ActivationStatus>
<mag:Enabled>true</mag:Enabled>
<mag:ActivatedAt>2024-01-15T10:30:00Z</mag:ActivatedAt>
<mag:AutoCommunicate>true</mag:AutoCommunicate>
</mag:ActivationStatus>
</mag:Result>
</mag:TaxCommunicationActivationSetResponse>
</soapenv:Body>
</soapenv:Envelope>
Error Response
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Invalid AT credentials</faultstring>
<detail>
<mag:Error xmlns:mag="http://magnifinance.com/api/v2.1">
<mag:Code>AT_AUTH_FAILED</mag:Code>
<mag:Message>The provided AT credentials are invalid or expired</mag:Message>
</mag:Error>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Error Codes
| Code | Description |
|---|---|
AT_AUTH_FAILED | Invalid AT credentials |
ALREADY_ACTIVATED | Tax communication is already activated |
INVALID_NIF | Company NIF is not properly configured |
AT_SERVICE_UNAVAILABLE | AT web services are temporarily unavailable |
Example (C#)
using System.ServiceModel;
var binding = new BasicHttpsBinding();
var endpoint = new EndpointAddress("https://api.magnifinance.com/soap/v2.1/TaxCommunication");
var client = new TaxCommunicationClient(binding, endpoint);
var request = new TaxCommunicationActivationRequest
{
Enabled = true,
ATUsername = "your_at_username",
ATPassword = "your_at_password",
AutoCommunicate = true
};
var result = await client.TaxCommunicationActivationSetAsync(credentials, request);
if (result.Success)
{
Console.WriteLine($"Activated at: {result.ActivationStatus.ActivatedAt}");
}
Notes
- AT credentials can be obtained from the Portuguese Tax Authority portal (Portal das Financas)
- The AT password is encrypted during transmission and storage
- Enabling
AutoCommunicatewill automatically send documents to AT when they are finalized