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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68b76b84ea2dd83e23dd709f8e3e13f466b6c76288231422450aa51327c53fc8
4
- data.tar.gz: ff828a44dbc6769aff37a705b184a7868c3610ad7580261806e511f57ffe5c6e
3
+ metadata.gz: 27a391c944632b4a4b72fe58a4e22d189304455cd4f9656966d010dd22719c6d
4
+ data.tar.gz: ad176a20efd417af6d0d7dd00de7842f4efdc4154d1c9321c766631c78937525
5
5
  SHA512:
6
- metadata.gz: 1857326fecea58e66633a177f6322aa5c6cc7d93b71e51b93d768d30d470c031783ac35a2036dbc19680850554c0ea79b24cb907b16313966a0c199b1811a3f4
7
- data.tar.gz: 4125e27bc20f280f4f9a02a8b4c8d989acb8df5a7859265ac474d7412c253f80fe466f91aeee19d8a3d69b3f98de2d5c6720cdcd524c2ba34cc32714f097b4cc
6
+ metadata.gz: '07248e63f96fd8223e21868c515492b3281935b9bc89854cc3df61526e28435e72842c397b9d050fe5f21a7fe73991aa3ff62ea48cfd2c36688bcdc1445b51b7'
7
+ data.tar.gz: 70e896447209679b5b75bc41b820910b074a1bda2d6f0e9b7c2679249681749634204d13b4519e3696b7150eba66e3539745da2c81485817fd9f95e4bc0c6949
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZaiPayment
4
- VERSION = '2.9.0'
4
+ VERSION = '2.9.1'
5
5
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zai_payment
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eddy Jaga
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-12-21 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: base64
@@ -58,45 +59,7 @@ executables: []
58
59
  extensions: []
59
60
  extra_rdoc_files: []
60
61
  files:
61
- - ".yardopts"
62
- - IMPLEMENTATION_SUMMARY.md
63
62
  - LICENSE.txt
64
- - RESPONSE_FORMAT_CORRECTION.md
65
- - Rakefile
66
- - badges/.gitkeep
67
- - badges/coverage.json
68
- - changelog.md
69
- - code_of_conduct.md
70
- - contributing.md
71
- - docs/architecture.md
72
- - docs/authentication.md
73
- - docs/bank_accounts.md
74
- - docs/batch_transactions.md
75
- - docs/bpay_accounts.md
76
- - docs/direct_api_usage.md
77
- - docs/items.md
78
- - docs/pay_ids.md
79
- - docs/readme.md
80
- - docs/token_auths.md
81
- - docs/user_id_field.md
82
- - docs/user_quick_reference.md
83
- - docs/users.md
84
- - docs/virtual_accounts.md
85
- - docs/wallet_accounts.md
86
- - docs/webhook_security_quickstart.md
87
- - docs/webhook_signature.md
88
- - docs/webhooks.md
89
- - examples/bank_accounts.md
90
- - examples/batch_transactions.md
91
- - examples/bpay_accounts.md
92
- - examples/items.md
93
- - examples/pay_ids.md
94
- - examples/rails_card_payment.md
95
- - examples/token_auths.md
96
- - examples/users.md
97
- - examples/virtual_accounts.md
98
- - examples/wallet_accounts.md
99
- - examples/webhooks.md
100
63
  - lib/zai_payment.rb
101
64
  - lib/zai_payment/auth/token_provider.rb
102
65
  - lib/zai_payment/auth/token_store.rb
@@ -116,8 +79,6 @@ files:
116
79
  - lib/zai_payment/resources/webhook.rb
117
80
  - lib/zai_payment/response.rb
118
81
  - lib/zai_payment/version.rb
119
- - readme.md
120
- - sig/zai_payment.rbs
121
82
  homepage: https://www.sentia.com.au
122
83
  licenses:
123
84
  - MIT
@@ -129,6 +90,7 @@ metadata:
129
90
  code_of_conduct_uri: https://github.com/Sentia/zai-payment/blob/main/code_of_conduct.md
130
91
  rubygems_mfa_required: 'true'
131
92
  documentation_uri: https://github.com/Sentia/zai-payment#readme
93
+ post_install_message:
132
94
  rdoc_options: []
133
95
  require_paths:
134
96
  - lib
@@ -143,7 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
105
  - !ruby/object:Gem::Version
144
106
  version: '0'
145
107
  requirements: []
146
- rubygems_version: 3.7.1
108
+ rubygems_version: 3.0.3.1
109
+ signing_key:
147
110
  specification_version: 4
148
111
  summary: Ruby gem for Zai payment integration
149
112
  test_files: []
