Skip to content

Commit a007492

Browse files
authored
Merge pull request #35 from FacturAPI/FAC-1383/feat/update-self-invoice-settings
Add method to update self-invoice settings
2 parents 5f57ca0 + 25038aa commit a007492

File tree

6 files changed

+35
-2
lines changed

6 files changed

+35
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.9.0] - 2025-06-16
9+
10+
### Added
11+
12+
- Add `Organizations.UpdateSelfInvoiceSettingsAsync` method to update self invoice settings.
13+
814
## [4.8.0] - 2025-04-22
915

1016
### Added

Models/Organization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public class Organization
1111
public List<CompletionStep> PendingSteps { get; set; }
1212
public Legal Legal { get; set; }
1313
public Customization Customization { get; set; }
14+
public SelfInvoiceSettings SelfInvoice { get; set; }
1415
public Certificate Certificate { get; set; }
15-
1616
public List<LiveApiKey> ApiKeys { get; set; }
1717
}
1818
}

Models/SelfInvoiceSettings.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Facturapi
2+
{
3+
public class SelfInvoiceSettings
4+
{
5+
public string[] AllowedCfdiUses { get; set; }
6+
public bool ApplyResicoIsr { get; set; }
7+
public string SupportEmail { get; set; }
8+
public bool SupportEmailVerified { get; set; }
9+
}
10+
}

Router/OrganizationRouter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,9 @@ public static string DeleteSeriesGroup (string id, string series_name)
9696
return $"{RetrieveOrganization(id)}/series-group/{series_name}";
9797
}
9898

99+
public static string UpdateSelfInvoiceSettings(string organizationId)
100+
{
101+
return $"{RetrieveOrganization(organizationId)}/self-invoice";
102+
}
99103
}
100104
}

Wrappers/OrganizationWrapper.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,5 +258,18 @@ public async Task<List<LiveApiKey>> DeleteLiveApiKeyAsync(string id, string apiK
258258
var deserializeJson = JsonConvert.DeserializeObject<List<LiveApiKey>>(resultString, this.jsonSettings);
259259
return deserializeJson;
260260
}
261+
262+
public async Task<Organization> UpdateSelfInvoiceSettingsAsync(string organizationId, Dictionary<string, object> data)
263+
{
264+
var response = await client.PutAsync(Router.UpdateSelfInvoiceSettings(organizationId), new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"));
265+
var resultString = await response.Content.ReadAsStringAsync();
266+
if (!response.IsSuccessStatusCode)
267+
{
268+
var error = JsonConvert.DeserializeObject<JObject>(resultString);
269+
throw new FacturapiException(error["message"].ToString());
270+
}
271+
var organization = JsonConvert.DeserializeObject<Organization>(resultString, this.jsonSettings);
272+
return organization;
273+
}
261274
}
262275
}

facturapi-net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
API Keys creando una cuenta gratuita en https://www.facturapi.io</Summary>
1212
<PackageTags>factura factura-electronica cfdi facturapi mexico conekta</PackageTags>
1313
<Title>Facturapi</Title>
14-
<Version>4.8.0</Version>
14+
<Version>4.9.0</Version>
1515
<PackageVersion>$(Version)</PackageVersion>
1616
<Owners>Facturapi</Owners>
1717
<ApplicationIcon>facturapi.ico</ApplicationIcon>

0 commit comments

Comments
 (0)