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