lunixi-sdk 1.3.1 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +44 -9
  4. data/README.tr.md +39 -8
  5. data/docs/card-rewards.md +21 -0
  6. data/docs/ruby.en.md +11 -1
  7. data/docs/ruby.tr.md +11 -1
  8. data/lib/lunixi/bank_connect.rb +132 -15
  9. data/lib/lunixi/bank_connect_filters.rb +13 -3
  10. data/lib/lunixi/bank_connect_pos.rb +165 -0
  11. data/lib/lunixi/bank_connect_values.rb +127 -5
  12. data/lib/lunixi/card_requests.rb +34 -5
  13. data/lib/lunixi/client.rb +15 -8
  14. data/lib/lunixi/direct_method_payment_request.rb +27 -3
  15. data/lib/lunixi/fraud.rb +3 -2
  16. data/lib/lunixi/fraud_uk_claims.rb +127 -0
  17. data/lib/lunixi/fraud_values.rb +46 -0
  18. data/lib/lunixi/marketplace.rb +8 -2
  19. data/lib/lunixi/order_details.rb +115 -0
  20. data/lib/lunixi/payment_link_rules.rb +13 -1
  21. data/lib/lunixi/payment_link_values.rb +9 -3
  22. data/lib/lunixi/payment_links.rb +3 -1
  23. data/lib/lunixi/payment_values.rb +22 -2
  24. data/lib/lunixi/payments.rb +45 -9
  25. data/lib/lunixi/product_webhooks.rb +17 -1
  26. data/lib/lunixi/route_table.rb +10 -5
  27. data/lib/lunixi/routing_pin.rb +247 -0
  28. data/lib/lunixi/sanction.rb +77 -17
  29. data/lib/lunixi/sanction_batch.rb +215 -0
  30. data/lib/lunixi/sanction_values.rb +289 -5
  31. data/lib/lunixi/split_payment.rb +22 -2
  32. data/lib/lunixi/subscription_resources.rb +3 -1
  33. data/lib/lunixi/subscription_routing.rb +70 -0
  34. data/lib/lunixi/subscription_values.rb +40 -4
  35. data/lib/lunixi/subscriptions.rb +22 -2
  36. data/lib/lunixi/version.rb +1 -1
  37. data/lib/lunixi/wallet_resources.rb +7 -2
  38. data/lib/lunixi/wallet_routes.rb +5 -2
  39. data/lib/lunixi.rb +7 -0
  40. metadata +9 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1162b2efebff421ad65d7a57e15f0e224cd65fa70e07cce9fd41f952450f93c6
4
- data.tar.gz: 9a5fa79c17af6872843b6873f50dcd1349532c6564c9154a5d7582a1b09dc3a8
3
+ metadata.gz: 15d0bfe9861d614a8fbd5b4ba72ca9d9257409abab50470417e79ebfb645c5da
4
+ data.tar.gz: f3f689285448bd4795fe36566d69db76d7fd515b3b12e3e856cdea0d5a46baef
5
5
  SHA512:
