zai_payment 2.2.0 → 2.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: 4711fe7ce837e63205c63cdacf15dd79ab6ac310c23cffd48dac60a3770fcb4f
4
- data.tar.gz: 7de103d746c51bb8951f0c7d330ef8b05b6b69abcf15c8f170d275baa7bdb3e0
3
+ metadata.gz: bd2bc88b008ee18d342d81dfbe7ee3680e2564b266d2fadd0f6d6f65140098b2
4
+ data.tar.gz: 59158c3d8919b6ae9df07ddefc6f21162b51218bf47b7c3267e81a52b25172b4
5
5
  SHA512:
6
- metadata.gz: 63ee9160f09c7e1170cd601fbe2106c026b99077afb52692bd7f1089d061aae2b0a8d91ee2471c059b270c0fdd69b4799bc9c05e5807ec2cd3ca513b6bc069b6
7
- data.tar.gz: 4344ee075e93a036ffaf4b525ec15d4bc38dc4d00f2a2391a0bc7020c684e7255ac5b2c1584ac87c84ade8c8868bef3a0f831851ff11063da0cc1c67b24f023f
6
+ metadata.gz: 19e4a3f16c002720a058dbd172a63f14231f99cb9d70735080ad400267e3490813062a5cdfb3ea3c538df71a48008d10bf47efa2284503a9beb2ecd1ee4f7e35
7
+ data.tar.gz: c3efe64996d506e89b364a9867c7b349111061ff58ad222b9a8814479b1842985ebf0f8bb72c89cf469327ac3e24985c25f84ebb7aee9ae1cbc05d08bf46a070
data/changelog.md CHANGED
@@ -1,4 +1,25 @@
1
1
  ## [Released]
2
+ ## [2.3.1] - 2025-10-28
3
+ ### Fixed
4
+ - **Token Refresh Bug**: Fixed authentication token not being refreshed after expiration
5
+ - Previously, the Authorization header was set once when the connection was created
6
+ - After ~1 hour, tokens would expire and subsequent API calls would fail with `UnauthorizedError`
7
+ - Now, the Authorization header is set dynamically on each request, ensuring fresh tokens are always used
8
+ - The `TokenProvider` automatically refreshes expired tokens, preventing authentication errors
9
+ - Fixes issue where some APIs would work while others failed after token expiration
10
+
11
+ ## [2.3.0] - 2025-10-28
12
+ ### Added
13
+ - **User Management API Enhancement**: Added search parameter to list users endpoint
14
+ - `ZaiPayment.users.list(limit:, offset:, search:)` - Search users by text value
15
+ - Search parameter is optional and filters users by email, name, or other text fields
16
+ - Example: `users.list(search: "john@example.com")`
17
+
18
+ ### Changed
19
+ - Coverage badge updated to 97.15%
20
+
21
+ **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.2.0...v2.3.0
22
+
2
23
  ## [2.2.0] - 2025-10-24
3
24
  ### Added
4
25
  - **Extended User Management API**: 7 new user-related endpoints 🚀
@@ -53,6 +53,7 @@ module ZaiPayment
53
53
  def request(method, path, params: {}, body: {})
54
54
  response = connection.public_send(method) do |req|
55
55
  req.url path
56
+ req.headers['Authorization'] = token_provider.bearer_token
56
57
  req.params = params if params.any?
57
58
  req.body = body if body.any?
58
59
  end
@@ -81,7 +82,7 @@ module ZaiPayment
81
82
  end
82
83
 
83
84
  def apply_headers(faraday)
84
- faraday.headers['Authorization'] = token_provider.bearer_token
85
+ # Authorization header is set per-request to ensure fresh tokens
85
86
  faraday.headers['Content-Type'] = 'application/json'
86
87
  faraday.headers['Accept'] = 'application/json'
87
88
  end
@@ -68,6 +68,7 @@ module ZaiPayment
68
68
  #
69
69
  # @param limit [Integer] number of records to return (default: 10)
70
70
  # @param offset [Integer] number of records to skip (default: 0)
71
+ # @param search [String] text value to be used for searching users
71
72
  # @return [Response] the API response containing users array
72
73
  #
73
74
  # @example
@@ -75,12 +76,16 @@ module ZaiPayment
75
76
  # response = users.list
76
77
  # response.data # => [{"id" => "...", "email" => "..."}, ...]
77
78
  #
79
+ # @example with search
80
+ # response = users.list(search: "john@example.com")
81
+ #
78
82
  # @see https://developer.hellozai.com/reference/getallusers
79
- def list(limit: 10, offset: 0)
83
+ def list(limit: 10, offset: 0, search: nil)
80
84
  params = {
81
85
  limit: limit,
82
86
  offset: offset
83
87
  }
88
+ params[:search] = search if search
84
89
 
85
90
  client.get('/users', params: params)
86
91
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZaiPayment
4
- VERSION = '2.2.0'
4
+ VERSION = '2.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: 2.2.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddy Jaga
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubygems_version: 3.6.7
128
+ rubygems_version: 3.7.1
129
129
  specification_version: 4
130
130
  summary: Ruby gem for Zai payment integration
131
131
  test_files: []