lunixi-sdk 1.2.2 → 1.3.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 +4 -4
- data/CHANGELOG.md +45 -0
- data/README.md +262 -9
- data/README.tr.md +266 -7
- data/lib/lunixi/bank_connect.rb +340 -0
- data/lib/lunixi/bank_connect_filters.rb +114 -0
- data/lib/lunixi/bank_connect_values.rb +205 -0
- data/lib/lunixi/bank_transfer.rb +106 -0
- data/lib/lunixi/card_requests.rb +150 -0
- data/lib/lunixi/client.rb +57 -16
- data/lib/lunixi/direct_method_payment_request.rb +243 -0
- data/lib/lunixi/enabled_installments.rb +28 -0
- data/lib/lunixi/errors.rb +69 -3
- data/lib/lunixi/fraud.rb +81 -5
- data/lib/lunixi/identity.rb +94 -0
- data/lib/lunixi/identity_values.rb +28 -0
- data/lib/lunixi/insurance.rb +294 -0
- data/lib/lunixi/insurance_request.rb +134 -0
- data/lib/lunixi/insurance_values.rb +200 -0
- data/lib/lunixi/kyc.rb +189 -0
- data/lib/lunixi/kyc_values.rb +158 -0
- data/lib/lunixi/marketplace.rb +264 -0
- data/lib/lunixi/marketplace_values.rb +86 -0
- data/lib/lunixi/method_fields.rb +142 -0
- data/lib/lunixi/money.rb +7 -4
- data/lib/lunixi/payment_link_filters.rb +32 -0
- data/lib/lunixi/payment_link_image_rules.rb +85 -0
- data/lib/lunixi/payment_link_rules.rb +132 -0
- data/lib/lunixi/payment_link_values.rb +134 -0
- data/lib/lunixi/payment_links.rb +152 -0
- data/lib/lunixi/payment_values.rb +86 -0
- data/lib/lunixi/payments.rb +154 -5
- data/lib/lunixi/physical_pos.rb +183 -0
- data/lib/lunixi/physical_pos_card_data.rb +117 -0
- data/lib/lunixi/physical_pos_card_number.rb +65 -0
- data/lib/lunixi/physical_pos_device_identity.rb +44 -0
- data/lib/lunixi/physical_pos_filters.rb +58 -0
- data/lib/lunixi/physical_pos_gateway.rb +153 -0
- data/lib/lunixi/physical_pos_identifiers.rb +62 -0
- data/lib/lunixi/physical_pos_management.rb +326 -0
- data/lib/lunixi/physical_pos_money.rb +46 -0
- data/lib/lunixi/physical_pos_request.rb +126 -0
- data/lib/lunixi/physical_pos_responses.rb +102 -0
- data/lib/lunixi/physical_pos_results.rb +52 -0
- data/lib/lunixi/physical_pos_settlement_policies.rb +71 -0
- data/lib/lunixi/physical_pos_value.rb +43 -0
- data/lib/lunixi/physical_pos_values.rb +203 -0
- data/lib/lunixi/physical_pos_webhook.rb +147 -0
- data/lib/lunixi/product_webhooks.rb +106 -0
- data/lib/lunixi/promissory_note.rb +155 -0
- data/lib/lunixi/reference.rb +41 -0
- data/lib/lunixi/route_request.rb +121 -0
- data/lib/lunixi/route_response.rb +101 -0
- data/lib/lunixi/route_table.rb +128 -0
- data/lib/lunixi/route_value.rb +60 -0
- data/lib/lunixi/sanction.rb +244 -0
- data/lib/lunixi/sanction_values.rb +132 -0
- data/lib/lunixi/split_payment.rb +145 -0
- data/lib/lunixi/subscription_resources.rb +355 -0
- data/lib/lunixi/subscription_values.rb +220 -0
- data/lib/lunixi/subscriptions.rb +202 -0
- data/lib/lunixi/version.rb +1 -1
- data/lib/lunixi/wallet.rb +153 -0
- data/lib/lunixi/wallet_resources.rb +402 -0
- data/lib/lunixi/wallet_routes.rb +123 -0
- data/lib/lunixi/wallet_values.rb +71 -0
- data/lib/lunixi/wire_money.rb +67 -0
- data/lib/lunixi.rb +57 -0
- metadata +58 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1162b2efebff421ad65d7a57e15f0e224cd65fa70e07cce9fd41f952450f93c6
|
|
4
|
+
data.tar.gz: 9a5fa79c17af6872843b6873f50dcd1349532c6564c9154a5d7582a1b09dc3a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: caef2d7bd60e3052704d03d13e24d041a4ad9493c72bf62bc75012357e8d271a6502ca7ef3cebf40688a040d4835cdf5870d083dc0d72533d7a5ded040589d3a
|
|
7
|
+
data.tar.gz: 8c44e3480d34eb1de8524e3d94a4c7d0691ab3bbdbe77cce78537a0940ac57f0eecae88676d6eb09f9b6a1dd716026c6343750d4f8f0cbe3266a6e2ff2cdf93b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.1 — 2026-11-15
|
|
4
|
+
|
|
5
|
+
- Lint (RuboCop) clean and `Gemfile.lock` carries the gem version, so the release builds in CI; no behaviour change.
|
|
6
|
+
|
|
7
|
+
## 1.3.0 — 2026-11-15
|
|
8
|
+
|
|
9
|
+
- `payments.direct_method_payment(body_or_request, idempotency_key:)` and `Lunixi::DirectMethodPaymentRequest`: start a payment with any method (`POST /payments/direct/payment`, signed). Raw and built bodies are checked before sending: known fields, only the chosen method's block, card fields only with `CARD`, block structure, promissory-note plan, 1–100 basket items for `SHOPPING_LOAN`, no `providerCode` for `BANK_TRANSFER`; the idempotency key is required.
|
|
10
|
+
- `payments.confirm_payment_action` / `payments.resend_payment_action` for OTP, consent and input actions; the confirm body carries only `otp`, `consentAccepted` and `fields`.
|
|
11
|
+
- `payments.list_payment_methods` alias of `payments.methods`; the `payment_method:` code is checked locally and `QR` is sent as `QR_CODE`.
|
|
12
|
+
- Promissory notes: `payments.get_promissory_notes`, `payments.cancel_promissory_notes`, `payments.download_promissory_note_document` (PDF bytes) and the plan rules (schedule or note count, at most 24 notes).
|
|
13
|
+
- Bank transfer: `payments.list_bank_transfer_exceptions`, `payments.accept_bank_transfer_exception`, `payments.mark_bank_transfer_exception_refunded` and `Lunixi::BankTransferInstruction.from_response` for the `DISPLAY` transfer instruction.
|
|
14
|
+
- `payments.list_splits(**filters)`; split legs other than card carry only `mobileBilling`, `wallet` or `promissoryNote`.
|
|
15
|
+
- `client.reference` address dictionary: `list_provinces`, `list_districts`, `list_neighborhoods`.
|
|
16
|
+
- Constants: `Lunixi::PaymentMethod`, `PaymentActionType`, `ProviderSelection`, `ProviderSelectionMode`, field lists (`METHOD_BLOCK_FIELDS`, `DIRECT_METHOD_PAYMENT_FIELDS`, `CARD_ONLY_FIELDS`, `PAYMENT_ACTION_CONFIRM_FIELDS`, `SPLIT_LEG_BLOCK_FIELDS`, `SPLIT_PAYMENT_LEG_FIELDS`, `LIST_SPLIT_PAYMENTS_FILTERS`), bank transfer, promissory-note and split values and webhook event names.
|
|
17
|
+
- `Client#request` takes `accept:` for endpoints that answer with another media type; the default stays `application/json`.
|
|
18
|
+
- `payments.bin_info`, `payments.installment_options` (with `Lunixi::InstallmentOptionsRequest`) and `payments.card_taxonomy`. Card numbers and BINs never appear in error messages or builder `inspect` output.
|
|
19
|
+
- Stored cards: `payments.store_card` (with `Lunixi::StoreCardRequest`), `payments.list_stored_cards`, `payments.get_stored_card` and `payments.deactivate_stored_card`; both writes are signed and require the idempotency key.
|
|
20
|
+
- `payments.create_marketplace_intent(body, idempotency_key:)` (signed): `sellers[].amountMinor` must be canonical minor-unit strings adding up to `amount`, checked before sending.
|
|
21
|
+
- `payments.failover_recovery_analytics(**filters)` and `payments.provider_credential_analytics(credential_id, **filters)`.
|
|
22
|
+
- `enabledInstallments` of `create_intent`, `create_marketplace_intent` and `installment_options` is checked before sending (distinct integers 1–36 that include 1) and sent in ascending order; a list the gateway would reject with 400 now raises `ConfigurationError`.
|
|
23
|
+
- `client.payment_links`: `create`, `list`, `get`, `update`, `pause`, `resume`, `deactivate`, `action`, `send_link`, `qr` (image bytes), `list_attempts`, `list_payments`, and the image upload `create_image_upload`, `confirm_image_upload` and `upload_image`. Every gateway call is signed; the presigned image PUT goes to the storage host with only `uploadHeaders`, never with the access token or the signature. Value sets `Lunixi::PaymentLinkUsage`, `PaymentLinkAmountMode`, `PaymentLinkState`, `PaymentLinkAttemptState`, `PaymentLinkEnvironment`, `BuyerFieldRequirement`, `CustomFieldType`, `PaymentLinkButtonLabel`, `PaymentLinkDeliveryChannel`, `PaymentLinkQrFormat`, `PaymentLinkLocale`, `PaymentLinkImageContentType` and the field lists `PAYMENT_LINK_SPEC_FIELDS`, `PAYMENT_LINK_IMMUTABLE_FIELDS`.
|
|
24
|
+
- Fraud decision log: `fraud.decisions.list`, `fraud.decisions.get` and `fraud.decisions.latest_for_payment`. Fraud events: `fraud.events.record` (`fraud.record_event` stays and calls it) and `fraud.events.record_batch` (signed, at most 500 events).
|
|
25
|
+
- A parity test checks every required operation of the shared SDK catalog against the client when the catalog is present.
|
|
26
|
+
- `client.physical_pos` (card terminals, `/api/v1/physical-pos`): `create_payment` (`SALE`, `PREAUTH_OPEN`, `REFUND_UNMATCHED`; target by `deviceId`, `vendorCode` + `serialNumber` or `externalRef`; sale items with `taxGroupCode`; `interaction` and `terminalProviderId` for provider-collected cards), `create_reversal` (`VOID`, `REFUND` by amount or items, `PREAUTH_CLOSE`, `PREAUTH_CANCEL`), `cancel_payment`, `get_payment`, `list_payments`, `list_transactions`, `get_transaction`, `list_ambiguous_payments`, `get_sales_summary`, `get_tax_summary`, `list_settlements`, `start_settlement`, `list_settlement_runs`, `get_settlement_run` and `iterate_*` for every list. Payment writes return `Lunixi::PhysicalPosWriteResult` (`payment`, `replayed`, `status_code` 202 new / 200 replay, `idempotency_key`); `create_payment` and `create_reversal` require the idempotency key and send it exactly as given; an uncertain outcome (no answer, a 5xx that does not say "not started", a 2xx without a payment) is retried with the same key and body and then raises `Lunixi::PhysicalPosOutcomeUnknownError`.
|
|
27
|
+
- `client.physical_pos_management`: overview, catalog (vendors, device models, acquirers), stores, registers, logical terminals with their bank rows, payment-provider rows and device links, devices (assignment, lifecycle, retirement), device identity keys (revocation, enrollment revert, activation-code revocation), end-of-day policies for the account, a store or a device and the effective policy, audit and history lists. Updates take the `rowVersion` you last read; keyed writes generate a UUID when the key is `nil`.
|
|
28
|
+
- Physical POS request checks before sending: closed field and filter lists (`Lunixi::PHYSICAL_POS_REQUEST_FIELDS`, `Lunixi::PHYSICAL_POS_FILTERS`), canonical minor-unit money strings, and card data (a PAN, track, expiry or security-code field at any depth, or a card number in `merchantReference`, an item name, a tax group or a free-text filter) raises `Lunixi::PhysicalPosCardDataRejectedError` with the field path only.
|
|
29
|
+
- Physical POS errors: `PhysicalPosCardDataRejectedError` (`field`), `PhysicalPosVoidAfterSettlementError` (`allowed_operation`), `PhysicalPosRateLimitError` (`retry_after` in seconds) and `PhysicalPosOutcomeUnknownError` (`attempts`); the key of a write is on the error as `idempotency_key`. `ApiError#details` keeps only the safe `field`, `allowedOperation` and `retryAfterSeconds` values of a gateway answer.
|
|
30
|
+
- `Lunixi::PhysicalPosWebhook.parse` (also `Lunixi::PhysicalPos.parse_webhook_event`): verifies the signature first, then reads a `physical_pos.*` event with `category`, `history_seq`, `original`, the optional `cashier` and `device_sale?`, and checks its amounts. Values: `Lunixi::PhysicalPosEvents`, `PhysicalPosPaymentOperation`, `PhysicalPosPaymentStatus`, `PhysicalPosReversalStatus`.
|
|
31
|
+
- `Client#request` takes `max_retries:` to lower the retry budget of one call.
|
|
32
|
+
- `client.wallet` (`/api/v1/wallet`): `ping` and the sub-clients `programs`, `end_users`, `wallets`, `deposits`, `corporate`, `fees`, `transfers` (`quote_w2w`, `initiate_w2w`, `complete_w2w`, `quote_w2_iban`, `initiate_w2_iban`, `complete_w2_iban`), `withdrawals`, `operations`, `topups`, `payments`, `qr` (`image` returns bytes) and `bulk_payouts`, with `iterate` on the cursor lists. Every call is signed and checked against `Lunixi::WALLET_ROUTES` before sending: unknown or missing fields, nested rows and bulk items, non-canonical amounts (numbers, decimals) and a missing or malformed `Idempotency-Key` (1–128 characters) raise `ConfigurationError`. The complete calls put `operationId` in the body themselves. `end_users.freeze_end_user(end_user_id, ...)` freezes an end user (named so that `Object#freeze` keeps its meaning).
|
|
33
|
+
- `client.bank_connect` (`/api/v1/bank-connect`): `list_banks`, `list_connections`, `get_connection`, `list_accounts`, `get_account`, `request_sync`, `list_balances`, `list_transactions`, `get_transaction` and `iterate_*`. Filters are checked against `Lunixi::BANK_CONNECT_FILTERS` before sending (value sets, `limit` 1–100, at most 100 account ids, canonical amount strings, `minAmountMinor` not above `maxAmountMinor`, `bookedTo` only with `bookedFrom`, at most 92 days).
|
|
34
|
+
- `bank_connect.transfers` (`list_purposes`, `create`, `list`, `iterate`, `get`) and `bank_connect.fx` (`list_rates`, `create_quote`, `create_order`, `list_orders`, `iterate_orders`, `get_order`) through `Lunixi::BANK_TRANSFER_ROUTES`. `create` and `create_order` check a given `Idempotency-Key` (8–200 printable ASCII) or generate a UUID v4, and retry a network error or a 5xx with the same key and body; an answered error carries the key as `idempotency_key`. Bodies are checked before sending (fields, positive amount strings, receiver name and IBAN length, purpose code, description length, exactly one quote amount, two different accounts).
|
|
35
|
+
- `client.sanction` (`/api/v1/sanction`, access token only): `screen_name`, `screen_wallet`, `screen_account`, `screen_transaction`, `screen_public_procurement_ban`, `screen_adverse_media`, `evaluate_behavioral_alert`, `list_screening_history`, `register_monitoring` (a `profile` Hash is sent as `profileJson`), `list_monitoring_alerts`, `list_monitored_entities`, `list_monitoring_matches`, `get_dataset_freshness`, `search_entities`, `get_entity_profile`, `get_entity_graph`, `get_indirect_exposure`, `get_ownership_aggregation`, `list_blacklist_entries` and `iterate_*`. Bodies and filters are checked against `Lunixi::SANCTION_ROUTES`, `SANCTION_NESTED_FIELDS` and `SANCTION_VALUE_SETS`; a screening answer whose `status` is not `success` raises `ApiError`. `Lunixi::Sanction.clear_screening?(result)` applies the clean-read rule (no match or hit, no blocking flag or decision, `coverageStatus` `COMPLETE` when reported).
|
|
36
|
+
- `client.insurance` (`/api/v1/insurance`, I1–I22): `list_products`, `search_products`, `list_reference_values`, `create_quote`, `get_quote`, `create_order`, `list_orders`, `get_order`, `bind_payment`, `confirm_payment`, `issue_policy`, `cancel_order`, `refund_premium`, `get_policy_document`, `get_policy_receipt`, `get_policy_certificate` (PDF bytes), `get_reconciliation_summary`, `list_reconciliation_orders`, `export_reconciliation` (`Lunixi::InsuranceReconciliationExport` with the CSV bytes, `truncated?`, `next_cursor`, `aborted?`), `create_lead`, `list_leads`, `get_lead`, `iterate_*`, and the helpers `Lunixi::Insurance.consent_from_quote` and `Lunixi::Insurance.premium_basket_item`. Every call is signed; `create_order`, `confirm_payment`, `issue_policy`, `cancel_order`, `refund_premium` and `create_lead` require the `Idempotency-Key` (8–200 printable ASCII), `create_quote` and `bind_payment` take it optionally. A quote with both `paymentIntentId` and `context.items` raises `ConfigurationError`; the fields of an insurance type's own object are left to the gateway.
|
|
37
|
+
- Webhook readers that verify the signature first: `Lunixi::BankConnectWebhook` (`bank_account.transaction.received`), `Lunixi::BankTransferWebhook` (Bank Connect `bank_transfer.*`, not the payment method's `payment.bank_transfer.*`) and `Lunixi::InsuranceWebhook` (order events and `insurance.lead.submitted`), each with `parse(raw_body, headers, secret_or_verifier)` and `from_event(verified_event)`; `data` holds the documented fields only and its amounts are checked. Event names: `Lunixi::BankConnectEvents`, `BankTransferEvents`, `InsuranceEvents`.
|
|
38
|
+
- Value sets for the four products (`WalletKycLevel`, `BankTransferStatus`, `SanctionRiskDomain`, `InsuranceOrderStatus` …) and `Lunixi::ListPage` (`items`, `next_cursor`, `has_more?`, `total_count`, `raw`) for their lists.
|
|
39
|
+
- The bank-connect balance fields (`availableMinor`, `blockedMinor`, `balanceAfterMinor`, `sourceBalanceAfterMinor`, `targetBalanceAfterMinor` …) and the `options` / `quote` containers are part of the canonical money check.
|
|
40
|
+
- The parity test also compares the wallet, bank transfer and sanction route tables, the filter, field and value lists and the key patterns with the shared catalog.
|
|
41
|
+
- `client.subscriptions` (`/api/v1/subscriptions`, access token only): `create` (the `Idempotency-Key` is required and also sent in the body), `get`, `list`, `iterate`, `cancel(at_period_end:)`, `pause(resume_at:)`, `resume`, `change_plan`, `audit_logs`, and the sub-clients `plans` (`create` checks the price, currency and billing rule), `customers`, `cards` (a `paymentMethodToken`, never a card number), `invoices`, `portal` (SDK session, hosted links on `/api/panel/v1/subscriptions/portal`, invite, settings), `products`, `features`, `addons` and `usage`. Checked against `Lunixi::SUBSCRIPTION_ROUTES`; money members of bodies, filters and answers must be canonical minor-unit strings. Helpers `Lunixi::Subscriptions.active?`, `terminal?` and `portal_url`; values `SubscriptionStatus`, `SubscriptionInvoiceStatus`, `SubscriptionCollectionMethod`, `SubscriptionBillingFrequency`, `SubscriptionCardVerificationMode`, `SubscriptionPlanChangeBehavior`, `SubscriptionPortalSdkMode`, `SubscriptionEvents`.
|
|
42
|
+
- `client.kyc` (`/api/v1/kyc`, access token only): `create_session`, `get_session`, `list_sessions` (only `limit` / `cursor`), `iterate_sessions`, `set_jurisdiction`, `set_primary_document`, `upload_document`, `timeline`, `submit`, `manual_review`, `evidence_request`, `merchant_policy`, `update_merchant_policy`, `rotate_webhook_secret`, `webhook_outbox`, `retry_webhook_event`, `erasure_requests`. `person:` / `company:` become `customer`, `metadata:` becomes `evidenceContextJson`. Helpers `Lunixi::Kyc.session_terminal?`, `assurance_rank`, `assurance_meets?`; values `KycSessionType`, `KycSessionStatus`, `KycEvidencePurpose`, `KycAssuranceLevel`, `KycAssuranceDomain`, `KycEvents`.
|
|
43
|
+
- `client.identity` (`/api/v1/identity/live-sessions`, access token only): `analyze_sync`, `analyze`, `account_links`, `get_session`, `related_sessions`, `timeline`, `top_sources`, `list_sessions`; helpers `Lunixi::Identity.device_shared?` and `link_reasons`.
|
|
44
|
+
- `client.marketplace`: the signed split charges `create_checkout_intent`, `charge_marketplace_card`, `charge_marketplace_card2d`, `charge_marketplace_card3d` (seller legs as arguments, adding up to `amount`; an intent without a token or form raises `ApiError`; card data never reaches an error message), and the sub-dealer, commission, payout and audit-log routes. Helper `Lunixi::Marketplace.onboarding_url`; values `MarketplaceDealerStatus`, `MarketplaceDealerType`, `MarketplaceMultiSellerPolicy`.
|
|
45
|
+
- `Lunixi::ListPage#page_size` (the page size of a subscription list); `Client#request` accepts the subscription portal panel routes (`/api/panel/v1/subscriptions/portal/...`).
|
|
46
|
+
- The parity test covers the subscription, KYC, identity and marketplace operations, route tables, lists and enum values.
|
|
47
|
+
|
|
3
48
|
## 1.2.2 — 2026-11-12
|
|
4
49
|
|
|
5
50
|
- Development lockfile only: Rails sample dependencies moved to patched versions (rails 8.1.4.1, nokogiri 1.19.7, loofah 2.25.3, rails-html-sanitizer 1.7.2) for new security advisories. The gem itself and its runtime dependencies are unchanged.
|
data/README.md
CHANGED
|
@@ -82,27 +82,280 @@ The shared Lunixi form owns enabled payment methods and supports the methods con
|
|
|
82
82
|
| --- | --- |
|
|
83
83
|
| Create intent | `payments.create_intent(body, idempotency_key:)` |
|
|
84
84
|
| Get/list payment | `payments.get(id)`, `payments.list(**filters)` |
|
|
85
|
-
| Enabled methods | `payments.methods(payment_method: nil)` |
|
|
85
|
+
| Enabled methods | `payments.methods(payment_method: nil)`, alias `payments.list_payment_methods(payment_method: nil)` |
|
|
86
|
+
| Pay with any method | `payments.direct_method_payment(body_or_request, idempotency_key:)`, `Lunixi::DirectMethodPaymentRequest` |
|
|
87
|
+
| Payment action | `payments.confirm_payment_action(payment_id, action_id, input)`, `payments.resend_payment_action(payment_id, action_id)` |
|
|
88
|
+
| Promissory notes | `payments.get_promissory_notes(id)`, `payments.cancel_promissory_notes(id, serial_numbers: nil, idempotency_key: nil)`, `payments.download_promissory_note_document(id, locale: nil)` |
|
|
89
|
+
| Bank transfer exceptions | `payments.list_bank_transfer_exceptions(environment: nil, status: nil, limit: nil)`, `payments.accept_bank_transfer_exception(id)`, `payments.mark_bank_transfer_exception_refunded(id)` |
|
|
90
|
+
| Address dictionary | `reference.list_provinces`, `reference.list_districts(province_code)`, `reference.list_neighborhoods(district_code)` |
|
|
86
91
|
| Capture/preauthorization | `payments.capture(id, idempotency_key:)` |
|
|
87
92
|
| Full/partial refund | `payments.refund(id, idempotency_key:, reason: nil)` |
|
|
88
93
|
| Void authorization | `payments.void(id, idempotency_key:)` |
|
|
89
94
|
| Split payment (1–5 legs) | `payments.split(body, idempotency_key:)` |
|
|
90
|
-
| Split status/refund | `payments.get_split(id)`, `payments.refund_split(id, amount:, idempotency_key:, reason: nil)` |
|
|
95
|
+
| Split status/list/refund | `payments.get_split(id)`, `payments.list_splits(**filters)`, `payments.refund_split(id, amount:, idempotency_key:, reason: nil)` |
|
|
96
|
+
| Marketplace intent | `payments.create_marketplace_intent(body, idempotency_key:)` |
|
|
97
|
+
| BIN and installments | `payments.bin_info(bin_or_pan)`, `payments.installment_options(body_or_request)`, `payments.card_taxonomy`, `Lunixi::InstallmentOptionsRequest` |
|
|
98
|
+
| Stored cards | `payments.store_card(body_or_request, idempotency_key:)`, `payments.list_stored_cards(card_user_key)`, `payments.get_stored_card(token)`, `payments.deactivate_stored_card(token, idempotency_key:)`, `Lunixi::StoreCardRequest` |
|
|
99
|
+
| Payment analytics | `payments.failover_recovery_analytics(**filters)`, `payments.provider_credential_analytics(credential_id, **filters)` |
|
|
100
|
+
| Payment links | `payment_links.create`, `list`, `get`, `update`, `pause`, `resume`, `deactivate`, `action`, `send_link`, `qr`, `list_attempts`, `list_payments` |
|
|
101
|
+
| Payment link image | `payment_links.create_image_upload`, `payment_links.confirm_image_upload(asset_id)`, `payment_links.upload_image(file_name:, content_type:, content:)` |
|
|
91
102
|
| Fraud decision | `fraud.evaluate(body)` |
|
|
92
|
-
| Fraud
|
|
93
|
-
|
|
|
94
|
-
|
|
95
|
-
|
|
103
|
+
| Fraud decision log | `fraud.decisions.list(**filters)`, `fraud.decisions.get(trace_id)`, `fraud.decisions.latest_for_payment(payment_id)` |
|
|
104
|
+
| Fraud transaction event | `fraud.record_event(body, idempotency_key:)` (same as `fraud.events.record`), `fraud.events.record_batch(events, idempotency_key:)` |
|
|
105
|
+
| Physical POS payments | `physical_pos.create_payment(request, idempotency_key:)`, `create_reversal(payment_id, request, idempotency_key:)`, `cancel_payment`, `get_payment`, `list_payments`, `list_transactions`, `get_transaction`, `list_ambiguous_payments` |
|
|
106
|
+
| Physical POS reports and end-of-day | `physical_pos.get_sales_summary`, `get_tax_summary`, `list_settlements`, `start_settlement(device_id, idempotency_key: nil)`, `list_settlement_runs`, `get_settlement_run` |
|
|
107
|
+
| Physical POS management | `physical_pos_management` stores, registers, terminals (bank and provider rows, device links), devices and identity keys, end-of-day policies, catalog and overview |
|
|
108
|
+
| Wallet | `wallet.ping`, `wallet.end_users`, `wallets`, `deposits`, `corporate`, `fees`, `transfers`, `withdrawals`, `operations`, `topups`, `payments`, `qr`, `bulk_payouts` |
|
|
109
|
+
| Bank accounts | `bank_connect.list_banks`, `list_connections`, `get_connection`, `list_accounts`, `get_account`, `request_sync`, `list_balances`, `list_transactions`, `get_transaction` |
|
|
110
|
+
| Bank transfers and FX | `bank_connect.transfers.list_purposes`, `create(request, idempotency_key: nil)`, `list`, `get`; `bank_connect.fx.list_rates`, `create_quote`, `create_order(request, idempotency_key: nil)`, `list_orders`, `get_order` |
|
|
111
|
+
| Sanctions screening | `sanction.screen_name`, `screen_wallet`, `screen_account`, `screen_transaction`, `screen_public_procurement_ban`, `screen_adverse_media`, monitoring, entity intelligence, `list_blacklist_entries`, `Lunixi::Sanction.clear_screening?(result)` |
|
|
112
|
+
| Insurance | `insurance.list_products`, `search_products`, `create_quote`, `create_order`, `bind_payment`, `confirm_payment`, `issue_policy`, `cancel_order`, `refund_premium`, policy files, reconciliation, leads |
|
|
113
|
+
| Subscriptions | `subscriptions.create(request, idempotency_key:)`, `get`, `list`, `cancel`, `pause`, `resume`, `change_plan`, `audit_logs`; sub-clients `plans`, `customers`, `cards`, `invoices`, `portal`, `products`, `features`, `addons`, `usage` |
|
|
114
|
+
| KYC / KYB / evidence | `kyc.create_session`, `get_session`, `list_sessions`, `set_jurisdiction`, `set_primary_document`, `upload_document`, `timeline`, `submit`, `manual_review`, `evidence_request`, merchant policy, webhook outbox, erasure requests |
|
|
115
|
+
| Identity signals | `identity.analyze_sync`, `analyze`, `account_links`, `get_session`, `related_sessions`, `timeline`, `top_sources`, `list_sessions` |
|
|
116
|
+
| Marketplace | `marketplace.create_checkout_intent`, `charge_marketplace_card2d`, `charge_marketplace_card3d`, sub-dealers, commissions, payouts, audit log |
|
|
117
|
+
| Other documented endpoints | `request(method, path, body: nil, query: {}, idempotency_key: nil, signed: true, binary: false, accept: 'application/json', max_retries: nil)` |
|
|
118
|
+
|
|
119
|
+
`amount`, split `totalAmount` and each leg/item price must be positive canonical minor-unit strings within the signed 64-bit fiat range. Root `price`/`paidPrice` are removed fields and rejected even when null. Basket and split totals must agree. Each `basketItems` entry may carry the optional `productCategory`: the Lunixi product category code (for example `'MOBILE_PHONE'`), used by payment methods with legal installment limits (e.g. shopping loan) and other platform features. Leave it out to keep today's behaviour; the gateway rejects an unknown code with 400. The codes are available as `Lunixi::ProductCategory` constants (`Lunixi::ProductCategory::MOBILE_PHONE`, all 40 in `Lunixi::ProductCategory::ALL`); the list only grows by appending, so the value stays a plain string and the SDK does not check it before sending. Intent installments belong to the checkout form; `installment` is rejected on intent creation. The optional `enabledInstallments` list only narrows the installment counts the form offers for one payment (`[1]` = single payment only); the form shows only the counts your panel settings, the card and the platform maximum also allow. Leave it out for no restriction. The list must hold distinct integers 1–36 that include 1; any other list (an empty list included) raises `ConfigurationError` before sending, and the list is sent in ascending order. Set `preauth: true` for authorization, then capture separately with a new durable operation key. Omitting the capture/refund `amount:` keyword asks the gateway to use the remaining amount; explicit nil, numeric, zero, false and noncanonical string amounts are rejected.
|
|
96
120
|
|
|
97
121
|
```ruby
|
|
98
122
|
lunixi.payments.refund('intent_123', amount: "2500",
|
|
99
123
|
reason: 'Customer request', idempotency_key: refund.persisted_operation_key)
|
|
100
124
|
|
|
101
125
|
# Advanced transport: a documented existing endpoint, not a second HTTP stack.
|
|
102
|
-
|
|
126
|
+
banks = lunixi.request('GET', '/api/v1/bank-connect/banks', query: { limit: 20 })
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Payments, fraud, payment links, physical POS, wallet, bank accounts, sanctions screening, insurance, subscriptions, KYC, identity signals and the marketplace have their own clients; other products use the signed transport with the published gateway schema. JSON is compact UTF-8 with JavaScript integer-index key ordering and compatible numeric formatting, so the signed bytes are exactly the transmitted bytes.
|
|
130
|
+
|
|
131
|
+
## Payment methods
|
|
132
|
+
|
|
133
|
+
`payments.list_payment_methods` (signed) returns the methods open for your account. Each method carries its `blockName`, `providerSelection` (`Lunixi::ProviderSelection`), `providerSelectionMode` (`Lunixi::ProviderSelectionMode`) and its providers with the `inputFields` to send in the method block. Always read the provider code from this response; never hard-code it. `payment_method:` narrows the list to one code (`Lunixi::PaymentMethod`); `QR` is sent as `QR_CODE` and a malformed code raises `ConfigurationError` before sending.
|
|
134
|
+
|
|
135
|
+
`payments.direct_method_payment` starts a payment with any method from your server (`POST /api/v1/payments/direct/payment`, signed). The `idempotency_key:` is required; reuse it when retrying the same payment. Build the body with `Lunixi::DirectMethodPaymentRequest` or pass a raw Hash; both are checked before sending: known fields only (`Lunixi::DIRECT_METHOD_PAYMENT_FIELDS`), exactly the block of the chosen method (`Lunixi::METHOD_BLOCK_FIELDS`, the camelCase method code), card fields (`Lunixi::CARD_ONLY_FIELDS`) only with `CARD`, the block structure (at most 32 fields; strings up to 1024 characters, numbers, booleans, `ADDRESS` objects and `GROUP` lists of up to 10 objects), the promissory-note plan and 1–100 basket items for `SHOPPING_LOAN`.
|
|
136
|
+
|
|
137
|
+
```ruby
|
|
138
|
+
request = Lunixi::DirectMethodPaymentRequest.new('10000', 'TRY', order.reference)
|
|
139
|
+
.with_method_fields(Lunixi::PaymentMethod::MOBILE_BILLING, provider_code,
|
|
140
|
+
gsmNumber: '+905321234567')
|
|
141
|
+
result = lunixi.payments.direct_method_payment(request, idempotency_key: order.payment_operation_key)
|
|
142
|
+
|
|
143
|
+
action = result.dig('data', 'action')
|
|
144
|
+
if action && action['type'] == Lunixi::PaymentActionType::OTP
|
|
145
|
+
lunixi.payments.confirm_payment_action(result.dig('data', 'paymentId'), action['id'], otp: code_from_buyer)
|
|
146
|
+
end
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`confirm_payment_action` sends only `otp` (digits), `consentAccepted` (boolean) and `fields` (the values an `INPUT` action asks for); checkout token fields are rejected. `resend_payment_action` sends a new one-time code; confirm with the new `data.action.id`. A card payment uses `with_card(card_fields)`, `with_installment(count, quote_token)` and `with_force3d(true)`.
|
|
150
|
+
|
|
151
|
+
### Promissory notes
|
|
152
|
+
|
|
153
|
+
A `PROMISSORY_NOTE` payment carries its plan: either `with_promissory_note_schedule([{ amount: '5000', dueDate: '2027-01-15' }, …])` (1–24 rows, positive minor-unit amounts adding up to `amount`, `YYYY-MM-DD` dates in order) or `with_promissory_note_count(3)`, never both. `get_promissory_notes(payment_id)` lists the notes (`Lunixi::PromissoryNoteStatus`), `cancel_promissory_notes(payment_id, serial_numbers: nil)` cancels the given notes or every open one (`Lunixi::PromissoryNoteCancelResult`, `Lunixi::PromissoryNoteCancelErrorCode`), and `download_promissory_note_document(payment_id, locale: 'tr-TR')` returns the printable PDF as a frozen binary String. Note changes arrive as `Lunixi::PromissoryNoteEvents` webhooks. `reference.list_provinces`, `list_districts` and `list_neighborhoods` return the address codes of an `ADDRESS` field.
|
|
154
|
+
|
|
155
|
+
### Bank transfer (Para Transferi)
|
|
156
|
+
|
|
157
|
+
A `BANK_TRANSFER` payment takes no provider code: send the buyer's bank as `with_method_fields(Lunixi::PaymentMethod::BANK_TRANSFER, nil, bankCode: '0062')`, or `Lunixi::BANK_TRANSFER_OTHER_BANKS_CODE` (`'9999'`) for EFT/FAST from a bank not listed. The response carries a `DISPLAY` action with the transfer instruction to show the buyer:
|
|
158
|
+
|
|
159
|
+
```ruby
|
|
160
|
+
instruction = Lunixi::BankTransferInstruction.from_response(result)
|
|
161
|
+
# instruction.iban, instruction.holder_name, instruction.amount_minor, instruction.payment_code, instruction.expires_at
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`from_response` returns nil when the response has no `DISPLAY` transfer instruction. Late, short and excess transfers become exceptions: `list_bank_transfer_exceptions(environment: 'LIVE', status: 'PENDING_DECISION', limit: 50)`, `accept_bank_transfer_exception(id)` and `mark_bank_transfer_exception_refunded(id)` (`Lunixi::PaymentBankTransferExceptionKind`, `Lunixi::PaymentBankTransferExceptionStatus`, webhook names in `Lunixi::PaymentBankTransferEvents`).
|
|
165
|
+
|
|
166
|
+
### Split payments
|
|
167
|
+
|
|
168
|
+
A non-card split leg carries only one of `Lunixi::SPLIT_LEG_BLOCK_FIELDS` (`mobileBilling`, `wallet`, `promissoryNote`); meal card, open banking, shopping loan and bank transfer cannot be legs and are rejected before sending. `list_splits(status: 'COMPLETED', limit: 25)` lists split payments (`Lunixi::LIST_SPLIT_PAYMENTS_FILTERS`). Webhook names are in `Lunixi::SplitPaymentEvents`; add `Lunixi::SPLIT_LEG_EVENTS_SUBSCRIPTION` to an endpoint's event types to also receive leg events.
|
|
169
|
+
|
|
170
|
+
### BIN, installments and stored cards
|
|
171
|
+
|
|
172
|
+
`payments.bin_info('45438800')` returns the card and bank details of a BIN or card number prefix (6–19 digits). `payments.installment_options` returns the installment table; with a BIN and `installment` above 1 it also returns the binding `quoteToken` for `DirectMethodPaymentRequest#with_installment`. Its `enabledInstallments` follows the rule of `create_intent`. Card numbers and BINs never appear in error messages or in the `inspect` output of the request builders.
|
|
173
|
+
|
|
174
|
+
```ruby
|
|
175
|
+
options = lunixi.payments.installment_options(
|
|
176
|
+
Lunixi::InstallmentOptionsRequest.new('10000', 'TRY').with_bin_or_pan(bin).with_enabled_installments([1, 2, 3])
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`payments.store_card(Lunixi::StoreCardRequest.new(card, card_user_key, callback_url), idempotency_key:)` verifies and stores a card (signed); `list_stored_cards(card_user_key)` and `get_stored_card(token)` return masked card data, and `deactivate_stored_card(token, idempotency_key:)` removes it (signed). Both writes require the idempotency key.
|
|
181
|
+
|
|
182
|
+
`payments.create_marketplace_intent` takes the intent body plus `sellers` (`[{ subDealerId:, amountMinor:, scenario: }]`) and `multiSellerPolicy`. Each `amountMinor` is a canonical minor-unit string and the sellers must add up to `amount`; any other total raises `ConfigurationError` before sending.
|
|
183
|
+
|
|
184
|
+
## Payment links
|
|
185
|
+
|
|
186
|
+
`client.payment_links` covers `/api/v1/payments/links`. Every call is signed, reads included; the signing key decides the merchant and the TEST/LIVE environment. Responses are the gateway envelope: a list has `data.items` and the top-level `pageInfo` (`hasMore`, `nextCursor`, `totalCount`).
|
|
187
|
+
|
|
188
|
+
```ruby
|
|
189
|
+
link = lunixi.payment_links.create(
|
|
190
|
+
{ usage: Lunixi::PaymentLinkUsage::SINGLE_USE, amountMode: Lunixi::PaymentLinkAmountMode::FIXED,
|
|
191
|
+
currency: 'TRY', amountMinor: '150000', title: 'Invoice 42', expiresAt: Time.now + 7 * 86_400 },
|
|
192
|
+
idempotency_key: invoice.link_operation_key
|
|
193
|
+
)
|
|
194
|
+
link_id = link.dig('data', 'id')
|
|
195
|
+
lunixi.payment_links.send_link(link_id, channel: Lunixi::PaymentLinkDeliveryChannel::EMAIL,
|
|
196
|
+
recipient_email: 'buyer@example.com', idempotency_key: invoice.send_operation_key)
|
|
197
|
+
lunixi.payment_links.update(link_id, link.dig('data', 'rowVersion'), { title: 'Invoice 42 (revised)' })
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
- `create` accepts only `Lunixi::PAYMENT_LINK_SPEC_FIELDS` plus `environment`; `update` takes the link's current `rowVersion` and the changed fields (`nil` clears one) and refuses `Lunixi::PAYMENT_LINK_IMMUTABLE_FIELDS`. A `Time` in `startsAt`, `expiresAt` or `eventAt` is sent as ISO 8601 UTC.
|
|
201
|
+
- `create` and `send_link` require the idempotency key; `update`, `pause`, `resume` and `deactivate` take an optional one.
|
|
202
|
+
- `list`, `list_attempts` and `list_payments` accept their documented filters only; an Array (for `state`, `usage`, `amountMode`) is sent as a comma list.
|
|
203
|
+
- `qr(link_id, format: 'png', size: 512)` returns the image as a frozen binary String.
|
|
204
|
+
|
|
205
|
+
A link image is uploaded in three steps, or in one call with `upload_image`:
|
|
206
|
+
|
|
207
|
+
```ruby
|
|
208
|
+
image = lunixi.payment_links.upload_image(file_name: 'cover.png', content_type: Lunixi::PaymentLinkImageContentType::PNG,
|
|
209
|
+
content: File.binread('cover.png'))
|
|
210
|
+
asset_id = image.dig('data', 'assetId') # use as imageAssetId
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
`create_image_upload` returns the upload target (`assetId`, `uploadUrl`, `uploadHeaders`, `expiresAt`); the bytes are then PUT to `uploadUrl`, and `confirm_image_upload(asset_id)` publishes the image. The PUT goes straight to the storage host through the configured transport with only `uploadHeaders`: it never carries the access token, the signature headers or the idempotency key. An upload target that is not HTTPS, not a `PUT` or has malformed headers raises `ApiError` before anything is uploaded. A failed PUT is not retried; it raises `ApiError` with the storage status and code (for example `AccessDenied` once the URL has expired), and `upload_image` can be called again for a new URL. Images are PNG, JPEG or WebP (never SVG), at most 2 MiB.
|
|
214
|
+
|
|
215
|
+
## Fraud decision log and event batches
|
|
216
|
+
|
|
217
|
+
`fraud.decisions.list(paymentId:, decision:, integrationMode:, productContext:, limit:, cursor:)` lists persisted decisions (`data` is the page, `pageInfo.nextCursor` the next cursor), `fraud.decisions.get(trace_id)` returns one and `fraud.decisions.latest_for_payment(payment_id)` returns the latest decision Hash of a payment or nil. `fraud.events.record_batch(events, idempotency_key:)` sends up to 500 transaction events as one signed JSON array; the batch can succeed partially, so read the per-event results in `data`.
|
|
218
|
+
|
|
219
|
+
## Physical POS
|
|
220
|
+
|
|
221
|
+
`client.physical_pos` starts and follows payments on your card terminals (`/api/v1/physical-pos`); `client.physical_pos_management` manages stores, registers, logical terminals, devices and the end-of-day policy. Every call is signed; a TEST key can only read. Body and filter keys are the wire names (String or Symbol; snake_case works too), amounts are canonical minor-unit strings and counts are numbers.
|
|
222
|
+
|
|
223
|
+
```ruby
|
|
224
|
+
key = Lunixi::PhysicalPos.new_idempotency_key
|
|
225
|
+
order.update!(pos_key: key) # store the key before you call
|
|
226
|
+
begin
|
|
227
|
+
result = lunixi.physical_pos.create_payment(
|
|
228
|
+
{ operation: Lunixi::PhysicalPosPaymentOperation::SALE, target: { deviceId: device_id }, amountMinor: '4500', currency: 'TRY',
|
|
229
|
+
merchantReference: order.reference, allowDuplicateReference: false },
|
|
230
|
+
idempotency_key: key
|
|
231
|
+
)
|
|
232
|
+
result.status_code # 202 accepted (not paid yet), 200 when the same key and body were sent before
|
|
233
|
+
rescue Lunixi::PhysicalPosOutcomeUnknownError
|
|
234
|
+
# The payment may exist: call again later with the SAME key, or find it with list_payments(merchantReference:).
|
|
235
|
+
end
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
- A payment write means "accepted": follow the outcome with the `physical_pos.payment.*` webhooks or `get_payment`. `create_payment` and `create_reversal` require the idempotency key (8–200 printable ASCII characters, sent exactly as given); `cancel_payment`, `start_settlement` and the keyed management writes create a UUID when you pass `nil` and return it as `idempotency_key`.
|
|
239
|
+
- A payment write tries 1 + `max_retries` times with the same key and body. No answer, a 5xx that does not say "not started" or a 2xx without a payment leaves the outcome unknown and ends in `PhysicalPosOutcomeUnknownError`, even when a later attempt got a 4xx. Never retry with a new key: it can charge the card twice.
|
|
240
|
+
- Card data is never sent; the card is read on the device. A card-data field (`pan`, `cardNumber`, `cvv`, `expiry`, `track2` …) at any depth, or a card number in `merchantReference`, an item name, a tax group or a free-text filter, raises `PhysicalPosCardDataRejectedError` before anything is sent; the error names the field, never the value. Any other unknown field or filter raises `ConfigurationError`.
|
|
241
|
+
- Lists return `Lunixi::PhysicalPosPage` (`items`, `has_more`, `next_cursor`, `total_count`); every list has an `iterate_*` twin that walks all pages. Updates and status changes take the `rowVersion` you last read.
|
|
242
|
+
- Typed errors: `PhysicalPosVoidAfterSettlementError` (`allowed_operation`, usually `REFUND`), `PhysicalPosRateLimitError` (`retry_after` in seconds), `PhysicalPosCardDataRejectedError` (`field`).
|
|
243
|
+
|
|
244
|
+
Physical POS webhooks are read through the signature check, never around it:
|
|
245
|
+
|
|
246
|
+
```ruby
|
|
247
|
+
event = Lunixi::PhysicalPosWebhook.parse(raw_request_bytes, signature_headers, ENV.fetch('LUNIXI_WEBHOOK_SECRET'))
|
|
248
|
+
case event.category
|
|
249
|
+
when Lunixi::PhysicalPosWebhook::CATEGORY_PAYMENT then apply_payment(event.data, event.history_seq, event.cashier)
|
|
250
|
+
when Lunixi::PhysicalPosWebhook::CATEGORY_SETTLEMENT then record_end_of_day(event.data) # no history_seq: deduplicate by event.id
|
|
251
|
+
end
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Delivery order is not guaranteed: deduplicate by `event.id` and ignore a payment event whose `history_seq` is not greater than the last one you applied. `event.original` names a reversal's original payment, `event.cashier` the device cashier session (nil when there was none) and `event.device_sale?` a sale made directly on the device.
|
|
255
|
+
|
|
256
|
+
## Wallet
|
|
257
|
+
|
|
258
|
+
`client.wallet` is the server-to-server wallet surface (`/api/v1/wallet`). Every call is signed; the key needs the `WALLET_SERVICE` product and the wallet permission of the route. Bodies and filters are checked against `Lunixi::WALLET_ROUTES` before anything is sent: an unknown field, a missing required field, an amount that is not a minor-unit digit string (`"12550"`, never `125.5` or `12550`) or a missing `Idempotency-Key` raises `ConfigurationError`. Keys are the wire names (String or Symbol; snake_case works too).
|
|
259
|
+
|
|
260
|
+
```ruby
|
|
261
|
+
step = lunixi.wallet.transfers.initiate_w2w(
|
|
262
|
+
{ endUserId: end_user_id, sourceWalletAccountId: account_id, destinationWalletNo: wallet_no, amount: '12550', currency: 'TRY' },
|
|
263
|
+
idempotency_key: transfer.initiate_key
|
|
264
|
+
)
|
|
265
|
+
lunixi.wallet.transfers.complete_w2w(step['operationId'], { endUserId: end_user_id, integrityHash: step['integrityHash'],
|
|
266
|
+
nonce: step['nonce'], otpCode: otp }, idempotency_key: transfer.complete_key)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Money moves in two steps: `initiate_*` reserves the limit, `complete_*` commits it with the same `integrityHash` and `nonce` (the SDK puts `operationId` in the body). Lists return `Lunixi::ListPage` (`items`, `next_cursor`, `has_more?`); `iterate` walks every page. `qr.image` returns the image bytes. `end_users.freeze_end_user(end_user_id, ...)` freezes an end user (named so that `Object#freeze` keeps its meaning).
|
|
270
|
+
|
|
271
|
+
## Bank accounts, transfers and FX
|
|
272
|
+
|
|
273
|
+
`client.bank_connect` reads your connected bank accounts, balances and transactions; bank connections are made in the Lunixi dashboard. Every call is signed and the key decides the environment. Filters are checked before sending: values in their sets, `limit` 1–100, at most 100 account ids, minor-unit strings for `minAmountMinor` / `maxAmountMinor`, and `bookedFrom` (inclusive) / `bookedTo` (exclusive) at most 92 days apart, `bookedTo` only with `bookedFrom`.
|
|
274
|
+
|
|
275
|
+
```ruby
|
|
276
|
+
page = lunixi.bank_connect.list_transactions(accountId: [account_id], bookedFrom: Time.now - 7 * 86_400, direction: 'CREDIT')
|
|
277
|
+
transfer = lunixi.bank_connect.transfers.create(
|
|
278
|
+
{ accountId: account_id, receiverIban: iban, receiverName: 'Receiver Name', amountMinor: '150075', description: 'Invoice 42' },
|
|
279
|
+
idempotency_key: payout.id # 8–200 printable ASCII; a UUID v4 is generated when nil
|
|
280
|
+
)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
`transfers` and `fx` need the `bank-connect:transfer` scope and a key with an IP allowlist. `transfers.create` and `fx.create_order` retry a network error or a 5xx with the same key and body; pass your own key to retry safely across processes (the same key and body answer the existing record with `replayed: true`). An answered error carries the key as `idempotency_key`. `fx.create_quote` takes exactly one of `sourceAmountMinor` / `targetAmountMinor`.
|
|
284
|
+
|
|
285
|
+
## Sanctions screening
|
|
286
|
+
|
|
287
|
+
`client.sanction` screens names, wallets, accounts and transactions, runs ongoing monitoring and reads entity intelligence. These calls carry the access token only (no request signature). Bodies and filters are checked against `Lunixi::SANCTION_ROUTES` before sending, including the nested rows and the value sets (`Lunixi::SanctionRiskDomain`, `SanctionScreenMode`, `SanctionWalletScreenMode`).
|
|
288
|
+
|
|
289
|
+
```ruby
|
|
290
|
+
result = lunixi.sanction.screen_name(name: 'Customer Name', riskDomains: [Lunixi::SanctionRiskDomain::SANCTIONS], customerReference: customer.id)
|
|
291
|
+
review!(result) unless Lunixi::Sanction.clear_screening?(result)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Screening returns matches, not verdicts. A result is clear only when it has no match or hit, no blocking flag or decision and, when it reports coverage, `coverageStatus` is `COMPLETE`; a screening that could not run raises `ApiError` and never looks like an empty result.
|
|
295
|
+
|
|
296
|
+
## Insurance
|
|
297
|
+
|
|
298
|
+
`client.insurance` offers, sells and services insurance for your basket items (I1–I22). Every call is signed. `create_order`, `confirm_payment`, `issue_policy`, `cancel_order`, `refund_premium` and `create_lead` require an `Idempotency-Key` (8–200 printable ASCII); `create_quote` and `bind_payment` take one optionally. The basket of a quote is either `paymentIntentId` or `context.items`, never both; the fields of an insurance type's own object are validated by the gateway (422 `insurance.validation.invalid` with every field at once).
|
|
299
|
+
|
|
300
|
+
```ruby
|
|
301
|
+
quote = lunixi.insurance.create_quote({ insuranceType: product['insuranceType'], currency: 'TRY', context: { items: basket_items } })
|
|
302
|
+
option = quote['options'].first
|
|
303
|
+
order = lunixi.insurance.create_order(
|
|
304
|
+
{ quoteId: option['quoteId'], consent: Lunixi::Insurance.consent_from_quote(option, accepted_at) }, idempotency_key: order_key
|
|
305
|
+
)
|
|
306
|
+
basket_items << Lunixi::Insurance.premium_basket_item(order, name: 'Insurance premium', category1: 'Insurance')
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Policy documents, receipts and certificates come back as PDF bytes; `export_reconciliation` returns a `Lunixi::InsuranceReconciliationExport` (`data`, `truncated?`, `next_cursor`, `aborted?`).
|
|
310
|
+
|
|
311
|
+
Bank-account, bank-transfer and insurance webhooks are read through the signature check:
|
|
312
|
+
|
|
313
|
+
```ruby
|
|
314
|
+
event = Lunixi::InsuranceWebhook.parse(raw_request_bytes, signature_headers, ENV.fetch('LUNIXI_WEBHOOK_SECRET'))
|
|
315
|
+
record_policy(event['insuranceOrderId'], event['policies']) if event.type == Lunixi::InsuranceEvents::POLICY_ISSUED
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`Lunixi::BankConnectWebhook` reads `bank_account.transaction.received`, `Lunixi::BankTransferWebhook` reads Bank Connect `bank_transfer.*` (not the payment method's `payment.bank_transfer.*`) and `Lunixi::InsuranceWebhook` the order events and `insurance.lead.submitted`. `event.data` holds the documented fields only; deduplicate by `event.id`.
|
|
319
|
+
|
|
320
|
+
## Subscriptions
|
|
321
|
+
|
|
322
|
+
`client.subscriptions` runs recurring billing: plans, customers (upserted by your own `externalId`), saved cards (added from the checkout SDK's `paymentMethodToken`, never a card number), subscriptions, invoices, the customer portal, catalog products, features, add-ons and metered usage. These calls carry the access token only. Creating a subscription requires an `Idempotency-Key`, which is sent in the body as well; plan, customer, card, plan-change and charge-retry writes accept one. Bodies and filters are checked against `Lunixi::SUBSCRIPTION_ROUTES` before sending, and the money members of bodies, filters and answers must be canonical minor-unit strings (`"0"` for a free plan).
|
|
323
|
+
|
|
324
|
+
```ruby
|
|
325
|
+
plan = lunixi.subscriptions.plans.create({ productId: product_id, code: 'pro', name: 'Pro', price: '9900', currency: 'TRY',
|
|
326
|
+
billing: { frequency: 'MONTHLY' } }, idempotency_key: plan_key)
|
|
327
|
+
customer = lunixi.subscriptions.customers.upsert({ externalId: user.id, email: user.email })
|
|
328
|
+
subscription = lunixi.subscriptions.create({ customerId: customer['id'], planId: plan['id'] }, idempotency_key: signup.key)
|
|
329
|
+
grant_access! if Lunixi::Subscriptions.active?(subscription)
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
The subscription, plan, customer, card, invoice and audit-log lists return a `Lunixi::ListPage` whose `next_cursor` goes back as `page_token:` (`page_size` is the envelope's `pageSize`); `iterate` walks every page. `portal.create_sdk_session` returns the embedded-portal proof (`portalToken`, `sessionProof`, `proofNonce`, `proofExpiresAt`); `portal.create_portal_link` returns a hosted link, opened with `Lunixi::Subscriptions.portal_url(link)`. Event names are in `Lunixi::SubscriptionEvents`.
|
|
333
|
+
|
|
334
|
+
## KYC and identity signals
|
|
335
|
+
|
|
336
|
+
`client.kyc` creates and drives KYC, KYB and evidence sessions; the browser SDK runs the capture with the publishable key and the `kyc.*` webhook (`Lunixi::KycEvents`) is the authority for the result. `person:` / `company:` are sent as `customer` with its `customerType`, and `metadata:` as `evidenceContextJson`. `list_sessions` takes only `limit` and `cursor` (`pageSize` / `pageToken` are read as the same). A document image never appears in an error message.
|
|
337
|
+
|
|
338
|
+
```ruby
|
|
339
|
+
session = lunixi.kyc.create_session({ subjectId: user.id, sessionType: Lunixi::KycSessionType::KYC, externalCustomerId: user.id,
|
|
340
|
+
person: { firstName: user.first_name } }, idempotency_key: kyc_key)
|
|
341
|
+
approved = Lunixi::Kyc.assurance_meets?(achieved_level, Lunixi::KycAssuranceLevel::SUBSTANTIAL)
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
`client.identity` reads device and account-linking signals for a browser `traceId` (risk flags and reason codes, not a verdict). `Lunixi::Identity.device_shared?(links)` tells whether another account uses the device; `Lunixi::Identity.link_reasons(links)` lists why. Both clients carry the access token only.
|
|
345
|
+
|
|
346
|
+
## Marketplace
|
|
347
|
+
|
|
348
|
+
`client.marketplace` splits a charge across sub-dealers and manages them. Split charges (`create_checkout_intent`, `charge_marketplace_card2d`, `charge_marketplace_card3d`) are signed and take an optional idempotency key (16–128 printable ASCII); pass one leg per sub-dealer, `{ subDealerId, amountMinor, scenario? }`, and the legs must add up to `amount` (checked before sending). A checkout intent answered without a token or a form raises `ApiError`. Card data is sent as given and never put in an error message; prefer the hosted form (`create_checkout_intent`) over a direct card charge.
|
|
349
|
+
|
|
350
|
+
```ruby
|
|
351
|
+
intent = lunixi.marketplace.create_checkout_intent(
|
|
352
|
+
{ amount: '100000', currency: 'TRY', orderId: order.id, callbackUrl: return_url },
|
|
353
|
+
[{ subDealerId: 'd_alice', amountMinor: '60000' }, { subDealerId: 'd_bob', amountMinor: '40000' }],
|
|
354
|
+
multi_seller_policy: Lunixi::MarketplaceMultiSellerPolicy::ALL_OR_NOTHING, idempotency_key: order.payment_key
|
|
355
|
+
)
|
|
103
356
|
```
|
|
104
357
|
|
|
105
|
-
|
|
358
|
+
Dealer, commission, payout and audit-log routes carry the access token only: `create_dealer`, `bulk_create_dealers`, `list_dealers`, `get_dealer`, `update_dealer_status`, `onboarding_token` (`Lunixi::Marketplace.onboarding_url(link)`), `dealer_application`, `submit_dealer_application`, `set_dealer_terms`, `sign_dealer_contract`, `activate_dealer`, `record_dealer_kyc_result`, `payout_ledger`, `transactions`, `commission_rules`, `upsert_commission_rule`, `preview_commission_rule`, `resolve_commission`, `create_payout`, `mark_payout_paid`, `bulk_mark_payouts_paid`, `audit_log` and `verify_audit_log`.
|
|
106
359
|
|
|
107
360
|
## Raw-body webhooks and durable deduplication
|
|
108
361
|
|
|
@@ -124,7 +377,7 @@ The durable store implements `process_once(id:, digest:) { … }`: insert a uniq
|
|
|
124
377
|
|
|
125
378
|
## Errors, retries and transport
|
|
126
379
|
|
|
127
|
-
`Lunixi::Error` is the base error. `ConfigurationError`, `SignatureError`, `TransportError`, `RedirectError`, `WebhookError`/`ReplayConflict`, and `ApiError` subclasses distinguish local, network and gateway failures. Gateway errors expose safe `status`, `code`, `request_id` and
|
|
380
|
+
`Lunixi::Error` is the base error. `ConfigurationError`, `SignatureError`, `TransportError`, `RedirectError`, `WebhookError`/`ReplayConflict`, and `ApiError` subclasses distinguish local, network and gateway failures. Gateway errors expose safe `status`, `code`, `request_id`, optional `retry_after` and `details` (only the `field`, `allowedOperation` and `retryAfterSeconds` identifiers); they omit bodies, credentials and remote error text. Treat timeouts as uncertain outcomes: query/reconcile the original operation, never retry using a new key.
|
|
128
381
|
|
|
129
382
|
GET/HEAD and keyed mutations may retry network failures or HTTP 429/502/503/504, at most `max_retries` (default 2, maximum 3). Each retry keeps the same body/key and creates a fresh nonce/signature. A safe 401 refreshes credentials once. Unkeyed mutations are never automatically retried. HTTP redirects are rejected, certificate verification cannot be disabled, and URL traversal/credential injection is blocked. Requests are bounded to 1 MiB and responses to 8 MiB. Net::HTTP does not inherit ambient proxy credentials; a custom enterprise transport is injectable.
|
|
130
383
|
|