zai_payment 2.7.0 โ 2.8.0
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 +4 -4
- data/badges/coverage.json +1 -1
- data/changelog.md +75 -0
- data/docs/pay_ids.md +777 -0
- data/docs/virtual_accounts.md +916 -0
- data/examples/pay_ids.md +871 -0
- data/examples/virtual_accounts.md +1530 -0
- data/lib/zai_payment/resources/pay_id.rb +197 -0
- data/lib/zai_payment/resources/virtual_account.rb +212 -0
- data/lib/zai_payment/response.rb +1 -1
- data/lib/zai_payment/version.rb +1 -1
- data/lib/zai_payment.rb +12 -0
- data/readme.md +25 -1
- metadata +7 -1
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ZaiPayment
|
|
4
|
+
module Resources
|
|
5
|
+
# PayID resource for managing Zai PayID registrations
|
|
6
|
+
#
|
|
7
|
+
# @see https://developer.hellozai.com/reference/registerpayid
|
|
8
|
+
class PayId
|
|
9
|
+
attr_reader :client
|
|
10
|
+
|
|
11
|
+
# Map of attribute keys to API field names for create
|
|
12
|
+
CREATE_FIELD_MAPPING = {
|
|
13
|
+
pay_id: :pay_id,
|
|
14
|
+
type: :type,
|
|
15
|
+
details: :details
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
18
|
+
# Valid PayID types
|
|
19
|
+
VALID_TYPES = %w[EMAIL].freeze
|
|
20
|
+
|
|
21
|
+
# Valid PayID statuses for update
|
|
22
|
+
VALID_STATUSES = %w[deregistered].freeze
|
|
23
|
+
|
|
24
|
+
def initialize(client: nil)
|
|
25
|
+
@client = client || Client.new(base_endpoint: :va_base)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Register a PayID for a given Virtual Account
|
|
29
|
+
#
|
|
30
|
+
# @param virtual_account_id [String] the virtual account ID
|
|
31
|
+
# @param attributes [Hash] PayID attributes
|
|
32
|
+
# @option attributes [String] :pay_id (Required) The PayID being registered (max 256 chars)
|
|
33
|
+
# @option attributes [String] :type (Required) The type of PayID ('EMAIL')
|
|
34
|
+
# @option attributes [Hash] :details (Required) Additional details
|
|
35
|
+
# @option details [String] :pay_id_name Name to identify the entity (1-140 chars)
|
|
36
|
+
# @option details [String] :owner_legal_name Full legal account name (1-140 chars)
|
|
37
|
+
# @return [Response] the API response containing PayID details
|
|
38
|
+
#
|
|
39
|
+
# @example Register an EMAIL PayID
|
|
40
|
+
# pay_ids = ZaiPayment::Resources::PayId.new
|
|
41
|
+
# response = pay_ids.create(
|
|
42
|
+
# '46deb476-c1a6-41eb-8eb7-26a695bbe5bc',
|
|
43
|
+
# pay_id: 'jsmith@mydomain.com',
|
|
44
|
+
# type: 'EMAIL',
|
|
45
|
+
# details: {
|
|
46
|
+
# pay_id_name: 'J Smith',
|
|
47
|
+
# owner_legal_name: 'Mr John Smith'
|
|
48
|
+
# }
|
|
49
|
+
# )
|
|
50
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", ...}
|
|
51
|
+
#
|
|
52
|
+
# @see https://developer.hellozai.com/reference/registerpayid
|
|
53
|
+
def create(virtual_account_id, **attributes)
|
|
54
|
+
validate_id!(virtual_account_id, 'virtual_account_id')
|
|
55
|
+
validate_create_attributes!(attributes)
|
|
56
|
+
|
|
57
|
+
body = build_create_body(attributes)
|
|
58
|
+
client.post("/virtual_accounts/#{virtual_account_id}/pay_ids", body: body)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Show a specific PayID
|
|
62
|
+
#
|
|
63
|
+
# @param pay_id_id [String] the PayID ID
|
|
64
|
+
# @return [Response] the API response containing PayID details
|
|
65
|
+
#
|
|
66
|
+
# @example Get PayID details
|
|
67
|
+
# pay_ids = ZaiPayment::Resources::PayId.new
|
|
68
|
+
# response = pay_ids.show('46deb476-c1a6-41eb-8eb7-26a695bbe5bc')
|
|
69
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", ...}
|
|
70
|
+
#
|
|
71
|
+
# @see https://developer.hellozai.com/reference/retrieveapayid
|
|
72
|
+
def show(pay_id_id)
|
|
73
|
+
validate_id!(pay_id_id, 'pay_id_id')
|
|
74
|
+
client.get("/pay_ids/#{pay_id_id}")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Update Status for a PayID
|
|
78
|
+
#
|
|
79
|
+
# Update the status of a PayID. Currently, this endpoint only supports deregistering
|
|
80
|
+
# PayIDs by setting the status to 'deregistered'. This is an asynchronous operation
|
|
81
|
+
# that returns a 202 Accepted response.
|
|
82
|
+
#
|
|
83
|
+
# @param pay_id_id [String] the PayID ID
|
|
84
|
+
# @param status [String] the new status (must be 'deregistered')
|
|
85
|
+
# @return [Response] the API response containing the operation status
|
|
86
|
+
#
|
|
87
|
+
# @example Deregister a PayID
|
|
88
|
+
# pay_ids = ZaiPayment::Resources::PayId.new
|
|
89
|
+
# response = pay_ids.update_status(
|
|
90
|
+
# '46deb476-c1a6-41eb-8eb7-26a695bbe5bc',
|
|
91
|
+
# 'deregistered'
|
|
92
|
+
# )
|
|
93
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", "message" => "...", ...}
|
|
94
|
+
#
|
|
95
|
+
# @see https://developer.hellozai.com/reference/updatepayidstatus
|
|
96
|
+
def update_status(pay_id_id, status)
|
|
97
|
+
validate_id!(pay_id_id, 'pay_id_id')
|
|
98
|
+
validate_status!(status)
|
|
99
|
+
|
|
100
|
+
body = { status: status }
|
|
101
|
+
client.patch("/pay_ids/#{pay_id_id}/status", body: body)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def validate_id!(value, field_name)
|
|
107
|
+
return unless value.nil? || value.to_s.strip.empty?
|
|
108
|
+
|
|
109
|
+
raise Errors::ValidationError, "#{field_name} is required and cannot be blank"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def validate_create_attributes!(attributes)
|
|
113
|
+
validate_pay_id!(attributes[:pay_id])
|
|
114
|
+
validate_type!(attributes[:type])
|
|
115
|
+
validate_details!(attributes[:details])
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def validate_pay_id!(pay_id)
|
|
119
|
+
if pay_id.nil? || pay_id.to_s.strip.empty?
|
|
120
|
+
raise Errors::ValidationError, 'pay_id is required and cannot be blank'
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
return unless pay_id.to_s.length > 256
|
|
124
|
+
|
|
125
|
+
raise Errors::ValidationError, 'pay_id must be 256 characters or less'
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def validate_type!(type)
|
|
129
|
+
raise Errors::ValidationError, 'type is required and cannot be blank' if type.nil? || type.to_s.strip.empty?
|
|
130
|
+
|
|
131
|
+
return if VALID_TYPES.include?(type.to_s.upcase)
|
|
132
|
+
|
|
133
|
+
raise Errors::ValidationError,
|
|
134
|
+
"type must be one of: #{VALID_TYPES.join(', ')}, got '#{type}'"
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def validate_details!(details)
|
|
138
|
+
raise Errors::ValidationError, 'details is required and must be a hash' if details.nil? || !details.is_a?(Hash)
|
|
139
|
+
|
|
140
|
+
validate_pay_id_name!(details[:pay_id_name])
|
|
141
|
+
validate_owner_legal_name!(details[:owner_legal_name])
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def validate_pay_id_name!(pay_id_name)
|
|
145
|
+
return unless pay_id_name
|
|
146
|
+
|
|
147
|
+
raise Errors::ValidationError, 'pay_id_name cannot be empty when provided' if pay_id_name.to_s.empty?
|
|
148
|
+
|
|
149
|
+
return unless pay_id_name.to_s.length > 140
|
|
150
|
+
|
|
151
|
+
raise Errors::ValidationError, 'pay_id_name must be between 1 and 140 characters'
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def validate_owner_legal_name!(owner_legal_name)
|
|
155
|
+
return unless owner_legal_name
|
|
156
|
+
|
|
157
|
+
raise Errors::ValidationError, 'owner_legal_name cannot be empty when provided' if owner_legal_name.to_s.empty?
|
|
158
|
+
|
|
159
|
+
return unless owner_legal_name.to_s.length > 140
|
|
160
|
+
|
|
161
|
+
raise Errors::ValidationError, 'owner_legal_name must be between 1 and 140 characters'
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
def validate_status!(status)
|
|
165
|
+
raise Errors::ValidationError, 'status cannot be blank' if status.nil? || status.to_s.strip.empty?
|
|
166
|
+
|
|
167
|
+
return if VALID_STATUSES.include?(status.to_s)
|
|
168
|
+
|
|
169
|
+
raise Errors::ValidationError,
|
|
170
|
+
"status must be 'deregistered', got '#{status}'"
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# rubocop:disable Metrics/AbcSize
|
|
174
|
+
def build_create_body(attributes)
|
|
175
|
+
body = {}
|
|
176
|
+
|
|
177
|
+
# Add pay_id
|
|
178
|
+
body[:pay_id] = attributes[:pay_id] if attributes[:pay_id]
|
|
179
|
+
|
|
180
|
+
# Add type (convert to uppercase to match API expectations)
|
|
181
|
+
body[:type] = attributes[:type].to_s.upcase if attributes[:type]
|
|
182
|
+
|
|
183
|
+
# Add details
|
|
184
|
+
if attributes[:details].is_a?(Hash)
|
|
185
|
+
body[:details] = {}
|
|
186
|
+
details = attributes[:details]
|
|
187
|
+
|
|
188
|
+
body[:details][:pay_id_name] = details[:pay_id_name] if details[:pay_id_name]
|
|
189
|
+
body[:details][:owner_legal_name] = details[:owner_legal_name] if details[:owner_legal_name]
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
body
|
|
193
|
+
end
|
|
194
|
+
# rubocop:enable Metrics/AbcSize
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ZaiPayment
|
|
4
|
+
module Resources
|
|
5
|
+
# VirtualAccount resource for managing Zai virtual accounts
|
|
6
|
+
#
|
|
7
|
+
# @see https://developer.hellozai.com/reference/createvirtualaccount
|
|
8
|
+
class VirtualAccount
|
|
9
|
+
attr_reader :client
|
|
10
|
+
|
|
11
|
+
# Map of attribute keys to API field names for create
|
|
12
|
+
CREATE_FIELD_MAPPING = {
|
|
13
|
+
account_name: :account_name,
|
|
14
|
+
aka_names: :aka_names
|
|
15
|
+
}.freeze
|
|
16
|
+
|
|
17
|
+
def initialize(client: nil)
|
|
18
|
+
@client = client || Client.new(base_endpoint: :va_base)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# List Virtual Accounts for a given Wallet Account
|
|
22
|
+
#
|
|
23
|
+
# @param wallet_account_id [String] the wallet account ID
|
|
24
|
+
# @return [Response] the API response containing array of virtual accounts
|
|
25
|
+
#
|
|
26
|
+
# @example List virtual accounts
|
|
27
|
+
# virtual_accounts = ZaiPayment::Resources::VirtualAccount.new
|
|
28
|
+
# response = virtual_accounts.list('ae07556e-22ef-11eb-adc1-0242ac120002')
|
|
29
|
+
# response.data # => [{"id" => "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", ...}, ...]
|
|
30
|
+
# response.meta # => {"total" => 2}
|
|
31
|
+
#
|
|
32
|
+
# @see https://developer.hellozai.com/reference
|
|
33
|
+
def list(wallet_account_id)
|
|
34
|
+
validate_id!(wallet_account_id, 'wallet_account_id')
|
|
35
|
+
client.get("/wallet_accounts/#{wallet_account_id}/virtual_accounts")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Show a specific Virtual Account
|
|
39
|
+
#
|
|
40
|
+
# @param virtual_account_id [String] the virtual account ID
|
|
41
|
+
# @return [Response] the API response containing virtual account details
|
|
42
|
+
#
|
|
43
|
+
# @example Get virtual account details
|
|
44
|
+
# virtual_accounts = ZaiPayment::Resources::VirtualAccount.new
|
|
45
|
+
# response = virtual_accounts.show('46deb476-c1a6-41eb-8eb7-26a695bbe5bc')
|
|
46
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", ...}
|
|
47
|
+
#
|
|
48
|
+
# @see https://developer.hellozai.com/reference/showvirtualaccount
|
|
49
|
+
def show(virtual_account_id)
|
|
50
|
+
validate_id!(virtual_account_id, 'virtual_account_id')
|
|
51
|
+
client.get("/virtual_accounts/#{virtual_account_id}")
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Create a Virtual Account for a given Wallet Account
|
|
55
|
+
#
|
|
56
|
+
# @param wallet_account_id [String] the wallet account ID
|
|
57
|
+
# @param attributes [Hash] virtual account attributes
|
|
58
|
+
# @option attributes [String] :account_name A name given for the Virtual Account (max 140 chars)
|
|
59
|
+
# @option attributes [Array<String>] :aka_names A list of AKA Names (0 to 3 items)
|
|
60
|
+
# @return [Response] the API response containing virtual account details
|
|
61
|
+
#
|
|
62
|
+
# @example Create a virtual account
|
|
63
|
+
# virtual_accounts = ZaiPayment::Resources::VirtualAccount.new
|
|
64
|
+
# response = virtual_accounts.create(
|
|
65
|
+
# 'ae07556e-22ef-11eb-adc1-0242ac120002',
|
|
66
|
+
# account_name: 'Real Estate Agency X',
|
|
67
|
+
# aka_names: ['Realestate agency X']
|
|
68
|
+
# )
|
|
69
|
+
# response.data # => {"id" => "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", ...}
|
|
70
|
+
#
|
|
71
|
+
# @see https://developer.hellozai.com/reference/listvirtualaccountbywalletaccount
|
|
72
|
+
def create(wallet_account_id, **attributes)
|
|
73
|
+
validate_id!(wallet_account_id, 'wallet_account_id')
|
|
74
|
+
validate_create_attributes!(attributes)
|
|
75
|
+
|
|
76
|
+
body = build_create_body(attributes)
|
|
77
|
+
client.post("/wallet_accounts/#{wallet_account_id}/virtual_accounts", body: body)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Update AKA Names for a Virtual Account
|
|
81
|
+
#
|
|
82
|
+
# Replace the list of AKA Names for a Virtual Account. This completely replaces
|
|
83
|
+
# the existing AKA names with the new list provided.
|
|
84
|
+
#
|
|
85
|
+
# @param virtual_account_id [String] the virtual account ID
|
|
86
|
+
# @param aka_names [Array<String>] array of AKA names (0 to 3 items)
|
|
87
|
+
# @return [Response] the API response containing updated virtual account details
|
|
88
|
+
#
|
|
89
|
+
# @example Update AKA names
|
|
90
|
+
# virtual_accounts = ZaiPayment::Resources::VirtualAccount.new
|
|
91
|
+
# response = virtual_accounts.update_aka_names(
|
|
92
|
+
# '46deb476-c1a6-41eb-8eb7-26a695bbe5bc',
|
|
93
|
+
# ['New Name 1', 'New Name 2']
|
|
94
|
+
# )
|
|
95
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", ...}
|
|
96
|
+
#
|
|
97
|
+
# @see https://developer.hellozai.com/reference/updatevirtualaccountakaname
|
|
98
|
+
def update_aka_names(virtual_account_id, aka_names)
|
|
99
|
+
validate_id!(virtual_account_id, 'virtual_account_id')
|
|
100
|
+
validate_aka_names!(aka_names)
|
|
101
|
+
|
|
102
|
+
body = { aka_names: aka_names }
|
|
103
|
+
client.patch("/virtual_accounts/#{virtual_account_id}/aka_names", body: body)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Update Account Name for a Virtual Account
|
|
107
|
+
#
|
|
108
|
+
# Change the name of a Virtual Account. This is used in CoP lookups.
|
|
109
|
+
#
|
|
110
|
+
# @param virtual_account_id [String] the virtual account ID
|
|
111
|
+
# @param account_name [String] the new account name (max 140 characters)
|
|
112
|
+
# @return [Response] the API response containing updated virtual account details
|
|
113
|
+
#
|
|
114
|
+
# @example Update account name
|
|
115
|
+
# virtual_accounts = ZaiPayment::Resources::VirtualAccount.new
|
|
116
|
+
# response = virtual_accounts.update_account_name(
|
|
117
|
+
# '46deb476-c1a6-41eb-8eb7-26a695bbe5bc',
|
|
118
|
+
# 'New Real Estate Agency Name'
|
|
119
|
+
# )
|
|
120
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", ...}
|
|
121
|
+
#
|
|
122
|
+
# @see https://developer.hellozai.com/reference/updatevirtualaccountaccountname
|
|
123
|
+
def update_account_name(virtual_account_id, account_name)
|
|
124
|
+
validate_id!(virtual_account_id, 'virtual_account_id')
|
|
125
|
+
validate_account_name!(account_name)
|
|
126
|
+
|
|
127
|
+
body = { account_name: account_name }
|
|
128
|
+
client.patch("/virtual_accounts/#{virtual_account_id}/account_name", body: body)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Update Status for a Virtual Account
|
|
132
|
+
#
|
|
133
|
+
# Close a Virtual Account. Once closed, the account cannot be reopened and will
|
|
134
|
+
# no longer be able to receive payments. This operation is asynchronous and returns
|
|
135
|
+
# a 202 Accepted response.
|
|
136
|
+
#
|
|
137
|
+
# @param virtual_account_id [String] the virtual account ID
|
|
138
|
+
# @param status [String] the new status (must be 'closed')
|
|
139
|
+
# @return [Response] the API response containing the operation status
|
|
140
|
+
#
|
|
141
|
+
# @example Close a virtual account
|
|
142
|
+
# virtual_accounts = ZaiPayment::Resources::VirtualAccount.new
|
|
143
|
+
# response = virtual_accounts.update_status(
|
|
144
|
+
# '46deb476-c1a6-41eb-8eb7-26a695bbe5bc',
|
|
145
|
+
# 'closed'
|
|
146
|
+
# )
|
|
147
|
+
# response.data # => {"id" => "46deb476-c1a6-41eb-8eb7-26a695bbe5bc", "message" => "...", ...}
|
|
148
|
+
#
|
|
149
|
+
# @see https://developer.hellozai.com/reference/updatevirtualaccount
|
|
150
|
+
def update_status(virtual_account_id, status)
|
|
151
|
+
validate_id!(virtual_account_id, 'virtual_account_id')
|
|
152
|
+
validate_status!(status)
|
|
153
|
+
|
|
154
|
+
body = { status: status }
|
|
155
|
+
client.patch("/virtual_accounts/#{virtual_account_id}/status", body: body)
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
private
|
|
159
|
+
|
|
160
|
+
def validate_id!(value, field_name)
|
|
161
|
+
return unless value.nil? || value.to_s.strip.empty?
|
|
162
|
+
|
|
163
|
+
raise Errors::ValidationError, "#{field_name} is required and cannot be blank"
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def validate_create_attributes!(attributes)
|
|
167
|
+
# Only validate if attributes are actually provided (not nil)
|
|
168
|
+
validate_account_name!(attributes[:account_name]) if attributes.key?(:account_name)
|
|
169
|
+
validate_aka_names!(attributes[:aka_names]) if attributes.key?(:aka_names)
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
def validate_account_name!(account_name)
|
|
173
|
+
if account_name.nil? || account_name.to_s.strip.empty?
|
|
174
|
+
raise Errors::ValidationError, 'account_name cannot be blank'
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
return unless account_name.to_s.length > 140
|
|
178
|
+
|
|
179
|
+
raise Errors::ValidationError, 'account_name must be 140 characters or less'
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
def validate_aka_names!(aka_names)
|
|
183
|
+
raise Errors::ValidationError, 'aka_names must be an array' unless aka_names.is_a?(Array)
|
|
184
|
+
|
|
185
|
+
return unless aka_names.length > 3
|
|
186
|
+
|
|
187
|
+
raise Errors::ValidationError, 'aka_names must contain between 0 and 3 items'
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def validate_status!(status)
|
|
191
|
+
raise Errors::ValidationError, 'status cannot be blank' if status.nil? || status.to_s.strip.empty?
|
|
192
|
+
|
|
193
|
+
return if status.to_s == 'closed'
|
|
194
|
+
|
|
195
|
+
raise Errors::ValidationError, "status must be 'closed', got '#{status}'"
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def build_create_body(attributes)
|
|
199
|
+
body = {}
|
|
200
|
+
|
|
201
|
+
attributes.each do |key, value|
|
|
202
|
+
next if value.nil? || (value.respond_to?(:empty?) && value.empty?)
|
|
203
|
+
|
|
204
|
+
api_field = CREATE_FIELD_MAPPING[key]
|
|
205
|
+
body[api_field] = value if api_field
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
body
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
data/lib/zai_payment/response.rb
CHANGED
|
@@ -8,7 +8,7 @@ module ZaiPayment
|
|
|
8
8
|
RESPONSE_DATA_KEYS = %w[
|
|
9
9
|
webhooks users items fees transactions
|
|
10
10
|
batch_transactions batches bpay_accounts bank_accounts card_accounts
|
|
11
|
-
wallet_accounts routing_number disbursements
|
|
11
|
+
wallet_accounts virtual_accounts routing_number disbursements pay_ids
|
|
12
12
|
].freeze
|
|
13
13
|
|
|
14
14
|
def initialize(faraday_response)
|
data/lib/zai_payment/version.rb
CHANGED
data/lib/zai_payment.rb
CHANGED
|
@@ -18,6 +18,8 @@ require_relative 'zai_payment/resources/bank_account'
|
|
|
18
18
|
require_relative 'zai_payment/resources/bpay_account'
|
|
19
19
|
require_relative 'zai_payment/resources/batch_transaction'
|
|
20
20
|
require_relative 'zai_payment/resources/wallet_account'
|
|
21
|
+
require_relative 'zai_payment/resources/virtual_account'
|
|
22
|
+
require_relative 'zai_payment/resources/pay_id'
|
|
21
23
|
|
|
22
24
|
module ZaiPayment
|
|
23
25
|
class << self
|
|
@@ -81,5 +83,15 @@ module ZaiPayment
|
|
|
81
83
|
def wallet_accounts
|
|
82
84
|
@wallet_accounts ||= Resources::WalletAccount.new(client: Client.new(base_endpoint: :core_base))
|
|
83
85
|
end
|
|
86
|
+
|
|
87
|
+
# @return [ZaiPayment::Resources::VirtualAccount] virtual_account resource instance
|
|
88
|
+
def virtual_accounts
|
|
89
|
+
@virtual_accounts ||= Resources::VirtualAccount.new
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @return [ZaiPayment::Resources::PayId] pay_id resource instance
|
|
93
|
+
def pay_ids
|
|
94
|
+
@pay_ids ||= Resources::PayId.new
|
|
95
|
+
end
|
|
84
96
|
end
|
|
85
97
|
end
|
data/readme.md
CHANGED
|
@@ -24,6 +24,8 @@ A lightweight and extensible Ruby client for the **Zai (AssemblyPay)** API โ s
|
|
|
24
24
|
- ๐ฆ **Bank Account Management** - Complete CRUD + validation for AU/UK bank accounts
|
|
25
25
|
- ๐ณ **BPay Account Management** - Manage BPay accounts for Australian bill payments
|
|
26
26
|
- ๐ผ **Wallet Account Management** - Show wallet accounts, check balances, and pay bills via BPay
|
|
27
|
+
- ๐ฆ **Virtual Accounts** - Complete virtual account management with PayTo and BPay support
|
|
28
|
+
- ๐ณ **PayID Management** - Create and manage PayIDs for Australian NPP payments
|
|
27
29
|
- ๐ซ **Token Auth** - Generate secure tokens for bank and card account data collection
|
|
28
30
|
- ๐ช **Webhooks** - Full CRUD + secure signature verification (HMAC SHA256)
|
|
29
31
|
- ๐งช **Batch Transactions** - Prelive-only endpoints for testing batch transaction flows
|
|
@@ -160,6 +162,23 @@ if payment_response.success?
|
|
|
160
162
|
end
|
|
161
163
|
```
|
|
162
164
|
|
|
165
|
+
### Virtual Accounts
|
|
166
|
+
|
|
167
|
+
Manage virtual accounts with support for AKA names and Confirmation of Payee (CoP) lookups.
|
|
168
|
+
|
|
169
|
+
**๐ Documentation:**
|
|
170
|
+
- ๐ [Virtual Account Management Guide](docs/virtual_accounts.md) - Complete guide for virtual accounts
|
|
171
|
+
- ๐ก [Virtual Account Examples](examples/virtual_accounts.md) - Real-world patterns and workflows
|
|
172
|
+
- ๐ [Zai: Virtual Accounts API Reference](https://developer.hellozai.com/reference/overview-va)
|
|
173
|
+
|
|
174
|
+
### PayID
|
|
175
|
+
|
|
176
|
+
Register and manage PayIDs (EMAIL type) for Australian NPP (New Payments Platform) payments.
|
|
177
|
+
|
|
178
|
+
**๐ Documentation:**
|
|
179
|
+
- ๐ [PayID Management Guide](docs/pay_ids.md) - Complete guide for PayID registration
|
|
180
|
+
- ๐ก [PayID Examples](examples/pay_ids.md) - Real-world patterns and workflows
|
|
181
|
+
|
|
163
182
|
### Token Auth
|
|
164
183
|
|
|
165
184
|
Generate secure tokens for collecting bank and card account information.
|
|
@@ -246,7 +265,8 @@ end
|
|
|
246
265
|
| โ
Token Auth | Generate bank/card tokens | Done |
|
|
247
266
|
| โ
Batch Transactions (Prelive) | Simulate batch processing flows | Done |
|
|
248
267
|
| โ
Payments | Single and recurring payments | Done |
|
|
249
|
-
|
|
|
268
|
+
| โ
Virtual Accounts | Manage virtual accounts & PayTo | Done |
|
|
269
|
+
| โ
PayID | Create and manage PayIDs | Done |
|
|
250
270
|
|
|
251
271
|
## ๐งช Development
|
|
252
272
|
|
|
@@ -305,6 +325,8 @@ Everyone interacting in the ZaiPayment project's codebases, issue trackers, chat
|
|
|
305
325
|
- [**Bank Account Guide**](docs/bank_accounts.md) - Managing bank accounts for AU/UK users
|
|
306
326
|
- [**BPay Account Guide**](docs/bpay_accounts.md) - Managing BPay accounts for Australian bill payments
|
|
307
327
|
- [**Wallet Account Guide**](docs/wallet_accounts.md) - Managing wallet accounts, checking balances, and paying bills
|
|
328
|
+
- [**Virtual Account Guide**](docs/virtual_accounts.md) - Managing virtual accounts with PayTo and BPay support
|
|
329
|
+
- [**PayID Guide**](docs/pay_ids.md) - Creating and managing PayIDs for Australian NPP payments
|
|
308
330
|
- [**Webhook Examples**](examples/webhooks.md) - Complete webhook usage guide
|
|
309
331
|
- [**Documentation Index**](docs/readme.md) - Full documentation navigation
|
|
310
332
|
|
|
@@ -314,6 +336,8 @@ Everyone interacting in the ZaiPayment project's codebases, issue trackers, chat
|
|
|
314
336
|
- [Bank Account Examples](examples/bank_accounts.md) - Bank account integration patterns
|
|
315
337
|
- [BPay Account Examples](examples/bpay_accounts.md) - BPay account integration patterns
|
|
316
338
|
- [Wallet Account Examples](examples/wallet_accounts.md) - Wallet account and bill payment workflows
|
|
339
|
+
- [Virtual Account Examples](examples/virtual_accounts.md) - Virtual account management and PayTo workflows
|
|
340
|
+
- [PayID Examples](examples/pay_ids.md) - PayID creation and management workflows
|
|
317
341
|
- [Token Auth Examples](examples/token_auths.md) - Secure token generation and integration
|
|
318
342
|
- [Webhook Examples](examples/webhooks.md) - Webhook integration patterns
|
|
319
343
|
- [Batch Transaction Examples](examples/batch_transactions.md) - Testing batch transaction flows (prelive only)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zai_payment
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eddy Jaga
|
|
@@ -75,11 +75,13 @@ files:
|
|
|
75
75
|
- docs/bpay_accounts.md
|
|
76
76
|
- docs/direct_api_usage.md
|
|
77
77
|
- docs/items.md
|
|
78
|
+
- docs/pay_ids.md
|
|
78
79
|
- docs/readme.md
|
|
79
80
|
- docs/token_auths.md
|
|
80
81
|
- docs/user_id_field.md
|
|
81
82
|
- docs/user_quick_reference.md
|
|
82
83
|
- docs/users.md
|
|
84
|
+
- docs/virtual_accounts.md
|
|
83
85
|
- docs/wallet_accounts.md
|
|
84
86
|
- docs/webhook_security_quickstart.md
|
|
85
87
|
- docs/webhook_signature.md
|
|
@@ -88,9 +90,11 @@ files:
|
|
|
88
90
|
- examples/batch_transactions.md
|
|
89
91
|
- examples/bpay_accounts.md
|
|
90
92
|
- examples/items.md
|
|
93
|
+
- examples/pay_ids.md
|
|
91
94
|
- examples/rails_card_payment.md
|
|
92
95
|
- examples/token_auths.md
|
|
93
96
|
- examples/users.md
|
|
97
|
+
- examples/virtual_accounts.md
|
|
94
98
|
- examples/wallet_accounts.md
|
|
95
99
|
- examples/webhooks.md
|
|
96
100
|
- lib/zai_payment.rb
|
|
@@ -104,8 +108,10 @@ files:
|
|
|
104
108
|
- lib/zai_payment/resources/batch_transaction.rb
|
|
105
109
|
- lib/zai_payment/resources/bpay_account.rb
|
|
106
110
|
- lib/zai_payment/resources/item.rb
|
|
111
|
+
- lib/zai_payment/resources/pay_id.rb
|
|
107
112
|
- lib/zai_payment/resources/token_auth.rb
|
|
108
113
|
- lib/zai_payment/resources/user.rb
|
|
114
|
+
- lib/zai_payment/resources/virtual_account.rb
|
|
109
115
|
- lib/zai_payment/resources/wallet_account.rb
|
|
110
116
|
- lib/zai_payment/resources/webhook.rb
|
|
111
117
|
- lib/zai_payment/response.rb
|