6
- metadata.gz: caef2d7bd60e3052704d03d13e24d041a4ad9493c72bf62bc75012357e8d271a6502ca7ef3cebf40688a040d4835cdf5870d083dc0d72533d7a5ded040589d3a
7
- data.tar.gz: 8c44e3480d34eb1de8524e3d94a4c7d0691ab3bbdbe77cce78537a0940ac57f0eecae88676d6eb09f9b6a1dd716026c6343750d4f8f0cbe3266a6e2ff2cdf93b
6
+ metadata.gz: 7d918280c8b8f693dbcd4afb36c6d98ca511ee2eb38bc0499e3fc488a19806edc3201309f66314da019dba11ef9bec3d6d29ad0268f04bde184a1484cf753249
7
+ data.tar.gz: 5224e1fae4f1c61a0b0f3dcd33d5bbde4c5f9f8db7179936ef7daa284da023e5894a326446b4e7fb1d6ae18f4cd2dcdf301129a8ca686f5ca56fa88354c3fdfb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.1 — 2026-12-03
4
+
5
+ - Development dependencies: `websocket-driver` 0.9.2 (0.8.2 has a critical advisory, GHSA-pf93-24xc-xgxc). The gem itself is unchanged.
6
+
7
+ ## 2.2.0 — 2026-12-03
8
+
9
+ - Bank transfers: route preview `bank_connect.transfers.preview(accountId:, amountMinor:, receiverIban: | recipientId: | receiverAccountId:, currency: nil)` (`POST /api/v1/bank-connect/transfers/preview`) answers `rail`, `arrival`, `receiverBank`, `receiverIbanMasked`, `ownAccount`, `fastStatus` and `notes`; it stores nothing. `transfers.create` takes exactly one receiver — `receiverIban`, `recipientId` (a saved recipient) or `receiverAccountId` (your own account on the same connection: internal transfer) —, `receiverName` is required only with `receiverIban`, and `saveRecipient: { nickname: }` saves the receiver once the bank accepts the transfer; checked before sending. A transfer carries `plannedRail`, `railFallbackFrom`, `recipientId` and `receiverAccountId`. Saved recipients on `bank_connect.transfer_recipients` (`Lunixi::BankConnectTransferRecipients`): `list` / `iterate(q:, limit:, cursor:)`, `create(iban:, name:, nickname: nil)` (409 `bank_connect.transfer.recipient_exists`), `update(recipient_id, name:, nickname:)` (`nickname: ''` removes it), `delete(recipient_id)`. New values `BankTransferArrival`, `BankFastStatus`, `BankTransferPreviewNote`, `BANK_TRANSFER_RECEIVER_FIELDS`, `BANK_TRANSFER_RECIPIENT_NICKNAME_MAX`, `BANK_TRANSFER_RECIPIENT_SEARCH_MAX`; `BANK_TRANSFER_ROUTES` gains `previewTransfer`, `listTransferRecipients`, `createTransferRecipient`, `updateTransferRecipient`, `deleteTransferRecipient`.
10
+ - Bank accounts: POS accounts on `bank_connect.pos_accounts` (`Lunixi::BankConnectPosAccounts`) — the bank's merchant (POS) records on connections with the new capability `BankCapability::POS_ACQUIRING`: `list_accounts` / `iterate_accounts(connectionId:)`, `get_account`, `list_terminals` / `iterate_terminals`, `list_transactions` / `iterate_transactions(pos_account_id, terminalId:, from:, to:, type:, cardBrand:, minAmountMinor:, maxAmountMinor:, provisional:)` (`from`/`to` at most 92 days apart, checked before sending), `list_statement` / `iterate_statement` (value dates `YYYY-MM-DD`, both inclusive), `get_day_summary(pos_account_id, business_date)`, `request_sync`. Fields without a value are `nil`. New values `BankPosTransactionType`, `BankPosChannel`, `BankPosTransactionSource`, `BankPosRecordStatus`, `BankPosDayStatus`, `BANK_POS_FILTERS`, `BANK_POS_CARD_BRAND_PATTERN`, `BANK_POS_TRANSACTION_RANGE_MAX_DAYS`; webhook event `BankPosEvents::DAY_CLOSED` (`bank_pos.day_closed`, `BankPosEvents::PATTERN` `bank_pos.*`), read with `Lunixi::BankPosWebhook.parse` (data `BANK_POS_DAY_CLOSED_FIELDS`).
11
+ - Payments: `void` on a `PROCESSING` payment with an open request waiting for the buyer (Request to Pay approval, bank transfer instruction, QR) cancels the request; the answer's `code` is a `Lunixi::PaymentPendingActionCode` value (`payment.pending_action.cancelled`, `already_completed`, `not_cancellable`, `cancel_unconfirmed`, `not_open`, `busy`). Request to Pay can also run on DenizBank (`providerCode` `DENIZBANK_REQUEST_TO_PAY`, read it from the method list).
12
+
13
+ ## 2.1.0 — 2026-12-01
14
+
15
+ - Sanction: country risk and website screening. `screen_name` accepts `nationality`, `residenceCountry` and `registrationCountry` (ISO 3166-1 alpha-2, country risk only); the answer carries `jurisdictionRisk`. New `screen_website` (`POST /api/v1/sanction/screening/website`, `website` + optional `customerReference`). Bulk rows and column mapping take the same three fields (`SanctionBatchMappingField::NATIONALITY`, `RESIDENCE_COUNTRY`, `REGISTRATION_COUNTRY`). New values `SanctionJurisdictionListCode`, `SanctionJurisdictionRiskEffect`, `SanctionJurisdictionRiskStatus`, `SanctionWebsiteMatchType`, `SanctionCoverageReason`, `SanctionBatchReasonCode::REVIEW_HIGH_RISK_JURISDICTION`; webhook event `SanctionEvents::MONITORING_JURISDICTION_RISK_FOUND` (`sanction.monitoring.jurisdiction_risk_found`).
16
+ - Sanction: `screen_name`, `screen_wallet`, `screen_website`, `screen_account`, `screen_transaction` and `screen_public_procurement_ban` take an optional `idempotency_key:`, sent as the `Idempotency-Key` header (8–120 printable ASCII characters, checked before sending; the gateway answers 400 `sanction.idempotency_key.invalid`); braceless keyword calls (`screen_name(name: 'X')`) keep working. A row of `get_batch_result_row` may carry `jurisdictionRisk` (`field`, `country`, `listCode`, `listName`, `effect`, `listDate`).
17
+ - Payments: routing pin. `routing: { providerCode:, credentialId:, mode: }` on `DirectMethodPaymentRequest#with_routing`, `InstallmentOptionsRequest#with_routing`, `payments.create_intent` / `create_marketplace_intent`, `payments.split` legs, `payment_links.create` / `update` as `checkout.routing`, `subscriptions.create` and the marketplace checkout intent and card charges, checked before sending (`Lunixi::RoutingPin.pin!`: at least one of `providerCode` / `credentialId`, `credentialId` a uuid, `mode` `PREFER` | `STRICT`, no unknown field; a non-card block's `providerCode` must equal `routing.providerCode`; no `routing` with `BANK_TRANSFER`). New `payments.connections.list(payment_method: nil)` (`GET /api/v1/payments/connections`, signed), `RoutingPin.result(response)` of a payment or an installment quote (an unknown `reason` is kept; `outcome` nil in a quote the `STRICT` target does not offer), `PaymentConnectionStatusChanged.from_event` (the whole payload, `deleted?`). New `subscriptions.update_routing(id, routing | nil, reason:)` (`POST /api/v1/subscriptions/subscriptions/{id}/routing`; nil removes the pin), `SubscriptionRouting.from_subscription`, `SubscriptionRoutingPinBlocked.from_event`, `SubscriptionEvents::ROUTING_PIN_BLOCKED` (`subscription.routing_pin_blocked`), `SUBSCRIPTION_ROUTING_FIELDS`, `SUBSCRIPTION_ROUTING_BLOCK_FIELDS`, `SUBSCRIPTION_ROUTING_PIN_BLOCKED_FIELDS`. New values `RoutingPinMode`, `RoutingPinOutcome`, `RoutingPinReason`, `RoutingPinErrorCode` (with `PIN_VIOLATION`), `RoutingPinMismatch` (`details.mismatch`), `ROUTING_PIN_FIELDS`, `ROUTING_PIN_RESULT_FIELDS`, `PaymentConnectionStatus` (with `DELETED`, in the event only), `PaymentConnectionEnvironment`, `PAYMENT_CONNECTION_FIELDS`, `PAYMENT_CONNECTION_STATUS_CHANGED_FIELDS`, `PAYMENT_LINK_CREATE_ONLY_FIELDS` (`environment`); webhook event `PaymentConnectionEvents::STATUS_CHANGED` (`payment.connection.status_changed`).
18
+ - Card rewards: signed option and balance reads, approved string-minor selections on existing direct and split card payments, and original-sale allocation reporting. Availability follows the connected payment programme.
19
+ - Fraud: `fraud.uk_claims.open(claim, actor_id:)` records a UK APP reimbursement claim (`POST /api/v1/fraud/uk-claims`) and returns the claim view. `actor_id` is sent as `X-Actor-Id` (the analyst recording the claim, required with an API key; 1-64 characters of letters, digits and `. _ @ + -`); unknown fields, numeric amounts and non-GBP claims are rejected before sending. New values `UK_CLAIM_FIELDS`, `UK_CLAIM_PAYMENT_FIELDS`, `UK_CLAIM_ROLES`, `UK_CLAIM_PAYER_TYPES`, `UK_CLAIM_REPORTED_BY`, `UK_CLAIM_SCAM_TYPES`, `UK_CLAIM_SCHEMES`, `UK_CLAIM_DEADLINE_KINDS`; fraud webhook event types `Lunixi::FraudWebhookEvents` / `FRAUD_EVENT_TYPES`, with the new `FraudWebhookEvents::UK_CLAIM_DEADLINE` (`fraud.uk_claim.deadline`).
20
+
21
+ ## 2.0.2 — 2026-11-20
22
+
23
+ - The 2.0.0 and 2.0.1 releases did not reach RubyGems; this version carries the same changes. The Rails sample's development server `puma` moves to 8.0.4 (security advisories in 8.0.2); the gem has no runtime dependency on it.
24
+
25
+ ## 2.0.1 — 2026-11-20
26
+
27
+ - The 2.0.0 release did not reach RubyGems; this version carries the same changes. Test and Rails sample style follow RuboCop.
28
+
29
+ ## 2.0.0 — 2026-11-20
30
+
31
+ - **Breaking — order details required.** Every payment endpoint requires the buyer, the billing address and at least one basket item; a `PHYSICAL` item also requires the shipping address (payment providers do not start a payment without them). `payments.create_intent`, `payments.create_marketplace_intent`, `payments.direct_method_payment`, `payments.split`, `marketplace.create_checkout_intent`, the marketplace card charges and `payments.store_card` (buyer and billing address only) raise `ConfigurationError` naming the missing paths before sending; on the checkout intents `buyer.ip` may be left out (the Lunixi form takes it from the browser). `StoreCardRequest` gains `with_buyer` / `with_billing_address`. New `Lunixi::OrderDetails.missing(body, basket:, checkout_intent:)` / `OrderDetails.check!` and constants `ORDER_DETAILS_REQUIRED_FIELDS`, `BUYER_REQUIRED_FIELDS`, `CHECKOUT_INTENT_BUYER_OPTIONAL_FIELDS`, `ADDRESS_REQUIRED_FIELDS`, `BASKET_ITEM_REQUIRED_FIELDS`, `OrderFieldErrorCode` (`payment.order.field_required`, `payment.order.field_invalid`), `OrderFieldReason`.
32
+ - Split payment bodies carry `buyer`, `billingAddress`, `shippingAddress` and `basketItems`; their field list is `Lunixi::SPLIT_PAYMENT_FIELDS`.
33
+ - Wallet card top-up (`wallet.topups.start_card`): `buyer` and `billingAddress` are required, `shippingAddress` optional; a missing field raises `ConfigurationError` before sending (the gateway answers 400 `payment.order.field_required` with `details.fields`).
34
+ - **Breaking — subscription customers.** `subscriptions.customers.upsert` requires `name`, `surname`, `email`, `gsmNumber`, `identityNumber`, `billingAddress`, `billingCity`, `billingCountry`, `billingZipCode` (renewals take the buyer from this record); `phone`, `locale` and `metadata` were never accepted by the gateway and are removed from the route. New constant `Lunixi::SubscriptionCustomerErrorCode`.
35
+ - **Breaking — payment link buyer fields.** `Lunixi::BuyerFieldRequirement` has only `REQUIRED`: the link page always asks all five buyer fields (the gateway answers `HIDDEN` / `OPTIONAL` with 400).
36
+ - Rails sample: `Order.order_details` (encrypted, migration `20261120000000_add_order_details_to_orders`) carries the buyer, addresses and basket; checkout checks them before reserving an attempt and sends them with the intent outside the reserved request.
37
+
3
38
  ## 1.3.1 — 2026-11-15
4
39
 
5
40
  - Lint (RuboCop) clean and `Gemfile.lock` carries the gem version, so the release builds in CI; no behaviour change.
data/README.md CHANGED
@@ -60,7 +60,13 @@ result = lunixi.payments.create_intent(
60
60
  currency: 'TRY',
61
61
  orderId: order.public_id,
62
62
  callbackUrl: 'https://merchant.example/payments/return',
63
- basketItems: [{ id: 'item-1', name: 'Product', itemType: 'PHYSICAL', price: "10050" }],
63
+ # Order details every payment requires (take them from your checkout, never a placeholder).
64
+ # buyer.ip may be left out on an intent: the Lunixi form takes it from the buyer's browser.
65
+ buyer: { name: 'Ada', surname: 'Yilmaz', identityNumber: '11111111111', email: 'ada@example.com',
66
+ gsmNumber: '+905350000000', city: 'Istanbul', country: 'Turkey', zipCode: '34000' },
67
+ billingAddress: { contactName: 'Ada Yilmaz', address: 'Example Street 1', city: 'Istanbul', country: 'Turkey', zipCode: '34000' },
68
+ shippingAddress: { contactName: 'Ada Yilmaz', address: 'Example Street 1', city: 'Istanbul', country: 'Turkey', zipCode: '34000' },
69
+ basketItems: [{ id: 'item-1', name: 'Product', category1: 'Electronics', itemType: 'PHYSICAL', price: "10050" }],
64
70
  enabledInstallments: [1, 2, 3] # optional: at most 3 installments
65
71
  },
66
72
  idempotency_key: order.persisted_payment_attempt_key
@@ -107,8 +113,9 @@ The shared Lunixi form owns enabled payment methods and supports the methods con
107
113
  | 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
114
  | Wallet | `wallet.ping`, `wallet.end_users`, `wallets`, `deposits`, `corporate`, `fees`, `transfers`, `withdrawals`, `operations`, `topups`, `payments`, `qr`, `bulk_payouts` |
109
115
  | 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)` |
116
+ | Bank transfers and FX | `bank_connect.transfers.list_purposes`, `preview(request)`, `create(request, idempotency_key: nil)`, `list`, `get`; `bank_connect.transfer_recipients.list`, `iterate`, `create`, `update(recipient_id, changes)`, `delete`; `bank_connect.fx.list_rates`, `create_quote`, `create_order(request, idempotency_key: nil)`, `list_orders`, `get_order` |
117
+ | POS accounts (bank records) | `bank_connect.pos_accounts.list_accounts`, `get_account`, `list_terminals`, `list_transactions`, `list_statement`, `get_day_summary(pos_account_id, business_date)`, `request_sync` (and the `iterate_*` forms) |
118
+ | Sanctions screening | `sanction.screen_name`, `screen_wallet`, `screen_website`, `screen_account`, `screen_transaction`, `screen_public_procurement_ban`, `screen_adverse_media`, monitoring, entity intelligence, `list_blacklist_entries`, `Lunixi::Sanction.clear_screening?(result)` |
112
119
  | 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
120
  | 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
121
  | 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 |
@@ -116,6 +123,8 @@ The shared Lunixi form owns enabled payment methods and supports the methods con
116
123
  | Marketplace | `marketplace.create_checkout_intent`, `charge_marketplace_card2d`, `charge_marketplace_card3d`, sub-dealers, commissions, payouts, audit log |
117
124
  | Other documented endpoints | `request(method, path, body: nil, query: {}, idempotency_key: nil, signed: true, binary: false, accept: 'application/json', max_retries: nil)` |
118
125
 
126
+ Every payment body carries the order details (`Lunixi::OrderDetails`): `buyer` (`name`, `surname`, `identityNumber` — Turkish ID or passport number, `email` — ASCII, `gsmNumber`, `city`, `country`, `zipCode`, `ip` — the buyer's browser IP), `billingAddress` (`contactName`, `address`, `city`, `country`, `zipCode`) and at least one `basketItems` entry (`id`, `name`, `category1`, `itemType`, `price`; the prices add up to the amount); a `PHYSICAL` item also needs `shippingAddress`. On `create_intent`, `create_marketplace_intent` and `marketplace.create_checkout_intent` `ip` may be left out (`Lunixi::CHECKOUT_INTENT_BUYER_OPTIONAL_FIELDS`): the Lunixi form takes it from the buyer's browser. `create_intent`, `create_marketplace_intent`, `direct_method_payment`, `split`, the marketplace intents and card charges, `store_card` (buyer and billing address only) and `wallet.topups.start_card` (buyer and billing address, `shippingAddress` optional) raise `ConfigurationError` naming the missing paths before sending; `Lunixi::OrderDetails.missing(body)` returns the same list (`buyer.email`, `basketItems.0.category1`, `shippingAddress`). The field lists are `Lunixi::ORDER_DETAILS_REQUIRED_FIELDS`, `Lunixi::BUYER_REQUIRED_FIELDS`, `Lunixi::ADDRESS_REQUIRED_FIELDS` and `Lunixi::BASKET_ITEM_REQUIRED_FIELDS`. The gateway answers a missing field with 400 `payment.order.field_required` and an invalid one with `payment.order.field_invalid` (`Lunixi::OrderFieldErrorCode`, `Lunixi::OrderFieldReason`).
127
+
119
128
  `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.
