zai_payment 2.9.0 → 2.9.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/lib/zai_payment/version.rb +1 -1
- metadata +6 -43
- data/.yardopts +0 -3
- data/IMPLEMENTATION_SUMMARY.md +0 -183
- data/RESPONSE_FORMAT_CORRECTION.md +0 -75
- data/Rakefile +0 -12
- data/badges/.gitkeep +0 -2
- data/badges/coverage.json +0 -1
- data/changelog.md +0 -750
- data/code_of_conduct.md +0 -132
- data/contributing.md +0 -383
- data/docs/architecture.md +0 -232
- data/docs/authentication.md +0 -647
- data/docs/bank_accounts.md +0 -496
- data/docs/batch_transactions.md +0 -340
- data/docs/bpay_accounts.md +0 -519
- data/docs/direct_api_usage.md +0 -489
- data/docs/items.md +0 -1241
- data/docs/pay_ids.md +0 -777
- data/docs/readme.md +0 -111
- data/docs/token_auths.md +0 -523
- data/docs/user_id_field.md +0 -284
- data/docs/user_quick_reference.md +0 -230
- data/docs/users.md +0 -750
- data/docs/virtual_accounts.md +0 -916
- data/docs/wallet_accounts.md +0 -493
- data/docs/webhook_security_quickstart.md +0 -136
- data/docs/webhook_signature.md +0 -244
- data/docs/webhooks.md +0 -417
- data/examples/bank_accounts.md +0 -637
- data/examples/batch_transactions.md +0 -450
- data/examples/bpay_accounts.md +0 -642
- data/examples/items.md +0 -2713
- data/examples/pay_ids.md +0 -871
- data/examples/rails_card_payment.md +0 -1252
- data/examples/token_auths.md +0 -687
- data/examples/users.md +0 -765
- data/examples/virtual_accounts.md +0 -1530
- data/examples/wallet_accounts.md +0 -733
- data/examples/webhooks.md +0 -635
- data/readme.md +0 -357
- data/sig/zai_payment.rbs +0 -4
data/code_of_conduct.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
-
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
-
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
-
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
-
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
-
identity and orientation.
|
|
11
|
-
|
|
12
|
-
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
-
diverse, inclusive, and healthy community.
|
|
14
|
-
|
|
15
|
-
## Our Standards
|
|
16
|
-
|
|
17
|
-
Examples of behavior that contributes to a positive environment for our
|
|
18
|
-
community include:
|
|
19
|
-
|
|
20
|
-
* Demonstrating empathy and kindness toward other people
|
|
21
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
-
* Giving and gracefully accepting constructive feedback
|
|
23
|
-
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
-
and learning from the experience
|
|
25
|
-
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
-
community
|
|
27
|
-
|
|
28
|
-
Examples of unacceptable behavior include:
|
|
29
|
-
|
|
30
|
-
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
-
any kind
|
|
32
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
-
* Public or private harassment
|
|
34
|
-
* Publishing others' private information, such as a physical or email address,
|
|
35
|
-
without their explicit permission
|
|
36
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
-
professional setting
|
|
38
|
-
|
|
39
|
-
## Enforcement Responsibilities
|
|
40
|
-
|
|
41
|
-
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
-
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
-
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
-
or harmful.
|
|
45
|
-
|
|
46
|
-
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
-
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
-
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
-
decisions when appropriate.
|
|
50
|
-
|
|
51
|
-
## Scope
|
|
52
|
-
|
|
53
|
-
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
-
an individual is officially representing the community in public spaces.
|
|
55
|
-
Examples of representing our community include using an official email address,
|
|
56
|
-
posting via an official social media account, or acting as an appointed
|
|
57
|
-
representative at an online or offline event.
|
|
58
|
-
|
|
59
|
-
## Enforcement
|
|
60
|
-
|
|
61
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
-
reported to the community leaders responsible for enforcement at
|
|
63
|
-
contact@sentia.com.au.
|
|
64
|
-
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
-
|
|
66
|
-
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
-
reporter of any incident.
|
|
68
|
-
|
|
69
|
-
## Enforcement Guidelines
|
|
70
|
-
|
|
71
|
-
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
-
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
-
|
|
74
|
-
### 1. Correction
|
|
75
|
-
|
|
76
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
-
unprofessional or unwelcome in the community.
|
|
78
|
-
|
|
79
|
-
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
-
clarity around the nature of the violation and an explanation of why the
|
|
81
|
-
behavior was inappropriate. A public apology may be requested.
|
|
82
|
-
|
|
83
|
-
### 2. Warning
|
|
84
|
-
|
|
85
|
-
**Community Impact**: A violation through a single incident or series of
|
|
86
|
-
actions.
|
|
87
|
-
|
|
88
|
-
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
-
interaction with the people involved, including unsolicited interaction with
|
|
90
|
-
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
-
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
-
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
-
ban.
|
|
94
|
-
|
|
95
|
-
### 3. Temporary Ban
|
|
96
|
-
|
|
97
|
-
**Community Impact**: A serious violation of community standards, including
|
|
98
|
-
sustained inappropriate behavior.
|
|
99
|
-
|
|
100
|
-
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
-
communication with the community for a specified period of time. No public or
|
|
102
|
-
private interaction with the people involved, including unsolicited interaction
|
|
103
|
-
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
-
Violating these terms may lead to a permanent ban.
|
|
105
|
-
|
|
106
|
-
### 4. Permanent Ban
|
|
107
|
-
|
|
108
|
-
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
-
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
-
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
-
|
|
112
|
-
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
-
community.
|
|
114
|
-
|
|
115
|
-
## Attribution
|
|
116
|
-
|
|
117
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
-
version 2.1, available at
|
|
119
|
-
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
-
|
|
121
|
-
Community Impact Guidelines were inspired by
|
|
122
|
-
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
-
|
|
124
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
-
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
-
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
-
|
|
128
|
-
[homepage]: https://www.contributor-covenant.org
|
|
129
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
-
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
-
[translations]: https://www.contributor-covenant.org/translations
|
data/contributing.md
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
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
|
-
|