zai_payment 1.3.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: 1962ecb8f18a68596d577ebcd067a6f91e83552d7fd28545d0ccbdcc17282b3e
4
- data.tar.gz: 9d8e68d9ffee32fe2a4a9e8fb460d63e34e74e71499b6945255aef149242eac4
3
+ metadata.gz: dabc0f9dc5f73ccb000c026d7a13eb171d14e447d0968af90458ddbc618ed415
4
+ data.tar.gz: a0152f5b7d19286f58d2c0cb0e7e551f657e3e3ddba54211ccb37fb145206674
5
5
  SHA512:
6
- metadata.gz: 84172d3fdb684fbc3d71b7d57c12eb04bca0d97b7423cb8a9a731dacd6de4198b6c6e33510b6fade6ed314d38de5d11d50f0511b2ba1af8b8cbae76cac5ddc24
7
- data.tar.gz: db6a76ba905cf0a729769b279e326e84f387574d1c5dd3a0a6791a853d0ed88ed4f35bbf3175dbae497d9777146a09bc6096fd8a0849b4e1f3238a467123a694
6
+ metadata.gz: eca4cb501d4135796dc7947eb21110ba1581672860450343995284f64209e200348791ade1573a599540702c82c86427f4fb5d3dcc7d4b3d91a1c775263fbd62
7
+ data.tar.gz: 45aabfa5d699dcb06c9e527ff72690698cdb70ab635d813070a94811f73b596bad47bde1771828eea1f200f6f2a1b805841cdc52677e69ef55994b0de9e5c96e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
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
+
3
10
  ## [1.3.0] - 2025-10-23
4
11
  ### Added
5
12
  - **User Management API**: Full CRUD operations for managing Zai users (payin and payout) 👥
data/IMPLEMENTATION.md CHANGED
@@ -285,8 +285,8 @@ The implementation is complete and ready for use. Recommended next steps:
285
285
 
286
286
  ## References
287
287
 
288
- - [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user)
289
- - [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user)
288
+ - [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user)
289
+ - [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user)
290
290
  - [Zai API Reference](https://developer.hellozai.com/reference)
291
291
 
292
292
  ## Support
data/README.md CHANGED
@@ -137,8 +137,8 @@ response = ZaiPayment.users.update('user_id', mobile: '+9876543210')
137
137
  **📚 Documentation:**
138
138
  - 📖 [User Management Guide](docs/USERS.md) - Complete guide for payin and payout users
139
139
  - 💡 [User Examples](examples/users.md) - Real-world usage patterns and Rails integration
140
- - 🔗 [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user)
141
- - 🔗 [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user)
140
+ - 🔗 [Zai: Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user)
141
+ - 🔗 [Zai: Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user)
142
142
 
143
143
  ### Webhooks
144
144
 
data/badges/coverage.json CHANGED
@@ -1 +1 @@
1
- {"schemaVersion": 1, "label": "coverage", "message": "95.18%", "color": "brightgreen"}
1
+ {"schemaVersion": 1, "label": "coverage", "message": "94.77%", "color": "brightgreen"}
data/docs/USERS.md CHANGED
@@ -12,8 +12,8 @@ Both user types use the same endpoints but have different required information b
12
12
 
13
13
  ## References
14
14
 
15
- - [Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user)
16
- - [Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user)
15
+ - [Onboarding a Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user)
16
+ - [Onboarding a Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user)
17
17
 
18
18
  ## Usage
19
19
 
@@ -269,7 +269,7 @@ old_user.update(zai_user_id: new_response.data['id'])
269
269
 
270
270
  ## References
271
271
 
272
- - [Zai Developer Documentation](https://developer.hellozai.com/docs/onboarding-a-payin-user)
272
+ - [Zai Developer Documentation](https://developer.hellozai.com/docs/onboarding-a-pay-in-user)
273
273
  - [Zai API Reference](https://developer.hellozai.com/reference/createuser)
274
274
  - [User Management Guide](USERS.md)
275
275
 
@@ -218,8 +218,8 @@ ruby examples/user_demo.rb
218
218
 
219
219
  - [Full User Guide](USERS.md)
220
220
  - [Usage Examples](../examples/users.md)
221
- - [Zai: Payin User](https://developer.hellozai.com/docs/onboarding-a-payin-user)
222
- - [Zai: Payout User](https://developer.hellozai.com/docs/onboarding-a-payout-user)
221
+ - [Zai: Payin User](https://developer.hellozai.com/docs/onboarding-a-pay-in-user)
222
+ - [Zai: Payout User](https://developer.hellozai.com/docs/onboarding-a-pay-out-user)
223
223
 
224
224
  ## Support
225
225
 
@@ -4,8 +4,8 @@ module ZaiPayment
4
4
  module Resources
5
5
  # User resource for managing Zai users (payin and payout)
6
6
  #
7
- # @see https://developer.hellozai.com/docs/onboarding-a-payin-user
8
- # @see https://developer.hellozai.com/docs/onboarding-a-payout-user
7
+ # @see https://developer.hellozai.com/docs/onboarding-a-pay-in-user
8
+ # @see https://developer.hellozai.com/docs/onboarding-a-pay-out-user
9
9
  class User
10
10
  attr_reader :client
11
11
 
@@ -197,8 +197,8 @@ module ZaiPayment
197
197
  # )
198
198
  #
199
199
  # @see https://developer.hellozai.com/reference/createuser
200
- # @see https://developer.hellozai.com/docs/onboarding-a-payin-user
201
- # @see https://developer.hellozai.com/docs/onboarding-a-payout-user
200
+ # @see https://developer.hellozai.com/docs/onboarding-a-pay-in-user
201
+ # @see https://developer.hellozai.com/docs/onboarding-a-pay-out-user
202
202
  def create(**attributes)
203
203
  validate_create_attributes!(attributes)
204
204
 
@@ -68,10 +68,23 @@ module ZaiPayment
68
68
 
69
69
  def extract_error_message
70
70
  if body.is_a?(Hash)
71
- body['error'] || body['message'] || body['errors']&.join(', ') || "HTTP #{status}"
71
+ body['error'] || body['message'] || format_errors(body['errors']) || "HTTP #{status}"
72
72
  else
73
73
  "HTTP #{status}: #{body}"
74
74
  end
75
75
  end
76
+
77
+ def format_errors(errors)
78
+ return nil if errors.nil?
79
+
80
+ case errors
81
+ when Array
82
+ errors.join(', ')
83
+ when Hash
84
+ errors.map { |key, value| "#{key}: #{value}" }.join(', ')
85
+ else
86
+ errors.to_s
87
+ end
88
+ end
76
89
  end
77
90
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZaiPayment
4
- VERSION = '1.3.0'
4
+ VERSION = '1.3.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zai_payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddy Jaga