Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7a31331
Release/1.0.21.1 (#104)
marifersw Dec 3, 2024
612ca48
Hotfix (SS-596): se ignoran warnings de javadoc
martinfnsw Feb 18, 2025
4c294aa
Hotfix (SS-596): se actualiza versión
martinfnsw Feb 18, 2025
6c08839
Merge pull request #105 from lunasoft/hotfix/SS-596-master
martinfnsw Feb 19, 2025
c1e735d
Se actualiza versión
FerCarrilloM Aug 13, 2025
4e83e31
Se agrega XSLT para sellado.
FerCarrilloM Aug 13, 2025
1e8a138
Se agrega método de Stamp Retention
FerCarrilloM Aug 13, 2025
89c5169
Se agregan UT.
FerCarrilloM Aug 13, 2025
70fdab2
Se agregan los xslt restantes
FerCarrilloM Aug 13, 2025
1a385ba
Se actualiza README
FerCarrilloM Aug 26, 2025
c915f10
Merge pull request #107 from lunasoft/bugfix/DEVOPS-721
SwAeyrton Aug 26, 2025
0763870
fix README
FerCarrilloM Aug 26, 2025
2836b0b
Se ajusta función de sellado
FerCarrilloM Aug 26, 2025
f3c3fd6
Merge remote-tracking branch 'origin/develop' into feature/retencione…
FerCarrilloM Aug 26, 2025
4a963f0
fix UT
FerCarrilloM Aug 26, 2025
24d0b4f
prueba de UT
FerCarrilloM Aug 26, 2025
5ef2d4e
ajuste UT
FerCarrilloM Aug 26, 2025
77c529c
Merge pull request #109 from lunasoft/feature/retencionesRest
FerCarrilloM Aug 27, 2025
da9cbb7
Feature(SS-858): Se agregan metodos de cancelación de retenciones
martinfnsw Aug 31, 2025
563f71b
Fix variables
martinfnsw Sep 1, 2025
b017d3c
Feature(SS-858): add readme
martinfnsw Sep 1, 2025
a87a535
Merge pull request #110 from lunasoft/feature/SS-858
martinfnsw Sep 1, 2025
4867426
Merge branch 'bugfix/DEVOPS-721' into develop
martinfnsw Sep 3, 2025
9f6ffd8
Feature(SS-838): Fix Sign retention
martinfnsw Sep 5, 2025
3af5e1c
Feature(SS-838): remove xslt
martinfnsw Sep 5, 2025
207a428
javadoc
martinfnsw Sep 5, 2025
62ea121
add UT 401
martinfnsw Sep 5, 2025
544a626
Merge pull request #114 from lunasoft/feature/SS-838
martinfnsw Sep 5, 2025
4e2f40a
Merge branch 'master' into release/1.0.24.1
martinfnsw Sep 5, 2025
3506a46
Merge pull request #115 from lunasoft/release/1.0.24.1
martinfnsw Sep 5, 2025
b3d348e
update nexusurl
alinerz01 Sep 5, 2025
a263217
Feature(SS-881): Se agrega obtener saldo por Id
martinfnsw Dec 5, 2025
48c07ce
Merge pull request #117 from lunasoft/feature/SS-881
martinfnsw Dec 12, 2025
4b3b745
Merge pull request #118 from lunasoft/release/1.0.25.1
martinfnsw Dec 15, 2025
54687dc
SMTRDEVOPS-721
Jan 13, 2026
5b1796c
Fix: Update CI to JDK 11 for Jakarta EE 9+ compatibility
Jan 13, 2026
9a3b0bd
Fix: Use setup-java server credentials for OSSRH auth
Jan 13, 2026
4d8890a
Migrate to Central Portal from deprecated OSSRH
Jan 13, 2026
5e9be53
Merge pull request #119 from lunasoft/master
SebastianSW Jan 13, 2026
2c6beca
Update LICENSE and Version
SebastianSW May 19, 2026
a8b005a
Merge pull request #120 from lunasoft/feature/UPDATE-LICENSE
SebastianSW May 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/publish-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to Maven Central

on:
push:
tags:
- 'release-*'

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
cache: maven
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Build and verify
run: mvn clean verify -DskipTests

- name: Publish to Maven Central
run: mvn deploy -Prelease -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
103 changes: 103 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

SW-JAVA is a Java SDK for consuming SW sapien® CFDI (Mexican electronic invoicing) services. It provides authentication, stamping (timbrado), cancellation, validation, and other tax document operations.

## Build Commands

```bash
# Build the project
mvn clean package

# Build with dependencies JAR
mvn clean package assembly:single

# Run all tests
mvn test

# Run a single test class
mvn test -Dtest=SWAuthenticationServiceTest

# Run a specific test method
mvn test -Dtest=SWAuthenticationServiceTest#testAuth

# Build for release (includes GPG signing)
mvn clean deploy -Prelease
```

## Test Environment Variables

Tests require the following environment variables:
- `SDKTEST_USER` - SW account username
- `SDKTEST_PASSWORD` - SW account password
- `SDKTEST_TOKEN` - SW authentication token

Test endpoints:
- Services URL: `https://services.test.sw.com.mx`
- API URL: `https://api.test.sw.com.mx`

## Architecture

### Service Layer (`Services/`)
All services extend the abstract `SWService` base class which handles:
- Authentication (user/password or token-based)
- Token auto-refresh based on expiration
- Proxy support
- TLS 1.2 enforcement

Key services:
- `SWAuthenticationService` - Token generation
- `SWStampService` / `SWStampServiceV2` / `SWStampServiceV4` - CFDI stamping
- `SWIssueService` / `SWIssueServiceV2` / `SWIssueServiceV4` - CFDI sealing and stamping
- `SWCancelationService` - Invoice cancellation
- `SWValidateService` - CFDI validation
- `SWBalanceAccountService` - Account balance queries
- `SWPdfService` - PDF generation from CFDI
- `SWStorageService` - Document storage operations

### Request/Response Pattern (`Utils/Requests/`, `Utils/Responses/`)
Each service has corresponding request and response classes:
- Request classes handle HTTP communication to SW APIs
- Response classes model the API responses with status, data, and error information
- Response versions (V1-V4) provide different levels of detail for stamping operations

### Response Versions for Stamping
| Version | Response Content |
|---------|------------------|
| V1 | Timbre fiscal digital (TFD) only |
| V2 | TFD + timbrado CFDI |
| V3 | Timbrado CFDI only |
| V4 | All stamping data |

### Exceptions (`Exceptions/`)
- `AuthException` - Authentication failures
- `GeneralException` - General API errors
- `ValidationException` - Input validation errors

### Helpers (`Utils/Helpers/`)
- `BuildResponseV1-V4` - Response builders for different stamp versions
- `RequestHelper` / `RequestZipHelper` - HTTP request utilities
- `Validations` - Input validation utilities

## CFDI Types Supported

Test resources in `src/test/resources/CFDI40/` show supported document types:
- Standard invoices (Ingreso)
- Payments (Pagos20)
- Payroll (Nomina12)
- Foreign trade (ComercioExterior11)
- Transportation (CartaPorte20)
- Retentions (Retenciones20)
- Donations (Donatarias11)
- Other complements (INE, Addenda, etc.)

## Dependencies

The SDK uses:
- Apache HttpClient 5 for HTTP operations
- org.json and Gson for JSON processing
- JUnit Jupiter 5 for testing
- External dependency `sw-resources-java` for CFDI cadena original generation
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Lunasoft®

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading