zai_payment 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/badges/coverage.json +1 -1
- data/changelog.md +36 -1
- data/docs/readme.md +55 -25
- data/docs/token_auths.md +523 -0
- data/docs/user_id_field.md +1 -1
- data/docs/users.md +3 -3
- data/examples/token_auths.md +687 -0
- data/lib/zai_payment/resources/token_auth.rb +75 -0
- data/lib/zai_payment/version.rb +1 -1
- data/lib/zai_payment.rb +7 -1
- data/readme.md +31 -0
- data/token_auth_implementation_summary.md +249 -0
- metadata +5 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 875d506340e0ebde15266915492626d10e454df4630a74fa17881cbc04b9e6fe
|
|
4
|
+
data.tar.gz: d0fae97dd2dc5d219f46af7ea61a04e0fcc74239b0860f3cfed251782c34086a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa334f191958e38c6e87846daac9fd33391a3e34ae0ebcca24395c501aac4b283c44fb059d6f24b70c5bd1f91f9a241abe668f81e66facfc194dfd10f66065e4
|
|
7
|
+
data.tar.gz: c81b7ceb54b8947859c62a49c98efba981e6ee0a8550e7c4bb810c23bd66aad06eece483db51d9d6cc9e1c0f05afb0e37fb1bacdadbb222fbd8dc59887e907c3
|
data/badges/coverage.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion": 1, "label": "coverage", "message": "95.
|
|
1
|
+
{"schemaVersion": 1, "label": "coverage", "message": "95.22%", "color": "brightgreen"}
|
data/changelog.md
CHANGED
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
## [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
|
+
|
|
30
|
+
## [2.0.2] - 2025-10-24
|
|
31
|
+
### Fixed
|
|
32
|
+
- **Items API**: Fixed endpoint configuration to use `core_base` instead of `va_base`
|
|
33
|
+
- Items resource now correctly uses the `https://test.api.promisepay.com` endpoint (prelive)
|
|
34
|
+
- Resolves CloudFront 403 error when creating items via POST requests
|
|
35
|
+
- Ensures Items API uses the same endpoint as Users API for consistency
|
|
36
|
+
|
|
2
37
|
## [2.0.1] - 2025-10-24
|
|
3
38
|
### Changes
|
|
4
|
-
- Updated markdown files
|
|
39
|
+
- Updated markdown files
|
|
5
40
|
|
|
6
41
|
## [2.0.0] - 2025-10-24
|
|
7
42
|
### Added
|
data/docs/readme.md
CHANGED
|
@@ -5,24 +5,30 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
|
|
|
5
5
|
## 📖 Getting Started
|
|
6
6
|
|
|
7
7
|
**New to the gem?** Start here:
|
|
8
|
-
1. [Main README](../
|
|
9
|
-
2. [Authentication Guide](
|
|
10
|
-
3. [Webhook Quick Start](
|
|
8
|
+
1. [Main README](../readme.md) - Installation and basic configuration
|
|
9
|
+
2. [Authentication Guide](authentication.md) - Get tokens with two approaches (short & long way)
|
|
10
|
+
3. [Webhook Quick Start](webhook_security_quickstart.md) - Set up secure webhooks in 5 minutes
|
|
11
11
|
4. [Webhook Examples](../examples/webhooks.md) - Complete usage examples
|
|
12
12
|
|
|
13
13
|
## 🏗️ Architecture & Design
|
|
14
14
|
|
|
15
|
-
- [**
|
|
16
|
-
- [**
|
|
17
|
-
- [**
|
|
15
|
+
- [**architecture.md**](architecture.md) - System architecture and design principles
|
|
16
|
+
- [**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
|
|
20
|
+
- [**webhooks.md**](webhooks.md) - Webhook implementation details, best practices, and patterns
|
|
18
21
|
|
|
19
22
|
## 🔐 Security Guides
|
|
20
23
|
|
|
21
|
-
- [**
|
|
22
|
-
- [**
|
|
24
|
+
- [**webhook_security_quickstart.md**](webhook_security_quickstart.md) - Quick 5-minute security setup guide
|
|
25
|
+
- [**webhook_signature.md**](webhook_signature.md) - Detailed signature verification implementation
|
|
23
26
|
|
|
24
27
|
## 📝 Examples
|
|
25
28
|
|
|
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
|
|
26
32
|
- [**Webhook Examples**](../examples/webhooks.md) - Comprehensive webhook usage examples including:
|
|
27
33
|
- Basic CRUD operations
|
|
28
34
|
- Rails controller implementation
|
|
@@ -34,15 +40,30 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
|
|
|
34
40
|
## 🔗 Quick Links
|
|
35
41
|
|
|
36
42
|
### Authentication
|
|
37
|
-
- **Getting Started**: [Authentication Guide](
|
|
43
|
+
- **Getting Started**: [Authentication Guide](authentication.md)
|
|
38
44
|
- **Short Way**: `ZaiPayment.token` (one-liner)
|
|
39
45
|
- **Long Way**: `TokenProvider.new(config: config).bearer_token` (full control)
|
|
40
46
|
|
|
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
|
+
|
|
41
62
|
### Webhooks
|
|
42
|
-
- **Setup**: [Quick Start Guide](
|
|
63
|
+
- **Setup**: [Quick Start Guide](webhook_security_quickstart.md)
|
|
43
64
|
- **Examples**: [Complete Examples](../examples/webhooks.md)
|
|
44
|
-
- **Details**: [Technical Documentation](
|
|
45
|
-
- **Security**: [Signature Verification](
|
|
65
|
+
- **Details**: [Technical Documentation](webhooks.md)
|
|
66
|
+
- **Security**: [Signature Verification](webhook_signature.md)
|
|
46
67
|
|
|
47
68
|
### External Resources
|
|
48
69
|
- [Zai Developer Portal](https://developer.hellozai.com/)
|
|
@@ -53,29 +74,38 @@ Welcome to the Zai Payment Ruby gem documentation. This guide will help you find
|
|
|
53
74
|
|
|
54
75
|
```
|
|
55
76
|
docs/
|
|
56
|
-
├──
|
|
57
|
-
├──
|
|
58
|
-
├──
|
|
59
|
-
├──
|
|
60
|
-
├──
|
|
61
|
-
|
|
77
|
+
├── readme.md # This file - documentation index
|
|
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!)
|
|
82
|
+
├── architecture.md # System architecture
|
|
83
|
+
├── webhooks.md # Webhook technical docs
|
|
84
|
+
├── webhook_security_quickstart.md # Quick security setup
|
|
85
|
+
└── webhook_signature.md # Signature implementation
|
|
62
86
|
|
|
63
87
|
examples/
|
|
64
|
-
|
|
88
|
+
├── users.md # User management examples
|
|
89
|
+
├── items.md # Item examples
|
|
90
|
+
├── token_auths.md # Token auth examples (NEW!)
|
|
91
|
+
└── webhooks.md # Webhook examples
|
|
65
92
|
```
|
|
66
93
|
|
|
67
94
|
## 💡 Tips
|
|
68
95
|
|
|
69
|
-
- **Getting tokens?** Check [
|
|
70
|
-
- **
|
|
71
|
-
- **
|
|
72
|
-
- **
|
|
73
|
-
- **
|
|
96
|
+
- **Getting tokens?** Check [authentication.md](authentication.md) for both approaches
|
|
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
|
|
101
|
+
- **Need quick setup?** See [webhook_security_quickstart.md](webhook_security_quickstart.md)
|
|
102
|
+
- **Want to understand the design?** Read [architecture.md](architecture.md)
|
|
103
|
+
- **Security details?** Review [webhook_signature.md](webhook_signature.md)
|
|
74
104
|
|
|
75
105
|
## 🆘 Need Help?
|
|
76
106
|
|
|
77
107
|
1. Check the relevant documentation section above
|
|
78
|
-
2. Review the [examples](../examples/
|
|
108
|
+
2. Review the [examples](../examples/)
|
|
79
109
|
3. Consult the [Zai API documentation](https://developer.hellozai.com/)
|
|
80
110
|
4. Open an issue on GitHub
|
|
81
111
|
|