120
129
 
121
130
  ```ruby
@@ -138,6 +147,8 @@ Payments, fraud, payment links, physical POS, wallet, bank accounts, sanctions s
138
147
  request = Lunixi::DirectMethodPaymentRequest.new('10000', 'TRY', order.reference)
139
148
  .with_method_fields(Lunixi::PaymentMethod::MOBILE_BILLING, provider_code,
140
149
  gsmNumber: '+905321234567')
150
+ .with_buyer(buyer).with_billing_address(billing_address) # buyer includes ip here
151
+ .with_basket_items(basket_items)
141
152
  result = lunixi.payments.direct_method_payment(request, idempotency_key: order.payment_operation_key)
142
153
 
143
154
  action = result.dig('data', 'action')
@@ -165,7 +176,7 @@ instruction = Lunixi::BankTransferInstruction.from_response(result)
165
176
 
166
177
  ### Split payments
167
178
 
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.
179
+ The split body (`Lunixi::SPLIT_PAYMENT_FIELDS`) carries the order details with the legs: `buyer`, `billingAddress`, `basketItems` (adding up to `totalAmount`) and `shippingAddress` for a `PHYSICAL` item. 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
180
 
170
181
  ### BIN, installments and stored cards
171
182
 
@@ -177,7 +188,7 @@ options = lunixi.payments.installment_options(
177
188
  )
178
189
  ```
