zai_payment 2.6.0 → 2.6.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: 5c0f57b605f7a885cb3fcbb0e8b4554d782fd298444d49b57732d0214b0a8a14
4
- data.tar.gz: 014e39994a1d9051b28d90deaec6407cd638de2ed7995509c0196ec25da6805a
3
+ metadata.gz: 21a2f54b50cab4893520a396d33149bd53daf27aa6023fcc2b720fd2c2100e89
4
+ data.tar.gz: 736516f787ba6acb1d3c40222530606dae8be04e0c2ac222d2f5a367815ad26d
5
5
  SHA512:
6
- metadata.gz: 24b3058ec5ee8e06b06f9444175a6a86e455a3ba08b2a5f40df990f5ab7beae812d05225e62802b1fd2e69acc37f9364f33d1dc89f37fb045c150c52ae18fd04
7
- data.tar.gz: a2e4715f2f8e8630fe4ea03d13ad83318acf4fd09737266de497ecc889af22af84fc7edd0b8d6846658ebc50d4c49ed8d36ae0144190a0d79aeae88d6e398bce
6
+ metadata.gz: 0c05de5aa53f36e794f65e0dfb421b997db67c039700b9ea62d96d38abace81d44f6bd7f22e2b98ed2885365c78c3c8ebdb2fde14a737844784379a3f64874d6
7
+ data.tar.gz: 3731f8af6454bf2ae233e47a8716e06c1290912989a2ba4d9a728341845ebb5d01d0a9e7d903e0fd6f07c38cbbccd9a3931f56d6b1cb84f3e20cb5c0d50f2307
data/changelog.md CHANGED
@@ -1,5 +1,31 @@
1
1
  ## [Released]
2
2
 
3
+ ## [2.6.1] - 2025-11-03
4
+
5
+ ### Changed
6
+ - **Wallet Accounts Response Structure**: Updated to match actual API response format 🔄
7
+ - Response now properly returns nested `wallet_accounts` object with complete structure
8
+ - Added `wallet_accounts` to `Response#data` automatic extraction
9
+ - The `Response#data` method now automatically extracts the `wallet_accounts` object for cleaner API usage
10
+ - Updated response includes: `id`, `active`, `created_at`, `updated_at`, `balance`, `currency`
11
+ - Enhanced `links` structure with: `self`, `users`, `batch_transactions`, `transactions`, `bpay_details`, `npp_details`, `virtual_accounts`
12
+
13
+ ### Improved
14
+ - **API Consistency**: `response.data` now works consistently across all resources
15
+ - Before: `response.data['wallet_accounts']['balance']` (manual extraction)
16
+ - After: `response.data['balance']` (automatic extraction)
17
+ - **Documentation**: Updated all wallet_account documentation and examples
18
+ - Updated `docs/users.md` with complete wallet account response structure
19
+ - Added note about automatic data extraction in Response class
20
+ - Updated code examples in `lib/zai_payment/resources/user.rb`
21
+ - **Test Coverage**: Enhanced wallet_account test suite
22
+ - Split tests into focused examples for better maintainability
23
+ - Added comprehensive validation for all wallet account fields
24
+ - Tests for active status, timestamps, and all link fields
25
+ - All tests comply with RuboCop standards
26
+
27
+ **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.6.0...v2.6.1
28
+
3
29
  ## [2.6.0] - 2025-11-03
4
30
 
5
31
  ### Added
