Skip to content

Commit 6c2d0d0

Browse files
authored
Merge pull request #2 from FiscalAPI/feat/AddLadingComplementSupport
Added lading support
2 parents 3318e52 + 3148963 commit 6c2d0d0

30 files changed

Lines changed: 9805 additions & 21 deletions

.claude/settings.local.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"permissions": {
3+
"defaultMode": "bypassPermissions"
4+
}
5+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ build/
3535
.vscode/
3636

3737
### Mac OS ###
38-
.DS_Store
38+
.DS_Store
39+
.fake

CLAUDE.md

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,36 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
Official Java SDK for FiscalAPI - a Mexican CFDI electronic invoicing service (SAT integration). Provides CFDI 4.0 invoicing, certificate management, mass downloads, payroll, and SAT catalog queries.
7+
Official Java SDK for FiscalAPI - a Mexican CFDI electronic invoicing service (SAT integration). Provides CFDI 4.0 invoicing, certificate management, mass downloads, payroll, and SAT catalog queries. Published to Maven Central as `com.fiscalapi:fiscalapi`.
88

99
## Build Commands
1010

1111
```bash
1212
mvn clean compile # Compile
13-
mvn test # Run tests
1413
mvn package # Create JAR
15-
mvn clean deploy -Prelease # Deploy to Maven Central (requires GPG)
14+
mvn clean deploy -Prelease # Deploy to Maven Central (requires GPG + settings.xml credentials)
1615
```
1716

17+
No unit tests exist in this project currently. No linting or formatting tools are configured.
18+
1819
## Architecture
1920

2021
### Entry Point
21-
`FiscalApiClient.create(FiscalApiSettings)` - Factory method creating the main client with all services.
22+
`FiscalApiClient.create(FiscalApiSettings)` - Factory method creating the main client with all 10 services.
2223

2324
### Service Layer Pattern
2425
```
2526
IFiscalApiClient (facade)
26-
├── getInvoiceService() → IInvoiceService extends IFiscalApiService<Invoice>
27-
├── getPersonService() → IPersonService extends IFiscalApiService<Person>
28-
├── getProductService() → IProductService extends IFiscalApiService<Product>
29-
├── getTaxFileService() → ITaxFileService extends IFiscalApiService<TaxFile>
30-
├── getCatalogService() → ICatalogService extends IFiscalApiService<CatalogDto>
31-
└── ... (other services)
27+
├── getInvoiceService() → IInvoiceService (cancel, status, getPdf, send, getXml)
28+
├── getPersonService() → IPersonService
29+
├── getProductService() → IProductService
30+
├── getTaxFileService() → ITaxFileService (getDefaultReferences, getDefaultValues)
31+
├── getCatalogService() → ICatalogService (custom search/query)
32+
├── getApiKeyService() → IApiKeyService
33+
├── getStampService() → IStampService (transfer, withdraw)
34+
├── getDownloadCatalogService() → IDownloadCatalogService
35+
├── getDownloadRuleService() → IDownloadRuleService
36+
└── getDownloadRequestService() → IDownloadRequestService (cancel, retry, delete)
3237
```
3338

3439
### Generic CRUD Base
@@ -43,20 +48,39 @@ Subclasses must implement `getTypeParameterClass()` to return the entity type fo
4348

4449
### DTO Hierarchy
4550
```
46-
SerializableDto → AuditableDto (createdAt, updatedAt) → BaseDto (id)
51+
SerializableDto (toString() returns pretty-printed JSON)
52+
→ AuditableDto (createdAt, updatedAt: LocalDateTime)
53+
→ BaseDto (id: String)
4754
```
4855
All models extend `BaseDto`. Responses wrapped in `ApiResponse<T>`.
4956