179
190
 
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.
191
+ `payments.store_card(Lunixi::StoreCardRequest.new(card, card_user_key, callback_url).with_buyer(buyer).with_billing_address(billing_address), idempotency_key:)` verifies and stores a card (signed; the card holder as the buyer and the billing address are required); `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
192
 
182
193
  `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
194
 
@@ -280,7 +291,7 @@ transfer = lunixi.bank_connect.transfers.create(
280
291
  )
281
292
  ```
282
293
 
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`.
294
+ `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`. A transfer's receiver is exactly one of `receiverIban` (with `receiverName`), `recipientId` (a saved recipient of `transfer_recipients`) or `receiverAccountId` (your own account, internal transfer); `transfers.preview` shows the rail and arrival before sending.
284
295
 
285
296
  ## Sanctions screening
286
297
 
@@ -293,6 +304,21 @@ review!(result) unless Lunixi::Sanction.clear_screening?(result)
293
304
 
294
305
  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
306
 
307
+ Country risk: name screening also takes `nationality`, `residenceCountry` (a person) and `registrationCountry` (an organization), ISO 3166-1 alpha-2, compared only with the country risk lists and never read by name matching. The answer's `jurisdictionRisk` holds `ruleVersion`, `status` (`ASSESSED`, `NO_COUNTRY`, `UNAVAILABLE`), `subjectCountries`, `matches`, `lists`, `effect` (`REVIEW`, `INFO`, `NONE`) and `decisionRaised`. A country on the FATF call-for-action list (`FATF_CALL_FOR_ACTION`) turns an `allow` into a `review` (`REVIEW_HIGH_RISK_JURISDICTION`); the FATF increased-monitoring list (`FATF_INCREASED_MONITORING`) and the EU high-risk third countries (`EU_HIGH_RISK_THIRD_COUNTRIES`) are information only; a country never blocks. A field that does not apply to the subject type, or an invalid code, is refused with 400 `sanction.screen_name.failed` (`details.issues[].code`: `FIELD_NOT_APPLICABLE_FOR_SUBJECT_TYPE`, `NATIONALITY_INVALID`, `RESIDENCE_COUNTRY_INVALID`, `REGISTRATION_COUNTRY_INVALID`). Bulk rows and column mapping take the same three fields.
308
+
309
+ ```ruby
310
+ result = lunixi.sanction.screen_name(name: 'Customer Name', subjectType: 'person', nationality: 'TR')
311
+ risk = result['jurisdictionRisk'] # nil on older screenings
312
+ review!(result) if risk && risk['effect'] == Lunixi::SanctionJurisdictionRiskEffect::REVIEW
313
+ site = lunixi.sanction.screen_website(website: 'https://www.example.com/path', customerReference: customer.id,
314
+ idempotency_key: "site-check-#{customer.id}")
315
+ # site['domain'], site['hits'][i]['matchType'] (Lunixi::SanctionWebsiteMatchType), site['decision']
316
+ ```
317
+
318
+ Website screening compares the host in canonical form with the websites on the lists: the listed host itself (`EXACT_HOST`) or a subdomain of it (`PARENT_DOMAIN`). The decision is `review` or `allow`, never a block. Webhook `sanction.monitoring.jurisdiction_risk_found`: a monitored subject's country entered the FATF call-for-action list.
319
+
320
+ The name, wallet, website, account, transaction and public procurement ban screenings take an optional idempotency key, sent as the `Idempotency-Key` header (8–120 printable ASCII characters without spaces; otherwise 400 `sanction.idempotency_key.invalid`); without one no header is sent. A bulk result row read one by one may carry `jurisdictionRisk[]` (`field`, `country`, `listCode`, `listName`, `effect`, `listDate`); the row list does not.
321
+
296
322
  ## Insurance
297
323
 
298
324
  `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).
@@ -324,12 +350,16 @@ record_policy(event['insuranceOrderId'], event['policies']) if event.type == Lun
324
350
  ```ruby
325
351
  plan = lunixi.subscriptions.plans.create({ productId: product_id, code: 'pro', name: 'Pro', price: '9900', currency: 'TRY',
326
352
  billing: { frequency: 'MONTHLY' } }, idempotency_key: plan_key)
327
- customer = lunixi.subscriptions.customers.upsert({ externalId: user.id, email: user.email })
353
+ # Renewals take the buyer from the customer record: identity and billing details are required.
354
+ customer = lunixi.subscriptions.customers.upsert({ externalId: user.id, name: user.first_name, surname: user.last_name, email: user.email,
355
+ gsmNumber: user.phone, identityNumber: user.identity_number,
356
+ billingAddress: user.address, billingCity: user.city, billingCountry: user.country,
357
+ billingZipCode: user.zip_code })
328
358
  subscription = lunixi.subscriptions.create({ customerId: customer['id'], planId: plan['id'] }, idempotency_key: signup.key)
329
359
  grant_access! if Lunixi::Subscriptions.active?(subscription)
330
360
  ```
331
361
 
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`.
362
+ 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`. A missing or invalid customer field is 400 `subscription.customer.field_required` / `subscription.customer.field_invalid` (`Lunixi::SubscriptionCustomerErrorCode`).
333
363
 
334
364
  ## KYC and identity signals
335
365
 
@@ -349,7 +379,8 @@ approved = Lunixi::Kyc.assurance_meets?(achieved_level, Lunixi::KycAssuranceLeve
349
379
 
350
380
  ```ruby
351
381
  intent = lunixi.marketplace.create_checkout_intent(
352
- { amount: '100000', currency: 'TRY', orderId: order.id, callbackUrl: return_url },
382
+ { amount: '100000', currency: 'TRY', orderId: order.id, callbackUrl: return_url,
383
+ buyer: buyer, billingAddress: billing_address, basketItems: basket_items }, # order details as in Start checkout
353
384
  [{ subDealerId: 'd_alice', amountMinor: '60000' }, { subDealerId: 'd_bob', amountMinor: '40000' }],
354
385
  multi_seller_policy: Lunixi::MarketplaceMultiSellerPolicy::ALL_OR_NOTHING, idempotency_key: order.payment_key
355
386
  )
@@ -415,3 +446,7 @@ Historical focused 0.1.2 verification: 24 Rails form/return/URL/CSP security tes
415
446
  The checkout page’s CSP permits form POSTs only to `'self'` and the configured gateway origin (default `https://api-gateway.lunixi.com`). This preserves wallet/provider and legacy POST handoffs supported by the browser SDK. For another reviewed provider, set server-only `LUNIXI_FORM_ACTION_ORIGINS` to a comma-separated list of exact HTTPS origins, without spaces, paths, trailing slashes, credentials, query, fragment or wildcards. Invalid configuration fails closed; gateway responses and browser fields never expand this list. Script nonces, frame/connect restrictions and informational return handling remain in force.
416
447
 
417
448
  Before upgrading from 0.x, follow [the money-string migration](MIGRATION-1.0.md).