data/docs/users.md CHANGED
@@ -168,12 +168,51 @@ Show the user's wallet account using a given user ID.
168
168
  ```ruby
169
169
  response = ZaiPayment.users.wallet_account('user_id')
170
170
 
171
+ # Access wallet account details (automatically extracted from response)
171
172
  wallet = response.data
172
- puts wallet['id']
173
- puts wallet['balance']
174
- puts wallet['currency']
173
+ puts "Wallet Account ID: #{wallet['id']}"
174
+ puts "Active: #{wallet['active']}"
175
+ puts "Balance: #{wallet['balance']}"
176
+ puts "Currency: #{wallet['currency']}"
177
+ puts "Created At: #{wallet['created_at']}"
178
+ puts "Updated At: #{wallet['updated_at']}"
179
+
180
+ # Access related resource links
181
+ puts "Self URL: #{wallet['links']['self']}"
182
+ puts "Users URL: #{wallet['links']['users']}"
183
+ puts "Batch Transactions URL: #{wallet['links']['batch_transactions']}"
184
+ puts "Transactions URL: #{wallet['links']['transactions']}"
185
+ puts "BPay Details URL: #{wallet['links']['bpay_details']}"
186
+ puts "NPP Details URL: #{wallet['links']['npp_details']}"
187
+ puts "Virtual Accounts URL: #{wallet['links']['virtual_accounts']}"
175
188
  ```
176
189
 
190
+ **Response Structure:**
191
+
192
+ ```ruby
193
+ {
194
+ "wallet_accounts" => {
195
+ "id" => "5c1c6b10-4c56-0137-8cd7-0242ac110002",
196
+ "active" => true,
197
+ "created_at" => "2019-04-29T02:42:31.536Z",
198
+ "updated_at" => "2020-05-03T12:01:02.254Z",
199
+ "balance" => 663337,
200
+ "currency" => "AUD",
201
+ "links" => {
202
+ "self" => "/transactions/aed45af0-6f63-0138-901c-0a58a9feac03/wallet_accounts",
203
+ "users" => "/wallet_accounts/5c1c6b10-4c56-0137-8cd7-0242ac110002/users",
204
+ "batch_transactions" => "/wallet_accounts/5c1c6b10-4c56-0137-8cd7-0242ac110002/batch_transactions",
205
+ "transactions" => "/wallet_accounts/5c1c6b10-4c56-0137-8cd7-0242ac110002/transactions",
206
+ "bpay_details" => "/wallet_accounts/5c1c6b10-4c56-0137-8cd7-0242ac110002/bpay_details",
207
+ "npp_details" => "/wallet_accounts/5c1c6b10-4c56-0137-8cd7-0242ac110002/npp_details",
208
+ "virtual_accounts" => "/wallet_accounts/5c1c6b10-4c56-0137-8cd7-0242ac110002/virtual_accounts"
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ **Note:** The `response.data` method automatically extracts the `wallet_accounts` object from the response, so you can access the wallet account fields directly without needing to access `response.data['wallet_accounts']`.
215
+
177
216
  ### List User Items
178
217
 
179
218
  Retrieve an ordered and paginated list of existing items the user is associated with.
@@ -277,7 +277,13 @@ module ZaiPayment
277
277
  # @example
278
278
  # users = ZaiPayment::Resources::User.new
279
279
  # response = users.wallet_account("user_id")
280
- # response.data # => {"id" => "...", "balance" => ..., ...}
280
+ # # The response.data method automatically extracts the wallet_accounts object
281
+ # wallet = response.data
282
+ # wallet["id"] # => "5c1c6b10-4c56-0137-8cd7-0242ac110002"
283
+ # wallet["balance"] # => 663337
284
+ # wallet["currency"] # => "AUD"
285
+ # wallet["active"] # => true
286
+ # wallet["links"]["transactions"] # => "/wallet_accounts/.../transactions"
281
287
  #
282
288
  # @see https://developer.hellozai.com/reference/showuserwalletaccounts
283
289
  def wallet_account(user_id)
@@ -8,7 +8,7 @@ module ZaiPayment
8
8
  RESPONSE_DATA_KEYS = %w[
9
9
  webhooks users items fees transactions
10
10
  batch_transactions bpay_accounts bank_accounts card_accounts
11
- routing_number
11
+ wallet_accounts routing_number
12
12
  ].freeze
13
13
 
14
14
  def initialize(faraday_response)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZaiPayment
4
- VERSION = '2.6.0'
4
+ VERSION = '2.6.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.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddy Jaga