@isroilov_an/paylov 0.0.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ Consumer-visible changes, following [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This
4
+ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## [0.0.1] - 2026-11-17
7
+
8
+ Initial release. Documented in [`docs/usage/`](docs/usage/INDEX.md).
9
+
10
+ ### Added
11
+
12
+ - `PaylovClient` for the Paylov merchant gateway, with lazy OAuth2, GET-only retries, metadata-only
13
+ logging and a `close()` that revokes the access token.
14
+ - Typed errors discriminated by `kind`: `PaylovInputError`, `PaylovClientClosedError`,
15
+ `PaylovApiError`, `PaylovProtocolError` and `PaylovConnectionError`, each with a log-safe
16
+ `toJSON()`. `isPaylovOutcomeUnknown` guides recovery after ambiguous failures.
17
+ - Integer tiyin money with `sumToTiyin` and `formatSum`.
18
+ - `paylov.gateway`: gateway status and issuing banks.
19
+ - `paylov.cards`: Card Bind links and sessions, card number binding with an OTP, card reads,
20
+ deletion and phone checks.
21
+ - `paylov.payments`: saved-card payments, card number payments with an OTP, and full refunds.
22
+ - `paylov.transactions`: reconciliation reads, the settled-sales list and the RRN read.
23
+ - `paylov.holds`: create, capture once, release and read.
24
+ - `paylov.splits` and `paylov.subMerchants`.
25
+ - `paylov.fiscalization`: register, read, attach and refund OFD receipts, and check activity types.
26
+ Receipt item lines total `(priceTiyin - discountTiyin) * count`; this is the SDK's reading, as
27
+ Paylov documents no formula.
28
+ - `createCheckoutUrl` for the hosted checkout page.
29
+ - `PaylovWebhookReceiver` and `createWebhookResponse` for the five inbound callback kinds.
30
+ - `PaylovOnboarding` for the one-time credential issue.
31
+ - The `@isroilov_an/paylov/testing` entry point: `PaylovFakeGateway`, an in-memory gateway that
32
+ scripts every client and onboarding method and records each request, and `createWebhookRequest`
33
+ for authenticated webhook requests.
34
+
35
+ [0.0.1]: https://github.com/IsroilovA/paylov-ts-sdk/releases/tag/v0.0.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 IsroilovA
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @isroilov_an/paylov
2
+
3
+ Unofficial server-side TypeScript SDK for the [Paylov](https://paylov.uz) payment gateway
4
+ (Uzbekistan). Node 24.13.1+, ESM only, zero runtime dependencies.
5
+
6
+ > **Not affiliated with Paylov.** This is an independent project. It is not connected to, affiliated
7
+ > with, endorsed by, or sponsored by Paylov or its team. "Paylov" is a trademark of its owner and is
8
+ > used here only to name the service this SDK integrates with.
9
+
10
+ ## Features
11
+
12
+ - Card binding through hosted Card Bind or card number and OTP; saved-card and one-off payments;
13
+ full refunds.
14
+ - Holds with single capture or release, splits to sub-merchants, and OFD fiscal receipts.
15
+ - Transaction reconciliation, hosted checkout links, and authenticated webhook decoding with typed
16
+ responses.
17
+ - Integer tiyin money, typed errors with recovery guidance for ambiguous failures, GET-only retries,
18
+ and metadata-only logging that never records credentials or card data.
19
+ - A `@isroilov_an/paylov/testing` entry point with an in-memory gateway for application tests.
20
+
21
+ ## Install
22
+
23
+ ```sh
24
+ npm install @isroilov_an/paylov
25
+ ```
26
+
27
+ Paylov issues the API credentials and allowlists the networks that may call the gateway; see
28
+ [Setup](docs/usage/setup.md).
29
+
30
+ ## Quickstart
31
+
32
+ ```ts
33
+ import { PaylovClient } from '@isroilov_an/paylov';
34
+
35
+ const paylov = new PaylovClient({
36
+ baseUrl: 'https://dev.gw.paylov.uz',
37
+ consumerKey: paylovConsumerKey,
38
+ consumerSecret: paylovConsumerSecret,
39
+ username: paylovUsername,
40
+ password: paylovPassword,
41
+ });
42
+
43
+ const transaction = await paylov.transactions.get({ transactionId });
44
+ if (transaction?.status === 'paid') await orders.markPaid(orderId);
45
+
46
+ await paylov.close();
47
+ ```
48
+
49
+ `baseUrl` is the bare gateway origin: `https://dev.gw.paylov.uz` for development,
50
+ `https://gw2.paylov.uz` for production.
51
+
52
+ ## Documentation
53
+
54
+ The guides ship in the package under `docs/usage/`. Method contracts are in the JSDoc.
55
+
56
+ - [Usage index](docs/usage/INDEX.md): every export and method, and the guide that explains it.
57
+ - [Setup](docs/usage/setup.md): requirements, hosts, client lifecycle and a sandbox check.
58
+ - [Errors](docs/usage/errors.md): branching on failures and recovery after an ambiguous one.
59
+ - [Webhooks](docs/usage/webhooks.md): receiving and answering Paylov callbacks.
60
+ - [Testing](docs/usage/testing.md): the in-memory gateway and webhook requests.
61
+ - [Examples](examples/): runnable checkout and hold-capture flows.
62
+
63
+ Paylov's own references: the [sandbox](https://sandbox.paylov.uz/) and the
64
+ [developer docs](https://developer.paylov.uz/).
65
+
66
+ ## Status
67
+
68
+ Pre-1.0: any release may contain breaking changes, listed in the [changelog](CHANGELOG.md). Where
69
+ Paylov leaves behavior undocumented, the SDK does not guess; those gaps are tracked as
70
+ [open questions](docs/paylov/open-questions.md).
71
+
72
+ ## Contributing
73
+
74
+ The repository also holds the Paylov protocol notes the SDK implements
75
+ ([`docs/paylov/`](docs/paylov/README.md)), the [architecture](docs/architecture.md), and the
76
+ contributor guide ([`AGENTS.md`](AGENTS.md) and the [runbook](docs/runbook.md)). Report
77
+ vulnerabilities privately as described in [`SECURITY.md`](SECURITY.md).
78
+
79
+ ## License
80
+
81
+ [MIT](LICENSE)