449
+
450
+ ### Card rewards
451
+
452
+ See [Card rewards](docs/card-rewards.md) for signed balance queries, approved reward selections on direct or split payments, and allocation reporting.
data/README.tr.md CHANGED
@@ -58,7 +58,13 @@ Toplamı sunucuda hesaplayın. Çağrıdan **önce** ödeme denemesine bir UUID
58
58
  result = lunixi.payments.create_intent(
59
59
  { amount: "10050", currency: 'TRY', orderId: order.public_id,
60
60
  callbackUrl: 'https://merchant.example/payments/return',
61
- basketItems: [{ id: 'urun-1', name: 'Product', itemType: 'PHYSICAL', price: "10050" }],
61
+ # Her ödemenin istediği sipariş bilgileri (ödeme sayfanızdan alın, yer tutucu kullanmayın).
62
+ # Intent'te buyer.ip gönderilmeyebilir: Lunixi formu IP'yi alıcının tarayıcısından alır.
63
+ buyer: { name: 'Ada', surname: 'Yilmaz', identityNumber: '11111111111', email: 'ada@example.com',
64
+ gsmNumber: '+905350000000', city: 'Istanbul', country: 'Turkey', zipCode: '34000' },
65
+ billingAddress: { contactName: 'Ada Yilmaz', address: 'Example Street 1', city: 'Istanbul', country: 'Turkey', zipCode: '34000' },
66
+ shippingAddress: { contactName: 'Ada Yilmaz', address: 'Example Street 1', city: 'Istanbul', country: 'Turkey', zipCode: '34000' },
67
+ basketItems: [{ id: 'urun-1', name: 'Product', category1: 'Electronics', itemType: 'PHYSICAL', price: "10050" }],
62
68
  enabledInstallments: [1, 2, 3] }, # isteğe bağlı: en fazla 3 taksit
63
69
  idempotency_key: order.persisted_payment_attempt_key
64
70
  )
@@ -66,6 +72,8 @@ intent_id = result.fetch('data').fetch('paymentId')
66
72
  checkout_token = result.fetch('data').fetch('token')
67
73
  ```
68
74
 
75
+ Her ödeme gövdesi sipariş bilgilerini taşır (`Lunixi::OrderDetails`): `buyer` (`name`, `surname`, `identityNumber` — T.C. kimlik veya pasaport numarası, `email` — ASCII, `gsmNumber`, `city`, `country`, `zipCode`, `ip` — alıcının tarayıcı IP'si), `billingAddress` (`contactName`, `address`, `city`, `country`, `zipCode`) ve en az bir `basketItems` satırı (`id`, `name`, `category1`, `itemType`, `price`; fiyatların toplamı tutara eşittir); `PHYSICAL` bir satır `shippingAddress` de ister. `create_intent`, `create_marketplace_intent` ve `marketplace.create_checkout_intent` çağrılarında `ip` gönderilmeyebilir (`Lunixi::CHECKOUT_INTENT_BUYER_OPTIONAL_FIELDS`): Lunixi formu IP'yi alıcının tarayıcısından alır. `create_intent`, `create_marketplace_intent`, `direct_method_payment`, `split`, pazaryeri intent'leri ve kart tahsilatları, `store_card` (yalnız alıcı ve fatura adresi) ve `wallet.topups.start_card` (alıcı ve fatura adresi, `shippingAddress` isteğe bağlı) eksik alanların yollarını sayan bir `ConfigurationError` ile göndermeden önce durur; `Lunixi::OrderDetails.missing(body)` aynı listeyi döndürür (`buyer.email`, `basketItems.0.category1`, `shippingAddress`). Alan listeleri `Lunixi::ORDER_DETAILS_REQUIRED_FIELDS`, `Lunixi::BUYER_REQUIRED_FIELDS`, `Lunixi::ADDRESS_REQUIRED_FIELDS` ve `Lunixi::BASKET_ITEM_REQUIRED_FIELDS` sabitlerindedir. Gateway eksik alanı 400 `payment.order.field_required`, geçersiz alanı `payment.order.field_invalid` ile yanıtlar (`Lunixi::OrderFieldErrorCode`, `Lunixi::OrderFieldReason`).
76
+
69
77
  `"10050"`, 100,50 TRY’nin kuruş karşılığıdır. Tutarlar pozitif, kanonik alt birim string olmalı ve işaretli 64 bit fiat aralığında kalmalıdır; sayısal değerler kabul edilmez. Eski kök `price`/`paidPrice` alanları null olsa bile reddedilir. Sepet toplamı ve split bacak toplamı ana tutarla aynı olmalıdır. Her `basketItems` satırı isteğe bağlı `productCategory` alanını taşıyabilir: Lunixi ürün kategorisi kodu (ör. `'MOBILE_PHONE'`); yasal taksit sınırı olan ödeme yöntemleri (ör. alışveriş kredisi) ve diğer platform özellikleri tarafından kullanılır. Alanı göndermezseniz mevcut davranış korunur; gateway bilinmeyen kodu 400 ile reddeder. Kodlar `Lunixi::ProductCategory` sabitleri olarak hazırdır (`Lunixi::ProductCategory::MOBILE_PHONE`, 40 kodun tamamı `Lunixi::ProductCategory::ALL` içinde); liste yalnız sona ekleme ile büyüdüğünden değer düz string olarak kalır ve SDK göndermeden önce denetlemez. Intent’te `installment` gönderilmez; taksiti ödeme formu seçtirir. İsteğe bağlı `enabledInstallments` listesi, bir ödeme için formun sunacağı taksit sayılarını yalnızca daraltır (`[1]` = yalnız tek çekim); form, panel ayarlarınızın, kartın ve platform üst sınırının da izin verdiği sayıları gösterir. Kısıt istemiyorsanız alanı göndermeyin. Liste 1–36 arası, tekrarsız ve 1'i içeren tamsayılardan oluşmalıdır; başka bir liste (boş liste dahil) göndermeden önce `ConfigurationError` oluşturur ve liste artan sırada gönderilir. `preauth: true` ile provizyon alınabilir; capture ayrı işlem ve anahtarla yapılır.
70
78
 
71
79
  Varsayılan form mağaza içinde açılır; isteğe bağlı yönlendirme yalnız doğrulanmış backend `paymentPageUrl` adresini kullanır. Token ve adres şifrelenir; iki mod aynı Lunixi form ayarlarını paylaşır. PAN/CVV toplamayın.
@@ -103,8 +111,9 @@ HTTP 2xx, token, dönüş sayfası veya devam eden split durumu tahsilat kanıt
103
111
  | Fiziki POS yönetimi | `physical_pos_management` mağazalar, kasalar, terminaller (banka ve sağlayıcı satırları, cihaz bağlantıları), cihazlar ve kimlik anahtarları, gün sonu politikaları, katalog ve genel görünüm |
104
112
  | Cüzdan | `wallet.ping`, `wallet.end_users`, `wallets`, `deposits`, `corporate`, `fees`, `transfers`, `withdrawals`, `operations`, `topups`, `payments`, `qr`, `bulk_payouts` |
105
113
  | Banka hesapları | `bank_connect.list_banks`, `list_connections`, `get_connection`, `list_accounts`, `get_account`, `request_sync`, `list_balances`, `list_transactions`, `get_transaction` |
106
- | Banka transferleri ve döviz | `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` |
107
- | Yaptırım taraması | `sanction.screen_name`, `screen_wallet`, `screen_account`, `screen_transaction`, `screen_public_procurement_ban`, `screen_adverse_media`, izleme, varlık istihbaratı, `list_blacklist_entries`, `Lunixi::Sanction.clear_screening?(result)` |
114
+ | Banka transferleri ve döviz | `bank_connect.transfers.list_purposes`, `preview(request)`, `create(request, idempotency_key: nil)`, `list`, `get`; `bank_connect.transfer_recipients.list`, `iterate`, `create`, `update(recipient_id, changes)`, `delete`; `bank_connect.fx.list_rates`, `create_quote`, `create_order(request, idempotency_key: nil)`, `list_orders`, `get_order` |
115
+ | POS hesapları (banka kayıtları) | `bank_connect.pos_accounts.list_accounts`, `get_account`, `list_terminals`, `list_transactions`, `list_statement`, `get_day_summary(pos_account_id, business_date)`, `request_sync` (ve `iterate_*` biçimleri) |
116
+ | Yaptırım taraması | `sanction.screen_name`, `screen_wallet`, `screen_website`, `screen_account`, `screen_transaction`, `screen_public_procurement_ban`, `screen_adverse_media`, izleme, varlık istihbaratı, `list_blacklist_entries`, `Lunixi::Sanction.clear_screening?(result)` |
108
117
  | Sigorta | `insurance.list_products`, `search_products`, `create_quote`, `create_order`, `bind_payment`, `confirm_payment`, `issue_policy`, `cancel_order`, `refund_premium`, poliçe dosyaları, mutabakat, potansiyel müşteriler |
109
118
  | Abonelik | `subscriptions.create(request, idempotency_key:)`, `get`, `list`, `cancel`, `pause`, `resume`, `change_plan`, `audit_logs`; alt istemciler `plans`, `customers`, `cards`, `invoices`, `portal`, `products`, `features`, `addons`, `usage` |
110
119
  | KYC / KYB / kanıt | `kyc.create_session`, `get_session`, `list_sessions`, `set_jurisdiction`, `set_primary_document`, `upload_document`, `timeline`, `submit`, `manual_review`, `evidence_request`, üye işyeri politikası, webhook kuyruğu, silme talepleri |
@@ -129,6 +138,8 @@ banks = lunixi.request('GET', '/api/v1/bank-connect/banks', query: { limit: 20 }
129
138
  request = Lunixi::DirectMethodPaymentRequest.new('10000', 'TRY', order.reference)
130
139
  .with_method_fields(Lunixi::PaymentMethod::MOBILE_BILLING, provider_code,
131
140
  gsmNumber: '+905321234567')
141
+ .with_buyer(buyer).with_billing_address(billing_address) # buyer burada ip içerir
142
+ .with_basket_items(basket_items)
132
143
  result = lunixi.payments.direct_method_payment(request, idempotency_key: order.payment_operation_key)
133
144
 
134
145
  action = result.dig('data', 'action')
@@ -156,7 +167,7 @@ Yanıtta `DISPLAY` transfer talimatı yoksa `from_response` nil döndürür. Ge
156
167
 
157
168
  ### Parçalı ödeme
158
169
 
159
- Kart dışı bir parça `Lunixi::SPLIT_LEG_BLOCK_FIELDS` alanlarından (`mobileBilling`, `wallet`, `promissoryNote`) yalnız birini taşır; yemek kartı, açık bankacılık, alışveriş kredisi ve Para Transferi parça olamaz ve göndermeden önce reddedilir. `list_splits(status: 'COMPLETED', limit: 25)` parçalı ödemeleri listeler (`Lunixi::LIST_SPLIT_PAYMENTS_FILTERS`). Webhook adları `Lunixi::SplitPaymentEvents` içindedir; parça olaylarını da almak için uç noktanın olay türlerine `Lunixi::SPLIT_LEG_EVENTS_SUBSCRIPTION` ekleyin.
170
+ Çoklu ödeme gövdesi (`Lunixi::SPLIT_PAYMENT_FIELDS`) parçalarla birlikte sipariş bilgilerini taşır: `buyer`, `billingAddress`, `basketItems` (toplamı `totalAmount`) ve `PHYSICAL` bir satır için `shippingAddress`. Kart dışı bir parça `Lunixi::SPLIT_LEG_BLOCK_FIELDS` alanlarından (`mobileBilling`, `wallet`, `promissoryNote`) yalnız birini taşır; yemek kartı, açık bankacılık, alışveriş kredisi ve Para Transferi parça olamaz ve göndermeden önce reddedilir. `list_splits(status: 'COMPLETED', limit: 25)` parçalı ödemeleri listeler (`Lunixi::LIST_SPLIT_PAYMENTS_FILTERS`). Webhook adları `Lunixi::SplitPaymentEvents` içindedir; parça olaylarını da almak için uç noktanın olay türlerine `Lunixi::SPLIT_LEG_EVENTS_SUBSCRIPTION` ekleyin.
160
171
 
161
172
  ### BIN, taksitler ve saklı kartlar
162
173
 
@@ -168,7 +179,7 @@ options = lunixi.payments.installment_options(
168
179
  )
169
180
  ```
