zai_payment 1.3.2 → 2.0.1
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/.yardopts +1 -1
- data/badges/coverage.json +1 -1
- data/{CHANGELOG.md → changelog.md} +57 -12
- data/{CONTRIBUTING.md → contributing.md} +6 -6
- data/docs/{AUTHENTICATION.md → authentication.md} +2 -2
- data/docs/items.md +666 -0
- data/docs/{USER_QUICK_REFERENCE.md → user_quick_reference.md} +6 -6
- data/docs/{WEBHOOK_SECURITY_QUICKSTART.md → webhook_security_quickstart.md} +1 -1
- data/docs/{WEBHOOK_SIGNATURE.md → webhook_signature.md} +2 -2
- data/examples/items.md +598 -0
- data/examples/users.md +69 -50
- data/{IMPLEMENTATION.md → implementation.md} +10 -10
- data/{IMPLEMENTATION_SUMMARY.md → implementation_summary.md} +4 -4
- data/lib/zai_payment/resources/item.rb +363 -0
- data/lib/zai_payment/resources/user.rb +61 -23
- data/lib/zai_payment/response.rb +6 -1
- data/lib/zai_payment/version.rb +1 -1
- data/lib/zai_payment.rb +6 -0
- data/{README.md → readme.md} +65 -19
- metadata +22 -19
- /data/{CODE_OF_CONDUCT.md → code_of_conduct.md} +0 -0
- /data/docs/{ARCHITECTURE.md → architecture.md} +0 -0
- /data/docs/{README.md → readme.md} +0 -0
- /data/docs/{USER_ID_FIELD.md → user_id_field.md} +0 -0
- /data/docs/{USERS.md → users.md} +0 -0
- /data/docs/{WEBHOOKS.md → webhooks.md} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3f50f91d34afe9dcce310026974f08678796243aef8a5b13acbb2436895d87e
|
|
4
|
+
data.tar.gz: 1c30ea6419a504eeba75b5387525d703f7fad2e82d7dc9882d6a79537ea51a78
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12dd73742c4fc6682635e563636ea5a3e6c5fe18a1b22b7acb5911959ef5172bd7ffcb81e4ceab283304200a4eafa43e9f1a52ed3528f070ada636879ac96dbf
|
|
7
|
+
data.tar.gz: 03e9ef546c66eab48234e130ef02481e1e0074538a41d433bf86a3f48ad432660c0ce85b10731da1fe00ec9e7b686f7e808a1cf453a886e386c1eec9728a5706
|
data/.yardopts
CHANGED
data/badges/coverage.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion": 1, "label": "coverage", "message": "
|
|
1
|
+
{"schemaVersion": 1, "label": "coverage", "message": "95.19%", "color": "brightgreen"}
|
|
@@ -1,4 +1,49 @@
|
|
|
1
1
|
## [Released]
|
|
2
|
+
## [2.0.1] - 2025-10-24
|
|
3
|
+
### Changes
|
|
4
|
+
- Updated markdown files
|
|
5
|
+
|
|
6
|
+
## [2.0.0] - 2025-10-24
|
|
7
|
+
### Added
|
|
8
|
+
- **Items Management API**: Full CRUD operations for managing Zai items (transactions/payments) 🛒
|
|
9
|
+
- `ZaiPayment.items.list(limit:, offset:)` - List all items with pagination
|
|
10
|
+
- `ZaiPayment.items.show(item_id)` - Get item details by ID
|
|
11
|
+
- `ZaiPayment.items.create(**attributes)` - Create new item/transaction
|
|
12
|
+
- `ZaiPayment.items.update(item_id, **attributes)` - Update item information
|
|
13
|
+
- `ZaiPayment.items.delete(item_id)` - Delete an item
|
|
14
|
+
- `ZaiPayment.items.show_seller(item_id)` - Get seller details for an item
|
|
15
|
+
- `ZaiPayment.items.show_buyer(item_id)` - Get buyer details for an item
|
|
16
|
+
- `ZaiPayment.items.show_fees(item_id)` - Get fees associated with an item
|
|
17
|
+
- `ZaiPayment.items.show_wire_details(item_id)` - Get wire transfer details for an item
|
|
18
|
+
- `ZaiPayment.items.list_transactions(item_id, limit:, offset:)` - List transactions for an item
|
|
19
|
+
- `ZaiPayment.items.list_batch_transactions(item_id, limit:, offset:)` - List batch transactions for an item
|
|
20
|
+
- `ZaiPayment.items.show_status(item_id)` - Get current status of an item
|
|
21
|
+
- Comprehensive validation for item attributes (name, amount, payment_type, buyer_id, seller_id)
|
|
22
|
+
- Support for optional item fields (description, currency, fee_ids, custom_descriptor, deposit_reference, etc.)
|
|
23
|
+
- Full RSpec test suite for Items resource with 100% coverage
|
|
24
|
+
- Comprehensive examples documentation in `examples/items.md`
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- **User Management Enhancement**: Updated user creation validation to support user type-specific required fields
|
|
28
|
+
- `user_type` parameter now determines which fields are required during user creation
|
|
29
|
+
- Payin users require: `email`, `first_name`, `last_name`, `country`
|
|
30
|
+
- Payout users require additional fields: `address_line1`, `city`, `state`, `zip`, `dob`
|
|
31
|
+
- Company validation now enforces required fields based on user type
|
|
32
|
+
- For payout companies, additional fields required: `address_line1`, `city`, `state`, `zip`, `phone`, `country`
|
|
33
|
+
- All companies require: `name`, `legal_name`, `tax_number`, `business_email`, `country`
|
|
34
|
+
- **Clarified device_id and ip_address requirements**: These fields are NOT required when creating a payin user, but become required when creating an item and charging a card
|
|
35
|
+
- Refactored company validation logic for better maintainability and reduced cyclomatic complexity
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
- Added detailed Items API examples with complete workflow demonstrations
|
|
39
|
+
- Payment types documentation (1-7: Direct Debit, Credit Card, Bank Transfer, Wallet, BPay, PayPal, Other)
|
|
40
|
+
- Error handling examples for Items operations
|
|
41
|
+
- Updated User Management documentation (`docs/users.md`) with correct required fields for each user type
|
|
42
|
+
- Updated all user examples in `examples/users.md` to reflect proper user type usage
|
|
43
|
+
- Added clear notes about when `device_id` and `ip_address` are required
|
|
44
|
+
- Updated company field requirements in all documentation
|
|
45
|
+
|
|
46
|
+
**Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.3.2...v2.0.0
|
|
2
47
|
|
|
3
48
|
## [1.3.2] - 2025-10-23
|
|
4
49
|
### Added
|
|
@@ -6,7 +51,7 @@
|
|
|
6
51
|
- Added `yard` gem as development dependency for API documentation
|
|
7
52
|
|
|
8
53
|
### Fixed
|
|
9
|
-
- Fixed YARD link resolution warning in
|
|
54
|
+
- Fixed YARD link resolution warning in readme.md by converting markdown link to HTML format
|
|
10
55
|
|
|
11
56
|
### Documentation
|
|
12
57
|
- Configured YARD to generate comprehensive API documentation
|
|
@@ -32,7 +77,7 @@
|
|
|
32
77
|
- Comprehensive validation for all user types
|
|
33
78
|
- Email format validation
|
|
34
79
|
- Country code validation (ISO 3166-1 alpha-3)
|
|
35
|
-
- Date of birth format validation (
|
|
80
|
+
- Date of birth format validation (DD/MM/YYYY)
|
|
36
81
|
- User type validation (payin/payout)
|
|
37
82
|
- Progressive profile building support
|
|
38
83
|
|
|
@@ -44,7 +89,7 @@
|
|
|
44
89
|
- **Main Module**: Added `users` accessor for convenient access to User resource
|
|
45
90
|
|
|
46
91
|
### Documentation
|
|
47
|
-
- **NEW**: [User Management Guide](docs/
|
|
92
|
+
- **NEW**: [User Management Guide](docs/users.md) - Comprehensive guide covering:
|
|
48
93
|
- Overview of payin vs payout users
|
|
49
94
|
- Required fields for each user type
|
|
50
95
|
- Complete API reference with examples
|
|
@@ -64,10 +109,10 @@
|
|
|
64
109
|
- User profile validation helper
|
|
65
110
|
- RSpec integration tests
|
|
66
111
|
- Common patterns with retry logic
|
|
67
|
-
- **NEW**: [User Quick Reference](docs/
|
|
112
|
+
- **NEW**: [User Quick Reference](docs/user_quick_reference.md) - Quick lookup for common operations
|
|
68
113
|
- **NEW**: [User Demo Script](examples/user_demo.rb) - Interactive demo of all user operations
|
|
69
|
-
- **NEW**: [Implementation Summary](
|
|
70
|
-
- **Updated**:
|
|
114
|
+
- **NEW**: [Implementation Summary](implementation.md) - Detailed summary of the implementation
|
|
115
|
+
- **Updated**: readme.md - Added Users section with quick examples and updated roadmap
|
|
71
116
|
|
|
72
117
|
### Testing
|
|
73
118
|
- 40+ new test cases for User resource
|
|
@@ -97,24 +142,24 @@
|
|
|
97
142
|
- Support for multiple signatures (key rotation scenarios)
|
|
98
143
|
|
|
99
144
|
### Documentation
|
|
100
|
-
- **NEW**: [Authentication Guide](docs/
|
|
145
|
+
- **NEW**: [Authentication Guide](docs/authentication.md) - Comprehensive guide covering:
|
|
101
146
|
- Short way: `ZaiPayment.token` (one-liner approach)
|
|
102
147
|
- Long way: `TokenProvider.new(config:).bearer_token` (advanced control)
|
|
103
148
|
- Token lifecycle and automatic management
|
|
104
149
|
- Multiple configurations, testing, error handling
|
|
105
150
|
- Best practices and troubleshooting
|
|
106
|
-
- **NEW**: [Webhook Security Quick Start](docs/
|
|
107
|
-
- **NEW**: [Webhook Signature Implementation](docs/
|
|
108
|
-
- **NEW**: [Documentation Index](docs/
|
|
151
|
+
- **NEW**: [Webhook Security Quick Start](docs/webhook_security_quickstart.md) - 5-minute setup guide
|
|
152
|
+
- **NEW**: [Webhook Signature Implementation](docs/webhook_signature.md) - Technical details
|
|
153
|
+
- **NEW**: [Documentation Index](docs/readme.md) - Central navigation for all docs
|
|
109
154
|
- **Enhanced**: [Webhook Examples](examples/webhooks.md) - Added 400+ lines of examples:
|
|
110
155
|
- Complete Rails controller implementation
|
|
111
156
|
- Sinatra example
|
|
112
157
|
- Rack middleware example
|
|
113
158
|
- Background job processing pattern
|
|
114
159
|
- Idempotency pattern
|
|
115
|
-
- **Enhanced**: [Webhook Technical Guide](docs/
|
|
160
|
+
- **Enhanced**: [Webhook Technical Guide](docs/webhooks.md) - Added 170+ lines on security
|
|
116
161
|
- **Reorganized**: All documentation moved to `docs/` folder for better organization
|
|
117
|
-
- **Updated**:
|
|
162
|
+
- **Updated**: readme.md - Now concise with clear links to detailed documentation
|
|
118
163
|
|
|
119
164
|
### Testing
|
|
120
165
|
- 56 new test cases for webhook signature verification
|
|
@@ -23,7 +23,7 @@ First off, thank you for considering contributing to Zai Payment! 🎉 It's peop
|
|
|
23
23
|
|
|
24
24
|
## Code of Conduct
|
|
25
25
|
|
|
26
|
-
This project and everyone participating in it is governed by our [Code of Conduct](
|
|
26
|
+
This project and everyone participating in it is governed by our [Code of Conduct](code_of_conduct.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [contact@sentia.com.au](mailto:contact@sentia.com.au).
|
|
27
27
|
|
|
28
28
|
---
|
|
29
29
|
|
|
@@ -86,7 +86,7 @@ Please follow these steps to have your contribution considered by the maintainer
|
|
|
86
86
|
**Pull Request Guidelines:**
|
|
87
87
|
- Keep changes focused - one feature/fix per PR
|
|
88
88
|
- Link any relevant issues in the PR description
|
|
89
|
-
- Update
|
|
89
|
+
- Update changelog.md if appropriate
|
|
90
90
|
- Maintain backward compatibility when possible
|
|
91
91
|
- Include tests for new functionality
|
|
92
92
|
- Follow the existing code style
|
|
@@ -231,7 +231,7 @@ feat(webhooks): add support for webhook signature verification
|
|
|
231
231
|
|
|
232
232
|
fix(auth): prevent token refresh race condition
|
|
233
233
|
|
|
234
|
-
docs: update
|
|
234
|
+
docs: update readme with webhook examples
|
|
235
235
|
|
|
236
236
|
test(client): add specs for error handling
|
|
237
237
|
```
|
|
@@ -268,9 +268,9 @@ bundle exec rubocop -a
|
|
|
268
268
|
|
|
269
269
|
- **Public APIs must be documented** using YARD syntax
|
|
270
270
|
- **Include examples** in documentation when helpful
|
|
271
|
-
- **Update
|
|
271
|
+
- **Update readme.md** when adding new features
|
|
272
272
|
- **Update relevant docs/** files for architectural changes
|
|
273
|
-
- **Keep
|
|
273
|
+
- **Keep changelog.md** updated with notable changes
|
|
274
274
|
|
|
275
275
|
**YARD Documentation Example:**
|
|
276
276
|
```ruby
|
|
@@ -364,7 +364,7 @@ end
|
|
|
364
364
|
### Recognition
|
|
365
365
|
|
|
366
366
|
Contributors will be recognized in:
|
|
367
|
-
- The project's
|
|
367
|
+
- The project's readme (if significant contribution)
|
|
368
368
|
- The CHANGELOG for their specific contributions
|
|
369
369
|
- Release notes
|
|
370
370
|
|
|
@@ -641,7 +641,7 @@ Gets or refreshes the bearer token.
|
|
|
641
641
|
## Next Steps
|
|
642
642
|
|
|
643
643
|
- ✅ Authentication configured and working
|
|
644
|
-
- 📖 Read [Webhook Guide](
|
|
644
|
+
- 📖 Read [Webhook Guide](webhooks.md) to start using webhooks
|
|
645
645
|
- 💡 Check [Examples](../examples/webhooks.md) for complete code samples
|
|
646
|
-
- 🔒 Set up [Webhook Security](
|
|
646
|
+
- 🔒 Set up [Webhook Security](webhook_security_quickstart.md)
|
|
647
647
|
|