@rubikpara/pf-sdk 0.0.0-stage → 0.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.
- package/CHANGELOG.md +28 -0
- package/LICENSE +21 -0
- package/README.md +259 -2
- package/dist/index.cjs +867 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +857 -0
- package/dist/index.d.ts +857 -0
- package/dist/index.js +844 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -4
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,857 @@
|
|
|
1
|
+
/** Tek bir API çağrısına özel seçenekler. */
|
|
2
|
+
interface RequestOptions {
|
|
3
|
+
/**
|
|
4
|
+
* İstek takip kimliği. Verilmezse SDK otomatik üretir.
|
|
5
|
+
* API aynı conversationId ile gelen istekleri idempotent kabul eder; bu
|
|
6
|
+
* yüzden ödeme gibi kritik çağrılarda kendi benzersiz değerinizi vermeniz önerilir.
|
|
7
|
+
*/
|
|
8
|
+
conversationId?: string;
|
|
9
|
+
/** İşlemi yapan son kullanıcının IP adresi. `ClientIpAddress` header'ı olarak gönderilir. */
|
|
10
|
+
clientIpAddress?: string;
|
|
11
|
+
/** İsteği dışarıdan iptal etmek için. */
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
/** Bu çağrı için zaman aşımı (ms). İstemci genelindeki değeri ezer. */
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
interface TransportConfig {
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
publicKey: string;
|
|
19
|
+
secretKey: string;
|
|
20
|
+
merchantNumber: string;
|
|
21
|
+
timeoutMs: number;
|
|
22
|
+
throwOnApiError: boolean;
|
|
23
|
+
fetch: typeof fetch;
|
|
24
|
+
conversationIdFactory: () => string;
|
|
25
|
+
userAgent: string;
|
|
26
|
+
}
|
|
27
|
+
type QueryValue = string | number | boolean | null | undefined;
|
|
28
|
+
type FormValue = string | number | boolean | null | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Tüm kaynak sınıflarının kullandığı düşük seviyeli HTTP katmanı.
|
|
31
|
+
* İmzalama, header/form kimlik doğrulama, zaman aşımı ve hata eşlemesini üstlenir.
|
|
32
|
+
*/
|
|
33
|
+
declare class Transport {
|
|
34
|
+
private readonly cfg;
|
|
35
|
+
constructor(cfg: TransportConfig);
|
|
36
|
+
/** JSON gövdeli veya gövdesiz istek. Kimlik doğrulama bilgileri header olarak gider. */
|
|
37
|
+
requestJson<T>(method: "GET" | "POST", path: string, init?: {
|
|
38
|
+
body?: unknown;
|
|
39
|
+
query?: Record<string, QueryValue>;
|
|
40
|
+
options?: RequestOptions;
|
|
41
|
+
}): Promise<T>;
|
|
42
|
+
/**
|
|
43
|
+
* `multipart/form-data` istek. Kimlik doğrulama bilgileri header yerine
|
|
44
|
+
* form alanı olarak gönderilir (`/v1/Tokens`, `/v1/ThreeDS/init3ds`).
|
|
45
|
+
*/
|
|
46
|
+
requestForm<T>(path: string, fields: Record<string, FormValue>, options?: RequestOptions): Promise<T>;
|
|
47
|
+
/** Kimlik doğrulaması gerektirmeyen düz metin GET (ör. /HealthCheck). */
|
|
48
|
+
requestText(path: string, options?: RequestOptions): Promise<string>;
|
|
49
|
+
private sign;
|
|
50
|
+
private buildUrl;
|
|
51
|
+
private send;
|
|
52
|
+
private mapTransportError;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Tüm API yanıtlarında bulunan ortak alanlar.
|
|
57
|
+
* HTTP 200 dönen yanıtlar bile `isSucceed: false` olabilir; SDK varsayılan
|
|
58
|
+
* olarak bu durumda `PfApiError` fırlatır.
|
|
59
|
+
*/
|
|
60
|
+
interface ApiResponseBase {
|
|
61
|
+
isSucceed: boolean;
|
|
62
|
+
errorCode?: string | null;
|
|
63
|
+
errorMessage?: string | null;
|
|
64
|
+
conversationId?: string | null;
|
|
65
|
+
}
|
|
66
|
+
/** Provision, Reverse ve Return yanıtlarındaki banka detayları. */
|
|
67
|
+
interface BankTransactionDetail {
|
|
68
|
+
/** Banka referans numarası (RRN). Destek taleplerinde paylaşılması önerilir. */
|
|
69
|
+
bankRrnNo?: string | null;
|
|
70
|
+
bankTansId?: string | null;
|
|
71
|
+
bankAuthCode?: string | null;
|
|
72
|
+
/** Banka dönüş kodu. `00` başarılı demektir. */
|
|
73
|
+
bankReturnCode?: string | null;
|
|
74
|
+
}
|
|
75
|
+
/** `Auth` doğrudan satış, `PreAuth` ön provizyon, `PostAuth` ön provizyon tamamlama. */
|
|
76
|
+
type PaymentType = "Auth" | "PreAuth" | "PostAuth";
|
|
77
|
+
type TransactionType = "Auth" | "PreAuth" | "Return" | "PostAuth" | "Reverse" | "Void" | "Refund";
|
|
78
|
+
type TransactionStatus = "Pending" | "Fail" | "Success" | "Returned" | "PartiallyReturned" | "Reversed" | "Closed" | "PartiallyClosed";
|
|
79
|
+
type IntegrationMode = "Unknown" | "Api" | "Hpp" | "ManuelPaymentPage" | "LinkPaymentPage" | "OnUs";
|
|
80
|
+
type CardBrand = "Undefined" | "UnionPay" | "Amex" | "Visa" | "Troy" | "MasterCard";
|
|
81
|
+
type CardNetwork = "Unknown" | "CardFinans" | "World" | "Paraf" | "Maximum" | "Axess" | "Advantage" | "Bonus" | "BankKart" | "SaglamKart";
|
|
82
|
+
type CardType = "Unknown" | "Credit" | "Debit" | "QRCode";
|
|
83
|
+
type CardSubType = "Unknown" | "Classic" | "Business";
|
|
84
|
+
type ProfileCardType = "Credit" | "Debit" | "International" | "Amex" | "Wallet" | "QRCode";
|
|
85
|
+
type ReturnStatus = "NoAction" | "Pending" | "Approved" | "Rejected";
|
|
86
|
+
type ReturnApprovalStatus = "None" | "PendingApproval" | "Approved";
|
|
87
|
+
type MerchantVposStatus = "WaitingForApproval" | "ReadyToPay" | "RejectedByIKS";
|
|
88
|
+
type LinkType = "SingleUse" | "MultipleUse";
|
|
89
|
+
type LinkAmountType = "FixedAmount" | "VariableAmount";
|
|
90
|
+
type NotificationMethod = "None" | "Sms" | "Email" | "Both";
|
|
91
|
+
type ChannelStatus = "Active" | "Passive" | "Expired" | "Cancelled";
|
|
92
|
+
type ChannelPaymentStatus = "Pending" | "Success" | "Failed" | "Expired";
|
|
93
|
+
interface CreateCardTokenInput {
|
|
94
|
+
/** Kart numarası (boşluksuz). */
|
|
95
|
+
cardNumber: string;
|
|
96
|
+
/** Son kullanma ayı, ör. `"12"` veya `12`. */
|
|
97
|
+
expireMonth: string | number;
|
|
98
|
+
/** Son kullanma yılı, ör. `"2030"` veya `2030`. */
|
|
99
|
+
expireYear: string | number;
|
|
100
|
+
cvv: string;
|
|
101
|
+
}
|
|
102
|
+
interface CardTokenResponse extends ApiResponseBase {
|
|
103
|
+
/** Sonraki ödeme / 3DS / sorgu adımlarında kullanılacak token. */
|
|
104
|
+
cardToken?: string | null;
|
|
105
|
+
signature?: string | null;
|
|
106
|
+
}
|
|
107
|
+
interface CreateThreeDSessionInput {
|
|
108
|
+
/** Toplam ödeme tutarı. */
|
|
109
|
+
amount: number;
|
|
110
|
+
/** `/v1/Tokens` yanıtındaki `cardToken`. */
|
|
111
|
+
cardToken: string;
|
|
112
|
+
/** Puan ile ödenecek tutar. Varsayılan `0`. */
|
|
113
|
+
pointAmount?: number;
|
|
114
|
+
/** ISO 4217 para birimi kodu. Varsayılan istemci ayarı (`TRY`). */
|
|
115
|
+
currency?: string;
|
|
116
|
+
/** Varsayılan `Auth`. */
|
|
117
|
+
paymentType?: PaymentType;
|
|
118
|
+
/** Taksit sayısı. Tek çekim için `1` (varsayılan). */
|
|
119
|
+
installmentCount?: number;
|
|
120
|
+
/** Varsayılan istemci ayarı (`tr`). */
|
|
121
|
+
languageCode?: string;
|
|
122
|
+
}
|
|
123
|
+
interface ThreeDSessionResponse extends ApiResponseBase {
|
|
124
|
+
/** init3ds, getResult ve provision adımlarında kullanılır. */
|
|
125
|
+
threeDSessionId?: string | null;
|
|
126
|
+
}
|
|
127
|
+
interface InitThreeDSInput {
|
|
128
|
+
threeDSessionId: string;
|
|
129
|
+
/** Banka doğrulaması sonrası kullanıcının yönlendirileceği, sizin sunucunuzdaki URL. */
|
|
130
|
+
callbackUrl: string;
|
|
131
|
+
/** Son kullanıcının IP adresi. Bu uç noktada form alanı olarak gönderilir. */
|
|
132
|
+
clientIpAddress: string;
|
|
133
|
+
cardHolderName?: string;
|
|
134
|
+
languageCode?: string;
|
|
135
|
+
}
|
|
136
|
+
interface InitThreeDSResponse extends ApiResponseBase {
|
|
137
|
+
/**
|
|
138
|
+
* Kullanıcının tarayıcısında render edilecek HTML. Genellikle bankaya
|
|
139
|
+
* auto-submit olan bir form içerir.
|
|
140
|
+
*/
|
|
141
|
+
htmlContent?: string | null;
|
|
142
|
+
}
|
|
143
|
+
interface ThreeDSessionResultInput {
|
|
144
|
+
threeDSessionId: string;
|
|
145
|
+
languageCode?: string;
|
|
146
|
+
}
|
|
147
|
+
interface ThreeDSessionResultResponse extends ApiResponseBase {
|
|
148
|
+
currentStep?: string | null;
|
|
149
|
+
/** `"1"` başarılı tam doğrulama. */
|
|
150
|
+
mdStatus?: string | null;
|
|
151
|
+
mdErrorMessage?: string | null;
|
|
152
|
+
halfSecure: boolean;
|
|
153
|
+
}
|
|
154
|
+
/** Bankanın `callbackUrl`'e form POST ile gönderdiği alanların çözümlenmiş hali. */
|
|
155
|
+
interface ThreeDSCallbackData {
|
|
156
|
+
mdStatus: string;
|
|
157
|
+
isSucceed: boolean;
|
|
158
|
+
errorCode: string;
|
|
159
|
+
errorMessage: string;
|
|
160
|
+
threeDSessionId: string;
|
|
161
|
+
conversationId: string;
|
|
162
|
+
/** `mdStatus === "1"` ve `isSucceed` birlikte sağlanıyorsa `true`. */
|
|
163
|
+
isVerified: boolean;
|
|
164
|
+
/** Tüm form alanları, geldiği isimlerle. */
|
|
165
|
+
raw: Record<string, string>;
|
|
166
|
+
}
|
|
167
|
+
interface ProvisionInput {
|
|
168
|
+
amount: number;
|
|
169
|
+
cardToken: string;
|
|
170
|
+
/** Varsayılan `0`. */
|
|
171
|
+
pointAmount?: number;
|
|
172
|
+
/** Varsayılan istemci ayarı (`TRY`). */
|
|
173
|
+
currency?: string;
|
|
174
|
+
/** Varsayılan `Auth`. */
|
|
175
|
+
paymentType?: PaymentType;
|
|
176
|
+
/** Varsayılan `Api`. */
|
|
177
|
+
integrationMode?: IntegrationMode;
|
|
178
|
+
/** Varsayılan `1`. */
|
|
179
|
+
installmentCount?: number;
|
|
180
|
+
/** 3D Secure'lu ödemede zorunlu; 3DS'siz ödemede gönderilmez. */
|
|
181
|
+
threeDSessionId?: string;
|
|
182
|
+
/** `PostAuth` için tamamlanacak ön provizyonun orderId değeri. */
|
|
183
|
+
originalOrderId?: string;
|
|
184
|
+
languageCode?: string;
|
|
185
|
+
merchantCustomerName?: string;
|
|
186
|
+
merchantCustomerPhoneCode?: string;
|
|
187
|
+
merchantCustomerPhoneNumber?: string;
|
|
188
|
+
description?: string;
|
|
189
|
+
cardHolderName?: string;
|
|
190
|
+
gateway?: string;
|
|
191
|
+
}
|
|
192
|
+
interface ProvisionResponse extends ApiResponseBase {
|
|
193
|
+
/** İptal, iade ve sorgulama için mutlaka saklanmalıdır. */
|
|
194
|
+
orderId?: string | null;
|
|
195
|
+
provisionNumber?: string | null;
|
|
196
|
+
description?: string | null;
|
|
197
|
+
bankResponse?: BankTransactionDetail | null;
|
|
198
|
+
}
|
|
199
|
+
interface ReverseInput {
|
|
200
|
+
orderId: string;
|
|
201
|
+
languageCode?: string;
|
|
202
|
+
}
|
|
203
|
+
interface ReverseResponse extends ApiResponseBase {
|
|
204
|
+
provisionNumber?: string | null;
|
|
205
|
+
bankResponse?: BankTransactionDetail | null;
|
|
206
|
+
}
|
|
207
|
+
interface RefundInput {
|
|
208
|
+
orderId: string;
|
|
209
|
+
/** Kısmi iade için işlem tutarından küçük bir değer verilebilir. */
|
|
210
|
+
amount: number;
|
|
211
|
+
languageCode?: string;
|
|
212
|
+
}
|
|
213
|
+
interface RefundResponse extends ApiResponseBase {
|
|
214
|
+
returnMessage?: string | null;
|
|
215
|
+
approvalStatus?: ReturnApprovalStatus;
|
|
216
|
+
provisionNumber?: string | null;
|
|
217
|
+
bankResponse?: BankTransactionDetail | null;
|
|
218
|
+
}
|
|
219
|
+
interface InquireInput {
|
|
220
|
+
/** Provision yanıtındaki orderId. */
|
|
221
|
+
orderId?: string;
|
|
222
|
+
/** Provision isteğinde kullanılan conversationId. */
|
|
223
|
+
paymentConversationId?: string;
|
|
224
|
+
languageCode?: string;
|
|
225
|
+
}
|
|
226
|
+
interface ProvisionModel {
|
|
227
|
+
amount: number;
|
|
228
|
+
transactionStatus: TransactionStatus;
|
|
229
|
+
transactionType: TransactionType;
|
|
230
|
+
transactionDate?: string | null;
|
|
231
|
+
}
|
|
232
|
+
interface InquireResponse extends ApiResponseBase {
|
|
233
|
+
paymentConversationId?: string | null;
|
|
234
|
+
orderId?: string | null;
|
|
235
|
+
transactionType: TransactionType;
|
|
236
|
+
transactionStatus: TransactionStatus;
|
|
237
|
+
amount: number;
|
|
238
|
+
pointAmount: number;
|
|
239
|
+
currency?: string | null;
|
|
240
|
+
installmentCount: number;
|
|
241
|
+
binNumber?: string | null;
|
|
242
|
+
cardNumber?: string | null;
|
|
243
|
+
cardBrand: CardBrand;
|
|
244
|
+
cardNetwork: CardNetwork;
|
|
245
|
+
cardType: CardType;
|
|
246
|
+
issuerBankCode: number;
|
|
247
|
+
is3ds: boolean;
|
|
248
|
+
provisionList?: ProvisionModel[] | null;
|
|
249
|
+
returnStatus: ReturnStatus;
|
|
250
|
+
authCode?: string | null;
|
|
251
|
+
pfPaymentDate?: string | null;
|
|
252
|
+
commissionRate: number;
|
|
253
|
+
amountWithoutCommission: number;
|
|
254
|
+
pfPartialPaymentDates?: string[] | null;
|
|
255
|
+
pfPartialPaymentAmounts?: number[] | null;
|
|
256
|
+
}
|
|
257
|
+
interface PointInquiryInput {
|
|
258
|
+
cardToken: string;
|
|
259
|
+
currency?: string;
|
|
260
|
+
languageCode?: string;
|
|
261
|
+
}
|
|
262
|
+
interface PointInquiryResponse extends ApiResponseBase {
|
|
263
|
+
availablePoint: number;
|
|
264
|
+
}
|
|
265
|
+
interface BinInformationInput {
|
|
266
|
+
/** Kartın ilk 6 veya 8 hanesi. `cardToken` verilmemişse zorunlu. */
|
|
267
|
+
binNumber?: string;
|
|
268
|
+
cardToken?: string;
|
|
269
|
+
languageCode?: string;
|
|
270
|
+
}
|
|
271
|
+
interface BinInformationResponse extends ApiResponseBase {
|
|
272
|
+
binNumber?: string | null;
|
|
273
|
+
cardBrand: CardBrand;
|
|
274
|
+
cardNetwork: CardNetwork;
|
|
275
|
+
cardType: CardType;
|
|
276
|
+
cardSubType: CardSubType;
|
|
277
|
+
bankCode: number;
|
|
278
|
+
bankName?: string | null;
|
|
279
|
+
isVirtual: boolean;
|
|
280
|
+
}
|
|
281
|
+
interface InstallmentQueryInput {
|
|
282
|
+
/** Kartın ilk 6 veya 8 hanesi. */
|
|
283
|
+
binNumber: string;
|
|
284
|
+
amount: number;
|
|
285
|
+
commissionFromCustomerSingleInstallment?: boolean;
|
|
286
|
+
}
|
|
287
|
+
interface InstallmentPricing {
|
|
288
|
+
profileCardType: ProfileCardType;
|
|
289
|
+
installmentNumber: number;
|
|
290
|
+
installmentNumberEnd: number;
|
|
291
|
+
commissionRate: number;
|
|
292
|
+
amount: number;
|
|
293
|
+
commissionAmount: number;
|
|
294
|
+
totalAmount: number;
|
|
295
|
+
blockedDayNumber: number;
|
|
296
|
+
isActive: boolean;
|
|
297
|
+
partialValor?: string | null;
|
|
298
|
+
}
|
|
299
|
+
interface LoyaltyInstallmentPricing {
|
|
300
|
+
cardNetwork?: string | null;
|
|
301
|
+
status: MerchantVposStatus;
|
|
302
|
+
installmentPricings?: InstallmentPricing[] | null;
|
|
303
|
+
}
|
|
304
|
+
interface InstallmentQueryResponse {
|
|
305
|
+
merchantNumber?: string | null;
|
|
306
|
+
loyaltyInstallmentPricing?: LoyaltyInstallmentPricing[] | null;
|
|
307
|
+
isSucceed: boolean;
|
|
308
|
+
conversationId?: string | null;
|
|
309
|
+
}
|
|
310
|
+
interface CreateLinkInput {
|
|
311
|
+
linkType: LinkType;
|
|
312
|
+
/** ISO 8601, ör. `"2026-12-31T23:59:59"`. */
|
|
313
|
+
expiryDate: string;
|
|
314
|
+
/** `MultipleUse` için kullanım sınırı. `SingleUse` için `1`. */
|
|
315
|
+
maxUsageCount?: number;
|
|
316
|
+
orderId?: string;
|
|
317
|
+
linkAmountType: LinkAmountType;
|
|
318
|
+
/** `FixedAmount` için zorunlu. */
|
|
319
|
+
amount?: number;
|
|
320
|
+
/** ISO 4217 numerik kod. `949` = TRY. Varsayılan `949`. */
|
|
321
|
+
currency?: number;
|
|
322
|
+
/** İzin verilen taksit seçenekleri, ör. `[1, 3, 6]`. */
|
|
323
|
+
installments?: number[];
|
|
324
|
+
commissionFromCustomer?: boolean;
|
|
325
|
+
commissionFromCustomerSingleInstallment?: boolean;
|
|
326
|
+
is3dRequired?: boolean;
|
|
327
|
+
productName?: string;
|
|
328
|
+
productDescription?: string;
|
|
329
|
+
returnUrl?: string;
|
|
330
|
+
isNameRequired?: boolean;
|
|
331
|
+
isEmailRequired?: boolean;
|
|
332
|
+
isPhoneNumberRequired?: boolean;
|
|
333
|
+
isAddressRequired?: boolean;
|
|
334
|
+
isNoteRequired?: boolean;
|
|
335
|
+
/** Varsayılan `None`. `Sms` için `smsTo`, `Email` için `emailTo` zorunlu. */
|
|
336
|
+
notificationMethod?: NotificationMethod;
|
|
337
|
+
smsTo?: string[];
|
|
338
|
+
emailTo?: string[];
|
|
339
|
+
/** Üye işyeri GUID'i. Genellikle gerekmez; MerchantNumber header'ından çözülür. */
|
|
340
|
+
merchantId?: string;
|
|
341
|
+
}
|
|
342
|
+
interface CreateLinkResponse {
|
|
343
|
+
/** Durum sorgulama ve silme işlemlerinde kullanılır. */
|
|
344
|
+
id: string;
|
|
345
|
+
isSuccess: boolean;
|
|
346
|
+
linkUrl?: string | null;
|
|
347
|
+
}
|
|
348
|
+
interface LinkIdInput {
|
|
349
|
+
/** `links.create` yanıtındaki `id`. */
|
|
350
|
+
id: string;
|
|
351
|
+
}
|
|
352
|
+
interface LinkInstallmentDto {
|
|
353
|
+
installment: number;
|
|
354
|
+
}
|
|
355
|
+
interface LinkDto {
|
|
356
|
+
id: string;
|
|
357
|
+
linkCode?: string | null;
|
|
358
|
+
linkUrl?: string | null;
|
|
359
|
+
linkStatus: ChannelStatus;
|
|
360
|
+
linkPaymentStatus: ChannelPaymentStatus;
|
|
361
|
+
linkType: LinkType;
|
|
362
|
+
expiryDate: string;
|
|
363
|
+
createDate: string;
|
|
364
|
+
currentUsageCount: number;
|
|
365
|
+
maxUsageCount: number;
|
|
366
|
+
orderId?: string | null;
|
|
367
|
+
linkAmountType: LinkAmountType;
|
|
368
|
+
amount: number;
|
|
369
|
+
currency: number;
|
|
370
|
+
commissionFromCustomer: boolean;
|
|
371
|
+
is3dRequired: boolean;
|
|
372
|
+
merchantName?: string | null;
|
|
373
|
+
merchantNumber?: string | null;
|
|
374
|
+
productName?: string | null;
|
|
375
|
+
productDescription?: string | null;
|
|
376
|
+
returnUrl?: string | null;
|
|
377
|
+
isNameRequired: boolean;
|
|
378
|
+
isEmailRequired: boolean;
|
|
379
|
+
isPhoneNumberRequired: boolean;
|
|
380
|
+
isAddressRequired: boolean;
|
|
381
|
+
isNoteRequired: boolean;
|
|
382
|
+
linkInstallments?: LinkInstallmentDto[] | null;
|
|
383
|
+
createdNameBy?: string | null;
|
|
384
|
+
}
|
|
385
|
+
interface LinkProvisionInput {
|
|
386
|
+
/** Link URL'sindeki kod (ör. `SRAQTzuI`). */
|
|
387
|
+
linkCode: string;
|
|
388
|
+
amount: number;
|
|
389
|
+
cardToken: string;
|
|
390
|
+
pointAmount?: number;
|
|
391
|
+
cardHolderName?: string;
|
|
392
|
+
paymentType?: PaymentType;
|
|
393
|
+
integrationMode?: IntegrationMode;
|
|
394
|
+
installmentCount?: number;
|
|
395
|
+
threeDSessionId?: string;
|
|
396
|
+
originalOrderId?: string;
|
|
397
|
+
languageCode?: string;
|
|
398
|
+
customerName?: string;
|
|
399
|
+
customerEmail?: string;
|
|
400
|
+
customerPhoneNumber?: string;
|
|
401
|
+
customerAddress?: string;
|
|
402
|
+
customerNote?: string;
|
|
403
|
+
gateway?: string;
|
|
404
|
+
recipientCompanyName?: string;
|
|
405
|
+
recipientTaxOffice?: string;
|
|
406
|
+
recipientTaxNumber?: string;
|
|
407
|
+
}
|
|
408
|
+
interface FilterMerchantDto {
|
|
409
|
+
id: string;
|
|
410
|
+
name?: string | null;
|
|
411
|
+
number?: string | null;
|
|
412
|
+
tradeRegistrationNumber?: string | null;
|
|
413
|
+
taxAdministration?: string | null;
|
|
414
|
+
}
|
|
415
|
+
interface LinkProvisionResponse extends ApiResponseBase {
|
|
416
|
+
linkUrlPath?: string | null;
|
|
417
|
+
orderId?: string | null;
|
|
418
|
+
filterMerchant?: FilterMerchantDto | null;
|
|
419
|
+
transactionType: TransactionType;
|
|
420
|
+
amount: number;
|
|
421
|
+
amountWithoutCommission: number;
|
|
422
|
+
commissionAmount: number;
|
|
423
|
+
currency: number;
|
|
424
|
+
installmentCount: number;
|
|
425
|
+
binNumber?: string | null;
|
|
426
|
+
cardNumber?: string | null;
|
|
427
|
+
hasCvv: boolean;
|
|
428
|
+
responseCode?: string | null;
|
|
429
|
+
responseDescription?: string | null;
|
|
430
|
+
merchantCustomerName?: string | null;
|
|
431
|
+
merchantCustomerPhoneCode?: string | null;
|
|
432
|
+
merchantCustomerPhoneNumber?: string | null;
|
|
433
|
+
description?: string | null;
|
|
434
|
+
cardHolderName?: string | null;
|
|
435
|
+
pfCommissionAmount: number;
|
|
436
|
+
amountWithoutCommissions: number;
|
|
437
|
+
bsmvAmount: number;
|
|
438
|
+
productName?: string | null;
|
|
439
|
+
productDescription?: string | null;
|
|
440
|
+
linkCustomerName?: string | null;
|
|
441
|
+
linkEmail?: string | null;
|
|
442
|
+
linkPhoneNumber?: string | null;
|
|
443
|
+
linkAddress?: string | null;
|
|
444
|
+
linkNote?: string | null;
|
|
445
|
+
transactionDate: string;
|
|
446
|
+
commissionFromCustomerSingleInstallment: boolean;
|
|
447
|
+
isSplitReceiptAndTransfer?: boolean | null;
|
|
448
|
+
linkProductName?: string | null;
|
|
449
|
+
linkProductDescription?: string | null;
|
|
450
|
+
recipientCompanyName?: string | null;
|
|
451
|
+
recipientTaxOffice?: string | null;
|
|
452
|
+
recipientTaxNumber?: string | null;
|
|
453
|
+
}
|
|
454
|
+
interface CreatePaymentSessionInput {
|
|
455
|
+
amount: number;
|
|
456
|
+
transactionType?: string;
|
|
457
|
+
/** SoftPOS kullanıcısının GUID'i. */
|
|
458
|
+
userId: string;
|
|
459
|
+
orderId?: string;
|
|
460
|
+
callbackUrl?: string;
|
|
461
|
+
}
|
|
462
|
+
interface CreatePaymentSessionResponse {
|
|
463
|
+
paymentSessionToken?: string | null;
|
|
464
|
+
}
|
|
465
|
+
interface SoftPosTransactionDetail {
|
|
466
|
+
orderId?: string | null;
|
|
467
|
+
authorizationCode?: string | null;
|
|
468
|
+
paymentSessionToken?: string | null;
|
|
469
|
+
transactionDateISO: string;
|
|
470
|
+
createDate: string;
|
|
471
|
+
installmentSelected: number;
|
|
472
|
+
maskedPan?: string | null;
|
|
473
|
+
bankResponseCodeValue?: string | null;
|
|
474
|
+
statusCode?: string | null;
|
|
475
|
+
screenMessage?: string | null;
|
|
476
|
+
currencyCode?: string | null;
|
|
477
|
+
amount: number;
|
|
478
|
+
transactionType?: string | null;
|
|
479
|
+
receipt?: string | null;
|
|
480
|
+
issuerBankCode: number;
|
|
481
|
+
issuerBankName?: string | null;
|
|
482
|
+
acquirerBankCode: number;
|
|
483
|
+
acquirerBankName?: string | null;
|
|
484
|
+
}
|
|
485
|
+
type HandleCallbackResponse = SoftPosTransactionDetail;
|
|
486
|
+
interface TransactionReferenceStatusResponse {
|
|
487
|
+
isRefunded?: boolean | null;
|
|
488
|
+
isVoided?: boolean | null;
|
|
489
|
+
orderId?: string | null;
|
|
490
|
+
amount: number;
|
|
491
|
+
transactionDateISO: string;
|
|
492
|
+
}
|
|
493
|
+
interface SoftPosTransactionInquiryInput {
|
|
494
|
+
orderId: string;
|
|
495
|
+
}
|
|
496
|
+
interface SoftPosTransactionInquiryResponse extends SoftPosTransactionDetail {
|
|
497
|
+
transactionReferenceStatusResponse?: TransactionReferenceStatusResponse | null;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/** Taksit ve komisyon sorgulama. */
|
|
501
|
+
declare class InstallmentsResource {
|
|
502
|
+
private readonly transport;
|
|
503
|
+
constructor(transport: Transport);
|
|
504
|
+
/**
|
|
505
|
+
* BIN ve tutara göre kullanılabilir taksit seçeneklerini ve komisyon
|
|
506
|
+
* oranlarını döner. `GET /v1/Installment`
|
|
507
|
+
*/
|
|
508
|
+
query(input: InstallmentQueryInput, options?: RequestOptions): Promise<InstallmentQueryResponse>;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/** Kaynak sınıflarının isteklere uyguladığı istemci geneli varsayılanlar. */
|
|
512
|
+
interface ResourceDefaults {
|
|
513
|
+
languageCode: string;
|
|
514
|
+
currency: string;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** Link ile ödeme işlemleri. */
|
|
518
|
+
declare class LinksResource {
|
|
519
|
+
private readonly transport;
|
|
520
|
+
private readonly defaults;
|
|
521
|
+
constructor(transport: Transport, defaults: ResourceDefaults);
|
|
522
|
+
/**
|
|
523
|
+
* Ödeme linki oluşturur. Yanıttaki `id` değerini saklayın.
|
|
524
|
+
* `POST /v1/Payments/createLink`
|
|
525
|
+
*/
|
|
526
|
+
create(input: CreateLinkInput, options?: RequestOptions): Promise<CreateLinkResponse>;
|
|
527
|
+
/**
|
|
528
|
+
* Link durumu ve ödeme durumu.
|
|
529
|
+
* `POST /v1/Payments/link-status`
|
|
530
|
+
*/
|
|
531
|
+
getStatus(input: LinkIdInput, options?: RequestOptions): Promise<LinkDto>;
|
|
532
|
+
/**
|
|
533
|
+
* Linki siler / pasife alır. Başarılıysa `true` döner.
|
|
534
|
+
* `POST /v1/Payments/deleteLink`
|
|
535
|
+
*/
|
|
536
|
+
delete(input: LinkIdInput, options?: RequestOptions): Promise<boolean>;
|
|
537
|
+
/**
|
|
538
|
+
* Link üzerinden kart ile ödeme (provizyon).
|
|
539
|
+
* `POST /v1/Payments/linkProvision`
|
|
540
|
+
*/
|
|
541
|
+
provision(input: LinkProvisionInput, options?: RequestOptions): Promise<LinkProvisionResponse>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/** Ödeme, iptal, iade ve sorgulama işlemleri. */
|
|
545
|
+
declare class PaymentsResource {
|
|
546
|
+
private readonly transport;
|
|
547
|
+
private readonly defaults;
|
|
548
|
+
constructor(transport: Transport, defaults: ResourceDefaults);
|
|
549
|
+
/**
|
|
550
|
+
* Ödeme (provizyon). 3D Secure'lu akışta `threeDSessionId` verilir,
|
|
551
|
+
* 3DS'siz akışta verilmez. Yanıttaki `orderId` değerini saklayın.
|
|
552
|
+
* `POST /v1/Payments/provision`
|
|
553
|
+
*/
|
|
554
|
+
provision(input: ProvisionInput, options?: RequestOptions): Promise<ProvisionResponse>;
|
|
555
|
+
/**
|
|
556
|
+
* İptal. Gün sonu yapılmamış işlemi tamamen iptal eder.
|
|
557
|
+
* `POST /v1/Payments/reverse`
|
|
558
|
+
*/
|
|
559
|
+
reverse(input: ReverseInput, options?: RequestOptions): Promise<ReverseResponse>;
|
|
560
|
+
/**
|
|
561
|
+
* İade (Return). Gün sonu yapılmış işlemde kısmi veya tam iade.
|
|
562
|
+
* `POST /v1/Payments/return`
|
|
563
|
+
*/
|
|
564
|
+
refund(input: RefundInput, options?: RequestOptions): Promise<RefundResponse>;
|
|
565
|
+
/**
|
|
566
|
+
* İşlem sorgulama. `orderId` veya `paymentConversationId` ile.
|
|
567
|
+
* `POST /v1/Payments/inquire`
|
|
568
|
+
*/
|
|
569
|
+
inquire(input: InquireInput, options?: RequestOptions): Promise<InquireResponse>;
|
|
570
|
+
/**
|
|
571
|
+
* Kartın kullanılabilir puanını sorgular.
|
|
572
|
+
* `POST /v1/Payments/pointInquiry`
|
|
573
|
+
*/
|
|
574
|
+
pointInquiry(input: PointInquiryInput, options?: RequestOptions): Promise<PointInquiryResponse>;
|
|
575
|
+
/**
|
|
576
|
+
* BIN bilgisi (kart markası, banka, kart tipi).
|
|
577
|
+
* `POST /v1/Payments/bin-information`
|
|
578
|
+
*/
|
|
579
|
+
binInformation(input: BinInformationInput, options?: RequestOptions): Promise<BinInformationResponse>;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/** SoftPOS (Payneos) işlemleri. */
|
|
583
|
+
declare class SoftPosResource {
|
|
584
|
+
private readonly transport;
|
|
585
|
+
constructor(transport: Transport);
|
|
586
|
+
/**
|
|
587
|
+
* SoftPOS ödeme oturumu başlatır, `paymentSessionToken` döner.
|
|
588
|
+
* `POST /v1/PayneosPayment/create-payment-session`
|
|
589
|
+
*/
|
|
590
|
+
createPaymentSession(input: CreatePaymentSessionInput, options?: RequestOptions): Promise<CreatePaymentSessionResponse>;
|
|
591
|
+
/**
|
|
592
|
+
* Ödeme sonrası dönen callback verisini işler.
|
|
593
|
+
* `POST /v1/PayneosPayment/handle-callback-data`
|
|
594
|
+
*
|
|
595
|
+
* @experimental OpenAPI tanımında istek gövdesi belirtilmemiştir; `payload`
|
|
596
|
+
* verildiğinde JSON olarak gönderilir.
|
|
597
|
+
*/
|
|
598
|
+
handleCallbackData(payload?: Record<string, unknown>, options?: RequestOptions): Promise<HandleCallbackResponse>;
|
|
599
|
+
/**
|
|
600
|
+
* SoftPOS işlem durumu sorgular.
|
|
601
|
+
* `POST /v1/PayneosPayment/soft-pos-transaction-inquiry`
|
|
602
|
+
*/
|
|
603
|
+
transactionInquiry(input: SoftPosTransactionInquiryInput, options?: RequestOptions): Promise<SoftPosTransactionInquiryResponse>;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
type CallbackSource = FormData | URLSearchParams | Record<string, unknown> | Iterable<[string, unknown]>;
|
|
607
|
+
/**
|
|
608
|
+
* Bankanın 3DS doğrulaması sonrası `callbackUrl`'e form POST ile gönderdiği
|
|
609
|
+
* verileri çözümler. Express'te `req.body`, Next.js'te `await req.formData()`
|
|
610
|
+
* doğrudan verilebilir.
|
|
611
|
+
*
|
|
612
|
+
* Callback verisi imzalı değildir; ödemeye geçmeden önce mutlaka
|
|
613
|
+
* `threeDS.getResult()` ile sunucu tarafında sonucu doğrulayın.
|
|
614
|
+
*/
|
|
615
|
+
declare function parseThreeDSCallback(source: CallbackSource): ThreeDSCallbackData;
|
|
616
|
+
/** 3D Secure oturum, başlatma ve sonuç işlemleri. */
|
|
617
|
+
declare class ThreeDSResource {
|
|
618
|
+
private readonly transport;
|
|
619
|
+
private readonly defaults;
|
|
620
|
+
constructor(transport: Transport, defaults: ResourceDefaults);
|
|
621
|
+
/**
|
|
622
|
+
* `cardToken` ile 3D Secure oturumu oluşturur ve `threeDSessionId` döner.
|
|
623
|
+
* `POST /v1/ThreeDS/getthreedsession`
|
|
624
|
+
*/
|
|
625
|
+
createSession(input: CreateThreeDSessionInput, options?: RequestOptions): Promise<ThreeDSessionResponse>;
|
|
626
|
+
/**
|
|
627
|
+
* Banka doğrulama sayfasının HTML içeriğini döner. Bu HTML'i kullanıcının
|
|
628
|
+
* tarayıcısında (iframe veya tam sayfa) render edin.
|
|
629
|
+
* `POST /v1/ThreeDS/init3ds` (multipart/form-data, kimlik doğrulama form alanı olarak).
|
|
630
|
+
*/
|
|
631
|
+
init(input: InitThreeDSInput, options?: RequestOptions): Promise<InitThreeDSResponse>;
|
|
632
|
+
/**
|
|
633
|
+
* Callback sonrası 3DS doğrulama sonucunu sunucu tarafında sorgular.
|
|
634
|
+
* `mdStatus === "1"` ise ödeme adımına geçilebilir.
|
|
635
|
+
* `POST /v1/ThreeDS/getthreedsessionresult`
|
|
636
|
+
*/
|
|
637
|
+
getResult(input: ThreeDSessionResultInput, options?: RequestOptions): Promise<ThreeDSessionResultResponse>;
|
|
638
|
+
/** `parseThreeDSCallback` fonksiyonunun kısayolu. */
|
|
639
|
+
parseCallback(source: CallbackSource): ThreeDSCallbackData;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/** Kart tokenizasyon işlemleri. */
|
|
643
|
+
declare class TokensResource {
|
|
644
|
+
private readonly transport;
|
|
645
|
+
constructor(transport: Transport);
|
|
646
|
+
/**
|
|
647
|
+
* Kart bilgilerini güvenli bir `cardToken` değerine dönüştürür.
|
|
648
|
+
* `POST /v1/Tokens` (multipart/form-data, kimlik doğrulama form alanı olarak).
|
|
649
|
+
*
|
|
650
|
+
* Kart verisi yalnızca bu çağrıda sunucunuzdan geçer; sonraki tüm adımlar
|
|
651
|
+
* `cardToken` ile yapılır.
|
|
652
|
+
*/
|
|
653
|
+
create(input: CreateCardTokenInput, options?: RequestOptions): Promise<CardTokenResponse>;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
interface CreateSignatureInput {
|
|
657
|
+
/** Üye işyerine ait açık anahtar (PublicKey / API Key). */
|
|
658
|
+
publicKey: string;
|
|
659
|
+
/** Üye işyerine ait gizli anahtar. Base64 kodlu olarak verilir. */
|
|
660
|
+
secretKey: string;
|
|
661
|
+
/** İstek takip kimliği. Verilmezse rastgele üretilir. */
|
|
662
|
+
conversationId?: string;
|
|
663
|
+
/**
|
|
664
|
+
* Milisaniye cinsinden zaman damgası. Normalde verilmez, otomatik üretilir;
|
|
665
|
+
* yalnızca deterministik testler için override edilir.
|
|
666
|
+
*/
|
|
667
|
+
nonce?: string;
|
|
668
|
+
}
|
|
669
|
+
interface SignatureResult {
|
|
670
|
+
publicKey: string;
|
|
671
|
+
nonce: string;
|
|
672
|
+
signature: string;
|
|
673
|
+
conversationId: string;
|
|
674
|
+
/** Ara değer (1. HMAC). Hata ayıklama için döndürülür, isteğe eklenmez. */
|
|
675
|
+
securityData: string;
|
|
676
|
+
}
|
|
677
|
+
/** Her istek için benzersiz nonce: Unix epoch milisaniye. */
|
|
678
|
+
declare function generateNonce(): string;
|
|
679
|
+
/**
|
|
680
|
+
* Varsayılan ConversationId üreteci: 16 karakterlik hex (64 bit entropi).
|
|
681
|
+
* API bu değeri idempotentlik anahtarı olarak kullandığı için çakışma
|
|
682
|
+
* ihtimali düşük tutulmuştur. Kendi sipariş numaranızı vermek genellikle
|
|
683
|
+
* daha iyi bir tercihtir.
|
|
684
|
+
*/
|
|
685
|
+
declare function generateConversationId(): string;
|
|
686
|
+
/**
|
|
687
|
+
* Base64 kodlu SecretKey'i HMAC anahtarı olarak kullanılacak byte dizisine çevirir.
|
|
688
|
+
* Dokümantasyondaki uyarı: SecretKey string olarak değil, Base64 decode edilmiş
|
|
689
|
+
* haliyle anahtar olarak kullanılır.
|
|
690
|
+
*/
|
|
691
|
+
declare function decodeSecretKey(secretKey: string): Buffer;
|
|
692
|
+
declare function computeHmacBase64(key: Buffer, data: string): string;
|
|
693
|
+
/**
|
|
694
|
+
* PF Gateway'in 2 aşamalı HMAC-SHA256 imzasını üretir.
|
|
695
|
+
*
|
|
696
|
+
* ```
|
|
697
|
+
* securityData = HMAC-SHA256(publicKey + nonce, Base64Decode(secretKey)) → Base64
|
|
698
|
+
* signature = HMAC-SHA256(secretKey + conversationId + nonce + securityData, Base64Decode(secretKey)) → Base64
|
|
699
|
+
* ```
|
|
700
|
+
*
|
|
701
|
+
* Her API çağrısı için yeni bir imza üretilmelidir; aynı nonce/signature çifti
|
|
702
|
+
* tekrar kullanılamaz. `PfClient` bunu her istekte otomatik yapar.
|
|
703
|
+
*/
|
|
704
|
+
declare function createSignature(input: CreateSignatureInput): SignatureResult;
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* SDK'nın adresini bildiği tek ortam. Canlı ortam adresi pakete gömülmez;
|
|
708
|
+
* canlıya geçişte entegrasyon@rubikpara.com tarafından iletilir ve
|
|
709
|
+
* `baseUrl` ile verilir.
|
|
710
|
+
*/
|
|
711
|
+
type PfEnvironment = "test";
|
|
712
|
+
declare const PF_BASE_URLS: Readonly<Record<PfEnvironment, string>>;
|
|
713
|
+
interface PfClientConfig {
|
|
714
|
+
/** Üye işyerine ait açık anahtar (API Key). */
|
|
715
|
+
publicKey: string;
|
|
716
|
+
/** Üye işyerine ait gizli anahtar (Base64). Asla istemci tarafına gönderilmez. */
|
|
717
|
+
secretKey: string;
|
|
718
|
+
/** Üye işyeri numarası. */
|
|
719
|
+
merchantNumber: string;
|
|
720
|
+
/**
|
|
721
|
+
* `"test"`: test ortamına bağlanır. Canlı ortam için bunun yerine `baseUrl`
|
|
722
|
+
* verin. İkisinden biri zorunludur; ortam bilinçli olarak varsayılansızdır.
|
|
723
|
+
*/
|
|
724
|
+
environment?: PfEnvironment;
|
|
725
|
+
/**
|
|
726
|
+
* API adresi. Canlı ortamda, canlıya geçişte size iletilen adresi verin.
|
|
727
|
+
* Verilirse `environment` yok sayılır.
|
|
728
|
+
*/
|
|
729
|
+
baseUrl?: string;
|
|
730
|
+
/** İstek zaman aşımı (ms). Varsayılan `30000`. */
|
|
731
|
+
timeoutMs?: number;
|
|
732
|
+
/** İsteklerde kullanılacak varsayılan dil kodu. Varsayılan `"tr"`. */
|
|
733
|
+
languageCode?: string;
|
|
734
|
+
/** Ödeme ve 3DS isteklerinde varsayılan para birimi. Varsayılan `"TRY"`. */
|
|
735
|
+
currency?: string;
|
|
736
|
+
/**
|
|
737
|
+
* `true` (varsayılan): yanıtta `isSucceed: false` ise `PfApiError` fırlatılır.
|
|
738
|
+
* `false`: yanıt olduğu gibi döner, `isSucceed` kontrolü size kalır.
|
|
739
|
+
*/
|
|
740
|
+
throwOnApiError?: boolean;
|
|
741
|
+
/** Özel `fetch` (test, proxy, loglama). Varsayılan `globalThis.fetch`. */
|
|
742
|
+
fetch?: typeof fetch;
|
|
743
|
+
/** Otomatik ConversationId üreteci. Varsayılan 16 karakter hex. */
|
|
744
|
+
conversationIdFactory?: () => string;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* PF Gateway API istemcisi.
|
|
748
|
+
*
|
|
749
|
+
* ```ts
|
|
750
|
+
* const pf = new PfClient({
|
|
751
|
+
* publicKey: process.env.PF_PUBLIC_KEY!,
|
|
752
|
+
* secretKey: process.env.PF_SECRET_KEY!,
|
|
753
|
+
* merchantNumber: process.env.PF_MERCHANT_NUMBER!,
|
|
754
|
+
* environment: "test",
|
|
755
|
+
* });
|
|
756
|
+
*
|
|
757
|
+
* const { cardToken } = await pf.tokens.create({ ... });
|
|
758
|
+
* ```
|
|
759
|
+
*/
|
|
760
|
+
declare class PfClient {
|
|
761
|
+
readonly baseUrl: string;
|
|
762
|
+
readonly tokens: TokensResource;
|
|
763
|
+
readonly threeDS: ThreeDSResource;
|
|
764
|
+
readonly payments: PaymentsResource;
|
|
765
|
+
readonly installments: InstallmentsResource;
|
|
766
|
+
readonly links: LinksResource;
|
|
767
|
+
readonly softPos: SoftPosResource;
|
|
768
|
+
private readonly transport;
|
|
769
|
+
private readonly publicKey;
|
|
770
|
+
private readonly secretKey;
|
|
771
|
+
constructor(config: PfClientConfig);
|
|
772
|
+
/** `GET /HealthCheck`. Kimlik doğrulaması gerektirmez. */
|
|
773
|
+
healthCheck(options?: RequestOptions): Promise<string>;
|
|
774
|
+
/**
|
|
775
|
+
* SDK dışında (ör. kendi HTTP istemcinizle) kullanmak üzere bu istemcinin
|
|
776
|
+
* anahtarlarıyla yeni bir imza üretir. Her istek için yeniden çağrılmalıdır.
|
|
777
|
+
*/
|
|
778
|
+
createSignature(conversationId?: string): SignatureResult;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* PF Gateway hata kodları prefix'e göre üç kategoriye ayrılır:
|
|
783
|
+
* - `0xxx` iş mantığı hataları (üye işyeri, limit, 3DS, token)
|
|
784
|
+
* - `1xxx` sistem hataları
|
|
785
|
+
* - `5xxx` banka yanıt kodları
|
|
786
|
+
*/
|
|
787
|
+
type PfErrorCategory = "business" | "system" | "bank" | "unknown";
|
|
788
|
+
declare function errorCategory(errorCode: string | null | undefined): PfErrorCategory;
|
|
789
|
+
/** Tüm SDK hatalarının ortak taban sınıfı. */
|
|
790
|
+
declare class PfError extends Error {
|
|
791
|
+
constructor(message: string, options?: {
|
|
792
|
+
cause?: unknown;
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
/** İstemci yapılandırması hatalı veya eksik (anahtar, ortam, Node sürümü). */
|
|
796
|
+
declare class PfConfigError extends PfError {
|
|
797
|
+
constructor(message: string);
|
|
798
|
+
}
|
|
799
|
+
interface PfApiErrorInit {
|
|
800
|
+
errorCode?: string | null;
|
|
801
|
+
errorMessage?: string | null;
|
|
802
|
+
conversationId?: string | null;
|
|
803
|
+
httpStatus: number;
|
|
804
|
+
response: unknown;
|
|
805
|
+
path: string;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* API, isteği aldı ancak iş mantığı hatası döndü (`isSucceed: false`).
|
|
809
|
+
* `errorCode` ve `errorMessage` alanları dokümantasyondaki hata kodları
|
|
810
|
+
* referansıyla birebir eşleşir.
|
|
811
|
+
*/
|
|
812
|
+
declare class PfApiError extends PfError {
|
|
813
|
+
readonly errorCode: string | null;
|
|
814
|
+
readonly errorMessage: string | null;
|
|
815
|
+
readonly conversationId: string | null;
|
|
816
|
+
readonly httpStatus: number;
|
|
817
|
+
readonly category: PfErrorCategory;
|
|
818
|
+
readonly path: string;
|
|
819
|
+
/** Sunucudan dönen ham yanıt gövdesi. */
|
|
820
|
+
readonly response: unknown;
|
|
821
|
+
constructor(init: PfApiErrorInit);
|
|
822
|
+
}
|
|
823
|
+
/** HTTP seviyesinde başarısız yanıt (4xx/5xx) veya JSON olarak çözümlenemeyen gövde. */
|
|
824
|
+
declare class PfHttpError extends PfError {
|
|
825
|
+
readonly status: number;
|
|
826
|
+
readonly statusText: string;
|
|
827
|
+
readonly body: string;
|
|
828
|
+
readonly conversationId: string | null;
|
|
829
|
+
readonly path: string;
|
|
830
|
+
constructor(init: {
|
|
831
|
+
status: number;
|
|
832
|
+
statusText: string;
|
|
833
|
+
body: string;
|
|
834
|
+
conversationId?: string | null;
|
|
835
|
+
path: string;
|
|
836
|
+
message?: string;
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
/** DNS, TLS, bağlantı kopması gibi ağ hataları. Orijinal hata `cause` içindedir. */
|
|
840
|
+
declare class PfNetworkError extends PfError {
|
|
841
|
+
readonly path: string;
|
|
842
|
+
constructor(path: string, cause: unknown);
|
|
843
|
+
}
|
|
844
|
+
/** İstek `timeoutMs` süresi içinde tamamlanmadı. */
|
|
845
|
+
declare class PfTimeoutError extends PfError {
|
|
846
|
+
readonly timeoutMs: number;
|
|
847
|
+
readonly path: string;
|
|
848
|
+
constructor(path: string, timeoutMs: number);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* SDK sürümü. `package.json` içindeki `version` alanı ile aynı tutulur
|
|
853
|
+
* (test/version.test.ts bunu doğrular).
|
|
854
|
+
*/
|
|
855
|
+
declare const SDK_VERSION = "0.1.1";
|
|
856
|
+
|
|
857
|
+
export { type ApiResponseBase, type BankTransactionDetail, type BinInformationInput, type BinInformationResponse, type CardBrand, type CardNetwork, type CardSubType, type CardTokenResponse, type CardType, type ChannelPaymentStatus, type ChannelStatus, type CreateCardTokenInput, type CreateLinkInput, type CreateLinkResponse, type CreatePaymentSessionInput, type CreatePaymentSessionResponse, type CreateSignatureInput, type CreateThreeDSessionInput, type FilterMerchantDto, type HandleCallbackResponse, type InitThreeDSInput, type InitThreeDSResponse, type InquireInput, type InquireResponse, type InstallmentPricing, type InstallmentQueryInput, type InstallmentQueryResponse, InstallmentsResource, type IntegrationMode, type LinkAmountType, type LinkDto, type LinkIdInput, type LinkInstallmentDto, type LinkProvisionInput, type LinkProvisionResponse, type LinkType, LinksResource, type LoyaltyInstallmentPricing, type MerchantVposStatus, type NotificationMethod, PF_BASE_URLS, type PaymentType, PaymentsResource, PfApiError, PfClient, type PfClientConfig, PfConfigError, type PfEnvironment, PfError, type PfErrorCategory, PfHttpError, PfNetworkError, PfTimeoutError, type PointInquiryInput, type PointInquiryResponse, type ProfileCardType, type ProvisionInput, type ProvisionModel, type ProvisionResponse, type RefundInput, type RefundResponse, type RequestOptions, type ReturnApprovalStatus, type ReturnStatus, type ReverseInput, type ReverseResponse, SDK_VERSION, type SignatureResult, SoftPosResource, type SoftPosTransactionDetail, type SoftPosTransactionInquiryInput, type SoftPosTransactionInquiryResponse, type ThreeDSCallbackData, ThreeDSResource, type ThreeDSessionResponse, type ThreeDSessionResultInput, type ThreeDSessionResultResponse, TokensResource, type TransactionReferenceStatusResponse, type TransactionStatus, type TransactionType, computeHmacBase64, createSignature, decodeSecretKey, errorCategory, generateConversationId, generateNonce, parseThreeDSCallback };
|