pec-payment-sdk 1.1.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.fa.md +212 -0
  3. package/README.md +212 -0
  4. package/dist/cjs/PecClient.d.ts +28 -0
  5. package/dist/cjs/PecClient.d.ts.map +1 -0
  6. package/dist/cjs/PecClient.js +218 -0
  7. package/dist/cjs/constants.d.ts +13 -0
  8. package/dist/cjs/constants.d.ts.map +1 -0
  9. package/dist/cjs/constants.js +15 -0
  10. package/dist/cjs/errors.d.ts +14 -0
  11. package/dist/cjs/errors.d.ts.map +1 -0
  12. package/dist/cjs/errors.js +28 -0
  13. package/dist/cjs/index.d.ts +6 -0
  14. package/dist/cjs/index.d.ts.map +1 -0
  15. package/dist/cjs/index.js +30 -0
  16. package/dist/cjs/soapClient.d.ts +6 -0
  17. package/dist/cjs/soapClient.d.ts.map +1 -0
  18. package/dist/cjs/soapClient.js +44 -0
  19. package/dist/cjs/types.d.ts +122 -0
  20. package/dist/cjs/types.d.ts.map +1 -0
  21. package/dist/cjs/types.js +2 -0
  22. package/dist/cjs/utils.d.ts +43 -0
  23. package/dist/cjs/utils.d.ts.map +1 -0
  24. package/dist/cjs/utils.js +162 -0
  25. package/dist/esm/PecClient.d.ts +28 -0
  26. package/dist/esm/PecClient.d.ts.map +1 -0
  27. package/dist/esm/PecClient.js +211 -0
  28. package/dist/esm/constants.d.ts +13 -0
  29. package/dist/esm/constants.d.ts.map +1 -0
  30. package/dist/esm/constants.js +12 -0
  31. package/dist/esm/errors.d.ts +14 -0
  32. package/dist/esm/errors.d.ts.map +1 -0
  33. package/dist/esm/errors.js +22 -0
  34. package/dist/esm/index.d.ts +6 -0
  35. package/dist/esm/index.d.ts.map +1 -0
  36. package/dist/esm/index.js +4 -0
  37. package/dist/esm/package.json +3 -0
  38. package/dist/esm/soapClient.d.ts +6 -0
  39. package/dist/esm/soapClient.d.ts.map +1 -0
  40. package/dist/esm/soapClient.js +36 -0
  41. package/dist/esm/types.d.ts +122 -0
  42. package/dist/esm/types.d.ts.map +1 -0
  43. package/dist/esm/types.js +1 -0
  44. package/dist/esm/utils.d.ts +43 -0
  45. package/dist/esm/utils.d.ts.map +1 -0
  46. package/dist/esm/utils.js +144 -0
  47. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Alireza
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.fa.md ADDED
@@ -0,0 +1,212 @@
1
+ # pec-payment-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/pec-payment-sdk?logo=npm&logoColor=white)](https://www.npmjs.com/package/pec-payment-sdk)
4
+ [![npm downloads](https://img.shields.io/npm/dm/pec-payment-sdk?logo=npm&logoColor=white&label=downloads)](https://www.npmjs.com/package/pec-payment-sdk)
5
+ [![GitHub stars](https://img.shields.io/github/stars/AlirezaMoVali/pec-sdk?style=flat&logo=github)](https://github.com/AlirezaMoVali/pec-sdk/stargazers)
6
+ [![GitHub issues](https://img.shields.io/github/issues/AlirezaMoVali/pec-sdk?style=flat&logo=github)](https://github.com/AlirezaMoVali/pec-sdk/issues)
7
+ [![GitHub license](https://img.shields.io/github/license/AlirezaMoVali/pec-sdk?style=flat)](https://github.com/AlirezaMoVali/pec-sdk/blob/main/LICENSE)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.4+-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
9
+
10
+ [English](./README.md) | **فارسی**
11
+
12
+ SDK نوشته‌شده با TypeScript/JavaScript برای درگاه پرداخت **PEC** (تجارت الکترونیک پارسیان). با Node.js، Express، Fastify، NestJS، Next.js و هر پروژه CommonJS یا ESM سازگار است.
13
+
14
+ این کتابخانه بر پایه سرویس‌های SOAP رسمی PEC (همان endpointهای نمونه PHP بانک) با API تایپ‌شده و helperهای آماده برای توسعه‌دهندگان ساخته شده است.
15
+
16
+ ## امکانات
17
+
18
+ - جریان استاندارد خرید، تایید و برگشت تراکنش
19
+ - پرداخت با تسهیم آنلاین
20
+ - پرداخت با شناسه حساب دولتی و تسهیم چند حسابی دولتی
21
+ - پرداخت قبض و استعلام قبض
22
+ - خرید شارژ موبایل
23
+ - گزارش تراکنش‌های فروش (REST API)
24
+ - **تبدیل ریال / تومان** (SDK مبلغ را به ریال برای بانک ارسال می‌کند)
25
+ - پشتیبانی از **CommonJS** (`require`) و **ESM** (`import`)
26
+ - تایپ‌های کامل TypeScript
27
+
28
+ ## پیش‌نیاز
29
+
30
+ - Node.js **۱۸ به بالا**
31
+
32
+ ## نصب
33
+
34
+ ```bash
35
+ npm install pec-payment-sdk
36
+ ```
37
+
38
+ ## شروع سریع
39
+
40
+ ### ESM / TypeScript
41
+
42
+ ```typescript
43
+ import {
44
+ PecClient,
45
+ generateOrderId,
46
+ parseCallback,
47
+ shouldConfirmPayment,
48
+ isSuccessStatus,
49
+ } from 'pec-payment-sdk';
50
+
51
+ const client = new PecClient({
52
+ loginAccount: process.env.PEC_LOGIN_ACCOUNT!,
53
+ callbackUrl: 'https://your-shop.com/payment/callback',
54
+ });
55
+
56
+ const sale = await client.requestPayment({
57
+ amount: 50000,
58
+ currency: 'toman', // پیش‌فرض؛ SDK مبلغ ۵۰۰٬۰۰۰ ریال به PEC می‌فرستد
59
+ orderId: generateOrderId(),
60
+ });
61
+
62
+ if (sale.paymentUrl) {
63
+ // کاربر را به صفحه پرداخت بانک هدایت کنید
64
+ res.redirect(sale.paymentUrl);
65
+ }
66
+ ```
67
+
68
+ ### CommonJS
69
+
70
+ ```javascript
71
+ const {
72
+ PecClient,
73
+ generateOrderId,
74
+ parseCallback,
75
+ shouldConfirmPayment,
76
+ } = require('pec-payment-sdk');
77
+
78
+ const client = new PecClient({
79
+ loginAccount: process.env.PEC_LOGIN_ACCOUNT,
80
+ callbackUrl: 'https://your-shop.com/payment/callback',
81
+ });
82
+ ```
83
+
84
+ ## فرآیند پرداخت
85
+
86
+ ```
87
+ ۱. سرور شما → client.requestPayment()
88
+ ۲. هدایت کاربر → sale.paymentUrl (درگاه PEC)
89
+ ۳. پرداخت کاربر → بانک به callbackUrl شما redirect می‌کند
90
+ ۴. سرور شما → parseCallback() + client.confirmPayment()
91
+ ```
92
+
93
+ ### هندلر callback (مثال Express)
94
+
95
+ پس از پرداخت، PEC با **POST** به آدرس callback شما فیلدهایی مثل `Token`، `status`، `OrderId`، `RRN`، `Amount` و `TerminalNo` ارسال می‌کند. مقدار `req.body` را به `parseCallback()` بدهید. اگر route شما query می‌خواند، ابتدا آن را با body ادغام کنید.
96
+
97
+ آدرس callback می‌تواند برای توسعه محلی **HTTP** (مثل `http://localhost`) یا در production **HTTPS** باشد.
98
+
99
+ ```typescript
100
+ app.post('/payment/callback', async (req, res) => {
101
+ const callback = parseCallback(req.body);
102
+
103
+ if (!shouldConfirmPayment(callback)) {
104
+ return res.redirect('/payment/failed');
105
+ }
106
+
107
+ const result = await client.confirmPayment({ token: callback.token });
108
+
109
+ if (isSuccessStatus(result.status)) {
110
+ return res.redirect(`/payment/success?rrn=${result.rrn}`);
111
+ }
112
+
113
+ res.redirect('/payment/failed');
114
+ });
115
+ ```
116
+
117
+ ## واحد پول (ریال / تومان)
118
+
119
+ PEC مبلغ را به **ریال** می‌پذیرد. مبلغ را با واحدی که در اپلیکیشن استفاده می‌کنید بفرستید:
120
+
121
+ | `currency` | مقدار ورودی | ارسال به PEC |
122
+ |------------|-------------|--------------|
123
+ | `'toman'` (پیش‌فرض) | `50000` | `500000` ریال |
124
+ | `'rial'` | `500000` | `500000` ریال |
125
+
126
+ ```typescript
127
+ import { toRials } from 'pec-payment-sdk';
128
+
129
+ toRials(50000, 'toman'); // 500000
130
+ toRials(500000, 'rial'); // 500000
131
+ ```
132
+
133
+ در **پرداخت تسهیمی**، مبلغ هر حساب (`accounts[].amount`) با همان `currency` درخواست اصلی به ریال تبدیل می‌شود.
134
+
135
+ ## مرجع API
136
+
137
+ ### ساخت کلاینت
138
+
139
+ ```typescript
140
+ const client = new PecClient({
141
+ loginAccount: string; // PIN پذیرنده (LoginAccount)
142
+ callbackUrl?: string; // آدرس callback پیش‌فرض
143
+ });
144
+ ```
145
+
146
+ ### متدهای پرداخت
147
+
148
+ | متد | توضیح |
149
+ |-----|--------|
150
+ | `requestPayment()` | خرید استاندارد کالا و خدمات |
151
+ | `requestMultiplexedPayment()` | پرداخت با تسهیم آنلاین (چند شبا) |
152
+ | `requestGovernmentPayment()` | پرداخت با شناسه حساب دولتی |
153
+ | `requestGovernmentMultiplexedPayment()` | پرداخت دولتی با تسهیم چند حسابی |
154
+ | `requestBillPayment()` | پرداخت قبض |
155
+ | `getBillInfo()` | استعلام قبض قبل از پرداخت |
156
+ | `requestMobileTopup()` | خرید شارژ موبایل |
157
+ | `confirmPayment()` | تایید (تسویه) تراکنش موفق |
158
+ | `reversePayment()` | برگشت تراکنش (در بازه زمانی مجاز بانک) |
159
+ | `getSaleReport()` | دریافت گزارش تراکنش‌ها (REST API) |
160
+
161
+ ### توابع کمکی
162
+
163
+ | Export | توضیح |
164
+ |--------|--------|
165
+ | `generateOrderId()` | تولید شماره سفارش یکتا |
166
+ | `getPaymentPageUrl(token)` | ساخت URL هدایت به درگاه |
167
+ | `parseCallback(body)` | پارس بدنه POST بازگشتی از بانک |
168
+ | `shouldConfirmPayment(callback)` | بررسی آماده بودن callback برای confirm |
169
+ | `isSuccessStatus(status)` | `true` وقتی status برابر `0` باشد |
170
+ | `isValidUrl(url)` | اعتبارسنجی آدرس callback با HTTP/HTTPS |
171
+ | `toRials(amount, currency)` | تبدیل مبلغ به ریال |
172
+ | `validateAmount(amount)` | خطا در صورت مبلغ نامعتبر |
173
+ | `validateSaleReportDateRange(from, to)` | محدودیت بازه ۳۰ روزه گزارش |
174
+
175
+ ### خطاها
176
+
177
+ | کلاس | زمان رخداد |
178
+ |------|-----------|
179
+ | `PecValidationError` | ورودی نامعتبر (مثلاً callback خالی) |
180
+ | `PecTransportError` | خطای شبکه یا SOAP |
181
+ | `PecError` | خطای عمومی مرتبط با PEC |
182
+
183
+ ## CommonJS و ESM
184
+
185
+ در هر دو سبک از یک نام پکیج استفاده کنید — Node و bundlerها به‌صورت خودکار build مناسب را انتخاب می‌کنند:
186
+
187
+ ```javascript
188
+ // CommonJS
189
+ const { PecClient } = require('pec-payment-sdk');
190
+ ```
191
+
192
+ ```typescript
193
+ // ESM
194
+ import { PecClient } from 'pec-payment-sdk';
195
+ ```
196
+
197
+ ## متغیرهای محیطی (پیشنهادی)
198
+
199
+ ```env
200
+ PEC_LOGIN_ACCOUNT=your_merchant_pin
201
+ ```
202
+
203
+ PIN پذیرنده را commit نکنید. از متغیر محیطی یا secrets manager استفاده کنید.
204
+
205
+ ## لینک‌ها
206
+
207
+ - [مخزن GitHub](https://github.com/AlirezaMoVali/pec-sdk)
208
+ - [مستندات درگاه PEC / پارسیان](https://pgw.pec.ir/)
209
+
210
+ ## مجوز
211
+
212
+ [MIT](./LICENSE) © Alireza Mohammadvali
package/README.md ADDED
@@ -0,0 +1,212 @@
1
+ # pec-payment-sdk
2
+
3
+ [![npm version](https://img.shields.io/npm/v/pec-payment-sdk?logo=npm&logoColor=white)](https://www.npmjs.com/package/pec-payment-sdk)
4
+ [![npm downloads](https://img.shields.io/npm/dm/pec-payment-sdk?logo=npm&logoColor=white&label=downloads)](https://www.npmjs.com/package/pec-payment-sdk)
5
+ [![GitHub stars](https://img.shields.io/github/stars/AlirezaMoVali/pec-sdk?style=flat&logo=github)](https://github.com/AlirezaMoVali/pec-sdk/stargazers)
6
+ [![GitHub issues](https://img.shields.io/github/issues/AlirezaMoVali/pec-sdk?style=flat&logo=github)](https://github.com/AlirezaMoVali/pec-sdk/issues)
7
+ [![GitHub license](https://img.shields.io/github/license/AlirezaMoVali/pec-sdk?style=flat)](https://github.com/AlirezaMoVali/pec-sdk/blob/main/LICENSE)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.4+-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
9
+
10
+ **English** | [فارسی](./README.fa.md)
11
+
12
+ TypeScript/JavaScript SDK for **PEC** (Parsian Electronic Commerce / تجارت الکترونیک پارسیان) payment gateway. Works with Node.js, Express, Fastify, NestJS, Next.js, and any CommonJS or ESM project.
13
+
14
+ Built on official PEC SOAP services (same endpoints as the bank’s PHP samples) with typed APIs and developer-friendly helpers.
15
+
16
+ ## Features
17
+
18
+ - Standard sale, confirm, and reverse flows
19
+ - Online multiplexed payments (تسهیم آنلاین)
20
+ - Government ID payments and government multiplexed payments
21
+ - Bill payment and bill inquiry
22
+ - Mobile top-up
23
+ - Sale transaction reporting (REST API)
24
+ - **Rial / Toman** amount handling
25
+ - **CommonJS** (`require`) and **ESM** (`import`) support
26
+ - Full TypeScript types
27
+
28
+ ## Requirements
29
+
30
+ - Node.js **18+**
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ npm install pec-payment-sdk
36
+ ```
37
+
38
+ ## Quick start
39
+
40
+ ### ESM / TypeScript
41
+
42
+ ```typescript
43
+ import {
44
+ PecClient,
45
+ generateOrderId,
46
+ parseCallback,
47
+ shouldConfirmPayment,
48
+ isSuccessStatus,
49
+ } from 'pec-payment-sdk';
50
+
51
+ const client = new PecClient({
52
+ loginAccount: process.env.PEC_LOGIN_ACCOUNT!,
53
+ callbackUrl: 'https://your-shop.com/payment/callback',
54
+ });
55
+
56
+ const sale = await client.requestPayment({
57
+ amount: 50000,
58
+ currency: 'toman', // default; SDK sends 500,000 Rials to PEC
59
+ orderId: generateOrderId(),
60
+ });
61
+
62
+ if (sale.paymentUrl) {
63
+ // Redirect the customer to the bank payment page
64
+ res.redirect(sale.paymentUrl);
65
+ }
66
+ ```
67
+
68
+ ### CommonJS
69
+
70
+ ```javascript
71
+ const {
72
+ PecClient,
73
+ generateOrderId,
74
+ parseCallback,
75
+ shouldConfirmPayment,
76
+ } = require('pec-payment-sdk');
77
+
78
+ const client = new PecClient({
79
+ loginAccount: process.env.PEC_LOGIN_ACCOUNT,
80
+ callbackUrl: 'https://your-shop.com/payment/callback',
81
+ });
82
+ ```
83
+
84
+ ## Payment flow
85
+
86
+ ```
87
+ 1. Your server → client.requestPayment()
88
+ 2. Redirect user → sale.paymentUrl (PEC gateway)
89
+ 3. User pays → Bank redirects to your callbackUrl
90
+ 4. Your server → parseCallback() + client.confirmPayment()
91
+ ```
92
+
93
+ ### Callback handler (Express example)
94
+
95
+ After payment, PEC **POSTs** to your callback URL with fields such as `Token`, `status`, `OrderId`, `RRN`, `Amount`, and `TerminalNo`. Pass `req.body` to `parseCallback()`. If your route reads query parameters instead, merge them into one object first.
96
+
97
+ Callback URLs may use **HTTP** (e.g. `http://localhost`) for local development or **HTTPS** in production.
98
+
99
+ ```typescript
100
+ app.post('/payment/callback', async (req, res) => {
101
+ const callback = parseCallback(req.body);
102
+
103
+ if (!shouldConfirmPayment(callback)) {
104
+ return res.redirect('/payment/failed');
105
+ }
106
+
107
+ const result = await client.confirmPayment({ token: callback.token });
108
+
109
+ if (isSuccessStatus(result.status)) {
110
+ return res.redirect(`/payment/success?rrn=${result.rrn}`);
111
+ }
112
+
113
+ res.redirect('/payment/failed');
114
+ });
115
+ ```
116
+
117
+ ## Currency
118
+
119
+ PEC expects amounts in **Rials**. Pass the amount in the unit your app uses:
120
+
121
+ | `currency` | You pass | Sent to PEC |
122
+ |------------|----------|-------------|
123
+ | `'toman'` (default) | `50000` | `500000` Rials |
124
+ | `'rial'` | `500000` | `500000` Rials |
125
+
126
+ ```typescript
127
+ import { toRials } from 'pec-payment-sdk';
128
+
129
+ toRials(50000, 'toman'); // 500000
130
+ toRials(500000, 'rial'); // 500000
131
+ ```
132
+
133
+ For **multiplexed payments**, each account `amount` uses the same `currency` as the main request.
134
+
135
+ ## API reference
136
+
137
+ ### Client
138
+
139
+ ```typescript
140
+ const client = new PecClient({
141
+ loginAccount: string; // Merchant PIN (LoginAccount)
142
+ callbackUrl?: string; // Default callback if omitted per request
143
+ });
144
+ ```
145
+
146
+ ### Payment methods
147
+
148
+ | Method | Description |
149
+ |--------|-------------|
150
+ | `requestPayment()` | Standard sale / goods & services |
151
+ | `requestMultiplexedPayment()` | Online split payment across IBAN accounts |
152
+ | `requestGovernmentPayment()` | Payment with government account ID |
153
+ | `requestGovernmentMultiplexedPayment()` | Government payment with split accounts |
154
+ | `requestBillPayment()` | Bill payment |
155
+ | `getBillInfo()` | Bill inquiry before payment |
156
+ | `requestMobileTopup()` | Mobile charge / top-up |
157
+ | `confirmPayment()` | Confirm (settle) a successful payment |
158
+ | `reversePayment()` | Reverse a payment (within bank time limit) |
159
+ | `getSaleReport()` | Fetch transactions via PEC reporting REST API |
160
+
161
+ ### Utilities
162
+
163
+ | Export | Description |
164
+ |--------|-------------|
165
+ | `generateOrderId()` | Generate a unique order ID |
166
+ | `getPaymentPageUrl(token)` | Build PEC redirect URL |
167
+ | `parseCallback(body)` | Parse bank callback POST body |
168
+ | `shouldConfirmPayment(callback)` | Check if callback is OK to confirm |
169
+ | `isSuccessStatus(status)` | `true` when PEC status is `0` |
170
+ | `isValidUrl(url)` | Validate HTTP/HTTPS callback URL |
171
+ | `toRials(amount, currency)` | Convert amount to Rials |
172
+ | `validateAmount(amount)` | Throw if amount is invalid |
173
+ | `validateSaleReportDateRange(from, to)` | Enforce max 30-day report window |
174
+
175
+ ### Errors
176
+
177
+ | Class | When |
178
+ |-------|------|
179
+ | `PecValidationError` | Invalid input (e.g. missing callback URL) |
180
+ | `PecTransportError` | Network or SOAP failure |
181
+ | `PecError` | General PEC-related error |
182
+
183
+ ## Module formats
184
+
185
+ Use the same package name in both styles — Node and bundlers pick the right build automatically:
186
+
187
+ ```javascript
188
+ // CommonJS
189
+ const { PecClient } = require('pec-payment-sdk');
190
+ ```
191
+
192
+ ```typescript
193
+ // ESM
194
+ import { PecClient } from 'pec-payment-sdk';
195
+ ```
196
+
197
+ ## Environment variables (recommended)
198
+
199
+ ```env
200
+ PEC_LOGIN_ACCOUNT=your_merchant_pin
201
+ ```
202
+
203
+ Never commit your merchant PIN. Use environment variables or a secrets manager.
204
+
205
+ ## Links
206
+
207
+ - [GitHub repository](https://github.com/AlirezaMoVali/pec-sdk)
208
+ - [PEC / Parsian gateway documentation](https://pgw.pec.ir/)
209
+
210
+ ## License
211
+
212
+ [MIT](./LICENSE) © Alireza Mohammadvali
@@ -0,0 +1,28 @@
1
+ import type { BillInfoResult, ConfirmPaymentInput, ConfirmPaymentResult, GetBillInfoInput, GetSaleReportInput, GetSaleReportResult, PaymentTokenResult, PecClientOptions, RequestBillPaymentInput, RequestGovernmentMultiplexedPaymentInput, RequestGovernmentPaymentInput, RequestMobileTopupInput, RequestMultiplexedPaymentInput, RequestPaymentInput, ReversePaymentInput, ReversePaymentResult } from './types.js';
2
+ export declare class PecClient {
3
+ private readonly loginAccount;
4
+ private readonly defaultCallbackUrl?;
5
+ constructor(options: PecClientOptions);
6
+ /** Starts a standard sale payment and returns a token plus redirect URL. */
7
+ requestPayment(input: RequestPaymentInput): Promise<PaymentTokenResult>;
8
+ /** Starts an online multiplexed sale (تسهیم آنلاین). */
9
+ requestMultiplexedPayment(input: RequestMultiplexedPaymentInput): Promise<PaymentTokenResult>;
10
+ /** Starts a government-ID sale (شناسه حساب دولتی). */
11
+ requestGovernmentPayment(input: RequestGovernmentPaymentInput): Promise<PaymentTokenResult>;
12
+ /** Starts a government sale with multiplexed IBAN accounts. */
13
+ requestGovernmentMultiplexedPayment(input: RequestGovernmentMultiplexedPaymentInput): Promise<PaymentTokenResult>;
14
+ /** Starts a bill payment request. */
15
+ requestBillPayment(input: RequestBillPaymentInput): Promise<PaymentTokenResult>;
16
+ /** Retrieves bill details before payment. */
17
+ getBillInfo(input: GetBillInfoInput): Promise<BillInfoResult>;
18
+ /** Starts a mobile top-up/charge request. */
19
+ requestMobileTopup(input: RequestMobileTopupInput): Promise<PaymentTokenResult>;
20
+ /** Confirms/settles a successful payment using its token. */
21
+ confirmPayment(input: ConfirmPaymentInput): Promise<ConfirmPaymentResult>;
22
+ /** Reverses a payment. Works only within the bank's allowed time window. */
23
+ reversePayment(input: ReversePaymentInput): Promise<ReversePaymentResult>;
24
+ /** Fetches sale transactions from PEC reporting REST API. */
25
+ getSaleReport(input: GetSaleReportInput): Promise<GetSaleReportResult>;
26
+ private resolveCallbackUrl;
27
+ }
28
+ //# sourceMappingURL=PecClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PecClient.d.ts","sourceRoot":"","sources":["../../src/PecClient.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,wCAAwC,EACxC,6BAA6B,EAC7B,uBAAuB,EACvB,8BAA8B,EAC9B,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,YAAY,CAAC;AAapB,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAS;gBAEjC,OAAO,EAAE,gBAAgB;IASrC,4EAA4E;IACtE,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAqB7E,wDAAwD;IAClD,yBAAyB,CAC7B,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,kBAAkB,CAAC;IAwB9B,sDAAsD;IAChD,wBAAwB,CAC5B,KAAK,EAAE,6BAA6B,GACnC,OAAO,CAAC,kBAAkB,CAAC;IAqB9B,+DAA+D;IACzD,mCAAmC,CACvC,KAAK,EAAE,wCAAwC,GAC9C,OAAO,CAAC,kBAAkB,CAAC;IAwB9B,qCAAqC;IAC/B,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsBrF,6CAA6C;IACvC,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAgBnE,6CAA6C;IACvC,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAwBrF,6DAA6D;IACvD,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAuB/E,4EAA4E;IACtE,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAsB/E,6DAA6D;IACvD,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiC5E,OAAO,CAAC,kBAAkB;CAa3B"}