diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 7820c28..fafeb48 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,105 +1,7 @@ -## Description +## Short Description / Link to Ticket - -## Type of Change +## Testing - - -- [ ] 🐛 Bug fix (non-breaking change which fixes an issue) -- [ ] ✨ New feature (non-breaking change which adds functionality) -- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] 📚 Documentation update -- [ ] 🔧 Configuration change -- [ ] ♻️ Refactoring (no functional changes) -- [ ] ✅ Test updates -- [ ] 🎨 Style/formatting changes -- [ ] ⚡️ Performance improvement - -## Related Issue(s) - - - -Fixes # - -## Motivation and Context - - - -## Changes Made - - - -- -- -- - -## Testing - - - -### Test Coverage - -- [ ] I have added tests that prove my fix is effective or that my feature works -- [ ] New and existing unit tests pass locally with my changes -- [ ] I have run the full test suite (`bundle exec rspec`) - -### Manual Testing - - - -```ruby -# Example code showing how you tested this -``` - -## Code Quality Checklist - -- [ ] My code follows the style guidelines of this project -- [ ] I have performed a self-review of my own code -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] I have made corresponding changes to the documentation -- [ ] My changes generate no new warnings or errors -- [ ] I have checked my code and corrected any misspellings -- [ ] All RuboCop offenses have been resolved (if applicable) - -## Documentation - -- [ ] I have updated the README.md (if applicable) -- [ ] I have updated the CHANGELOG.md -- [ ] I have updated the API documentation (if applicable) -- [ ] I have added/updated code examples (if applicable) - -## Breaking Changes - - - -- [ ] This PR introduces breaking changes -- [ ] I have documented the breaking changes and migration path - -**Breaking Change Details:** - - ## Additional Notes - - - -## Screenshots (if applicable) - - - -## Checklist Before Requesting Review - -- [ ] I have read the [CONTRIBUTING](../CONTRIBUTING.md) guide -- [ ] My branch is up to date with the main branch -- [ ] All commits follow the project's commit message conventions -- [ ] I have added appropriate labels to this PR -- [ ] I have requested review from relevant maintainers - ---- - - - diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index e7bc60d..56161b8 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -285,8 +285,8 @@ The implementation is complete and ready for use. Recommended next steps: ## References -- [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user) -- [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user) +- [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user) +- [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user) - [Zai API Reference](https://developer.hellozai.com/reference) ## Support diff --git a/README.md b/README.md index 9286ea3..6a03428 100644 --- a/README.md +++ b/README.md @@ -137,8 +137,8 @@ response = ZaiPayment.users.update('user_id', mobile: '+9876543210') **📚 Documentation:** - 📖 [User Management Guide](docs/USERS.md) - Complete guide for payin and payout users - 💡 [User Examples](examples/users.md) - Real-world usage patterns and Rails integration -- 🔗 [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user) -- 🔗 [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user) +- 🔗 [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user) +- 🔗 [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user) ### Webhooks diff --git a/docs/USERS.md b/docs/USERS.md index 3ebd669..71a661f 100644 --- a/docs/USERS.md +++ b/docs/USERS.md @@ -12,8 +12,8 @@ Both user types use the same endpoints but have different required information b ## References -- [Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user) -- [Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user) +- [Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user) +- [Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user) ## Usage diff --git a/docs/USER_ID_FIELD.md b/docs/USER_ID_FIELD.md index c9e8a6f..83aa9c5 100644 --- a/docs/USER_ID_FIELD.md +++ b/docs/USER_ID_FIELD.md @@ -269,7 +269,7 @@ old_user.update(zai_user_id: new_response.data['id']) ## References -- [Zai Developer Documentation](https://developer.hellozai.com/docs/onboarding-a-payin-user) +- [Zai Developer Documentation](https://developer.hellozai.com/docs/onboarding-a-pay-in-user) - [Zai API Reference](https://developer.hellozai.com/reference/createuser) - [User Management Guide](USERS.md) diff --git a/docs/USER_QUICK_REFERENCE.md b/docs/USER_QUICK_REFERENCE.md index cc58da4..89589b5 100644 --- a/docs/USER_QUICK_REFERENCE.md +++ b/docs/USER_QUICK_REFERENCE.md @@ -218,8 +218,8 @@ ruby examples/user_demo.rb - [Full User Guide](USERS.md) - [Usage Examples](../examples/users.md) -- [Zai: Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user) -- [Zai: Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user) +- [Zai: Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user) +- [Zai: Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user) ## Support diff --git a/lib/zai_payment/resources/user.rb b/lib/zai_payment/resources/user.rb index b859813..6297d95 100644 --- a/lib/zai_payment/resources/user.rb +++ b/lib/zai_payment/resources/user.rb @@ -4,8 +4,8 @@ module ZaiPayment module Resources # User resource for managing Zai users (payin and payout) # - # @see https://developer.hellozai.com/docs/onboarding-a-payin-user - # @see https://developer.hellozai.com/docs/onboarding-a-payout-user + # @see https://developer.hellozai.com/docs/onboarding-a-pay-in-user + # @see https://developer.hellozai.com/docs/onboarding-a-pay-out-user class User attr_reader :client @@ -197,8 +197,8 @@ def show(user_id) # ) # # @see https://developer.hellozai.com/reference/createuser - # @see https://developer.hellozai.com/docs/onboarding-a-payin-user - # @see https://developer.hellozai.com/docs/onboarding-a-payout-user + # @see https://developer.hellozai.com/docs/onboarding-a-pay-in-user + # @see https://developer.hellozai.com/docs/onboarding-a-pay-out-user def create(**attributes) validate_create_attributes!(attributes) diff --git a/lib/zai_payment/response.rb b/lib/zai_payment/response.rb index 3667098..7ff228d 100644 --- a/lib/zai_payment/response.rb +++ b/lib/zai_payment/response.rb @@ -68,10 +68,23 @@ def error_class_for_status def extract_error_message if body.is_a?(Hash) - body['error'] || body['message'] || body['errors']&.join(', ') || "HTTP #{status}" + body['error'] || body['message'] || format_errors(body['errors']) || "HTTP #{status}" else "HTTP #{status}: #{body}" end end + + def format_errors(errors) + return nil if errors.nil? + + case errors + when Array + errors.join(', ') + when Hash + errors.map { |key, value| "#{key}: #{value}" }.join(', ') + else + errors.to_s + end + end end end