170
181
 
171
- `payments.store_card(Lunixi::StoreCardRequest.new(card, card_user_key, callback_url), idempotency_key:)` bir kartı doğrular ve saklar (imzalı); `list_stored_cards(card_user_key)` ve `get_stored_card(token)` maskelenmiş kart verisini döndürür, `deactivate_stored_card(token, idempotency_key:)` kartı kaldırır (imzalı). İki yazım da idempotency anahtarı ister.
182
+ `payments.store_card(Lunixi::StoreCardRequest.new(card, card_user_key, callback_url).with_buyer(buyer).with_billing_address(billing_address), idempotency_key:)` bir kartı doğrular ve saklar (imzalı; alıcı olarak kart sahibi ve fatura adresi zorunludur); `list_stored_cards(card_user_key)` ve `get_stored_card(token)` maskelenmiş kart verisini döndürür, `deactivate_stored_card(token, idempotency_key:)` kartı kaldırır (imzalı). İki yazım da idempotency anahtarı ister.
172
183
 
173
184
  `payments.create_marketplace_intent` intent gövdesine ek olarak `sellers` (`[{ subDealerId:, amountMinor:, scenario: }]`) ve `multiSellerPolicy` alır. Her `amountMinor` kanonik küçük birim string'idir ve satıcıların toplamı `amount` değerine eşit olmalıdır; başka bir toplam göndermeden önce `ConfigurationError` oluşturur.
174
185
 
@@ -284,6 +295,21 @@ review!(result) unless Lunixi::Sanction.clear_screening?(result)
284
295
 
285
296
  Tarama karar değil eşleşme döndürür. Sonuç yalnız eşleşme veya isabet, engelleyici işaret veya karar yoksa ve kapsam bildiriyorsa `coverageStatus` değeri `COMPLETE` ise temizdir; çalıştırılamayan tarama `ApiError` oluşturur ve hiçbir zaman boş sonuç gibi görünmez.
286
297
 
