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.
data/changelog.md DELETED
@@ -1,750 +0,0 @@
1
- ## [Released]
2
-
3
- ## [2.9.0] - 2025-12-16
4
-
5
- ### Added
6
- - **Webhook Jobs API**: Retrieve and monitor webhook delivery jobs 📋
7
- - `ZaiPayment.webhooks.list_jobs(webhook_id, limit:, offset:, status:, object_id:)` - List jobs associated with a webhook
8
- - `ZaiPayment.webhooks.show_job(webhook_id, job_id)` - Get details of a specific webhook job
9
- - Support for pagination with `limit` (1-200) and `offset` parameters
10
- - Support for filtering by `status` ('success' or 'failed')
11
- - Support for filtering by `object_id`
12
- - Job details include: `uuid`, `webhook_uuid`, `object_id`, `payload`, `request_responses`, `created_at`, `updated_at`
13
- - Request responses include delivery attempts with `response_code`, `message`, and timestamps
14
- - Validation for status parameter (must be 'success' or 'failed')
15
- - Full RSpec test suite with 21 test examples
16
- - Comprehensive YARD documentation with examples
17
-
18
- ### Enhanced
19
- - **Response Class**: Added `jobs` to `RESPONSE_DATA_KEYS` for automatic data extraction
20
- - `response.data` now properly extracts jobs array from list_jobs responses
21
- - Consistent with other resource response handling
22
-
23
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.6...v2.9.0
24
-
25
- ## [2.8.6] - 2025-12-12
26
-
27
- ### Fixed
28
- - **Production API Endpoints**: Fixed incorrect production URL configuration 🔧
29
- - Corrected `core_base` endpoint to use `https://secure.api.promisepay.com` (was incorrectly set to assemblypay.com)
30
- - Corrected `va_base` endpoint to use `https://au-0000.api.assemblypay.com` (was incorrectly set to promisepay.com)
31
- - Removed deprecated `webhook_base_endpoint` method from Config class
32
- - Production environment now uses correct endpoints for core API and virtual accounts
33
- - Ensures proper routing of production API requests to Zai servers
34
-
35
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.5...v2.8.6
36
-
37
- ## [2.8.5] - 2025-12-12
38
-
39
- ### Fixed
40
- - **Webhook Environment-Based Base URL**: Fixed webhook base URL to dynamically switch based on environment 🔧
41
- - Added `Config#webhook_base_endpoint` method to determine correct endpoint per environment
42
- - Production environment: webhooks use `core_base` (`https://au-0000.api.assemblypay.com`)
43
- - Prelive environment: webhooks use `va_base` (`https://sandbox.au-0000.api.assemblypay.com`)
44
- - Webhook client now automatically uses correct base URL when switching environments
45
- - Improves on v2.8.4 which hardcoded to `core_base` for all environments
46
-
47
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.4...v2.8.5
48
-
49
- ## [2.8.4] - 2025-12-12
50
-
51
- ### Fixed
52
- - **Webhook Resource Endpoint**: Fixed webhook client to use `core_base` endpoint 🔧
53
- - Updated `ZaiPayment.webhooks` to use `Client.new(base_endpoint: :core_base)` instead of `va_base`
54
- - Ensures webhooks API uses the correct endpoint for consistency with other resources
55
- - Aligns with the pattern used by other resources (users, items, bank_accounts, etc.)
56
-
57
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.3...v2.8.4
58
-
59
- ## [2.8.3] - 2025-11-21
60
-
61
- ### Added
62
- - **Wallet Account Withdraw**: New withdraw method for Wallet Account resource 💰
63
- - `ZaiPayment.wallet_accounts.withdraw(wallet_account_id, account_id:, amount:, **options)` - Withdraw funds from a wallet account to a disbursement account
64
- - Support for basic withdrawals with account_id and amount
65
- - Support for custom descriptors (max 200 chars for NPP, 18 for DE batch)
66
- - Support for reference IDs (cannot contain '.' character)
67
- - Support for NPP IFTI payouts with end_to_end_id and ifti_information
68
- - Validation for required fields (account_id, amount)
69
- - Validation for custom descriptor length
70
- - Validation for reference_id format
71
- - Comprehensive YARD documentation with examples
72
-
73
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.2...v2.8.3
74
-
75
- ## [2.8.1] - 2025-11-07
76
-
77
- ### Fixed
78
- - **Response Data Extraction Bug**: Fixed `.data` method returning only `routing_number` value instead of full object 🐛
79
- - Removed `routing_number` from `RESPONSE_DATA_KEYS` constant - it's a field within responses, not a collection wrapper key
80
- - The `.data` method was incorrectly treating `routing_number` as a top-level data key
81
- - This caused `response.data` to return just `"803320"` (the routing number) instead of the complete virtual account object
82
- - Now properly returns the full response object when no wrapper key is found
83
- - Affected resources: Virtual Accounts (and potentially other resources with `routing_number` field)
84
- - Updated test mocks to match actual API response format (flat objects for single resources)
85
-
86
- ### Changed
87
- - **Virtual Account Test Fixtures**: Updated response structure to match actual Zai API format
88
- - Single resource responses (show, create, update) now return flat objects without wrapper keys
89
- - Collection responses (list) continue to use `virtual_accounts` wrapper key
90
- - All 87 virtual account tests passing with corrected response structure
91
-
92
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.8.0...v2.8.1
93
-
94
- ## [2.8.0] - 2025-11-07
95
-
96
- ### Added
97
- - **Virtual Accounts Resource**: Complete virtual account management for Australian payments 🏦
98
- - `ZaiPayment.virtual_accounts.list(wallet_account_id)` - List all virtual accounts for a wallet account
99
- - `ZaiPayment.virtual_accounts.show(virtual_account_id)` - Get virtual account details
100
- - `ZaiPayment.virtual_accounts.create(wallet_account_id, account_name:, aka_names:)` - Create virtual account for a wallet account
101
- - `ZaiPayment.virtual_accounts.update_aka_names(virtual_account_id, aka_names)` - Update AKA names (0-3 items)
102
- - `ZaiPayment.virtual_accounts.update_account_name(virtual_account_id, account_name)` - Update account name (used in CoP lookups)
103
- - `ZaiPayment.virtual_accounts.update_status(virtual_account_id, status)` - Close a virtual account (status: 'closed')
104
- - Support for AKA names for account aliases
105
- - Support for Confirmation of Payee (CoP) lookups via account names
106
- - Validation for account names (max 140 characters)
107
- - Validation for AKA names (0-3 items)
108
- - Full RSpec test suite with 65+ test examples
109
- - Comprehensive documentation in `docs/virtual_accounts.md`
110
- - Practical examples in `examples/virtual_accounts.md`
111
-
112
- - **PayID Resource**: PayID registration management for Australian NPP payments 💳
113
- - `ZaiPayment.pay_ids.create(virtual_account_id, pay_id:, type:, details:)` - Register a PayID for a virtual account
114
- - `ZaiPayment.pay_ids.show(pay_id_id)` - Get PayID details including status
115
- - `ZaiPayment.pay_ids.update_status(pay_id_id, status)` - Deregister a PayID (status: 'deregistered')
116
- - Support for EMAIL PayID type
117
- - Validation for PayID format (max 256 characters)
118
- - Validation for details (pay_id_name and owner_legal_name, 1-140 characters each)
119
- - Asynchronous status update with 202 Accepted response
120
- - Full RSpec test suite with 35+ test examples
121
- - Comprehensive documentation in `docs/pay_ids.md`
122
- - Practical examples in `examples/pay_ids.md`
123
-
124
- ### Documentation
125
- - **Virtual Accounts Guide** (`docs/virtual_accounts.md`):
126
- - Complete guide for all 6 virtual account endpoints
127
- - Detailed workflow for account creation and management
128
- - AKA names for account aliases
129
- - Account name updates for CoP lookups
130
- - Status updates for closing accounts
131
- - Error handling patterns
132
- - Comprehensive use cases
133
-
134
- - **Virtual Accounts Examples** (`examples/virtual_accounts.md`):
135
- - List virtual accounts examples
136
- - Show virtual account examples
137
- - Create virtual account examples
138
- - Update AKA names examples
139
- - Update account name examples
140
- - Update status (close account) examples
141
- - Complete workflow patterns
142
- - Rails integration examples
143
-
144
- - **PayID Guide** (`docs/pay_ids.md`):
145
- - Complete guide for all 3 PayID endpoints
146
- - PayID registration with EMAIL type
147
- - PayID format validation rules
148
- - Status updates for deregistration
149
- - Integration with virtual accounts
150
- - Error handling patterns
151
- - Comprehensive use cases
152
-
153
- - **PayID Examples** (`examples/pay_ids.md`):
154
- - Register PayID examples
155
- - Show PayID examples
156
- - Update status (deregister) examples
157
- - Complete workflow patterns
158
- - Rails integration examples
159
-
160
- ### Enhanced
161
- - **README.md**:
162
- - Added Virtual Accounts to features section
163
- - Added PayID to features section
164
- - Added documentation links to virtual accounts and PayID guides
165
- - Updated roadmap to mark Virtual Accounts and PayID as Done
166
-
167
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.7.0...v2.8.0
168
-
169
- ## [2.7.0] - 2025-11-04
170
-
171
- ### Added
172
- - **Batch Transactions Resource**: Complete batch transaction management for testing in prelive environment 🔄
173
- - `ZaiPayment.batch_transactions.export_transactions` - Export pending transactions to batched state
174
- - `ZaiPayment.batch_transactions.process_to_bank_processing(batch_id, exported_ids:)` - Move batch to bank_processing state
175
- - `ZaiPayment.batch_transactions.process_to_successful(batch_id, exported_ids:)` - Complete batch processing (triggers webhooks)
176
- - `ZaiPayment.batch_transactions.show_batches` - List all batches
177
- - `ZaiPayment.batch_transactions.show_batch(batch_id)` - Get specific batch details
178
- - `ZaiPayment.batch_transactions.show_transactions(batch_id, limit:, offset:)` - List transactions in a batch with pagination
179
- - Prelive-only endpoints for testing transaction processing workflows
180
- - Full RSpec test suite with 20+ test examples
181
- - Comprehensive documentation in `docs/batch_transactions.md`
182
- - Practical examples in `examples/batch_transactions.md`
183
-
184
- - **Wallet Account Resource**: Complete wallet account management for Australian payments 💼
185
- - `ZaiPayment.wallet_accounts.show(wallet_account_id)` - Get wallet account details including balance
186
- - `ZaiPayment.wallet_accounts.show_user(wallet_account_id)` - Get user associated with wallet account
187
- - `ZaiPayment.wallet_accounts.show_npp_details(wallet_account_id)` - Get NPP (New Payments Platform) details including PayID
188
- - `ZaiPayment.wallet_accounts.show_bpay_details(wallet_account_id)` - Get BPay details including biller code and reference
189
- - `ZaiPayment.wallet_accounts.pay_bill(wallet_account_id, account_id:, amount:, reference_id:)` - Pay bills via BPay from wallet
190
- - Support for checking wallet balances before transactions
191
- - Support for NPP payments with PayID
192
- - Support for BPay bill payments
193
- - Validation for payment amounts and reference IDs
194
- - Full RSpec test suite with 35+ test examples across 5 describe blocks
195
- - Comprehensive documentation in `docs/wallet_accounts.md`
196
- - Practical examples in `examples/wallet_accounts.md`
197
-
198
- ### Documentation
199
- - **Batch Transactions Guide** (`docs/batch_transactions.md`):
200
- - Complete guide for all 6 batch transaction endpoints
201
- - Detailed workflow for simulating batch processing
202
- - State transition diagrams and examples
203
- - Error handling patterns for batch operations
204
- - Important notes about prelive-only usage
205
-
206
- - **Batch Transactions Examples** (`examples/batch_transactions.md`):
207
- - Export transactions examples (3 examples)
208
- - Process to bank_processing examples (3 examples)
209
- - Process to successful examples (3 examples)
210
- - Show batches and transactions examples (6 examples)
211
- - Complete workflow patterns
212
- - Rails integration examples
213
- - Webhook simulation workflows
214
-
215
- - **Wallet Accounts Guide** (`docs/wallet_accounts.md`):
216
- - Complete guide for all 5 wallet account endpoints
217
- - Balance checking and payment workflows
218
- - NPP PayID integration examples
219
- - BPay bill payment patterns
220
- - Validation rules and error handling
221
- - Four comprehensive use cases:
222
- - Balance verification before payment
223
- - Multiple bill payments workflow
224
- - User verification for payments
225
- - Disbursement status monitoring
226
-
227
- - **Wallet Accounts Examples** (`examples/wallet_accounts.md`):
228
- - Show wallet account examples (3 examples)
229
- - Show user examples (3 examples)
230
- - NPP details examples
231
- - BPay details examples
232
- - Pay bill examples (3 examples)
233
- - Three common patterns:
234
- - Complete payment workflow
235
- - Wallet payment service class
236
- - Rails controller integration
237
-
238
- ### Enhanced
239
- - **Response Class**: Added `disbursements` to `RESPONSE_DATA_KEYS` for automatic data extraction
240
- - `response.data` now properly extracts disbursement objects from pay_bill responses
241
- - Consistent with other resource response handling
242
-
243
- ### Updated
244
- - **README.md**:
245
- - Added Wallet Accounts to features section
246
- - Added Batch Transactions documentation links
247
- - Updated roadmap to mark Payments as Done
248
- - Added quick start examples for wallet account operations
249
-
250
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.6.1...v2.7.0
251
-
252
- ## [2.6.1] - 2025-11-03
253
-
254
- ### Changed
255
- - **Wallet Accounts Response Structure**: Updated to match actual API response format 🔄
256
- - Response now properly returns nested `wallet_accounts` object with complete structure
257
- - Added `wallet_accounts` to `Response#data` automatic extraction
258
- - The `Response#data` method now automatically extracts the `wallet_accounts` object for cleaner API usage
259
- - Updated response includes: `id`, `active`, `created_at`, `updated_at`, `balance`, `currency`
260
- - Enhanced `links` structure with: `self`, `users`, `batch_transactions`, `transactions`, `bpay_details`, `npp_details`, `virtual_accounts`
261
-
262
- ### Improved
263
- - **API Consistency**: `response.data` now works consistently across all resources
264
- - Before: `response.data['wallet_accounts']['balance']` (manual extraction)
265
- - After: `response.data['balance']` (automatic extraction)
266
- - **Documentation**: Updated all wallet_account documentation and examples
267
- - Updated `docs/users.md` with complete wallet account response structure
268
- - Added note about automatic data extraction in Response class
269
- - Updated code examples in `lib/zai_payment/resources/user.rb`
270
- - **Test Coverage**: Enhanced wallet_account test suite
271
- - Split tests into focused examples for better maintainability
272
- - Added comprehensive validation for all wallet account fields
273
- - Tests for active status, timestamps, and all link fields
274
- - All tests comply with RuboCop standards
275
-
276
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.6.0...v2.6.1
277
-
278
- ## [2.6.0] - 2025-11-03
279
-
280
- ### Added
281
- - **BPay Account Resource**: Complete BPay account management for Australian bill payments 💰
282
- - `ZaiPayment.bpay_accounts.show(bpay_account_id)` - Get BPay account details including biller information
283
- - `ZaiPayment.bpay_accounts.create(user_id:, account_name:, biller_code:, bpay_crn:)` - Create BPay account for disbursement destinations
284
- - `ZaiPayment.bpay_accounts.redact(bpay_account_id)` - Redact (deactivate) a BPay account
285
- - `ZaiPayment.bpay_accounts.show_user(bpay_account_id)` - Get user associated with a BPay account
286
- - Validation for biller code (3-10 digits)
287
- - Validation for BPay CRN (Customer Reference Number, 2-20 digits)
288
- - Support for Australian bill payment disbursements
289
- - Full RSpec test suite with 12 test examples across 4 describe blocks
290
- - Comprehensive documentation in `docs/bpay_accounts.md`
291
- - Practical examples in `examples/bpay_accounts.md`
292
-
293
- ### Documentation
294
- - **BPay Accounts Guide** (`docs/bpay_accounts.md`):
295
- - Complete guide for showing, creating, redacting BPay accounts, and retrieving associated users
296
- - Detailed API reference for all four endpoints
297
- - Response structure documentation with example payloads
298
- - Validation rules for biller codes and BPay CRN formats
299
- - Error handling documentation (ValidationError, NotFoundError)
300
- - Four comprehensive use cases:
301
- - Disbursement account setup for bill payments
302
- - User verification before disbursement
303
- - Deactivating old BPay accounts
304
- - Managing multiple utility BPay accounts
305
- - Important notes about BPay account usage and restrictions
306
- - **BPay Accounts Examples** (`examples/bpay_accounts.md`):
307
- - Show BPay account examples (3 examples):
308
- - Basic account retrieval with full details
309
- - Error handling and status verification
310
- - Pre-disbursement verification workflow
311
- - Show BPay account user examples (3 examples):
312
- - User information retrieval
313
- - User verification before disbursement
314
- - Contact information extraction for notifications
315
- - Redact BPay account examples (3 examples):
316
- - Basic redaction with response handling
317
- - Comprehensive error handling
318
- - Verification before redacting workflow
319
- - Create BPay account examples (3 examples):
320
- - Basic account creation
321
- - Error handling patterns
322
- - Multiple utility account setup
323
- - Four common patterns:
324
- - Retrieve and verify before disbursement
325
- - Complete onboarding workflow with user creation
326
- - BPay account form handler for Rails applications
327
- - BPay details validation helper
328
-
329
- ### Features
330
- - BPay accounts work as disbursement destinations for Australian bill payments
331
- - Supports all major Australian billers (utilities, telecommunications, financial services, government)
332
- - Automatic biller name lookup based on biller code
333
- - Full lifecycle management (create, show, show_user, redact)
334
- - Secure validation of BPay-specific formats
335
-
336
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.5.0...v2.6.0
337
-
338
- ## [2.5.0] - 2025-11-03
339
-
340
- ### Added
341
- - **Bank Account Resource**: Complete CRUD operations plus validation for Australian and UK bank accounts 🏦
342
- - `ZaiPayment.bank_accounts.show(bank_account_id, include_decrypted_fields:)` - Get bank account details with optional decrypted fields
343
- - `ZaiPayment.bank_accounts.create_au(user_id:, bank_name:, account_name:, routing_number:, account_number:, account_type:, holder_type:, country:)` - Create Australian bank account
344
- - `ZaiPayment.bank_accounts.create_uk(user_id:, bank_name:, account_name:, routing_number:, account_number:, account_type:, holder_type:, country:, iban:, swift_code:)` - Create UK bank account with IBAN and SWIFT code
345
- - `ZaiPayment.bank_accounts.redact(bank_account_id)` - Redact (deactivate) a bank account
346
- - `ZaiPayment.bank_accounts.validate_routing_number(routing_number)` - Validate US bank routing numbers and get bank information
347
- - Support for retrieving decrypted sensitive fields (full account numbers)
348
- - Support for savings and checking account types
349
- - Support for personal and business holder types
350
- - Comprehensive validation for required fields and formats
351
- - Full RSpec test suite with 25 test examples
352
- - Comprehensive documentation in `docs/bank_accounts.md`
353
- - Practical examples in `examples/bank_accounts.md`
354
-
355
- ### Documentation
356
- - **Bank Accounts Guide** (`docs/bank_accounts.md`):
357
- - Complete guide for showing, creating, validating, and redacting bank accounts
358
- - Documentation for decrypted fields parameter
359
- - Validation endpoint documentation for US routing numbers
360
- - Redaction endpoint documentation with warnings
361
- - Validation rules for account types, holder types, and country codes
362
- - Response structure documentation
363
- - Error handling examples
364
- - Use cases for disbursement accounts, multi-currency setups, and routing number validation
365
- - **Bank Accounts Examples** (`examples/bank_accounts.md`):
366
- - Examples for retrieving bank account details (masked and decrypted)
367
- - Examples for redacting bank accounts with error handling (Examples 9-10)
368
- - Examples for validating US routing numbers (Examples 11-13)
369
- - Real-world scenarios for Australian bank accounts
370
- - UK bank account creation with IBAN/SWIFT
371
- - Business account setup examples
372
- - Multi-region account management patterns
373
- - Routing number validation integration in forms
374
- - Security best practices for handling decrypted data
375
-
376
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.4.0...v2.5.0
377
-
378
- ## [2.4.0] - 2025-11-02
379
- ### Added
380
- - **Item Payment Actions API**: Advanced payment operations for managing item transactions 💳
381
- - `ZaiPayment.items.make_payment(item_id, account_id:, device_id:, ip_address:, cvv:, merchant_phone:)` - Process a payment for an item
382
- - `ZaiPayment.items.cancel(item_id)` - Cancel an item/transaction
383
- - `ZaiPayment.items.refund(item_id, refund_amount:, refund_message:, account_id:)` - Refund a payment
384
- - `ZaiPayment.items.authorize_payment(item_id, account_id:, cvv:, merchant_phone:)` - Authorize a payment without capturing
385
- - `ZaiPayment.items.capture_payment(item_id, amount:)` - Capture a previously authorized payment
386
- - `ZaiPayment.items.void_payment(item_id)` - Void an authorized payment
387
- - `ZaiPayment.items.make_payment_async(item_id, account_id:, request_three_d_secure:)` - Process an async payment with 3D Secure 2.0 support
388
- - Support for pre-authorization workflows (authorize then capture)
389
- - Support for async payment methods (direct debit, bank transfers, PayPal)
390
- - Comprehensive validation for payment parameters
391
- - Full RSpec test suite for all payment actions
392
- - Comprehensive documentation in `docs/items.md` and `examples/items.md`
393
-
394
- ### Documentation
395
- - **Updated Items Guide** (`docs/items.md`):
396
- - Complete payment workflow examples
397
- - Pre-authorization and capture patterns
398
- - Refund and cancellation examples
399
- - Async payment handling
400
- - Error handling for payment operations
401
- - **Updated Items Examples** (`examples/items.md`):
402
- - Real-world payment scenarios
403
- - Card payment workflows
404
- - Direct debit examples
405
- - PayPal integration patterns
406
- - Refund and dispute handling
407
-
408
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.3.2...v2.4.0
409
-
410
- ## [2.3.2] - 2025-10-29
411
- ### Fixed
412
- - **Timeout Error Handling**: Improved handling of timeout errors to prevent crashes
413
- - Added explicit rescue for `Net::ReadTimeout` and `Net::OpenTimeout` errors
414
- - Previously, these errors could sometimes bypass Faraday's error handling and crash the application
415
- - Now properly converts all timeout errors to `Errors::TimeoutError` with descriptive messages
416
- - Fixes issue: "Request timed out: Net::ReadTimeout with #<TCPSocket:(closed)>"
417
-
418
- ### Changed
419
- - **Increased Default Timeouts**: Adjusted default timeout values for better reliability
420
- - Default `timeout` increased from 10 to 30 seconds (general request timeout)
421
- - Added separate `read_timeout` configuration (default: 30 seconds)
422
- - `open_timeout` remains at 10 seconds (connection establishment)
423
- - Users can still customize timeouts via configuration:
424
- ```ruby
425
- ZaiPayment.configure do |config|
426
- config.timeout = 60 # Custom general timeout
427
- config.read_timeout = 60 # Custom read timeout
428
- config.open_timeout = 15 # Custom open timeout
429
- end
430
- ```
431
-
432
- ## [2.3.1] - 2025-10-28
433
- ### Fixed
434
- - **Token Refresh Bug**: Fixed authentication token not being refreshed after expiration
435
- - Previously, the Authorization header was set once when the connection was created
436
- - After ~1 hour, tokens would expire and subsequent API calls would fail with `UnauthorizedError`
437
- - Now, the Authorization header is set dynamically on each request, ensuring fresh tokens are always used
438
- - The `TokenProvider` automatically refreshes expired tokens, preventing authentication errors
439
- - Fixes issue where some APIs would work while others failed after token expiration
440
-
441
- ## [2.3.0] - 2025-10-28
442
- ### Added
443
- - **User Management API Enhancement**: Added search parameter to list users endpoint
444
- - `ZaiPayment.users.list(limit:, offset:, search:)` - Search users by text value
445
- - Search parameter is optional and filters users by email, name, or other text fields
446
- - Example: `users.list(search: "john@example.com")`
447
-
448
- ### Changed
449
- - Coverage badge updated to 97.15%
450
-
451
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.2.0...v2.3.0
452
-
453
- ## [2.2.0] - 2025-10-24
454
- ### Added
455
- - **Extended User Management API**: 7 new user-related endpoints 🚀
456
- - `ZaiPayment.users.wallet_account(user_id)` - Show user's wallet account details
457
- - `ZaiPayment.users.items(user_id, limit:, offset:)` - List items associated with user (paginated)
458
- - `ZaiPayment.users.set_disbursement_account(user_id, account_id)` - Set user's disbursement account
459
- - `ZaiPayment.users.bank_account(user_id)` - Show user's active bank account
460
- - `ZaiPayment.users.verify(user_id)` - Verify user (prelive environment only)
461
- - `ZaiPayment.users.card_account(user_id)` - Show user's active card account
462
- - `ZaiPayment.users.bpay_accounts(user_id)` - List user's BPay accounts
463
- - All endpoints include comprehensive nested data structures:
464
- - Bank accounts with nested `bank` details (account_name, routing_number, account_type, holder_type)
465
- - Card accounts with nested `card` details (type, full_name, masked number, expiry)
466
- - BPay accounts with nested `bpay_details` (biller_code, biller_name, CRN, account_name)
467
- - Items with full transaction details (buyer/seller info, payment_type, status, links to related resources)
468
- - Validation for all user_id and account_id parameters
469
- - Links to related resources included in all responses
470
-
471
- ### Enhanced
472
- - **Response Class Refactoring**: Improved data extraction logic
473
- - Replaced complex conditional chain with iterative approach using `RESPONSE_DATA_KEYS` constant
474
- - Added support for new data keys: `bpay_accounts`, `bank_accounts`, `card_accounts`
475
- - Reduced complexity metrics (ABC, Cyclomatic, Perceived Complexity)
476
- - More maintainable and extensible architecture
477
- - **User Creation Validation**: Made `user_type` a required field
478
- - Added validation to ensure `user_type` ('payin' or 'payout') is specified when creating users
479
- - Improved error messages for missing required fields
480
- - Enhanced test suite with compact, readable validation tests
481
-
482
- ### Documentation
483
- - **Updated User Management Guide** (`docs/users.md`):
484
- - Comprehensive examples for all 7 new endpoints
485
- - Complete response structures with real API data
486
- - Detailed field access patterns for nested objects
487
- - Pagination examples for list endpoints
488
- - Related resource link usage examples
489
- - **Updated README.md**:
490
- - Added quick reference for all new endpoints
491
- - Updated user management section with complete API surface
492
- - Real API response examples integrated for:
493
- - List User Items (with buyer/seller details, transaction links)
494
- - List User's BPay Accounts (with biller details, verification status)
495
- - Show User Bank Account (with bank details, direct debit authorities)
496
- - Show User Card Account (with card details, CVV verification status)
497
-
498
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.1.0...v2.2.0
499
-
500
- ## [2.1.0] - 2025-10-24
501
- ### Added
502
- - **Token Auth API**: Token generation for bank and card accounts 🔐
503
- - `ZaiPayment.token_auths.generate(user_id:, token_type:)` - Generate tokens for secure payment data collection
504
- - Support for bank tokens (collecting bank account information)
505
- - Support for card tokens (collecting credit card information)
506
- - Token type validation (bank or card)
507
- - User ID validation
508
- - Full RSpec test suite for TokenAuth resource
509
- - Comprehensive examples documentation in `examples/token_auths.md`
510
-
511
- ### Documentation
512
- - Added detailed TokenAuth API examples with complete integration patterns
513
- - Frontend integration examples (PromisePay.js)
514
- - Rails controller integration examples
515
- - Service object pattern examples
516
- - Error handling and retry logic examples
517
- - Security best practices (token expiry management, audit logging, rate limiting)
518
- - Complete payment flow example
519
-
520
- ### Testing
521
- - 20+ new test cases for TokenAuth resource
522
- - Validation error handling tested
523
- - Case-insensitive token type support tested
524
- - Default parameter behavior tested
525
-
526
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v2.0.2...v2.1.0
527
-
528
- ## [2.0.2] - 2025-10-24
529
- ### Fixed
530
- - **Items API**: Fixed endpoint configuration to use `core_base` instead of `va_base`
531
- - Items resource now correctly uses the `https://test.api.promisepay.com` endpoint (prelive)
532
- - Resolves CloudFront 403 error when creating items via POST requests
533
- - Ensures Items API uses the same endpoint as Users API for consistency
534
-
535
- ## [2.0.1] - 2025-10-24
536
- ### Changes
537
- - Updated markdown files
538
-
539
- ## [2.0.0] - 2025-10-24
540
- ### Added
541
- - **Items Management API**: Full CRUD operations for managing Zai items (transactions/payments) 🛒
542
- - `ZaiPayment.items.list(limit:, offset:)` - List all items with pagination
543
- - `ZaiPayment.items.show(item_id)` - Get item details by ID
544
- - `ZaiPayment.items.create(**attributes)` - Create new item/transaction
545
- - `ZaiPayment.items.update(item_id, **attributes)` - Update item information
546
- - `ZaiPayment.items.delete(item_id)` - Delete an item
547
- - `ZaiPayment.items.show_seller(item_id)` - Get seller details for an item
548
- - `ZaiPayment.items.show_buyer(item_id)` - Get buyer details for an item
549
- - `ZaiPayment.items.show_fees(item_id)` - Get fees associated with an item
550
- - `ZaiPayment.items.show_wire_details(item_id)` - Get wire transfer details for an item
551
- - `ZaiPayment.items.list_transactions(item_id, limit:, offset:)` - List transactions for an item
552
- - `ZaiPayment.items.list_batch_transactions(item_id, limit:, offset:)` - List batch transactions for an item
553
- - `ZaiPayment.items.show_status(item_id)` - Get current status of an item
554
- - Comprehensive validation for item attributes (name, amount, payment_type, buyer_id, seller_id)
555
- - Support for optional item fields (description, currency, fee_ids, custom_descriptor, deposit_reference, etc.)
556
- - Full RSpec test suite for Items resource with 100% coverage
557
- - Comprehensive examples documentation in `examples/items.md`
558
-
559
- ### Changed
560
- - **User Management Enhancement**: Updated user creation validation to support user type-specific required fields
561
- - `user_type` parameter now determines which fields are required during user creation
562
- - Payin users require: `email`, `first_name`, `last_name`, `country`
563
- - Payout users require additional fields: `address_line1`, `city`, `state`, `zip`, `dob`
564
- - Company validation now enforces required fields based on user type
565
- - For payout companies, additional fields required: `address_line1`, `city`, `state`, `zip`, `phone`, `country`
566
- - All companies require: `name`, `legal_name`, `tax_number`, `business_email`, `country`
567
- - **Clarified device_id and ip_address requirements**: These fields are NOT required when creating a payin user, but become required when creating an item and charging a card
568
- - Refactored company validation logic for better maintainability and reduced cyclomatic complexity
569
-
570
- ### Documentation
571
- - Added detailed Items API examples with complete workflow demonstrations
572
- - Payment types documentation (1-7: Direct Debit, Credit Card, Bank Transfer, Wallet, BPay, PayPal, Other)
573
- - Error handling examples for Items operations
574
- - Updated User Management documentation (`docs/users.md`) with correct required fields for each user type
575
- - Updated all user examples in `examples/users.md` to reflect proper user type usage
576
- - Added clear notes about when `device_id` and `ip_address` are required
577
- - Updated company field requirements in all documentation
578
-
579
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.3.2...v2.0.0
580
-
581
- ## [1.3.2] - 2025-10-23
582
- ### Added
583
- - YARD documentation generation support with `.yardopts` configuration
584
- - Added `yard` gem as development dependency for API documentation
585
-
586
- ### Fixed
587
- - Fixed YARD link resolution warning in readme.md by converting markdown link to HTML format
588
-
589
- ### Documentation
590
- - Configured YARD to generate comprehensive API documentation
591
- - Documentation coverage: 70.59% (51 methods, 22 classes, 5 modules)
592
-
593
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.3.1...v1.3.2
594
-
595
- ## [1.3.1] - 2025-10-23
596
- ### Changed
597
- - Update error response format
598
- - Update some docs
599
-
600
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.3.0...v1.3.1
601
-
602
- ## [1.3.0] - 2025-10-23
603
- ### Added
604
- - **User Management API**: Full CRUD operations for managing Zai users (payin and payout) 👥
605
- - `ZaiPayment.users.list(limit:, offset:)` - List all users with pagination
606
- - `ZaiPayment.users.show(user_id)` - Get user details by ID
607
- - `ZaiPayment.users.create(**attributes)` - Create payin (buyer) or payout (seller/merchant) users
608
- - `ZaiPayment.users.update(user_id, **attributes)` - Update user information
609
- - Support for both payin users (buyers) and payout users (sellers/merchants)
610
- - Comprehensive validation for all user types
611
- - Email format validation
612
- - Country code validation (ISO 3166-1 alpha-3)
613
- - Date of birth format validation (DD/MM/YYYY)
614
- - User type validation (payin/payout)
615
- - Progressive profile building support
616
-
617
- ### Enhancements
618
- - **Client**: Added `base_endpoint` parameter to support multiple API endpoints
619
- - Users API uses `core_base` endpoint
620
- - Webhooks API continues to use `va_base` endpoint
621
- - **Response**: Updated `data` method to handle both `webhooks` and `users` response formats
622
- - **Main Module**: Added `users` accessor for convenient access to User resource
623
-
624
- ### Documentation
625
- - **NEW**: [User Management Guide](docs/users.md) - Comprehensive guide covering:
626
- - Overview of payin vs payout users
627
- - Required fields for each user type
628
- - Complete API reference with examples
629
- - Field reference table
630
- - Error handling patterns
631
- - Best practices for each user type
632
- - Response structures
633
- - **NEW**: [User Examples](examples/users.md) - 500+ lines of practical examples:
634
- - Basic and advanced payin user creation
635
- - Progressive profile building patterns
636
- - Payout user creation (individual and company)
637
- - International users (AU, UK, US)
638
- - List, search, and pagination
639
- - Update operations
640
- - Rails integration examples
641
- - Batch operations
642
- - User profile validation helper
643
- - RSpec integration tests
644
- - Common patterns with retry logic
645
- - **NEW**: [User Quick Reference](docs/user_quick_reference.md) - Quick lookup for common operations
646
- - **NEW**: [User Demo Script](examples/user_demo.rb) - Interactive demo of all user operations
647
- - **NEW**: [Implementation Summary](implementation.md) - Detailed summary of the implementation
648
- - **Updated**: readme.md - Added Users section with quick examples and updated roadmap
649
-
650
- ### Testing
651
- - 40+ new test cases for User resource
652
- - All CRUD operations tested
653
- - Validation error handling tested
654
- - API error handling tested
655
- - Integration tests with main module
656
- - Tests for both payin and payout user types
657
-
658
- ### API Endpoints
659
- - `GET /users` - List users
660
- - `GET /users/:id` - Show user
661
- - `POST /users` - Create user
662
- - `PATCH /users/:id` - Update user
663
-
664
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.2.0...v1.3.0
665
-
666
- ## [1.2.0] - 2025-10-22
667
- ### Added
668
- - **Webhook Security: Signature Verification** 🔒
669
- - `create_secret_key(secret_key:)` - Register a secret key with Zai
670
- - `verify_signature(payload:, signature_header:, secret_key:, tolerance:)` - Verify webhook authenticity
671
- - `generate_signature(payload, secret_key, timestamp)` - Utility for testing
672
- - HMAC SHA256 signature verification with Base64 URL-safe encoding
673
- - Timestamp validation to prevent replay attacks (configurable tolerance)
674
- - Constant-time comparison to prevent timing attacks
675
- - Support for multiple signatures (key rotation scenarios)
676
-
677
- ### Documentation
678
- - **NEW**: [Authentication Guide](docs/authentication.md) - Comprehensive guide covering:
679
- - Short way: `ZaiPayment.token` (one-liner approach)
680
- - Long way: `TokenProvider.new(config:).bearer_token` (advanced control)
681
- - Token lifecycle and automatic management
682
- - Multiple configurations, testing, error handling
683
- - Best practices and troubleshooting
684
- - **NEW**: [Webhook Security Quick Start](docs/webhook_security_quickstart.md) - 5-minute setup guide
685
- - **NEW**: [Webhook Signature Implementation](docs/webhook_signature.md) - Technical details
686
- - **NEW**: [Documentation Index](docs/readme.md) - Central navigation for all docs
687
- - **Enhanced**: [Webhook Examples](examples/webhooks.md) - Added 400+ lines of examples:
688
- - Complete Rails controller implementation
689
- - Sinatra example
690
- - Rack middleware example
691
- - Background job processing pattern
692
- - Idempotency pattern
693
- - **Enhanced**: [Webhook Technical Guide](docs/webhooks.md) - Added 170+ lines on security
694
- - **Reorganized**: All documentation moved to `docs/` folder for better organization
695
- - **Updated**: readme.md - Now concise with clear links to detailed documentation
696
-
697
- ### Testing
698
- - 56 new test cases for webhook signature verification
699
- - All tests passing: 95/95 ✓
700
- - Tests cover valid/invalid signatures, expired timestamps, malformed headers, edge cases
701
-
702
- ### Security
703
- - ✅ OWASP compliance for webhook security
704
- - ✅ RFC 2104 (HMAC) implementation
705
- - ✅ RFC 4648 (Base64url) encoding
706
- - ✅ Protection against timing attacks, replay attacks, and MITM attacks
707
-
708
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.1.0...v1.2.0
709
-
710
- ## [1.1.0] - 2025-10-22
711
- ### Added
712
- - **Webhooks API**: Full CRUD operations for managing Zai webhooks
713
- - `ZaiPayment.webhooks.list` - List all webhooks with pagination
714
- - `ZaiPayment.webhooks.show(id)` - Get a specific webhook
715
- - `ZaiPayment.webhooks.create(...)` - Create a new webhook
716
- - `ZaiPayment.webhooks.update(id, ...)` - Update an existing webhook
717
- - `ZaiPayment.webhooks.delete(id)` - Delete a webhook
718
- - **Base API Client**: Reusable HTTP client for all API requests
719
- - **Response Wrapper**: Standardized response handling with error management
720
- - **Enhanced Error Handling**: New error classes for different API scenarios
721
- - `ValidationError` (400, 422)
722
- - `UnauthorizedError` (401)
723
- - `ForbiddenError` (403)
724
- - `NotFoundError` (404)
725
- - `RateLimitError` (429)
726
- - `ServerError` (5xx)
727
- - `TimeoutError` and `ConnectionError` for network issues
728
- - Comprehensive test suite for webhook functionality
729
- - Example code in `examples/webhooks.rb`
730
-
731
- **Full Changelog**: https://github.com/Sentia/zai-payment/compare/v1.0.2...v1.1.0
732
-
733
- ## [1.0.2] - 2025-10-22
734
- - Update gemspec files and readme
735
-
736
- **Full Changelog**: https://github.com/Sentia/zai-payment/releases/tag/v1.0.2
737
-
738
-
739
- ##[1.0.1] - 2025-10-21
740
- - Update readme and versions
741
-
742
- **Full Changelog**: https://github.com/Sentia/zai-payment/releases/tag/v1.0.1
743
-
744
-
745
- ## [1.0.0] - 2025-10-21
746
-
747
- - Initial release: token auth client with in-memory caching (`ZaiPayment.token`, `refresh_token!`, `clear_token!`, `token_type`, `token_expiry`)
748
-
749
- **Full Changelog**: https://github.com/Sentia/zai-payment/commits/v1.0.0
750
-