Skip to content

Commit 0217475

Browse files
authored
Merge pull request #13 from Sentia/feature/generate-token-promise-pay
Generate token
2 parents 7dd3a17 + 2f40f16 commit 0217475

File tree

11 files changed

+1853
-6
lines changed

11 files changed

+1853
-6
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
zai_payment (2.0.2)
4+
zai_payment (2.1.0)
55
base64 (~> 0.3.0)
66
faraday (~> 2.0)
77
openssl (~> 3.3)

changelog.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
## [Released]
2+
## [2.1.0] - 2025-10-24
3+
### Added
4+
- **Token Auth API**: Token generation for bank and card accounts 🔐
5+
- `ZaiPayment.token_auths.generate(user_id:, token_type:)` - Generate tokens for secure payment data collection
6+
- Support for bank tokens (collecting bank account information)
7+
- Support for card tokens (collecting credit card information)
8+
- Token type validation (bank or card)
9+
- User ID validation
10+
- Full RSpec test suite for TokenAuth resource
11+
- Comprehensive examples documentation in `examples/token_auths.md`
12+
13+
### Documentation
14+
- Added detailed TokenAuth API examples with complete integration patterns
15+
- Frontend integration examples (PromisePay.js)
16+
- Rails controller integration examples
17+
- Service object pattern examples
18+
- Error handling and retry logic examples
19+
- Security best practices (token expiry management, audit logging, rate limiting)
20+
- Complete payment flow example
21+
22+
### Testing
23+
- 20+ new test cases for TokenAuth resource
24+
- Validation error handling tested
25+
- Case-insensitive token type support tested
26+
- Default parameter behavior tested
27+
28+
**Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.0.2...v2.1.0
29+
230
## [2.0.2] - 2025-10-24
331
### Fixed
432
- **Items API**: Fixed endpoint configuration to use `core_base` instead of `va_base`

docs/readme.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
1414

1515
- [**architecture.md**](architecture.md) - System architecture and design principles
1616
- [**authentication.md**](authentication.md) - OAuth2 implementation, token management, two approaches
17+
- [**users.md**](users.md) - User management for payin (buyers) and payout (sellers/merchants)
18+
- [**items.md**](items.md) - Item management for transactions and payments
19+
- [**token_auths.md**](token_auths.md) - Token generation for secure bank and card data collection
1720
- [**webhooks.md**](webhooks.md) - Webhook implementation details, best practices, and patterns
1821

1922
## 🔐 Security Guides
@@ -23,6 +26,9 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
2326

2427
## 📝 Examples
2528

29+
- [**User Examples**](../examples/users.md) - User management examples and patterns
30+
- [**Item Examples**](../examples/items.md) - Transaction and payment workflows
31+
- [**Token Auth Examples**](../examples/token_auths.md) - Token generation and PromisePay.js integration
2632
- [**Webhook Examples**](../examples/webhooks.md) - Comprehensive webhook usage examples including:
2733
- Basic CRUD operations
2834
- Rails controller implementation
@@ -38,6 +44,21 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
3844
- **Short Way**: `ZaiPayment.token` (one-liner)
3945
- **Long Way**: `TokenProvider.new(config: config).bearer_token` (full control)
4046

47+
### Users
48+
- **Guide**: [User Management](users.md)
49+
- **Examples**: [User Examples](../examples/users.md)
50+
- **API Reference**: [Zai Users API](https://developer.hellozai.com/reference/getallusers)
51+
52+
### Items
53+
- **Guide**: [Item Management](items.md)
54+
- **Examples**: [Item Examples](../examples/items.md)
55+
- **API Reference**: [Zai Items API](https://developer.hellozai.com/reference/listitems)
56+
57+
### Token Auth
58+
- **Guide**: [Token Auth](token_auths.md)
59+
- **Examples**: [Token Auth Examples](../examples/token_auths.md)
60+
- **API Reference**: [Zai Generate Token API](https://developer.hellozai.com/reference/generatetoken)
61+
4162
### Webhooks
4263
- **Setup**: [Quick Start Guide](webhook_security_quickstart.md)
4364
- **Examples**: [Complete Examples](../examples/webhooks.md)
@@ -54,28 +75,37 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
5475
```
5576
docs/
5677
├── readme.md # This file - documentation index
57-
├── authentication.md # OAuth2 authentication guide (NEW!)
78+
├── authentication.md # OAuth2 authentication guide
79+
├── users.md # User management guide
80+
├── items.md # Item management guide
81+
├── token_auths.md # Token generation guide (NEW!)
5882
├── architecture.md # System architecture
5983
├── webhooks.md # Webhook technical docs
6084
├── webhook_security_quickstart.md # Quick security setup
6185
└── webhook_signature.md # Signature implementation
6286
6387
examples/
64-
└── webhooks.md # Complete webhook examples
88+
├── users.md # User management examples
89+
├── items.md # Item examples
90+
├── token_auths.md # Token auth examples (NEW!)
91+
└── webhooks.md # Webhook examples
6592
```
6693

6794
## 💡 Tips
6895

6996
- **Getting tokens?** Check [authentication.md](authentication.md) for both approaches
70-
- **Looking for code examples?** Check [examples/webhooks.md](../examples/webhooks.md)
97+
- **Managing users?** See [users.md](users.md) for payin and payout user guides
98+
- **Creating transactions?** Review [items.md](items.md) for item management
99+
- **Collecting payment data?** See [token_auths.md](token_auths.md) for secure token generation
100+
- **Looking for code examples?** Check the [examples](../examples/) directory
71101
- **Need quick setup?** See [webhook_security_quickstart.md](webhook_security_quickstart.md)
72102
- **Want to understand the design?** Read [architecture.md](architecture.md)
73103
- **Security details?** Review [webhook_signature.md](webhook_signature.md)
74104

75105
## 🆘 Need Help?
76106

77107
1. Check the relevant documentation section above
78-
2. Review the [examples](../examples/webhooks.md)
108+
2. Review the [examples](../examples/)
79109
3. Consult the [Zai API documentation](https://developer.hellozai.com/)
80110
4. Open an issue on GitHub
81111

0 commit comments

Comments
 (0)