zai_payment 1.2.0 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4b63d2fefc49eb419bc1de0db2cb41c3df25794f6efbf2b9a92ca6091112258
4
- data.tar.gz: 1ba74f063b3360b79acafe36a25d43c0b92ae09bee3c5d3da2f3ef30bf4fa5ab
3
+ metadata.gz: dabc0f9dc5f73ccb000c026d7a13eb171d14e447d0968af90458ddbc618ed415
4
+ data.tar.gz: a0152f5b7d19286f58d2c0cb0e7e551f657e3e3ddba54211ccb37fb145206674
5
5
  SHA512:
6
- metadata.gz: 209ce54d8809117bb3fe6059c50dc1a6be4a7de974a961506936772b3f0480510b28382445ef113f4bf0ef914b314377bb3ddf5613ee942ad691be818e1d3383
7
- data.tar.gz: e8efd4e2b0e5d2d42403d389c4218b95735ae4f1dcf60eb3e1e8012d23750bb2a0b8edd5fcc56f13816bc3c3de955de06f477230df5acce534824a15bebbc0ce
6
+ metadata.gz: eca4cb501d4135796dc7947eb21110ba1581672860450343995284f64209e200348791ade1573a599540702c82c86427f4fb5d3dcc7d4b3d91a1c775263fbd62
7
+ data.tar.gz: 45aabfa5d699dcb06c9e527ff72690698cdb70ab635d813070a94811f73b596bad47bde1771828eea1f200f6f2a1b805841cdc52677e69ef55994b0de9e5c96e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
1
1
  ## [Released]
2
2
 
3
+ ## [1.3.1] - 2025-10-23
4
+ ### Changed
5
+ - Update error response format
6
+ - Update some docs
7
+
8
+ **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.3.0...v1.3.1
9
+
10
+ ## [1.3.0] - 2025-10-23
11
+ ### Added
12
+ - **User Management API**: Full CRUD operations for managing Zai users (payin and payout) 👥
13
+ - `ZaiPayment.users.list(limit:, offset:)` - List all users with pagination
14
+ - `ZaiPayment.users.show(user_id)` - Get user details by ID
15
+ - `ZaiPayment.users.create(**attributes)` - Create payin (buyer) or payout (seller/merchant) users
16
+ - `ZaiPayment.users.update(user_id, **attributes)` - Update user information
17
+ - Support for both payin users (buyers) and payout users (sellers/merchants)
18
+ - Comprehensive validation for all user types
19
+ - Email format validation
20
+ - Country code validation (ISO 3166-1 alpha-3)
21
+ - Date of birth format validation (YYYYMMDD)
22
+ - User type validation (payin/payout)
23
+ - Progressive profile building support
24
+
25
+ ### Enhancements
26
+ - **Client**: Added `base_endpoint` parameter to support multiple API endpoints
27
+ - Users API uses `core_base` endpoint
28
+ - Webhooks API continues to use `va_base` endpoint
29
+ - **Response**: Updated `data` method to handle both `webhooks` and `users` response formats
30
+ - **Main Module**: Added `users` accessor for convenient access to User resource
31
+
32
+ ### Documentation
33
+ - **NEW**: [User Management Guide](docs/USERS.md) - Comprehensive guide covering:
34
+ - Overview of payin vs payout users
35
+ - Required fields for each user type
36
+ - Complete API reference with examples
37
+ - Field reference table
38
+ - Error handling patterns
39
+ - Best practices for each user type
40
+ - Response structures
41
+ - **NEW**: [User Examples](examples/users.md) - 500+ lines of practical examples:
42
+ - Basic and advanced payin user creation
43
+ - Progressive profile building patterns
44
+ - Payout user creation (individual and company)
45
+ - International users (AU, UK, US)
46
+ - List, search, and pagination
47
+ - Update operations
48
+ - Rails integration examples
49
+ - Batch operations
50
+ - User profile validation helper
51
+ - RSpec integration tests
52
+ - Common patterns with retry logic
53
+ - **NEW**: [User Quick Reference](docs/USER_QUICK_REFERENCE.md) - Quick lookup for common operations
54
+ - **NEW**: [User Demo Script](examples/user_demo.rb) - Interactive demo of all user operations
55
+ - **NEW**: [Implementation Summary](IMPLEMENTATION.md) - Detailed summary of the implementation
56
+ - **Updated**: README.md - Added Users section with quick examples and updated roadmap
57
+
58
+ ### Testing
59
+ - 40+ new test cases for User resource
60
+ - All CRUD operations tested
61
+ - Validation error handling tested
62
+ - API error handling tested
63
+ - Integration tests with main module
64
+ - Tests for both payin and payout user types
65
+
66
+ ### API Endpoints
67
+ - `GET /users` - List users
68
+ - `GET /users/:id` - Show user
69
+ - `POST /users` - Create user
70
+ - `PATCH /users/:id` - Update user
71
+
72
+ **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.2.0...v1.3.0
73
+
3
74
  ## [1.2.0] - 2025-10-22
