lunixi-sdk 2.0.2 → 2.3.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/CHANGELOG.md +28 -0
- data/README.md +43 -4
- data/README.tr.md +28 -3
- data/docs/card-rewards.md +21 -0
- data/lib/lunixi/bank_connect.rb +132 -15
- data/lib/lunixi/bank_connect_filters.rb +13 -3
- data/lib/lunixi/bank_connect_pos.rb +165 -0
- data/lib/lunixi/bank_connect_values.rb +127 -5
- data/lib/lunixi/card_requests.rb +9 -1
- data/lib/lunixi/client.rb +38 -14
- data/lib/lunixi/direct_method_payment_request.rb +24 -2
- data/lib/lunixi/errors.rb +49 -0
- data/lib/lunixi/fraud.rb +3 -2
- data/lib/lunixi/fraud_uk_claims.rb +127 -0
- data/lib/lunixi/fraud_values.rb +46 -0
- data/lib/lunixi/marketplace.rb +2 -0
- data/lib/lunixi/payment_link_rules.rb +13 -1
- data/lib/lunixi/payment_link_values.rb +4 -0
- data/lib/lunixi/payment_links.rb +3 -1
- data/lib/lunixi/payment_values.rb +22 -2
- data/lib/lunixi/payments.rb +62 -6
- data/lib/lunixi/product_webhooks.rb +17 -1
- data/lib/lunixi/refund_to_wallet.rb +94 -0
- data/lib/lunixi/route_table.rb +10 -5
- data/lib/lunixi/routing_pin.rb +247 -0
- data/lib/lunixi/sanction.rb +77 -17
- data/lib/lunixi/sanction_batch.rb +215 -0
- data/lib/lunixi/sanction_values.rb +289 -5
- data/lib/lunixi/split_payment.rb +17 -2
- data/lib/lunixi/subscription_routing.rb +70 -0
- data/lib/lunixi/subscription_values.rb +26 -3
- data/lib/lunixi/subscriptions.rb +22 -2
- data/lib/lunixi/version.rb +1 -1
- data/lib/lunixi/wallet.rb +43 -7
- data/lib/lunixi/wallet_customer_sessions.rb +75 -0
- data/lib/lunixi/wallet_customer_tokens.rb +238 -0
- data/lib/lunixi/wallet_portal.rb +340 -0
- data/lib/lunixi/wallet_portal_routes.rb +171 -0
- data/lib/lunixi/wallet_routes.rb +28 -3
- data/lib/lunixi/wallet_rules.rb +131 -0
- data/lib/lunixi/wallet_values.rb +151 -0
- data/lib/lunixi.rb +12 -0
- metadata +14 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lunixi
|
|
4
|
+
# bank_connect.pos_accounts: your merchant (acquiring) records at a connected bank
|
|
5
|
+
# (/api/v1/bank-connect/pos-accounts) — merchant accounts, terminals, POS transactions, the value date
|
|
6
|
+
# calendar and the end-of-day summary.
|
|
7
|
+
#
|
|
8
|
+
# These are the bank's records: every terminal of yours at the bank is included (other devices, virtual
|
|
9
|
+
# POS, e-commerce). They are read only on a connection whose capabilities has POS_ACQUIRING. Card
|
|
10
|
+
# numbers are masked; amounts are minor-unit strings; a field without a value is nil.
|
|
11
|
+
#
|
|
12
|
+
# Scopes: bank-connect:view for accounts, terminals and request_sync; bank-connect:transactions:view for
|
|
13
|
+
# transactions, the statement and the day summary. Every call is signed, reads included. 404
|
|
14
|
+
# bank_connect.acquiring_account.not_found for an unknown POS account; 400
|
|
15
|
+
# bank_connect.acquiring.range_invalid for a range the service rejects. Filters are checked against
|
|
16
|
+
# BANK_POS_FILTERS before anything is sent.
|
|
17
|
+
class BankConnectPosAccounts
|
|
18
|
+
BASE = '/api/v1/bank-connect/pos-accounts'
|
|
19
|
+
|
|
20
|
+
def initialize(client)
|
|
21
|
+
@client = client
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Your POS accounts. connectionId narrows to one connection.
|
|
25
|
+
def list_accounts(**filters)
|
|
26
|
+
page('', 'listPosAccounts', filters)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def iterate_accounts(**filters, &block)
|
|
30
|
+
RouteResponse.each_item(filters, block) { |query| list_accounts(**query) }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# 404 bank_connect.acquiring_account.not_found for an unknown POS account.
|
|
34
|
+
def get_account(pos_account_id)
|
|
35
|
+
read(account_path(pos_account_id))
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def list_terminals(pos_account_id, **filters)
|
|
39
|
+
page("#{account_path(pos_account_id)}/terminals", 'listPosTerminals', filters)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def iterate_terminals(pos_account_id, **filters, &block)
|
|
43
|
+
RouteResponse.each_item(filters, block) { |query| list_terminals(pos_account_id, **query) }
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# POS transactions (bank-connect:transactions:view). from (inclusive) / to (exclusive) filter on the
|
|
47
|
+
# transaction time: a Time or an ISO 8601 string with a time zone, at most 92 days apart; without them
|
|
48
|
+
# the last 30 days. type takes one value or an Array of BankPosTransactionType. minAmountMinor /
|
|
49
|
+
# maxAmountMinor are non-negative minor-unit strings. provisional true returns only intraday rows,
|
|
50
|
+
# false only final ones; an intraday row is updated in place by the bank's end-of-day record.
|
|
51
|
+
def list_transactions(pos_account_id, **filters)
|
|
52
|
+
page("#{account_path(pos_account_id)}/transactions", 'listPosTransactions', filters)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def iterate_transactions(pos_account_id, **filters, &block)
|
|
56
|
+
RouteResponse.each_item(filters, block) { |query| list_transactions(pos_account_id, **query) }
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# The value date calendar: amounts to be credited per value date (gross, commission, service fee,
|
|
60
|
+
# net), oldest value date first. from / to are YYYY-MM-DD value dates, both inclusive; without from
|
|
61
|
+
# today, without to 60 days after today.
|
|
62
|
+
def list_statement(pos_account_id, **filters)
|
|
63
|
+
page("#{account_path(pos_account_id)}/statement", 'listPosStatement', filters)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def iterate_statement(pos_account_id, **filters, &block)
|
|
67
|
+
RouteResponse.each_item(filters, block) { |query| list_statement(pos_account_id, **query) }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# End-of-day status and totals of one day (YYYY-MM-DD, Turkey time).
|
|
71
|
+
def get_day_summary(pos_account_id, business_date)
|
|
72
|
+
day = BankPosFilters.day!(business_date, 'businessDate')
|
|
73
|
+
read("#{account_path(pos_account_id)}/days/#{day}")
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Brings the intraday read forward (no body, no Idempotency-Key). SCHEDULED with scheduledAt when the
|
|
77
|
+
# bank's read interval has not passed; a request while one is waiting joins it (coalesced: true).
|
|
78
|
+
def request_sync(pos_account_id)
|
|
79
|
+
RouteResponse.unwrap(@client.request('POST', "#{BASE}#{account_path(pos_account_id)}/sync"))
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def inspect
|
|
83
|
+
'#<Lunixi::BankConnectPosAccounts>'
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
private
|
|
87
|
+
|
|
88
|
+
def page(path, route, filters)
|
|
89
|
+
RouteResponse.page(@client.request('GET', BASE + path, query: BankPosFilters.query!(filters, route)))
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def read(path)
|
|
93
|
+
RouteResponse.unwrap(@client.request('GET', BASE + path))
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def account_path(pos_account_id)
|
|
97
|
+
"/#{RouteRequest.path!(':posAccountId', 'posAccountId' => pos_account_id)}"
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Local checks of the POS account filters (BANK_POS_FILTERS). Not a public API.
|
|
102
|
+
module BankPosFilters
|
|
103
|
+
DAY = /\A[0-9]{4}-[0-9]{2}-[0-9]{2}\z/
|
|
104
|
+
|
|
105
|
+
module_function
|
|
106
|
+
|
|
107
|
+
# The query of a POS account list: unknown filters, a type outside BankPosTransactionType, a bad card
|
|
108
|
+
# brand, a negative or malformed amount, a non-boolean provisional, limit outside 1–100 or a from … to
|
|
109
|
+
# window over 92 days raise ConfigurationError. The statement's from / to are YYYY-MM-DD value dates.
|
|
110
|
+
def query!(filters, route)
|
|
111
|
+
given = RouteRequest.wire_keys!(filters || {}, BANK_POS_FILTERS.fetch(route), 'POS account', 'filter')
|
|
112
|
+
query = given.each_with_object({}) do |(key, value), out|
|
|
113
|
+
out[key] = filter_value(key, value, route) if RouteRequest.present?(value)
|
|
114
|
+
end
|
|
115
|
+
check_window!(query) if route == 'listPosTransactions'
|
|
116
|
+
query
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# A YYYY-MM-DD date (trimmed).
|
|
120
|
+
def day!(value, field)
|
|
121
|
+
raise ConfigurationError, "'#{field}' must be a date in YYYY-MM-DD form." unless value.is_a?(String) && value.strip.match?(DAY)
|
|
122
|
+
|
|
123
|
+
value.strip
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def filter_value(key, value, route)
|
|
127
|
+
case key
|
|
128
|
+
when 'limit', 'cursor' then BankConnectFilters.page_value(key, value)
|
|
129
|
+
when 'connectionId', 'terminalId' then RouteValue.text!(value, key)
|
|
130
|
+
when 'from', 'to' then route == 'listPosStatement' ? day!(value, key) : RouteValue.iso_time!(value, key)
|
|
131
|
+
when 'type' then BankConnectFilters.list_of(key, value, BankPosTransactionType::ALL)
|
|
132
|
+
when 'cardBrand' then card_brand(value)
|
|
133
|
+
when 'provisional'
|
|
134
|
+
raise ConfigurationError, "'provisional' must be true or false." unless [true, false].include?(value)
|
|
135
|
+
|
|
136
|
+
value.to_s
|
|
137
|
+
else BankConnectFilters.amount(key, value)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def card_brand(value)
|
|
142
|
+
unless value.is_a?(String) && value.strip.match?(BANK_POS_CARD_BRAND_PATTERN)
|
|
143
|
+
raise ConfigurationError, "'cardBrand' must be a card brand such as VISA, MASTERCARD, TROY or AMEX."
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
value.strip
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# When both are readable from <= to and at most 92 days apart; minAmountMinor <= maxAmountMinor.
|
|
150
|
+
def check_window!(query)
|
|
151
|
+
from = RouteValue.instant(query['from'])
|
|
152
|
+
to = RouteValue.instant(query['to'])
|
|
153
|
+
if from && to
|
|
154
|
+
raise ConfigurationError, "'from' must not be after 'to'." if from > to
|
|
155
|
+
if to - from > BANK_POS_TRANSACTION_RANGE_MAX_DAYS * BankConnectFilters::DAY_SECONDS
|
|
156
|
+
raise ConfigurationError, "'from' and 'to' may be at most #{BANK_POS_TRANSACTION_RANGE_MAX_DAYS} days apart."
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
return unless query.key?('minAmountMinor') && query.key?('maxAmountMinor')
|
|
160
|
+
return unless query['minAmountMinor'].to_i > query['maxAmountMinor'].to_i
|
|
161
|
+
|
|
162
|
+
raise ConfigurationError, "'minAmountMinor' must not be greater than 'maxAmountMinor'."
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
@@ -59,14 +59,16 @@ module Lunixi
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# What a bank or a connection offers. OUTGOING_TRANSFER and FX_EXCHANGE open bank_connect.transfers and
|
|
62
|
-
# bank_connect.fx.
|
|
62
|
+
# bank_connect.fx. POS_ACQUIRING: the bank's merchant (POS) records are read (bank_connect.pos_accounts);
|
|
63
|
+
# it cannot be turned off.
|
|
63
64
|
module BankCapability
|
|
64
65
|
ACCOUNT_LIST = 'ACCOUNT_LIST'
|
|
65
66
|
BALANCE = 'BALANCE'
|
|
66
67
|
TRANSACTIONS = 'TRANSACTIONS'
|
|
67
68
|
OUTGOING_TRANSFER = 'OUTGOING_TRANSFER'
|
|
68
69
|
FX_EXCHANGE = 'FX_EXCHANGE'
|
|
69
|
-
|
|
70
|
+
POS_ACQUIRING = 'POS_ACQUIRING'
|
|
71
|
+
ALL = [ACCOUNT_LIST, BALANCE, TRANSACTIONS, OUTGOING_TRANSFER, FX_EXCHANGE, POS_ACQUIRING].freeze
|
|
70
72
|
end
|
|
71
73
|
|
|
72
74
|
# QUEUED: the read starts now or is already waiting. SCHEDULED: it runs at scheduledAt.
|
|
@@ -110,6 +112,38 @@ module Lunixi
|
|
|
110
112
|
ALL = [INTERNAL, INTRABANK, FAST, EFT, UNKNOWN].freeze
|
|
111
113
|
end
|
|
112
114
|
|
|
115
|
+
# When a previewed transfer arrives: INSTANT (internal, same bank, FAST) or BANK_HOURS (EFT).
|
|
116
|
+
module BankTransferArrival
|
|
117
|
+
INSTANT = 'INSTANT'
|
|
118
|
+
BANK_HOURS = 'BANK_HOURS'
|
|
119
|
+
UNKNOWN = 'UNKNOWN'
|
|
120
|
+
ALL = [INSTANT, BANK_HOURS, UNKNOWN].freeze
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# The receiving bank's FAST status in a route preview; UNKNOWN means EFT is used (safe default).
|
|
124
|
+
module BankFastStatus
|
|
125
|
+
ACTIVE = 'ACTIVE'
|
|
126
|
+
NOT_PARTICIPANT = 'NOT_PARTICIPANT'
|
|
127
|
+
OUT_OF_SERVICE = 'OUT_OF_SERVICE'
|
|
128
|
+
UNKNOWN = 'UNKNOWN'
|
|
129
|
+
ALL = [ACTIVE, NOT_PARTICIPANT, OUT_OF_SERVICE, UNKNOWN].freeze
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Machine codes in transfers.preview's notes; they explain why a route was chosen.
|
|
133
|
+
module BankTransferPreviewNote
|
|
134
|
+
OWN_ACCOUNT_INTERNAL = 'own_account_internal'
|
|
135
|
+
OWN_ACCOUNT_OTHER_CONNECTION = 'own_account_other_connection'
|
|
136
|
+
OWN_ACCOUNT_CURRENCY_MISMATCH = 'own_account_currency_mismatch'
|
|
137
|
+
FAST_LIMIT_EXCEEDED = 'fast_limit_exceeded'
|
|
138
|
+
FAST_RECEIVER_NOT_PARTICIPANT = 'fast_receiver_not_participant'
|
|
139
|
+
FAST_RECEIVER_OUT_OF_SERVICE = 'fast_receiver_out_of_service'
|
|
140
|
+
FAST_PARTICIPANTS_UNKNOWN = 'fast_participants_unknown'
|
|
141
|
+
FAST_SENDER_IDENTITY_MISSING = 'fast_sender_identity_missing'
|
|
142
|
+
EFT_LARGE_AMOUNT_DESCRIPTION_REQUIRED = 'eft_large_amount_description_required'
|
|
143
|
+
ALL = [OWN_ACCOUNT_INTERNAL, OWN_ACCOUNT_OTHER_CONNECTION, OWN_ACCOUNT_CURRENCY_MISMATCH, FAST_LIMIT_EXCEEDED, FAST_RECEIVER_NOT_PARTICIPANT,
|
|
144
|
+
FAST_RECEIVER_OUT_OF_SERVICE, FAST_PARTICIPANTS_UNKNOWN, FAST_SENDER_IDENTITY_MISSING, EFT_LARGE_AMOUNT_DESCRIPTION_REQUIRED].freeze
|
|
145
|
+
end
|
|
146
|
+
|
|
113
147
|
module BankTransferInitiatedVia
|
|
114
148
|
PANEL = 'PANEL'
|
|
115
149
|
API = 'API'
|
|
@@ -143,6 +177,60 @@ module Lunixi
|
|
|
143
177
|
ALL = [CREATED, COMPLETED, FAILED, RETURNED].freeze
|
|
144
178
|
end
|
|
145
179
|
|
|
180
|
+
# Type of a POS transaction in the bank's records; the amount is positive, the direction comes from the
|
|
181
|
+
# type.
|
|
182
|
+
module BankPosTransactionType
|
|
183
|
+
SALE = 'SALE'
|
|
184
|
+
INSTALLMENT_SALE = 'INSTALLMENT_SALE'
|
|
185
|
+
REFUND = 'REFUND'
|
|
186
|
+
VOID = 'VOID'
|
|
187
|
+
PREAUTH_CLOSE = 'PREAUTH_CLOSE'
|
|
188
|
+
BONUS_SALE = 'BONUS_SALE'
|
|
189
|
+
OTHER = 'OTHER'
|
|
190
|
+
ALL = [SALE, INSTALLMENT_SALE, REFUND, VOID, PREAUTH_CLOSE, BONUS_SALE, OTHER].freeze
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
# CARD_PRESENT, ECOMMERCE, MOTO (mail/telephone order) or UNKNOWN.
|
|
194
|
+
module BankPosChannel
|
|
195
|
+
CARD_PRESENT = 'CARD_PRESENT'
|
|
196
|
+
ECOMMERCE = 'ECOMMERCE'
|
|
197
|
+
MOTO = 'MOTO'
|
|
198
|
+
UNKNOWN = 'UNKNOWN'
|
|
199
|
+
ALL = [CARD_PRESENT, ECOMMERCE, MOTO, UNKNOWN].freeze
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# DAILY: intraday (provisional). END_OF_DAY: the bank's final record. FORWARD: forward value date list.
|
|
203
|
+
module BankPosTransactionSource
|
|
204
|
+
DAILY = 'DAILY'
|
|
205
|
+
END_OF_DAY = 'END_OF_DAY'
|
|
206
|
+
FORWARD = 'FORWARD'
|
|
207
|
+
ALL = [DAILY, END_OF_DAY, FORWARD].freeze
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# POS account and terminal status. MISSING: not in the bank's latest list; the record is kept.
|
|
211
|
+
module BankPosRecordStatus
|
|
212
|
+
ACTIVE = 'ACTIVE'
|
|
213
|
+
MISSING = 'MISSING'
|
|
214
|
+
ALL = [ACTIVE, MISSING].freeze
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
# End-of-day read status of one POS account day.
|
|
218
|
+
module BankPosDayStatus
|
|
219
|
+
PENDING = 'PENDING'
|
|
220
|
+
COMPLETE = 'COMPLETE'
|
|
221
|
+
FAILED = 'FAILED'
|
|
222
|
+
ALL = [PENDING, COMPLETE, FAILED].freeze
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# POS account webhook events (subscription bank_pos.*). DAY_CLOSED: a POS account's day closed, the
|
|
226
|
+
# bank's end of day was read for the first time (once per account and day, usually after 01:30 the next
|
|
227
|
+
# day). Read it with Lunixi::BankPosWebhook.parse; data holds BANK_POS_DAY_CLOSED_FIELDS.
|
|
228
|
+
module BankPosEvents
|
|
229
|
+
DAY_CLOSED = 'bank_pos.day_closed'
|
|
230
|
+
PATTERN = 'bank_pos.*'
|
|
231
|
+
ALL = [DAY_CLOSED].freeze
|
|
232
|
+
end
|
|
233
|
+
|
|
146
234
|
# Query filters each read route accepts (the gateway rejects any other with 400).
|
|
147
235
|
BANK_CONNECT_FILTERS = {
|
|
148
236
|
'listBanks' => %w[limit cursor].freeze,
|
|
@@ -159,15 +247,31 @@ module Lunixi
|
|
|
159
247
|
BANK_CONNECT_BOOKED_RANGE_MAX_DAYS = 92
|
|
160
248
|
BANK_CONNECT_CURSOR_MAX_LENGTH = 2048
|
|
161
249
|
|
|
250
|
+
# Query fields each POS account list accepts (the gateway rejects any other with 400).
|
|
251
|
+
BANK_POS_FILTERS = {
|
|
252
|
+
'listPosAccounts' => %w[limit cursor connectionId].freeze,
|
|
253
|
+
'listPosTerminals' => %w[limit cursor].freeze,
|
|
254
|
+
'listPosTransactions' => %w[limit cursor terminalId from to type cardBrand minAmountMinor maxAmountMinor provisional].freeze,
|
|
255
|
+
'listPosStatement' => %w[limit cursor terminalId from to].freeze
|
|
256
|
+
}.freeze
|
|
257
|
+
# Widest from … to window of one POS transaction request, in days.
|
|
258
|
+
BANK_POS_TRANSACTION_RANGE_MAX_DAYS = 92
|
|
259
|
+
# Card brands the POS transaction filter takes (the gateway accepts 1–16 letters).
|
|
260
|
+
BANK_POS_CARD_BRAND_PATTERN = /\A[A-Za-z]{1,16}\z/
|
|
261
|
+
|
|
162
262
|
# Transfer and exchange routes: method, path, body fields, query fields and the Idempotency-Key rule.
|
|
163
263
|
# The same table as the Node SDK's BANK_TRANSFER_ROUTES (forbidNonWhitelisted: any other field is a
|
|
164
264
|
# 400); the parity test compares it with the shared catalog. Every route is signed and needs
|
|
165
265
|
# bank-connect:transfer plus a key with an IP allowlist.
|
|
166
266
|
BANK_TRANSFER_ROUTES = {
|
|
167
267
|
'listTransferPurposes' => RouteRequest.route('GET', '/api/v1/bank-connect/transfer-purposes', idempotency_key: false, query: %w[connectionId]),
|
|
268
|
+
'previewTransfer' => RouteRequest.route('POST', '/api/v1/bank-connect/transfers/preview',
|
|
269
|
+
idempotency_key: false, required: %w[accountId amountMinor],
|
|
270
|
+
optional: %w[receiverIban recipientId receiverAccountId currency]),
|
|
168
271
|
'createTransfer' => RouteRequest.route('POST', '/api/v1/bank-connect/transfers',
|
|
169
|
-
idempotency_key: true, required: %w[accountId
|
|
170
|
-
optional: %w[currency paymentPurpose description
|
|
272
|
+
idempotency_key: true, required: %w[accountId amountMinor],
|
|
273
|
+
optional: %w[receiverIban recipientId receiverAccountId receiverName currency paymentPurpose description
|
|
274
|
+
saveRecipient]),
|
|
171
275
|
'listTransfers' => RouteRequest.route('GET', '/api/v1/bank-connect/transfers',
|
|
172
276
|
idempotency_key: false, query: %w[limit cursor accountId status createdFrom createdTo]),
|
|
173
277
|
'getTransfer' => RouteRequest.route('GET', '/api/v1/bank-connect/transfers/:transferId', idempotency_key: false),
|
|
@@ -177,9 +281,22 @@ module Lunixi
|
|
|
177
281
|
optional: %w[sourceAmountMinor targetAmountMinor]),
|
|
178
282
|
'createFxOrder' => RouteRequest.route('POST', '/api/v1/bank-connect/fx/orders', idempotency_key: true, required: %w[quoteId], optional: %w[description]),
|
|
179
283
|
'listFxOrders' => RouteRequest.route('GET', '/api/v1/bank-connect/fx/orders', idempotency_key: false, query: %w[limit cursor status]),
|
|
180
|
-
'getFxOrder' => RouteRequest.route('GET', '/api/v1/bank-connect/fx/orders/:orderId', idempotency_key: false)
|
|
284
|
+
'getFxOrder' => RouteRequest.route('GET', '/api/v1/bank-connect/fx/orders/:orderId', idempotency_key: false),
|
|
285
|
+
'listTransferRecipients' => RouteRequest.route('GET', '/api/v1/bank-connect/transfer-recipients', idempotency_key: false, query: %w[limit cursor q]),
|
|
286
|
+
'createTransferRecipient' => RouteRequest.route('POST', '/api/v1/bank-connect/transfer-recipients',
|
|
287
|
+
idempotency_key: false, required: %w[iban name], optional: %w[nickname]),
|
|
288
|
+
'updateTransferRecipient' => RouteRequest.route('PATCH', '/api/v1/bank-connect/transfer-recipients/:recipientId',
|
|
289
|
+
idempotency_key: false, required: [], optional: %w[name nickname]),
|
|
290
|
+
'deleteTransferRecipient' => RouteRequest.route('DELETE', '/api/v1/bank-connect/transfer-recipients/:recipientId', idempotency_key: false)
|
|
181
291
|
}.freeze
|
|
182
292
|
|
|
293
|
+
# The receiver of a transfer or a preview: exactly one of these fields.
|
|
294
|
+
BANK_TRANSFER_RECEIVER_FIELDS = %w[receiverIban recipientId receiverAccountId].freeze
|
|
295
|
+
# Longest saved recipient nickname.
|
|
296
|
+
BANK_TRANSFER_RECIPIENT_NICKNAME_MAX = 64
|
|
297
|
+
# Longest q of transfer_recipients.list.
|
|
298
|
+
BANK_TRANSFER_RECIPIENT_SEARCH_MAX = 64
|
|
299
|
+
|
|
183
300
|
# Idempotency-Key of create_transfer / create_order: 8–200 printable ASCII characters.
|
|
184
301
|
BANK_TRANSFER_IDEMPOTENCY_KEY_PATTERN = RouteRequest::PRINTABLE_IDEMPOTENCY_KEY
|
|
185
302
|
# paymentPurpose: a code from transfers.list_purposes.
|
|
@@ -202,4 +319,9 @@ module Lunixi
|
|
|
202
319
|
transferId connectionId accountId bankEftCode bankName status rail amountMinor currency receiverIbanMasked receiverNameMasked
|
|
203
320
|
paymentPurpose description failureCode idempotencyKey createdAt completedAt failedAt returnedAt
|
|
204
321
|
].freeze
|
|
322
|
+
# data fields of the bank_pos.day_closed webhook (amounts are minor-unit strings, counts integers).
|
|
323
|
+
BANK_POS_DAY_CLOSED_FIELDS = %w[
|
|
324
|
+
acquiringAccountId connectionId bankEftCode bankName merchantNumber businessDate saleCount saleAmountMinor refundCount
|
|
325
|
+
refundAmountMinor netAmountMinor commissionAmountMinor currency
|
|
326
|
+
].freeze
|
|
205
327
|
end
|
data/lib/lunixi/card_requests.rb
CHANGED
|
@@ -49,7 +49,7 @@ module Lunixi
|
|
|
49
49
|
bin_or_pan!(data['binOrPan']) unless data['binOrPan'].nil?
|
|
50
50
|
installment!(data['installment']) unless data['installment'].nil?
|
|
51
51
|
data['enabledInstallments'] = EnabledInstallments.check!(data['enabledInstallments']) if data.key?('enabledInstallments')
|
|
52
|
-
data
|
|
52
|
+
RoutingPin.field!(data)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
# Body of POST /api/v1/payments/cards: card, cardUserKey, an HTTPS callbackUrl, the buyer and the
|
|
@@ -116,6 +116,14 @@ module Lunixi
|
|
|
116
116
|
self
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
+
# The same routing you will charge with: the table is computed for the pinned target (STRICT: only
|
|
120
|
+
# the installments it is authorized for) and the quote token is bound to the pin; another pin
|
|
121
|
+
# answers 422 installment.quote.pin_mismatch.
|
|
122
|
+
def with_routing(value)
|
|
123
|
+
@payload['routing'] = RoutingPin.pin!(value)
|
|
124
|
+
self
|
|
125
|
+
end
|
|
126
|
+
|
|
119
127
|
def to_h
|
|
120
128
|
@payload.dup
|
|
121
129
|
end
|
data/lib/lunixi/client.rb
CHANGED
|
@@ -5,12 +5,14 @@ require 'time'
|
|
|
5
5
|
|
|
6
6
|
module Lunixi
|
|
7
7
|
# Thread-safe server-side gateway client. Responses retain the gateway envelope.
|
|
8
|
-
class Client
|
|
8
|
+
class Client # rubocop:disable Metrics/ClassLength -- one entry point for every product client and the one request pipeline
|
|
9
9
|
AUTH_PATH = '/api/v1/auth/token'
|
|
10
10
|
METHODS = %w[GET HEAD POST PUT PATCH DELETE].freeze
|
|
11
11
|
ACCEPT_JSON = 'application/json'
|
|
12
12
|
# The customer-portal link routes of subscriptions live under the panel API.
|
|
13
13
|
PANEL_PORTAL_PATH = %r{\A/api/panel/v1/subscriptions/portal(?:/|\z)}
|
|
14
|
+
# A caller-supplied bearer token (the wallet customer session's access token).
|
|
15
|
+
BEARER_TOKEN = %r{\A[A-Za-z0-9_.:~+/=-]{1,8192}\z}
|
|
14
16
|
attr_reader :payments, :fraud, :reference, :payment_links, :physical_pos, :physical_pos_management, :wallet, :bank_connect, :sanction,
|
|
15
17
|
:insurance, :subscriptions, :kyc, :identity, :marketplace
|
|
16
18
|
|
|
@@ -37,9 +39,10 @@ module Lunixi
|
|
|
37
39
|
physical_pos_gateway = PhysicalPosGateway.new(self, max_retries: max_retries, backoff: ->(attempt) { pause(attempt, {}) })
|
|
38
40
|
@physical_pos = PhysicalPos.new(physical_pos_gateway)
|
|
39
41
|
@physical_pos_management = PhysicalPosManagement.new(physical_pos_gateway)
|
|
40
|
-
@wallet = Wallet.new(self)
|
|
42
|
+
@wallet = Wallet.new(self, clock: @clock, sleeper: @sleeper)
|
|
41
43
|
@bank_connect = BankConnect.new(self, max_retries: max_retries, backoff: ->(attempt) { pause(attempt, {}) })
|
|
42
|
-
|
|
44
|
+
# The transport also carries the bulk screening file part PUTs to storage, outside Client#request.
|
|
45
|
+
@sanction = Sanction.new(self, storage_transport: @transport)
|
|
43
46
|
@insurance = Insurance.new(self)
|
|
44
47
|
@subscriptions = Subscriptions.new(self)
|
|
45
48
|
@kyc = Kyc.new(self)
|
|
@@ -51,8 +54,15 @@ module Lunixi
|
|
|
51
54
|
# not invent field schemas, interpret financial results or retry an unsafe POST. With binary: true a
|
|
52
55
|
# 2xx body is returned as frozen bytes; accept: names the media types the endpoint answers with.
|
|
53
56
|
# max_retries: lowers the client's retry budget for this call (0 sends a single attempt).
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
# actor_id is sent as X-Actor-Id: the person in your organization acting, on endpoints that record a
|
|
58
|
+
# person's action (validated by the operation that needs it).
|
|
59
|
+
# bearer: sends that token as Authorization: Bearer instead of the merchant access token (the wallet
|
|
60
|
+
# customer session of the portal routes, which are signed as well); with bearer: a 401 is raised, never
|
|
61
|
+
# answered by minting a merchant token. reauth: false turns the 401 re-authentication off (routes where
|
|
62
|
+
# a 401 is a verdict on the request, not on the token). end_user_ip: is sent as X-Lunixi-End-User-Ip (a
|
|
63
|
+
# signal only; not signed).
|
|
64
|
+
def request(method, path, body: nil, query: {}, idempotency_key: nil, signed: true, binary: false, accept: ACCEPT_JSON, # rubocop:disable Metrics/ParameterLists -- transport options are keyword arguments
|
|
65
|
+
max_retries: nil, actor_id: nil, bearer: nil, reauth: true, end_user_ip: nil)
|
|
56
66
|
method = method.to_s.upcase
|
|
57
67
|
raise ConfigurationError, 'Unsupported HTTP method' unless METHODS.include?(method)
|
|
58
68
|
raise ConfigurationError, 'GET and HEAD cannot have a body' if %w[GET HEAD].include?(method) && !body.nil?
|
|
@@ -69,7 +79,7 @@ module Lunixi
|
|
|
69
79
|
bytes = body.nil? ? nil : JsonBody.dump(body)
|
|
70
80
|
raise ConfigurationError, 'Request body exceeds the size limit' if bytes && bytes.bytesize > 1024 * 1024
|
|
71
81
|
|
|
72
|
-
perform_request(method, path, bytes, key, signed, binary, accept, retries)
|
|
82
|
+
perform_request(method, path, bytes, key, signed, binary, accept, retries, request_extra(actor_id, bearer, reauth, end_user_ip))
|
|
73
83
|
end
|
|
74
84
|
|
|
75
85
|
# Validates caller-owned durable keys; a generated key on every retry is unsafe.
|
|
@@ -93,12 +103,20 @@ module Lunixi
|
|
|
93
103
|
def request_idempotency_key(path, key)
|
|
94
104
|
return PhysicalPosIdentifiers.idempotency_key!(key) if path.match?(PhysicalPosRequest::ROUTE)
|
|
95
105
|
return RouteRequest.printable_idempotency_key!(key) if path.match?(RouteRequest::PRINTABLE_KEY_ROUTE)
|
|
96
|
-
return WalletInvoker.idempotency_key!(key) if path.match?(WalletInvoker::ROUTE)
|
|
106
|
+
return WalletInvoker.idempotency_key!(key) if path.match?(WalletInvoker::ROUTE) || path.match?(WalletPortal::ROUTE)
|
|
97
107
|
return RouteTable.idempotency_key!(key) if path.match?(RouteTable::KEY_ROUTE)
|
|
108
|
+
return Sanction.screening_key!(key) if path.match?(Sanction::SCREENING_ROUTE)
|
|
98
109
|
|
|
99
110
|
self.class.idempotency_key!(key)
|
|
100
111
|
end
|
|
101
112
|
|
|
113
|
+
def request_extra(actor_id, bearer, reauth, end_user_ip)
|
|
114
|
+
raise ConfigurationError, 'Invalid X-Actor-Id' unless actor_id.nil? || actor_id.match?(/\A[A-Za-z0-9._@+-]{1,64}\z/)
|
|
115
|
+
raise ConfigurationError, 'Invalid bearer token' unless bearer.nil? || (bearer.is_a?(String) && bearer.match?(BEARER_TOKEN))
|
|
116
|
+
|
|
117
|
+
{ actor_id: actor_id, bearer: bearer, reauth: reauth != false, end_user_ip: end_user_ip.nil? ? nil : WalletRules.end_user_ip!(end_user_ip) }
|
|
118
|
+
end
|
|
119
|
+
|
|
102
120
|
def retry_budget(max_retries)
|
|
103
121
|
return @max_retries if max_retries.nil?
|
|
104
122
|
raise ConfigurationError, "max_retries must be between 0 and #{@max_retries}" unless max_retries.is_a?(Integer) && max_retries.between?(0, @max_retries)
|
|
@@ -106,14 +124,17 @@ module Lunixi
|
|
|
106
124
|
max_retries
|
|
107
125
|
end
|
|
108
126
|
|
|
109
|
-
|
|
127
|
+
# extra: actor_id, bearer, reauth, end_user_ip (see #request).
|
|
128
|
+
def perform_request(method, path, bytes, key, signed, binary, accept, max_retries, extra = {})
|
|
110
129
|
safe_to_retry = %w[GET HEAD].include?(method) || !key.nil?
|
|
130
|
+
bearer = extra[:bearer]
|
|
131
|
+
reauth = extra.fetch(:reauth, true) && bearer.nil?
|
|
111
132
|
retries = 0
|
|
112
133
|
reauthenticated = false
|
|
113
134
|
loop do
|
|
114
|
-
token = access_token
|
|
115
|
-
response = transmit(method, path, bytes, key, token, signed, accept)
|
|
116
|
-
if response.status == 401 && !reauthenticated && safe_to_retry
|
|
135
|
+
token = bearer || access_token
|
|
136
|
+
response = transmit(method, path, bytes, key, token, signed, accept, extra)
|
|
137
|
+
if response.status == 401 && !reauthenticated && safe_to_retry && reauth
|
|
117
138
|
invalidate_token(token)
|
|
118
139
|
reauthenticated = true
|
|
119
140
|
next
|
|
@@ -148,8 +169,9 @@ module Lunixi
|
|
|
148
169
|
end
|
|
149
170
|
|
|
150
171
|
def safe_path(path, query)
|
|
151
|
-
unless path.is_a?(String) && (path.start_with?('/api/v1/') || path.match?(PANEL_PORTAL_PATH)
|
|
152
|
-
|
|
172
|
+
unless path.is_a?(String) && (path.start_with?('/api/v1/') || path.match?(PANEL_PORTAL_PATH) || path.match?(WalletPortal::ROUTE)) &&
|
|
173
|
+
path.match?(%r{\A/[a-zA-Z0-9_~./%-]+\z})
|
|
174
|
+
raise ConfigurationError, 'Only relative /api/v1/ gateway paths (and the subscription and wallet portal routes) are accepted'
|
|
153
175
|
end
|
|
154
176
|
|
|
155
177
|
path.split('/').each do |segment|
|
|
@@ -188,11 +210,13 @@ module Lunixi
|
|
|
188
210
|
headers
|
|
189
211
|
end
|
|
190
212
|
|
|
191
|
-
def transmit(method, path, body, key, token, signed, accept = ACCEPT_JSON)
|
|
213
|
+
def transmit(method, path, body, key, token, signed, accept = ACCEPT_JSON, extra = {})
|
|
192
214
|
headers = { 'Accept' => accept, 'User-Agent' => "lunixi-sdk-ruby/#{VERSION}" }
|
|
193
215
|
headers['Authorization'] = "Bearer #{token}" if token
|
|
194
216
|
headers['Content-Type'] = 'application/json' unless body.nil?
|
|
195
217
|
headers['Idempotency-Key'] = key if key
|
|
218
|
+
headers['X-Actor-Id'] = extra[:actor_id] if extra[:actor_id]
|
|
219
|
+
headers['X-Lunixi-End-User-Ip'] = extra[:end_user_ip] if extra[:end_user_ip]
|
|
196
220
|
headers.merge!(signed_headers(method, path, body)) if signed
|
|
197
221
|
response = @transport.call(method: method, uri: URI.parse(@origin + path), headers: headers.freeze, body: body)
|
|
198
222
|
unless response.is_a?(Response) && response.status.is_a?(Integer) && response.headers.is_a?(Hash) && response.body.is_a?(String)
|
|
@@ -71,6 +71,12 @@ module Lunixi
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# Card only. true charges with 3D Secure: the response carries a REDIRECT action.
|
|
74
|
+
# Attach the buyer-approved amount from query_card_rewards.
|
|
75
|
+
def with_card_reward_selection(selection_id, amount_minor)
|
|
76
|
+
@payload['cardRewardSelection'] = { 'selectionId' => text(selection_id, 'selectionId'), 'amountMinor' => Money.minor(amount_minor) }
|
|
77
|
+
self
|
|
78
|
+
end
|
|
79
|
+
|
|
74
80
|
def with_force3d(value)
|
|
75
81
|
@payload['force3D'] = boolean(value, 'force3D')
|
|
76
82
|
self
|
|
@@ -123,6 +129,15 @@ module Lunixi
|
|
|
123
129
|
assign('metadata', value)
|
|
124
130
|
end
|
|
125
131
|
|
|
132
|
+
# Pins the payment to a provider and/or one of your connections ({ providerCode:, credentialId:,
|
|
133
|
+
# mode: }, RoutingPinMode). Card: STRICT uses only the target (422 payment.routing.pin_not_eligible
|
|
134
|
+
# when it cannot take the payment, nothing is charged); PREFER (default) falls back to normal
|
|
135
|
+
# routing. Other methods: the block's providerCode stays strict and must equal routing.providerCode
|
|
136
|
+
# when both are given; mode applies to the connection choice. Not for BANK_TRANSFER.
|
|
137
|
+
def with_routing(value)
|
|
138
|
+
assign('routing', RoutingPin.pin!(value))
|
|
139
|
+
end
|
|
140
|
+
|
|
126
141
|
def with_basket_items(items)
|
|
127
142
|
raise ConfigurationError, 'basketItems must be an array of objects' unless items.is_a?(Array)
|
|
128
143
|
|
|
@@ -150,12 +165,18 @@ module Lunixi
|
|
|
150
165
|
# string-keyed copy: known fields only, the chosen method's block and no other, card fields only
|
|
151
166
|
# with CARD, block structure, promissory-note plan, shopping-loan basket, no providerCode for
|
|
152
167
|
# BANK_TRANSFER. payments.direct_method_payment also checks the order details (OrderDetails).
|
|
153
|
-
def self.payload!(body)
|
|
168
|
+
def self.payload!(body) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity -- one check per gateway rule, in gateway order
|
|
154
169
|
raise ConfigurationError, 'A direct method payment needs a body; use DirectMethodPaymentRequest to build it' unless body.is_a?(Hash)
|
|
155
170
|
|
|
156
171
|
data = JSON.parse(JsonBody.dump(body))
|
|
157
172
|
raise ConfigurationError, 'Removed amount field; use amount in integer minor units' if %w[price paidPrice].any? { |key| data.key?(key) }
|
|
158
173
|
|
|
174
|
+
if data.key?('cardRewardSelection')
|
|
175
|
+
selection = data['cardRewardSelection']
|
|
176
|
+
raise ConfigurationError, 'Invalid reward selection' unless selection.is_a?(Hash) && selection['selectionId'].is_a?(String)
|
|
177
|
+
|
|
178
|
+
Money.minor(selection['amountMinor'])
|
|
179
|
+
end
|
|
159
180
|
unknown = data.keys - DIRECT_METHOD_PAYMENT_FIELDS
|
|
160
181
|
raise ConfigurationError, "Unknown direct method payment field(s): #{unknown.join(', ')}" unless unknown.empty?
|
|
161
182
|
|
|
@@ -172,7 +193,8 @@ module Lunixi
|
|
|
172
193
|
%w[preauth force3D].each do |field|
|
|
173
194
|
raise ConfigurationError, "#{field} must be a JSON boolean" if data.key?(field) && ![true, false].include?(data[field])
|
|
174
195
|
end
|
|
175
|
-
data
|
|
196
|
+
own = method == PaymentMethod::CARD ? nil : data[block_name]
|
|
197
|
+
RoutingPin.field!(data, payment_method: method, block_provider_code: own.is_a?(Hash) ? own['providerCode'] : nil)
|
|
176
198
|
end
|
|
177
199
|
|
|
178
200
|
# Block name of a method other than card; a method without a block cannot be paid here yet.
|
data/lib/lunixi/errors.rb
CHANGED
|
@@ -97,4 +97,53 @@ module Lunixi
|
|
|
97
97
|
super(code: CODE, **)
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
|
+
|
|
101
|
+
# Wallet customer session (merchant-vouched, /api/v1/wallet/customer-sessions, and the portal calls made
|
|
102
|
+
# with its tokens). session_ended is true when the session can no longer be used and the customer has to
|
|
103
|
+
# start a new one (wallet.customer_sessions.start); through wallet.portal the stored tokens of
|
|
104
|
+
# customer_key are already deleted then.
|
|
105
|
+
class WalletCustomerSessionError < ApiError
|
|
106
|
+
attr_reader :session_ended, :customer_key
|
|
107
|
+
|
|
108
|
+
def initialize(session_ended: false, customer_key: nil, **)
|
|
109
|
+
@session_ended = session_ended == true
|
|
110
|
+
@customer_key = customer_key
|
|
111
|
+
super(**)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def session_ended?
|
|
115
|
+
@session_ended
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# The same error naming customer_key (used when a session route error reaches a portal call).
|
|
119
|
+
def with_customer_key(customer_key)
|
|
120
|
+
self.class.new(status: status, code: code, request_id: request_id, retry_after: retry_after, details: details,
|
|
121
|
+
message: message, session_ended: session_ended, customer_key: customer_key)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# 401 AUTH_SESSION_BINDING_MISMATCH (the request was signed by another key or tenant than the one that
|
|
126
|
+
# opened the session) or AUTH_SESSION_BINDING_REQUIRED. The session is not burned; the request was made
|
|
127
|
+
# with the wrong key.
|
|
128
|
+
class WalletCustomerSessionBindingError < WalletCustomerSessionError; end
|
|
129
|
+
|
|
130
|
+
# 401 AUTH_REFRESH_REUSED: a refresh token that was already rotated was sent again. The gateway has
|
|
131
|
+
# revoked the whole session; start a new one.
|
|
132
|
+
class WalletCustomerRefreshReusedError < WalletCustomerSessionError; end
|
|
133
|
+
|
|
134
|
+
# The session can no longer be used: expired, revoked, refresh token invalid, re-authentication
|
|
135
|
+
# required, or no session is stored for the customer (status 0). Start a new session.
|
|
136
|
+
class WalletCustomerSessionExpiredError < WalletCustomerSessionError; end
|
|
137
|
+
|
|
138
|
+
# 503 WALLET_CUSTOMER_SESSION_NOT_ISSUED: the code was accepted and consumed but no session was opened.
|
|
139
|
+
# Do not retry the completion; start a new session.
|
|
140
|
+
class WalletCustomerSessionNotIssuedError < ApiError
|
|
141
|
+
CODE = 'WALLET_CUSTOMER_SESSION_NOT_ISSUED'
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# 503 WALLET_CUSTOMER_REVOKE_INCOMPLETE: the revocation was recorded but closing the access did not
|
|
145
|
+
# finish. Send the same revoke again (it is idempotent: an already revoked installation answers 200).
|
|
146
|
+
class WalletCustomerRevokeIncompleteError < ApiError
|
|
147
|
+
CODE = 'WALLET_CUSTOMER_REVOKE_INCOMPLETE'
|
|
148
|
+
end
|
|
100
149
|
end
|
data/lib/lunixi/fraud.rb
CHANGED
|
@@ -7,13 +7,14 @@ module Lunixi
|
|
|
7
7
|
paymentId payment bankTransfer cryptoTransfer walletOperation billPayment loanApplication payout
|
|
8
8
|
customer device session merchant mobileApp telemetry metadata identitySnapshot identityAssertion].freeze
|
|
9
9
|
|
|
10
|
-
# Transaction event ingest (signed)
|
|
11
|
-
attr_reader :events, :decisions
|
|
10
|
+
# Transaction event ingest (signed), the persisted decision log and UK APP reimbursement claims.
|
|
11
|
+
attr_reader :events, :decisions, :uk_claims
|
|
12
12
|
|
|
13
13
|
def initialize(client)
|
|
14
14
|
@client = client
|
|
15
15
|
@events = FraudEvents.new(client)
|
|
16
16
|
@decisions = FraudDecisions.new(client)
|
|
17
|
+
@uk_claims = FraudUkClaims.new(client)
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
# Evaluate the documented fraud DTO; tenant identity comes from credentials.
|