298
+ Ülke riski: isim taraması ayrıca `nationality`, `residenceCountry` (kişi) ve `registrationCountry` (kurum) alanlarını ISO 3166-1 alpha-2 kodla alır. Bu alanlar yalnız ülke riski listeleriyle karşılaştırılır, isim eşleştirmesini etkilemez. Yanıttaki `jurisdictionRisk` nesnesi `ruleVersion`, `status` (`ASSESSED`, `NO_COUNTRY`, `UNAVAILABLE`), `subjectCountries`, `matches`, `lists`, `effect` (`REVIEW`, `INFO`, `NONE`) ve `decisionRaised` alanlarını taşır. FATF karşı tedbir çağrısı listesindeki (`FATF_CALL_FOR_ACTION`) ülke "izin ver" kararını incelemeye çevirir (`REVIEW_HIGH_RISK_JURISDICTION`); FATF artırılmış izleme listesi (`FATF_INCREASED_MONITORING`) ve AB yüksek riskli üçüncü ülkeler (`EU_HIGH_RISK_THIRD_COUNTRIES`) yalnız bilgidir. Ülke tek başına engelleme üretmez. Kişi ya da kuruma uymayan alan ve geçersiz kod 400 `sanction.screen_name.failed` ile reddedilir (`details.issues[].code`: `FIELD_NOT_APPLICABLE_FOR_SUBJECT_TYPE`, `NATIONALITY_INVALID`, `RESIDENCE_COUNTRY_INVALID`, `REGISTRATION_COUNTRY_INVALID`). Toplu taramada satırlar ve sütun eşlemesi aynı üç alanı alır.
299
+
300
+ ```ruby
301
+ result = lunixi.sanction.screen_name(name: 'Customer Name', subjectType: 'person', nationality: 'TR')
302
+ risk = result['jurisdictionRisk'] # nil on older screenings
303
+ review!(result) if risk && risk['effect'] == Lunixi::SanctionJurisdictionRiskEffect::REVIEW
304
+ site = lunixi.sanction.screen_website(website: 'https://www.example.com/path', customerReference: customer.id,
305
+ idempotency_key: "site-check-#{customer.id}")
306
+ # site['domain'], site['hits'][i]['matchType'] (Lunixi::SanctionWebsiteMatchType), site['decision']
307
+ ```
308
+
309
+ Web sitesi taraması host'u kanonik biçimde listelerdeki web siteleriyle karşılaştırır: listelenen host'un kendisi (`EXACT_HOST`) ya da onun alt alan adı (`PARENT_DOMAIN`). Karar `review` ya da `allow` olur, engelleme yoktur. Webhook `sanction.monitoring.jurisdiction_risk_found`: izlediğiniz kişi ya da kurumun ülkesi FATF karşı tedbir çağrısı listesine girdi.
310
+
311
+ İsim, cüzdan, web sitesi, hesap, işlem ve kamu ihalesi yasağı taramaları isteğe bağlı bir idempotency anahtarı alır; anahtar `Idempotency-Key` başlığıyla gider (boşluksuz 8–120 yazdırılabilir ASCII karakter; aksi hâlde 400 `sanction.idempotency_key.invalid`). Anahtar vermezseniz başlık gönderilmez. Toplu taramada tek tek okunan satır sonucu `jurisdictionRisk[]` (`field`, `country`, `listCode`, `listName`, `effect`, `listDate`) taşıyabilir; satır listesinde bu alan yoktur.
312
+
287
313
  ## Sigorta
288
314
 
289
315
  `client.insurance` sepet kalemleriniz için sigorta sunar, satar ve yönetir (I1–I22). Her çağrı imzalıdır. `create_order`, `confirm_payment`, `issue_policy`, `cancel_order`, `refund_premium` ve `create_lead` bir `Idempotency-Key` ister (8–200 yazdırılabilir ASCII); `create_quote` ve `bind_payment` isteğe bağlı anahtar alır. Teklifin sepeti ya `paymentIntentId` ya da `context.items` olur, ikisi birden olmaz; bir sigorta türünün kendi nesnesinin alanlarını gateway doğrular (bütün alanlar tek seferde 422 `insurance.validation.invalid` ile).
@@ -315,12 +341,16 @@ record_policy(event['insuranceOrderId'], event['policies']) if event.type == Lun
315
341
  ```ruby
316
342
  plan = lunixi.subscriptions.plans.create({ productId: product_id, code: 'pro', name: 'Pro', price: '9900', currency: 'TRY',
317
343
  billing: { frequency: 'MONTHLY' } }, idempotency_key: plan_key)
318
- customer = lunixi.subscriptions.customers.upsert({ externalId: user.id, email: user.email })
344
+ # Yenilemeler alıcıyı müşteri kaydından alır: kimlik ve fatura bilgileri zorunludur.
345
+ customer = lunixi.subscriptions.customers.upsert({ externalId: user.id, name: user.first_name, surname: user.last_name, email: user.email,
346
+ gsmNumber: user.phone, identityNumber: user.identity_number,
347
+ billingAddress: user.address, billingCity: user.city, billingCountry: user.country,
348
+ billingZipCode: user.zip_code })
319
349
  subscription = lunixi.subscriptions.create({ customerId: customer['id'], planId: plan['id'] }, idempotency_key: signup.key)
320
350
  grant_access! if Lunixi::Subscriptions.active?(subscription)
321
351
  ```
322
352
 
323
- Abonelik, plan, müşteri, kart, fatura ve denetim kaydı listeleri, `next_cursor` değeri `page_token:` olarak geri gönderilen bir `Lunixi::ListPage` döndürür (`page_size` zarfın `pageSize` değeridir); `iterate` bütün sayfaları gezer. `portal.create_sdk_session` gömülü portal kanıtını döndürür (`portalToken`, `sessionProof`, `proofNonce`, `proofExpiresAt`); `portal.create_portal_link` barındırılan bir link döndürür, link `Lunixi::Subscriptions.portal_url(link)` ile açılır. Olay adları `Lunixi::SubscriptionEvents` içindedir.
353
+ Abonelik, plan, müşteri, kart, fatura ve denetim kaydı listeleri, `next_cursor` değeri `page_token:` olarak geri gönderilen bir `Lunixi::ListPage` döndürür (`page_size` zarfın `pageSize` değeridir); `iterate` bütün sayfaları gezer. `portal.create_sdk_session` gömülü portal kanıtını döndürür (`portalToken`, `sessionProof`, `proofNonce`, `proofExpiresAt`); `portal.create_portal_link` barındırılan bir link döndürür, link `Lunixi::Subscriptions.portal_url(link)` ile açılır. Olay adları `Lunixi::SubscriptionEvents` içindedir. Eksik veya geçersiz müşteri alanı 400 `subscription.customer.field_required` / `subscription.customer.field_invalid` ile yanıtlanır (`Lunixi::SubscriptionCustomerErrorCode`).
324
354
 
325
355
  ## KYC ve kimlik sinyalleri
326
356
 