5057
### HTTP Layer
51-
- `OkHttpClientFactory` - Creates/caches OkHttpClient instances with auth headers (X-API-KEY, X-TENANT-KEY, X-API-VERSION, X-TIMEZONE)
52-
- `FiscalApiHttpClient` - Wraps OkHttp with Jackson, handles request/response logging in debug mode
58+
- `OkHttpClientFactory` - Creates/caches OkHttpClient instances with auth headers (X-API-KEY, X-TENANT-KEY, X-API-VERSION, X-TIMEZONE). Default timezone: America/Mexico_City.
59+
- `FiscalApiHttpClient` - Wraps OkHttp with Jackson. ObjectMapper configured with:
60+
- `JavaTimeModule` (LocalDateTime/ZonedDateTime support)
61+
- `FAIL_ON_UNKNOWN_PROPERTIES = false`
62+
- `WRITE_BIGDECIMAL_AS_PLAIN = true`
63+
- Non-null serialization inclusion
64+
- Custom `BigDecimalSerializer` in `serialization/` (avoids scientific notation)
5365

5466
### Key Packages
55-
- `abstractions/` - Service interfaces
56-
- `common/` - ApiResponse, PagedList, settings
67+
- `abstractions/` - Service interfaces (all prefixed with `I`)
68+
- `common/` - ApiResponse, PagedList, FiscalApiSettings, BaseDto hierarchy
5769
- `http/` - HTTP client implementation
58-
- `models/` - All DTOs (invoicing/, downloading/ subpackages)
70+
- `models/` - All DTOs
71+
- `models/invoicing/` - Invoice, InvoiceItem, InvoiceIssuer, InvoiceRecipient, etc.
72+
- `models/invoicing/payroll/` - 13 payroll CFDI types (Payroll, EmployeeData, PayrollEarning, etc.)
73+
- `models/invoicing/paymentComplement/` - Payment complement models
74+
- `models/invoicing/localTaxes/` - Local tax models
75+
- `models/downloading/` - Mass download models
5976
- `services/` - Service implementations
77+
- `serialization/` - Custom Jackson serializers
78+
- `examples/` - Usage examples (payroll, local taxes, stamps)
79+
80+
### Two Modes of Operation
81+
The SDK supports two invoicing modes (see examples/):
82+
- **By references** - Pass entity IDs, server resolves full data
83+
- **By values** - Pass complete entity data inline
6084

6185
## Configuration
6286

@@ -65,18 +89,26 @@ FiscalApiSettings settings = new FiscalApiSettings();
6589
settings.setApiUrl("https://test.fiscalapi.com"); // or https://live.fiscalapi.com
6690
settings.setApiKey("sk_test_...");
6791
settings.setTenant("...");
68-
settings.setDebugMode(true); // Logs requests/responses
92+
settings.setDebugMode(true); // Logs requests/responses to console
93+
// settings.setApiVersion("v4"); // default
94+
// settings.setTimeZone("America/Mexico_City"); // default
6995
FiscalApiClient client = FiscalApiClient.create(settings);
7096
```
7197

98+
Spring Boot integration: Use `@Value` properties + `@Bean` registration (see README.md for full pattern).
99+
72100
## API Endpoint Pattern
73101

74102
`{apiUrl}/api/{apiVersion}/{resource}/{id?}/{action?}`
75103

76104
Example: `POST api/v4/invoices`, `GET api/v4/invoices/{id}?details=true`
77105

106+
## Deployment
107+
108+
GitHub Actions workflow (`.github/workflows/deploy.yml`): manual dispatch, builds with Java 8 Temurin, signs with GPG, deploys to Maven Central.
109+
78110
## Dependencies
79111

80112
- OkHttp3 4.12.0 (HTTP)
81-
- Jackson 2.14.2 (JSON)
113+
- Jackson 2.14.2 + JSR310 module (JSON + Java 8 time)
82114
- Java 8+ (source/target)

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<!-- Coordenadas del proyecto -->
88
<groupId>com.fiscalapi</groupId>
99
<artifactId>fiscalapi</artifactId>
10-
<version>4.0.360</version>
10+
<version>4.0.384</version>
1111
<name>${project.groupId}:${project.artifactId}</name>
1212
<description>Genera facturas CFDI válidas ante el SAT consumiendo la API de https://www.fiscalapi.com</description>
1313
<url>https://www.fiscalapi.com</url>

0 commit comments

Comments
 (0)