Skip to content

Conversation

@alessandrobellesia
Copy link
Member

@alessandrobellesia alessandrobellesia commented Dec 1, 2025

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced Satispay GBusiness Node.js SDK with multi-runtime support (Node.js 18+, Deno, Bun)
    • Added APIs for payments, consumers, daily closures, pre-authorized tokens, reports, and POS sessions
    • Included CLI tool for credential generation and key management
    • Provided comprehensive examples for common workflows and edge cases
  • Documentation

    • Added detailed README with usage examples and API reference
    • Included CHANGELOG documenting v0.0.1 release
    • Added MIT License
  • Chores

    • Set up build pipeline with GitHub Actions CI/CD
    • Configured ESLint, Prettier, and testing infrastructure

✏️ Tip: You can customize this high-level summary in your review settings.

Alessandro Bellesia and others added 6 commits November 18, 2025 22:59
feat: add vitest
feat: add more examples
feat: add CHANGELOG
Major features:
- Add Report API for payment/fee report generation (CSV, PDF, XLSX)
- Add Session API for POS integration with fund lock payments
- Extend Payment API with meal voucher and fringe benefits parameters
- Support euro-to-cent amount conversion in Payment.create() and Payment.update()
- Accept Date objects in Payment.all() for starting_after_timestamp parameter

API classes:
- Report: create(), all(), get() for merchant-level reports
- Session: open(), get(), update(), createEvent() for POS sessions
- Enhanced Payment types with meal_voucher_max_amount_unit and meal_voucher_max_quantity

TypeScript:
- Add ReportType, ReportFormatType, ReportStatus types
- Add SessionStatus, SessionEventType types
- Extend PaymentCreateBody and PaymentUpdateBody with meal voucher support
- Make amount/amount_unit mutually exclusive in payment types

Testing:
- Add 23 new unit tests for Report and Session classes (163 total passing)
- Add E2E test suite for staging environment integration testing
- Add setup helper functions for E2E test configuration
- Improve test coverage with edge cases and error handling

Documentation:
- Update CHANGELOG.md with comprehensive feature list
- Add examples for reports (reports.ts) and POS sessions (pos-session.ts)
- Update README with Reports, Sessions, and Meal Voucher sections

Fixes:
- Change Environment type from 'test' to 'staging' for consistency
- Fix Payment.all() return type from 'list' to 'data' (API compliance)
- Add proper SSL verification disable for staging environment
@coderabbitai
Copy link

coderabbitai bot commented Dec 1, 2025

Walkthrough

This PR establishes the complete initial release (v0.0.1) of the Satispay GBusiness Node.js SDK, including core API clients (Payment, Consumer, Report, Session, etc.), RSA-based request signing, token-based authentication, comprehensive utilities, TypeScript definitions, 163+ unit/E2E tests, CLI tooling, build/test infrastructure, and detailed documentation.

Changes