@@ -340,7 +370,8 @@ approved = Lunixi::Kyc.assurance_meets?(achieved_level, Lunixi::KycAssuranceLeve
340
370
 
341
371
  ```ruby
342
372
  intent = lunixi.marketplace.create_checkout_intent(
343
- { amount: '100000', currency: 'TRY', orderId: order.id, callbackUrl: return_url },
373
+ { amount: '100000', currency: 'TRY', orderId: order.id, callbackUrl: return_url,
374
+ buyer: buyer, billingAddress: billing_address, basketItems: basket_items }, # sipariş bilgileri, Ödeme başlatma örneğindeki gibi
344
375
  [{ subDealerId: 'd_alice', amountMinor: '60000' }, { subDealerId: 'd_bob', amountMinor: '40000' }],
345
376
  multi_seller_policy: Lunixi::MarketplaceMultiSellerPolicy::ALL_OR_NOTHING, idempotency_key: order.payment_key
346
377
  )
@@ -0,0 +1,21 @@
1
+ # Card rewards
2
+
3
+ Use the reward-options and reward-query methods of the payments client. These are signed server-side reads; query results do not reserve a balance. Send money as string minor units, for example `"10000"` for TRY 100.
4
+
5
+ Attach the selected `cardRewardSelection` (`selectionId`, `amountMinor`) to the existing direct payment or an eligible new-card split leg. Keep the full order or leg amount unchanged. Reuse the query's order, card, currency, installment and quote. Reuse the payment's idempotency key when retrying the same request.
6
+
7
+ The checkout displays this flow under **Points / Gift vouchers**. It does not add a points control to the ordinary card form. A non-card voucher uses its own method fields.
8
+
9
+ A selection expires and is scoped to the merchant and environment. A 2D-only reward selection cannot be changed into a 3D Secure payment or preauthorization. An unknown payment outcome must be checked using the existing payment ID; do not create a new charge.
10
+
11
+ The optional `cardRewardAllocation` response separates the requested amounts from the provider-confirmed original-sale amounts. Missing `actual` is unknown, never zero. A refund does not imply that points were restored in the original proportions.
12
+
13
+ For request examples and the current contract, see [Card rewards](https://docs.lunixi.com/en/payments/card-rewards).
14
+
15
+ ## SDK methods
16
+
17
+ - `list_card_rewards(body)`
18
+ - `query_card_rewards(body)`
19
+ - `with_card_reward_selection(selection_id, amount_minor)`
20
+
21
+ A split leg carries `cardRewardSelection` in the existing split request body. It does not create a separate points payment.
data/docs/ruby.en.md CHANGED
@@ -62,7 +62,15 @@ result = lunixi.payments.create_intent(
62
62
  currency: 'TRY',
63
63
  orderId: order.public_id,
64
64
  callbackUrl: 'https://merchant.example/payments/return',
65
- basketItems: [{ id: 'item-1', name: 'Product', itemType: 'PHYSICAL', price: "10050" }]
65
+ # Buyer, billing address and basket are required; a PHYSICAL item also needs the shipping address. The buyer IP is optional on an intent: the Lunixi form takes it from the browser.
66
+ buyer: {
67
+ name: 'Ada', surname: 'Yılmaz', identityNumber: '11111111111', email: 'ada@example.com',
68
+ gsmNumber: '+905000000000', city: 'Istanbul', country: 'Turkey', zipCode: '34732'
69
+ },
70
+ billingAddress: {
71
+ contactName: 'Ada Yılmaz', address: 'Altunizade Mah. Örnek Sok. No: 1', city: 'Istanbul', country: 'Turkey', zipCode: '34662'
72
+ },
73
+ basketItems: [{ id: 'item-1', name: 'Consulting service', category1: 'Services', itemType: 'VIRTUAL', price: "10050" }]
66
74
  },
67
75
  idempotency_key: order.persisted_payment_attempt_key
68
76
  )
@@ -77,6 +85,8 @@ checkout_token = result.fetch('data').fetch('token')
77
85
  An intent/token, HTTP 2xx, return URL or intermediate split state does not prove capture. Correlate a verified webhook with the persisted order and authenticate a payment status read; confirm final status, amount and currency before fulfillment.
78
86
 
79
87
 
88
+ Every payment body carries the order details (`Lunixi::OrderDetails`): `buyer` (name, surname, identityNumber, email, gsmNumber, city, country, zipCode and the browser `ip`, optional on the checkout intents), `billingAddress` (contactName, address, city, country, zipCode), at least one `basketItems` entry (id, name, category1, itemType, price) and `shippingAddress` for a `PHYSICAL` item. The SDK raises `ConfigurationError` naming the missing paths before sending; the gateway answers 400 `payment.order.field_required` (`Lunixi::OrderFieldErrorCode`).
89
+
80
90
  Amounts must be positive canonical minor-unit strings within the signed 64-bit fiat range. Root `price` and `paidPrice` are rejected even when null. Basket prices and split leg amounts must equal the relevant total. 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 `installment` is rejected because installments are selected in the checkout form; the optional `enabledInstallments` list (distinct integers 1–36 including 1, ascending; `[1]` = single payment only) only narrows the counts the form offers for one payment. `preauth: true` requests authorization; capture is a separate operation.
81
91
 
82
92
  ## Available helpers
data/docs/ruby.tr.md CHANGED
@@ -62,7 +62,15 @@ result = lunixi.payments.create_intent(
62
62
  currency: 'TRY',
63
63
  orderId: order.public_id,
64
64
  callbackUrl: 'https://merchant.example/payments/return',
65
- basketItems: [{ id: 'item-1', name: 'Product', itemType: 'PHYSICAL', price: "10050" }]
65
+ # Alıcı, fatura adresi ve sepet zorunludur; PHYSICAL bir satır teslimat adresi de ister. Intent'te alıcı IP'si isteğe bağlıdır: Lunixi formu IP'yi tarayıcıdan alır.
66
+ buyer: {
67
+ name: 'Ada', surname: 'Yılmaz', identityNumber: '11111111111', email: 'ada@example.com',
68
+ gsmNumber: '+905000000000', city: 'Istanbul', country: 'Turkey', zipCode: '34732'
69
+ },
70
+ billingAddress: {
71
+ contactName: 'Ada Yılmaz', address: 'Altunizade Mah. Örnek Sok. No: 1', city: 'Istanbul', country: 'Turkey', zipCode: '34662'
72
+ },
73
+ basketItems: [{ id: 'item-1', name: 'Consulting service', category1: 'Services', itemType: 'VIRTUAL', price: "10050" }]
66
74
  },
67
75
  idempotency_key: order.persisted_payment_attempt_key
68
76
  )
@@ -77,6 +85,8 @@ checkout_token = result.fetch('data').fetch('token')
77
85
  Intent/token, HTTP 2xx, dönüş sayfası veya ara split durumu tahsilat kanıtı değildir. İmzalı webhook’u kalıcı siparişle eşleştirin; sunucudan ödeme sorgusunda nihai durum, tutar ve para birimi uyuşmadan siparişi tamamlamayın.
78
86
 
79
87
 
88
+ Her ödeme gövdesi sipariş bilgilerini taşır (`Lunixi::OrderDetails`): `buyer` (name, surname, identityNumber, email, gsmNumber, city, country, zipCode ve checkout intent'lerinde isteğe bağlı tarayıcı `ip` değeri), `billingAddress` (contactName, address, city, country, zipCode), en az bir `basketItems` satırı (id, name, category1, itemType, price) ve `PHYSICAL` bir satır için `shippingAddress`. SDK eksik alanların yollarını sayan bir `ConfigurationError` ile göndermeden önce durur; gateway 400 `payment.order.field_required` ile yanıtlar (`Lunixi::OrderFieldErrorCode`).
89
+
80
90
  Tutarlar pozitif, kanonik alt birim string olmalı ve işaretli 64 bit fiat aralığında kalmalıdır. Kök `price`/`paidPrice` null olsa bile reddedilir. Sepet ve split bacak toplamları ana toplamla aynı olmalıdır. Her `basketItems` satırı isteğe bağlı `productCategory` alanını taşıyabilir: Lunixi ürün kategorisi kodu (ör. `'MOBILE_PHONE'`); yasal taksit sınırı olan ödeme yöntemleri (ör. alışveriş kredisi) ve diğer platform özellikleri tarafından kullanılır. Alanı göndermezseniz mevcut davranış korunur; gateway bilinmeyen kodu 400 ile reddeder. Kodlar `Lunixi::ProductCategory` sabitleri olarak hazırdır (`Lunixi::ProductCategory::MOBILE_PHONE`, 40 kodun tamamı `Lunixi::ProductCategory::ALL` içinde); liste yalnız sona ekleme ile büyüdüğünden değer düz string olarak kalır ve SDK göndermeden önce denetlemez. Intent’te `installment` gönderilmez; taksit formda seçilir. İsteğe bağlı `enabledInstallments` listesi (1–36 arası, tekrarsız, 1'i içeren, artan sıralı tamsayılar; `[1]` = yalnız tek çekim) bir ödeme için formun sunacağı sayıları yalnızca daraltır. `preauth: true` provizyon ister; capture ayrı işlemdir.
81
91
 
82
92
  ## Yardımcı API’ler