data/.yardopts DELETED
@@ -1,3 +0,0 @@
1
- --markup markdown
2
- --readme readme.md
3
- lib
@@ -1,183 +0,0 @@
1
- # Batch Transactions Implementation Summary
2
-
3
- ## Overview
4
-
5
- Successfully implemented prelive-only batch transaction endpoints for the Zai Payment Ruby gem. These endpoints allow testing and simulation of batch transaction processing flows in the prelive environment.
6
-
7
- ## Files Created
8
-
9
- ### 1. Resource Implementation
10
- **File:** `lib/zai_payment/resources/batch_transaction.rb`
11
-
12
- Implements the `BatchTransaction` resource class with the following methods:
13
- - `export_transactions` - Exports pending batch transactions to batched state
14
- - `update_transaction_states` - Updates batch transaction states (12700 or 12000)
15
- - `process_to_bank_processing` - Convenience method for state 12700
16
- - `process_to_successful` - Convenience method for state 12000 (triggers webhooks)
17
-
18
- **Key Features:**
19
- - Environment validation (prelive-only)
20
- - Comprehensive parameter validation
21
- - Clear error messages
22
- - Full YARD documentation
23
-
24
- ### 2. Spec File
25
- **File:** `spec/zai_payment/resources/batch_transaction_spec.rb`
26
-
27
- Comprehensive test coverage including:
28
- - Export transactions functionality
29
- - Update transaction states with both state codes
30
- - Convenience methods (process_to_bank_processing, process_to_successful)
31
- - Environment validation (prelive vs production)
32
- - Parameter validation for all methods
33
- - Multiple transaction ID handling
34
- - Integration with ZaiPayment module
35
-
36
- ### 3. Documentation
37
-
38
- #### Examples
39
- **File:** `examples/batch_transactions.md`
40
- - Complete workflow examples
41
- - Step-by-step usage guide
42
- - Error handling examples
43
- - Multiple transaction processing
44
- - Webhook testing guide
45
-
46
- #### Technical Documentation
47
- **File:** `docs/batch_transactions.md`
48
- - Complete method reference with signatures
49
- - Parameter descriptions and types
50
- - Return value specifications
51
- - Error handling details
52
- - State code documentation
53
- - Lifecycle diagrams
54
- - Integration examples
55
-
56
- ## Files Modified
57
-
58
- ### 1. Main Module
59
- **File:** `lib/zai_payment.rb`
60
- - Added require for batch_transaction resource
61
- - Added `batch_transactions` accessor method
62
-
63
- ### 2. Response Class
64
- **File:** `lib/zai_payment/response.rb`
65
- - Added "batches" to RESPONSE_DATA_KEYS array
66
-
67
- ### 3. README
68
- **File:** `readme.md`
69
- - Added batch transactions to Features section
70
- - Added new Quick Start section with example
71
- - Added to Roadmap as completed feature
72
- - Added to Examples & Patterns section
73
- - Added documentation links
74
-
75
- ## API Endpoints Implemented
76
-
77
- ### 1. Export Transactions
78
- **Method:** `GET /batch_transactions/export_transactions`
79
- **Purpose:** Move all pending batch_transactions to batched state
80
- **Returns:** Array of transactions with batch_id and transaction id
81
-
82
- ### 2. Update Transaction States
83
- **Method:** `PATCH /batches/:id/transaction_states`
84
- **Purpose:** Move batch transactions between states
85
- **Supports:**
86
- - State 12700 (bank_processing)
87
- - State 12000 (successful - triggers webhooks)
88
-
89
- ## Usage Example
90
-
91
- ```ruby
92
- # Configure for prelive
93
- ZaiPayment.configure do |config|
94
- config.environment = :prelive
95
- config.client_id = 'your_client_id'
96
- config.client_secret = 'your_client_secret'
97
- config.scope = 'your_scope'
98
- end
99
-
100
- # Export transactions
101
- export_response = ZaiPayment.batch_transactions.export_transactions
102
- batch_id = export_response.data.first['batch_id']
103
- transaction_ids = export_response.data.map { |t| t['id'] }
104
-
105
- # Move to bank_processing
106
- ZaiPayment.batch_transactions.process_to_bank_processing(
107
- batch_id,
108
- exported_ids: transaction_ids
109
- )
110
-
111
- # Complete processing (triggers webhook)
112
- ZaiPayment.batch_transactions.process_to_successful(
113
- batch_id,
114
- exported_ids: transaction_ids
115
- )
116
- ```
117
-
118
- ## Error Handling
119
-
120
- ### ConfigurationError
121
- Raised when attempting to use batch transaction endpoints outside prelive environment.
122
-
123
- ### ValidationError
124
- Raised for:
125
- - Blank or nil batch_id
126
- - Empty or nil exported_ids array
127
- - exported_ids not an array
128
- - exported_ids containing nil or empty values
129
- - Invalid state codes (not 12700 or 12000)
130
-
131
- ## Key Design Decisions
132
-
133
- 1. **Prelive-Only Enforcement**: Environment check in every method to prevent accidental production use
134
- 2. **Convenience Methods**: Separate methods for common operations (process_to_bank_processing, process_to_successful)
135
- 3. **Array Support**: All methods support processing multiple transactions at once
136
- 4. **State Code Constants**: Clear documentation of state codes (12700, 12000)
137
- 5. **Comprehensive Validation**: All parameters validated with clear error messages
138
- 6. **Consistent API**: Follows same patterns as other resources in the gem
139
-
140
- ## Testing
141
-
142
- The implementation includes comprehensive RSpec tests covering:
143
- - ✅ Happy path for all methods
144
- - ✅ Error cases (invalid environment, invalid parameters)
145
- - ✅ Multiple transaction handling
146
- - ✅ Response structure validation
147
- - ✅ Integration with main module
148
-
149
- ## Documentation
150
-
151
- Three levels of documentation provided:
152
- 1. **YARD Comments**: Inline documentation in the code
153
- 2. **Examples**: Practical usage examples (`examples/batch_transactions.md`)
154
- 3. **Technical Guide**: Complete reference documentation (`docs/batch_transactions.md`)
155
-
156
- ## Next Steps
157
-
158
- The implementation is complete and ready for use. To use it:
159
-
160
- 1. Ensure your environment is set to `:prelive`
161
- 2. Access via `ZaiPayment.batch_transactions`
162
- 3. Follow the workflow: export → bank_processing → successful
163
- 4. Handle webhooks triggered by the successful state
164
-
165
- ## Files Summary
166
-
167
- **Created:**
168
- - `lib/zai_payment/resources/batch_transaction.rb` (172 lines)
169
- - `spec/zai_payment/resources/batch_transaction_spec.rb` (443 lines)
170
- - `examples/batch_transactions.md` (276 lines)
171
- - `docs/batch_transactions.md` (434 lines)
172
-
173
- **Modified:**
174
- - `lib/zai_payment.rb` (added 2 lines)
175
- - `lib/zai_payment/response.rb` (added "batches" key)
176
- - `readme.md` (added sections and examples)
177
-
178
- **Total:** 1,325+ lines of code, tests, and documentation added.
179
-
180
- ## No Linter Errors
181
-
182
- All files pass linting checks with no errors or warnings.
183
-
@@ -1,75 +0,0 @@
1
- # Batch Transactions API Response Correction
2
-
3
- ## Response Format for PATCH /batches/:id/transaction_states
4
-
5
- ### ✅ Correct Response Format
6
-
7
- The actual API response for `PATCH /batches/:id/transaction_states` contains:
8
-
9
- ```json
10
- {
11
- "aggregated_jobs_uuid": "c1cbc502-9754-42fd-9731-2330ddd7a41f",
12
- "msg": "1 jobs have been sent to the queue.",
13
- "errors": []
14
- }
15
- ```
16
-
17
- ### Response Fields
18
-
19
- | Field | Type | Description |
20
- |-------|------|-------------|
21
- | `aggregated_jobs_uuid` | String | UUID identifying the batch of jobs sent to the queue |
22
- | `msg` | String | Success message indicating how many jobs were queued |
23
- | `errors` | Array | Array of any errors (typically empty on success) |
24
-
25
- ### Ruby Usage Example
26
-
27
- ```ruby
28
- response = ZaiPayment.batch_transactions.update_transaction_states(
29
- 'batch_id',
30
- exported_ids: ['439970a2-e0a1-418e-aecf-6b519c115c55'],
31
- state: 12700
32
- )
33
-
34
- # Access response data
35
- response.body['aggregated_jobs_uuid'] # => "c1cbc502-9754-42fd-9731-2330ddd7a41f"
36
- response.body['msg'] # => "1 jobs have been sent to the queue."
37
- response.body['errors'] # => []
38
-
39
- # Check for success
40
- if response.success? && response.body['errors'].empty?
41
- puts "Successfully queued #{response.body['msg']}"
42
- puts "Job UUID: #{response.body['aggregated_jobs_uuid']}"
43
- end
44
- ```
45
-
46
- ### Multiple Transactions
47
-
48
- When processing multiple transactions, the message reflects the count:
49
-
50
- ```ruby
51
- response = ZaiPayment.batch_transactions.update_transaction_states(
52
- 'batch_id',
53
- exported_ids: ['id1', 'id2', 'id3'],
54
- state: 12000
55
- )
56
-
57
- response.body['msg'] # => "3 jobs have been sent to the queue."
58
- ```
59
-
60
- ## Updated Files
61
-
62
- All documentation and specs have been updated to reflect the correct response format:
63
-
64
- 1. ✅ `lib/zai_payment/resources/batch_transaction.rb` - YARD documentation
65
- 2. ✅ `spec/zai_payment/resources/batch_transaction_spec.rb` - Test expectations
66
- 3. ✅ `examples/batch_transactions.md` - Example code
67
- 4. ✅ `docs/batch_transactions.md` - Technical documentation
68
-
69
- ## Key Points
70
-
71
- - The response is **asynchronous** - jobs are queued for processing
72
- - The `aggregated_jobs_uuid` can be used to track the batch of jobs
73
- - Check the `errors` array to ensure no errors occurred
74
- - The `msg` field contains a human-readable description of what was queued
75
-
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require 'rubocop/rake_task'
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
data/badges/.gitkeep DELETED
@@ -1,2 +0,0 @@
1
- # This directory stores coverage badge JSON
2
-
data/badges/coverage.json DELETED
@@ -1 +0,0 @@
1
- {"schemaVersion": 1, "label": "coverage", "message": "95.57%", "color": "brightgreen"}