Cohort / File(s) Summary
Configuration & Build Tools
.env.example, .prettierrc, .gitignore, .npmignore, eslint.config.js, package.json, tsconfig.json, vite.config.ts, vitest.config.ts, deno.json, pnpm-workspace.yaml, .vscode/settings.json
Environment example, code formatting/linting rules, package metadata, TypeScript compiler/Deno/Vite/Vitest configurations, editor settings, and workspace configuration. Establishes ESLint-centric formatting, TypeScript strict mode, and multi-runtime support (Node.js 18+, Deno, Bun).
CI/CD Pipelines
.github/workflows/{build,test,main,pr-check-suite,release-tag,sonarcloud}.yml
Six GitHub Actions workflows: build (pnpm build/pack), test (Vitest with coverage/Codecov), main (orchestrates analysis/build/test/publish-npm/publish-gpr on releases), pr-check-suite (PR validation with analysis/build/test), release-tag (creates releases from git tags), and sonarcloud (SonarCloud code analysis).
Documentation & Licensing
README.md, CHANGELOG.md, LICENSE
Complete README with amount handling (euros/cents), authentication workflow, API examples, Reports/Sessions/POS features, and advanced use cases. Changelog for v0.0.1 initial release. MIT License.
Core API Clients
src/{Api,ApiAuthentication,Payment,Consumer,DailyClosure,PreAuthorizedPaymentToken,Report,Session}.ts
Eight public API classes: Api (configuration/environment/sandbox management), ApiAuthentication (credential container), Payment (CRUD + amount conversion), Consumer (phone-based lookup), DailyClosure (daily settlement), PreAuthorizedPaymentToken (token management), Report (report creation/listing), Session (POS session lifecycle).
HTTP & Cryptography
src/Request.ts, src/RSAService/{RSAService,RSAServiceCrypto,RSAServiceFactory}.ts
Request class with multi-environment HTTP client, RSA-SHA256 request signing, platform/plugin headers, and error handling. RSAService abstract contract, RSAServiceCrypto for Node.js crypto operations, and RSAServiceFactory singleton.
Types & Utilities
src/types.ts, src/utils.ts
Comprehensive TypeScript types (40+ interfaces/unions) for requests, responses, enums, and query parameters. Utility namespaces: Amount (euros↔cents), DateUtils (formatting/parsing), Validation (external code/flow/currency/phone/metadata), CodeGenerator (external code generation), PaymentStatusUtils (status checks/labels).
Public API & CLI
src/index.ts, src/bin/satispay-keygen.ts
Centralized export surface re-exporting all API classes, utilities, and types. CLI tool for RSA key generation from activation tokens with sandbox/production environment support.
Example Scripts
examples/{auth-with-token,create-payment*,error-handling-retry,get-*,payment-*,pos-session,reports,using-utilities,webhook-handler}.ts
Fourteen example files demonstrating authentication, payment creation/retrieval/listing/filtering, retry logic, consumer/daily-closure/report operations, POS sessions with item management, utilities (amount/date/validation/code-gen), and webhook handling.
Unit Tests
tests/{Api,ApiAuthentication,Consumer,DailyClosure,Payment,PreAuthorizedPaymentToken,RSAService*,Report,Request,Session,utils}.test.ts, tests/setup.ts
Test suite with mocked Request layer, covering configuration, key/header management, CRUD operations, amount conversion, signing, error handling, utility functions, and E2E helpers. Setup module loads .env.local and conditionally enables E2E test mode.
E2E Tests
tests/e2e/{authentication,payment}.e2e.test.ts
Two E2E test suites (guarded by environment) validating authentication key configuration, API environment enforcement, payment creation/retrieval/listing/updates/filtering, and real interactions on staging.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Api
    participant Request
    participant RSAService as RSAServiceFactory
    participant Crypto as RSA Crypto
    participant HttpClient as Fetch

    Note over Client,HttpClient: Initialization: Token-Based Authentication
    Client->>Api: authenticateWithToken(token)
    Api->>RSAService: RSAServiceFactory.get()
    RSAService->>Crypto: generateKeys()
    Crypto-->>RSAService: {privateKey, publicKey}
    RSAService-->>Api: RSAService instance
    Api->>Crypto: RSA keys generated
    Api->>Request: POST /authentication_keys<br/>(publicKey, token)
    Request->>HttpClient: POST with headers
    HttpClient-->>Request: {privateKey, keyId}
    Request-->>Api: authentication response
    Api->>Api: Store keys + keyId<br/>Return ApiAuthentication

    Note over Client,HttpClient: Signed Request: Payment Creation
    Client->>Request: Payment.create({amount, flow})
    Request->>Request: Build request payload
    Request->>Request: signRequest()
    Request->>Crypto: sign(privateKey, message)
    Crypto-->>Request: signature (Buffer)
    Request->>Request: Assemble Authorization header<br/>(date, digest, signature)
    Request->>HttpClient: POST /payments<br/>with Authorization
    HttpClient-->>Request: {id, amount_unit, status}
    Request-->>Client: PaymentResponse
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

  • Api.ts & Request.ts: Dense logic for RSA signing, multi-environment request handling, and complex header construction; requires careful review of cryptographic operations and request lifecycle.
  • types.ts: Large number of interdependent type definitions (40+ interfaces/unions) with conditional/exclusive fields; requires validation of mutual exclusivity patterns and optional/required field correctness.
  • Payment.ts & other API classes: Consistent patterns across eight resource clients; verify amount↔amount_unit conversion logic, query serialization, and date handling edge cases.
  • Test coverage: 163 tests across unit and E2E; verify mock setup, assertion correctness, and edge case coverage for amount conversion and error scenarios.
  • CLI & Examples: satispay-keygen CLI and 14 example files; review for consistency, error handling, and documentation accuracy.
  • CI/CD workflows: Six distinct workflows orchestrating build, test, publish, and release steps; verify job dependencies, credential/token usage, and conditional logic.

