Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.3] - 2025-12-03

### Changed
- **BREAKING:** `DailyClosure` type structure completely rewritten to match actual Satispay API response
- Now returns `shop_daily_closure` and `device_daily_closure` objects
- Each closure includes: `id`, `type`, `customer_uid`, `gross_amount_unit`, `refund_amount_unit`, `amount_unit`, `currency`
- **BREAKING:** Removed non-existent fields from `DailyClosure` type:
- Removed `date` field (use `shop_daily_closure.id` instead)
- Removed `total_amount_unit` field (use `shop_daily_closure.amount_unit` instead)
- Removed `payments_count` field (not provided by Satispay API)
- `DailyClosure.get()` now accepts `Date` objects in addition to string dates (YYYYMMDD format)
- Updated documentation with correct API response structure and `Date` object usage examples

### Added
- `DailyClosureDetail` type for structured closure information
- `DateUtils.formatToYYYYMMDD()` utility function for date formatting
- Comprehensive E2E tests for daily closure functionality (5 test cases)
- Unit tests for `Date` object support in `DailyClosure.get()`
- Enhanced examples showing multiple ways to retrieve daily closures

### Fixed
- `DailyClosure` type now accurately reflects Satispay's actual API response
- Corrected documentation to match real API behavior verified through testing

## [0.0.2] - 2025-12-01

### Fixed
- add bin `satispay-keygen` to build configuration

## [0.0.1] - 2025-12-01

### Added
Expand Down Expand Up @@ -37,4 +66,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Example files for all major operations (payments, reports, sessions, webhooks, etc.)
- Runtime-specific examples for Node.js, Deno, and Bun

[0.0.3]: https://github.com/volverjs/zod-vue-i18n/compare/v0.0.2...v0.0.3
[0.0.2]: https://github.com/volverjs/zod-vue-i18n/compare/v0.0.1...v0.0.2
[0.0.1]: https://github.com/volverjs/satispay-node-sdk/releases/tag/v0.0.1
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,18 @@ import { DailyClosure } from '@volverjs/satispay-node-sdk';
// Today's closure
const closure = await DailyClosure.get();

// Specific date (YYYYMMDD format)
const closureByDate = await DailyClosure.get('20240115');
// Specific date using Date object (recommended)
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
const closureByDate = await DailyClosure.get(yesterday);

// Or using YYYYMMDD string format
const closureByString = await DailyClosure.get('20240115');

console.log('Date:', closure.date);
console.log('Total:', closure.total_amount_unit / 100, closure.currency);
console.log('Payments:', closure.payments_count);
console.log('Date:', closure.shop_daily_closure.id);
console.log('Total:', closure.shop_daily_closure.amount_unit / 100, closure.shop_daily_closure.currency);
console.log('Gross:', closure.shop_daily_closure.gross_amount_unit / 100);
console.log('Refunds:', closure.shop_daily_closure.refund_amount_unit / 100);
```

### Pre-Authorized Payment Tokens
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@
"devDependencies": {
"@eslint/js": "^9.39.1",
"@types/node": "^24.10.1",
"@vitest/coverage-v8": "^4.0.14",
"@vitest/ui": "^4.0.14",
"@vitest/coverage-v8": "^4.0.15",
"@vitest/ui": "^4.0.15",
"dotenv": "^17.2.3",
"eslint": "^9.39.1",
"eslint-plugin-vitest": "^0.5.4",
"prettier": "^3.7.3",
"prettier": "^3.7.4",
"typescript": "^5.9.3",
"typescript-eslint": "^8.48.0",
"typescript-eslint": "^8.48.1",
"vite": "^7.2.6",
"vite-plugin-dts": "^4.5.4",
"vitest": "^4.0.14"
"vitest": "^4.0.15"
}
}
Loading
Loading