4
75
  ### Added
5
76
  - **Webhook Security: Signature Verification** 🔒
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,383 @@
1
+ # Contributing to Zai Payment
2
+
3
+ First off, thank you for considering contributing to Zai Payment! 🎉 It's people like you that make this library better for everyone.
4
+
5
+ ## 📋 Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [How Can I Contribute?](#how-can-i-contribute)
9
+ - [Reporting Bugs](#reporting-bugs)
10
+ - [Suggesting Enhancements](#suggesting-enhancements)
11
+ - [Your First Code Contribution](#your-first-code-contribution)
12
+ - [Pull Requests](#pull-requests)
13
+ - [Development Setup](#development-setup)
14
+ - [Development Workflow](#development-workflow)
15
+ - [Style Guidelines](#style-guidelines)
16
+ - [Git Commit Messages](#git-commit-messages)
17
+ - [Ruby Style Guide](#ruby-style-guide)
18
+ - [Documentation](#documentation)
19
+ - [Testing](#testing)
20
+ - [Community](#community)
21
+
22
+ ---
23
+
24
+ ## Code of Conduct
25
+
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
+
28
+ ---
29
+
30
+ ## How Can I Contribute?
31
+
32
+ ### Reporting Bugs
33
+
34
+ Before creating bug reports, please check the [existing issues](https://github.com/Sentia/zai-payment/issues) as you might find that you don't need to create one. When you are creating a bug report, please include as many details as possible:
35
+
36
+ **Before Submitting A Bug Report:**
37
+ - Check the [documentation](https://rubydoc.info/gems/zai_payment) to confirm your understanding of the expected behavior
38
+ - Check if the issue has already been reported
39
+ - Perform a cursory search to see if the problem has been discussed or resolved
40
+
41
+ **How to Submit A Good Bug Report:**
42
+
43
+ Bugs are tracked as [GitHub issues](https://github.com/Sentia/zai-payment/issues). Create an issue and provide the following information:
44
+
45
+ - **Use a clear and descriptive title** for the issue to identify the problem
46
+ - **Describe the exact steps to reproduce the problem** in as much detail as possible
47
+ - **Provide specific examples** to demonstrate the steps (include code snippets)
48
+ - **Describe the behavior you observed** after following the steps
49
+ - **Explain which behavior you expected to see instead** and why
50
+ - **Include details about your environment**:
51
+ - Ruby version (`ruby -v`)
52
+ - Gem version (`bundle list | grep zai_payment`)
53
+ - OS and version
54
+
55
+ ### Suggesting Enhancements
56
+
57
+ Enhancement suggestions are tracked as [GitHub issues](https://github.com/Sentia/zai-payment/issues). When creating an enhancement suggestion, please include:
58
+
59
+ - **Use a clear and descriptive title**
60
+ - **Provide a detailed description** of the suggested enhancement
61
+ - **Provide specific examples** to demonstrate the use case
62
+ - **Describe the current behavior** and **explain the desired behavior**
63
+ - **Explain why this enhancement would be useful** to most users
64
+ - **List any similar features** in other libraries that inspired the suggestion
65
+
66
+ ### Your First Code Contribution
67
+
68
+ Unsure where to begin contributing? You can start by looking through these issues:
69
+
70
+ - **Good First Issue** - issues that should only require a few lines of code
71
+ - **Help Wanted** - issues that may be more involved
72
+
73
+ ### Pull Requests
74
+
75
+ Please follow these steps to have your contribution considered by the maintainers:
76
+
77
+ 1. **Fork the repository** and create your branch from `main`
78
+ 2. **Make your changes** following our [style guidelines](#style-guidelines)
79
+ 3. **Add or update tests** as needed
80
+ 4. **Ensure the test suite passes** (`bundle exec rspec`)
81
+ 5. **Run the linter** and fix any issues (`bundle exec rubocop`)
82
+ 6. **Update the documentation** if you've changed APIs or added features
83
+ 7. **Write clear commit messages** following our [commit message guidelines](#git-commit-messages)
84
+ 8. **Open a pull request** with a clear title and description
85
+
86
+ **Pull Request Guidelines:**
87
+ - Keep changes focused - one feature/fix per PR
88
+ - Link any relevant issues in the PR description
89
+ - Update CHANGELOG.md if appropriate
90
+ - Maintain backward compatibility when possible
91
+ - Include tests for new functionality
92
+ - Follow the existing code style
93
+
94
+ ---
95
+
96
+ ## Development Setup
97
+
98
+ ### Prerequisites
99
+
100
+ - **Ruby** 3.0 or higher
101
+ - **Bundler** 2.0 or higher
102
+ - **Git**
103
+
104
+ ### Getting Started
105
+
106
+ 1. **Fork and clone the repository:**
107
+
108
+ ```bash
109
+ git clone git@github.com:Sentia/zai-payment.git
110
+ cd zai-payment
111
+ ```
112
+
113
+ 2. **Install dependencies:**
114
+
115
+ ```bash
116
+ bin/setup
117
+ ```
118
+
119
+ This will:
120
+ - Install all required gems
121
+ - Set up git hooks (if applicable)
122
+ - Prepare your development environment
123
+
124
+ 3. **Verify your setup:**
125
+
126
+ ```bash
127
+ bundle exec rspec
128
+ bundle exec rubocop
129
+ ```
130
+
131
+ All tests should pass and there should be no linting errors.
132
+
133
+ ### Interactive Console
134
+
135
+ For quick testing and experimentation:
136
+
137
+ ```bash
138
+ bin/console
139
+ ```
140
+
141
+ This launches an IRB session with the gem loaded and ready to use.
142
+
143
+ ---
144
+
145
+ ## Development Workflow
146
+
147
+ ### Branch Naming
148
+
149
+ Use descriptive branch names that reflect the work being done:
150
+
151
+ - `feature/description` - for new features
152
+ - `bugfix/description` - for bug fixes
153
+ - `docs/description` - for documentation changes
154
+ - `refactor/description` - for code refactoring
155
+ - `test/description` - for test improvements
156
+
157
+ Examples:
158
+ - `feature/add-payment-resource`
159
+ - `bugfix/fix-token-refresh`
160
+ - `docs/improve-webhook-examples`
161
+
162
+ ### Making Changes
163
+
164
+ 1. **Create a feature branch:**
165
+
166
+ ```bash
167
+ git checkout -b feature/my-new-feature
168
+ ```
169
+
170
+ 2. **Make your changes** following our style guidelines
171
+
172
+ 3. **Write or update tests:**
173
+
174
+ ```bash
175
+ bundle exec rspec
176
+ ```
177
+
178
+ 4. **Check code quality:**
179
+
180
+ ```bash
181
+ bundle exec rubocop
182
+ # Auto-fix issues when possible
183
+ bundle exec rubocop -a
184
+ ```
185
+
186
+ 5. **Commit your changes:**
187
+
188
+ ```bash
189
+ git add .
190
+ git commit -m "feat: add awesome new feature"
191
+ ```
192
+
193
+ 6. **Push to your fork:**
194
+
195
+ ```bash
196
+ git push origin feature/my-new-feature
197
+ ```
198
+
199
+ 7. **Open a Pull Request** on GitHub
200
+
201
+ ---
202
+
203
+ ## Style Guidelines
204
+
205
+ ### Git Commit Messages
206
+
207
+ We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
208
+
209
+ **Format:**
210
+ ```
211
+ <type>(<scope>): <subject>
212
+
213
+ <body>
214
+
215
+ <footer>
216
+ ```
217
+
218
+ **Types:**
219
+ - `feat:` - A new feature
220
+ - `fix:` - A bug fix
221
+ - `docs:` - Documentation only changes
222
+ - `style:` - Changes that don't affect code meaning (whitespace, formatting)
223
+ - `refactor:` - Code change that neither fixes a bug nor adds a feature
224
+ - `perf:` - Performance improvements
225
+ - `test:` - Adding or updating tests
226
+ - `chore:` - Changes to build process or auxiliary tools
227
+
228
+ **Examples:**
229
+ ```
230
+ feat(webhooks): add support for webhook signature verification
231
+
232
+ fix(auth): prevent token refresh race condition
233
+
234
+ docs: update README with webhook examples
235
+
236
+ test(client): add specs for error handling
237
+ ```
238
+
239
+ **Guidelines:**
240
+ - Use present tense ("add feature" not "added feature")
241
+ - Use imperative mood ("move cursor to..." not "moves cursor to...")
242
+ - First line should be 50 characters or less
243
+ - Reference issues and pull requests after the first line
244
+
245
+ ### Ruby Style Guide
246
+
247
+ This project follows the [Ruby Style Guide](https://rubystyle.guide/) and uses [RuboCop](https://github.com/rubocop/rubocop) for enforcement.
248
+
249
+ **Key principles:**
250
+ - Use 2 spaces for indentation (no tabs)
251
+ - Keep line length to 120 characters or less
252
+ - Use `snake_case` for methods and variables
253
+ - Use `CamelCase` for classes and modules
254
+ - Write clear, self-documenting code
255
+ - Add comments for complex logic
256
+ - Follow existing patterns in the codebase
257
+
258
+ **Run RuboCop:**
259
+ ```bash
260
+ # Check for issues
261
+ bundle exec rubocop
262
+
263
+ # Auto-fix issues when possible
264
+ bundle exec rubocop -a
265
+ ```
266
+
267
+ ### Documentation
268
+
269
+ - **Public APIs must be documented** using YARD syntax
270
+ - **Include examples** in documentation when helpful
271
+ - **Update README.md** when adding new features
272
+ - **Update relevant docs/** files for architectural changes
273
+ - **Keep CHANGELOG.md** updated with notable changes
274
+
275
+ **YARD Documentation Example:**
276
+ ```ruby
277
+ # Fetches a webhook by its ID
278
+ #
279
+ # @param id [String] the webhook ID
280
+ # @return [ZaiPayment::Response] the response containing webhook data
281
+ # @raise [ZaiPayment::Errors::NotFoundError] if webhook doesn't exist
282
+ #
283
+ # @example
284
+ # response = client.webhooks.get('wh_123')
285
+ # webhook = response.data
286
+ #
287
+ def get(id)
288
+ # implementation
289
+ end
290
+ ```
291
+
292
+ ---
293
+
294
+ ## Testing
295
+
296
+ This project uses [RSpec](https://rspec.info/) for testing.
297
+
298
+ ### Running Tests
299
+
300
+ ```bash
301
+ # Run all tests
302
+ bundle exec rspec
303
+
304
+ # Run specific test file
305
+ bundle exec rspec spec/zai_payment/client_spec.rb
306
+
307
+ # Run specific test
308
+ bundle exec rspec spec/zai_payment/client_spec.rb:10
309
+
310
+ # Run with coverage report
311
+ bundle exec rspec --format documentation
312
+ ```
313
+
314
+ ### Writing Tests
315
+
316
+ - **Write tests for all new features and bug fixes**
317
+ - **Use descriptive test names** that explain what is being tested
318
+ - **Follow the Arrange-Act-Assert pattern**
319
+ - **Use factories or fixtures** for test data
320
+ - **Mock external API calls** using VCR or WebMock
321
+ - **Aim for high test coverage** (we target 90%+ coverage)
322
+
323
+ **Test Example:**
324
+ ```ruby
325
+ RSpec.describe ZaiPayment::Client do
326
+ describe '#initialize' do
327
+ context 'with valid configuration' do
328
+ it 'creates a client instance' do
329
+ config = ZaiPayment::Config.new
330
+ client = described_class.new(config: config)
331
+
332
+ expect(client).to be_a(described_class)
333
+ end
334
+ end
335
+
336
+ context 'without configuration' do
337
+ it 'uses default configuration' do
338
+ client = described_class.new
339
+
340
+ expect(client.config).to be_a(ZaiPayment::Config)
341
+ end
342
+ end
343
+ end
344
+ end
345
+ ```
346
+
347
+ ### Test Coverage
348
+
349
+ - Coverage reports are generated automatically with SimpleCov
350
+ - View coverage reports in `coverage/index.html`
351
+ - New code should maintain or improve overall coverage
352
+ - Don't write tests just to increase coverage - write meaningful tests
353
+
354
+ ---
355
+
356
+ ## Community
357
+
358
+ ### Questions?
359
+
360
+ - **GitHub Discussions** - For general questions and discussions
361
+ - **GitHub Issues** - For bugs and feature requests
362
+ - **Email** - [contact@sentia.com.au](mailto:contact@sentia.com.au)
363
+
364
+ ### Recognition
365
+
366
+ Contributors will be recognized in:
367
+ - The project's README (if significant contribution)
368
+ - The CHANGELOG for their specific contributions
369
+ - Release notes
370
+
371
+ ### Need Help?
372
+
373
+ Don't hesitate to ask questions! We're here to help:
374
+ - Comment on an issue you'd like to work on
375
+ - Open a discussion for clarification
376
+ - Reach out via email
377
+
378
+ ---
379
+
380
+ ## Thank You! 🙏
381
+
382
+ Your contributions to open source, large or small, make projects like this possible. Thank you for taking the time to contribute!
383
+