Poem

🐰 A garden of cryptography springs to life,
Keys dancing in RSA's light without strife,
Payments flowing through Request's swift stream,
Where Consumer and Session join the dream—
From token to signature, SDK complete! ✨


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 0f66281 and 162d85a.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (66)
  • .env.example (1 hunks)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/main.yml (1 hunks)
  • .github/workflows/pr-check-suite.yml (1 hunks)
  • .github/workflows/release-tag.yml (1 hunks)
  • .github/workflows/sonarcloud.yml (1 hunks)
  • .github/workflows/test.yml (1 hunks)
  • .gitignore (1 hunks)
  • .npmignore (1 hunks)
  • .prettierrc (1 hunks)
  • .vscode/settings.json (1 hunks)
  • CHANGELOG.md (1 hunks)
  • LICENSE (1 hunks)
  • README.md (7 hunks)
  • deno.json (1 hunks)
  • eslint.config.js (1 hunks)
  • examples/auth-with-token.ts (1 hunks)
  • examples/create-payment-with-amount.ts (1 hunks)
  • examples/create-payment.ts (1 hunks)
  • examples/error-handling-retry.ts (1 hunks)
  • examples/get-consumer.ts (1 hunks)
  • examples/get-daily-closure.ts (1 hunks)
  • examples/get-payment.ts (1 hunks)
  • examples/get-payments.ts (1 hunks)
  • examples/payment-date-filtering.ts (1 hunks)
  • examples/payment-monitoring.ts (1 hunks)
  • examples/pos-session.ts (1 hunks)
  • examples/reports.ts (1 hunks)
  • examples/using-utilities.ts (1 hunks)
  • examples/webhook-handler.ts (1 hunks)
  • package.json (1 hunks)
  • pnpm-workspace.yaml (1 hunks)
  • src/Api.ts (1 hunks)
  • src/ApiAuthentication.ts (1 hunks)
  • src/Consumer.ts (1 hunks)
  • src/DailyClosure.ts (1 hunks)
  • src/Payment.ts (1 hunks)
  • src/PreAuthorizedPaymentToken.ts (1 hunks)
  • src/RSAService/RSAService.ts (1 hunks)
  • src/RSAService/RSAServiceCrypto.ts (1 hunks)
  • src/RSAService/RSAServiceFactory.ts (1 hunks)
  • src/Report.ts (1 hunks)
  • src/Request.ts (1 hunks)
  • src/Session.ts (1 hunks)
  • src/bin/satispay-keygen.ts (1 hunks)
  • src/index.ts (1 hunks)
  • src/types.ts (1 hunks)
  • src/utils.ts (1 hunks)
  • tests/Api.test.ts (1 hunks)
  • tests/ApiAuthentication.test.ts (1 hunks)
  • tests/Consumer.test.ts (1 hunks)
  • tests/DailyClosure.test.ts (1 hunks)
  • tests/Payment.test.ts (1 hunks)
  • tests/PreAuthorizedPaymentToken.test.ts (1 hunks)
  • tests/RSAServiceCrypto.test.ts (1 hunks)
  • tests/RSAServiceFactory.test.ts (1 hunks)
  • tests/Report.test.ts (1 hunks)
  • tests/Request.test.ts (1 hunks)
  • tests/Session.test.ts (1 hunks)
  • tests/e2e/authentication.e2e.test.ts (1 hunks)
  • tests/e2e/payment.e2e.test.ts (1 hunks)
  • tests/setup.ts (1 hunks)
  • tests/utils.test.ts (1 hunks)
  • tsconfig.json (1 hunks)
  • vite.config.ts (1 hunks)
  • vitest.config.ts (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@alessandrobellesia alessandrobellesia merged commit 04e1d6b into main Dec 1, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants