Skip to content

Commit 5b521c7

Browse files
authored
Merge pull request #32 from FacturAPI/FAC-1254/feat/customer-edit-links
new customer model fields and query parameter support
2 parents 9226b9a + a473269 commit 5b521c7

File tree

7 files changed

+55
-14
lines changed

7 files changed

+55
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy to NuGet
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '7.0.x' # Adjust the .NET version as needed
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build
25+
run: dotnet build --configuration Release --no-restore
26+
27+
- name: Pack
28+
run: dotnet pack --configuration Release --no-build --output ./nupkg
29+
30+
- name: Publish to NuGet
31+
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ 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.7.0] = 2025-02-25
9+
10+
### Added
11+
12+
- Support sending query params to `Customers.CreateAsync` and `Customers.UpdateAsync` methods.
13+
- Added fields to `Customer` model: `SatValidatedAt`, `EditLink` and `EditLinkExpiresAt`.
14+
- Added targets for .NET 6.0 and .NET 7.0.
15+
816
## [4.6.0] - 2024-23-09
917

1018
### Added

Models/Customer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ public class Customer
1313
public string LegalName { get; set; }
1414
public string TaxId { get; set; }
1515
public string TaxSystem { get; set; }
16+
public DateTime SatValidatedAt { get; set; }
17+
public string EditLink { get; set; }
18+
public DateTime EditLinkExpiresAt { get; set; }
1619
}
1720
}

Router/CustomerRouter.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ public static string ListCustomers(Dictionary<string, object> query = null)
99
return UriWithQuery("customers", query);
1010
}
1111

12-
public static string RetrieveCustomer(string id)
12+
public static string RetrieveCustomer(string id, Dictionary<string, object> query = null)
1313
{
14-
return $"customers/{id}";
14+
return $"{UriWithQuery($"customers/{id}", query)}";
1515
}
1616

1717
public static string ValidateCustomerTaxInfo(string id)
1818
{
1919
return $"customers/{id}/tax-info-validation";
2020
}
2121

22-
public static string CreateCustomer()
22+
public static string CreateCustomer(Dictionary<string, object> query = null)
2323
{
24-
return "customers";
24+
return UriWithQuery("customers", query);
2525
}
2626

2727
public static string DeleteCustomer(string id)
2828
{
2929
return RetrieveCustomer(id);
3030
}
3131

32-
public static string UpdateCustomer(string id) {
33-
return RetrieveCustomer(id);
32+
public static string UpdateCustomer(string id, Dictionary<string, object> query = null) {
33+
return RetrieveCustomer(id, query);
3434
}
3535
}
3636
}

Wrappers/CustomerWrapper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public async Task<SearchResult<Customer>> ListAsync(Dictionary<string, object> q
3030
return searchResult;
3131
}
3232

33-
public async Task<Customer> CreateAsync(Dictionary<string, object> data)
33+
public async Task<Customer> CreateAsync(Dictionary<string, object> data, Dictionary<string, object> queryParams = null)
3434
{
35-
var response = await client.PostAsync(Router.CreateCustomer(), new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"));
35+
var response = await client.PostAsync(Router.CreateCustomer(queryParams), new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"));
3636
var resultString = await response.Content.ReadAsStringAsync();
3737
if (!response.IsSuccessStatusCode)
3838
{
@@ -69,9 +69,9 @@ public async Task<Customer> DeleteAsync(string id)
6969
return customer;
7070
}
7171

72-
public async Task<Customer> UpdateAsync(string id, Dictionary<string, object> data)
72+
public async Task<Customer> UpdateAsync(string id, Dictionary<string, object> data, Dictionary<string, object> queryParams = null)
7373
{
74-
var response = await client.PutAsync(Router.UpdateCustomer(id), new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"));
74+
var response = await client.PutAsync(Router.UpdateCustomer(id, queryParams), new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"));
7575
var resultString = await response.Content.ReadAsStringAsync();
7676
if (!response.IsSuccessStatusCode)
7777
{

facturapi-net.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net452</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0;net7.0;net452</TargetFrameworks>
55
<RootNamespace>Facturapi</RootNamespace>
66
<AssemblyName>Facturapi</AssemblyName>
77
<PackageId>Facturapi</PackageId>
@@ -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.6.0</Version>
14+
<Version>4.7.0</Version>
1515
<PackageVersion>$(Version)</PackageVersion>
1616
<Owners>Facturapi</Owners>
1717
<ApplicationIcon>facturapi.ico</ApplicationIcon>

facturapi-net.sln

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio Version 17
43
VisualStudioVersion = 17.8.34322.80
54
MinimumVisualStudioVersion = 10.0.40219.1

0 commit comments

Comments
 (0)