quickpos 1.0.910 → 1.0.912

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 (131) hide show
  1. package/PROVIDERS-DETAILS.md +1544 -0
  2. package/examples/example-2checkout.js +78 -0
  3. package/examples/example-bitpay.js +83 -0
  4. package/examples/example-cardcom.js +80 -0
  5. package/examples/example-cashfree.js +109 -0
  6. package/examples/example-checkout.js +85 -0
  7. package/examples/example-coingate.js +101 -0
  8. package/examples/example-coinpayments.js +89 -0
  9. package/examples/example-doku.js +27 -0
  10. package/examples/example-epay.js +64 -0
  11. package/examples/example-epoint.js +91 -0
  12. package/examples/example-freekassa.js +26 -0
  13. package/examples/example-heleket.js +139 -0
  14. package/examples/example-konnect.js +227 -0
  15. package/examples/example-midtrans.js +80 -0
  16. package/examples/example-noonpayments.js +297 -0
  17. package/examples/example-nowpayments.js +289 -0
  18. package/examples/example-omise.js +27 -0
  19. package/examples/example-paycom.js +82 -0
  20. package/{example-paydisini.js → examples/example-paydisini.js} +1 -1
  21. package/examples/example-payid19.js +87 -0
  22. package/examples/example-paykun.js +29 -0
  23. package/examples/example-payme.js +202 -0
  24. package/examples/example-paymentwall.js +201 -0
  25. package/examples/example-paynet.js +104 -0
  26. package/examples/example-paynettr.js +18 -0
  27. package/examples/example-payoneer.js +74 -0
  28. package/examples/example-payop.js +351 -0
  29. package/examples/example-paypal.js +200 -0
  30. package/examples/example-payriff.js +89 -0
  31. package/examples/example-paysend.js +81 -0
  32. package/examples/example-payspace.js +103 -0
  33. package/examples/example-payssion.js +27 -0
  34. package/examples/example-paytabs.js +28 -0
  35. package/examples/example-paytm.js +78 -0
  36. package/examples/example-payuindia.js +108 -0
  37. package/examples/example-payulatam.js +75 -0
  38. package/examples/example-phonepe.js +27 -0
  39. package/examples/example-picpay.js +27 -0
  40. package/examples/example-plisio.js +84 -0
  41. package/examples/example-portwallet.js +90 -0
  42. package/examples/example-primepayments.js +250 -0
  43. package/examples/example-razorpay.js +30 -0
  44. package/examples/example-senangpay.js +28 -0
  45. package/examples/example-shurjopay.js +94 -0
  46. package/examples/example-toyyibpay.js +80 -0
  47. package/examples/example-tripay.js +89 -0
  48. package/examples/example-unitpay.js +26 -0
  49. package/examples/example-urway.js +28 -0
  50. package/examples/example-volet.js +80 -0
  51. package/examples/example-xendit.js +28 -0
  52. package/examples/example-yallapay.js +253 -0
  53. package/examples/example-yookassa.js +27 -0
  54. package/examples/example-youcanpay.js +28 -0
  55. package/examples/example-zarinpal.js +98 -0
  56. package/{example.js → examples/example.js} +1 -1
  57. package/lib/2checkout.js +165 -0
  58. package/lib/amazonpay.js +161 -0
  59. package/lib/bitpay.js +122 -0
  60. package/lib/cardcom.js +193 -0
  61. package/lib/cashfree.js +184 -0
  62. package/lib/checkout.js +248 -0
  63. package/lib/coinbase.js +150 -0
  64. package/lib/coingate.js +137 -0
  65. package/lib/coinpayments.js +245 -0
  66. package/lib/doku.js +173 -0
  67. package/lib/epay.js +175 -0
  68. package/lib/epoint.js +162 -0
  69. package/lib/freekassa.js +128 -0
  70. package/lib/heleket.js +67 -1
  71. package/lib/instamojo.js +158 -0
  72. package/lib/konnect.js +211 -0
  73. package/lib/midtrans.js +227 -0
  74. package/lib/noonpayments.js +650 -0
  75. package/lib/nowpayments.js +311 -0
  76. package/lib/omise.js +150 -0
  77. package/lib/paddle.js +180 -0
  78. package/lib/paycom.js +216 -0
  79. package/lib/payid19.js +211 -0
  80. package/lib/paykun.js +144 -0
  81. package/lib/payme.js +302 -0
  82. package/lib/paymentwall.js +205 -0
  83. package/lib/paynet.js +186 -0
  84. package/lib/paynettr.js +165 -0
  85. package/lib/payoneer.js +128 -0
  86. package/lib/payop.js +256 -0
  87. package/lib/paypal.js +542 -0
  88. package/lib/payriff.js +148 -0
  89. package/lib/paysend.js +189 -0
  90. package/lib/payspace.js +168 -0
  91. package/lib/payssion.js +177 -0
  92. package/lib/paytabs.js +145 -0
  93. package/lib/paytm.js +253 -0
  94. package/lib/payuindia.js +162 -0
  95. package/lib/payulatam.js +179 -0
  96. package/lib/perfectmoney.js +143 -0
  97. package/lib/phonepe.js +174 -0
  98. package/lib/picpay.js +119 -0
  99. package/lib/plisio.js +234 -0
  100. package/lib/portwallet.js +152 -0
  101. package/lib/primepayments.js +256 -0
  102. package/lib/razorpay.js +205 -0
  103. package/lib/senangpay.js +130 -0
  104. package/lib/shurjopay.js +159 -0
  105. package/lib/toyyibpay.js +151 -0
  106. package/lib/tripay.js +220 -0
  107. package/lib/unitpay.js +223 -0
  108. package/lib/urway.js +182 -0
  109. package/lib/volet.js +147 -0
  110. package/lib/xendit.js +206 -0
  111. package/lib/yallapay.js +279 -0
  112. package/lib/yookassa.js +193 -0
  113. package/lib/youcanpay.js +124 -0
  114. package/lib/zarinpal.js +157 -0
  115. package/package.json +138 -64
  116. package/readme.md +348 -105
  117. package/test.js +492 -0
  118. package/example-heleket.js +0 -83
  119. package/lib/vallet.js +0 -22
  120. /package/{example-anypay.js → examples/example-anypay.js} +0 -0
  121. /package/{example-bufpay.js → examples/example-bufpay.js} +0 -0
  122. /package/{example-cryptomus.js → examples/example-cryptomus.js} +0 -0
  123. /package/{example-esnekpos.js → examples/example-esnekpos.js} +0 -0
  124. /package/{example-fedapay.js → examples/example-fedapay.js} +0 -0
  125. /package/{example-iyzico.js → examples/example-iyzico.js} +0 -0
  126. /package/{example-papara.js → examples/example-papara.js} +0 -0
  127. /package/{example-payeer.js → examples/example-payeer.js} +0 -0
  128. /package/{example-paymaya.js → examples/example-paymaya.js} +0 -0
  129. /package/{example-shopier.js → examples/example-shopier.js} +0 -0
  130. /package/{ipaymu.js → examples/ipaymu.js} +0 -0
  131. /package/{oderopay.js → examples/oderopay.js} +0 -0
package/test.js ADDED
@@ -0,0 +1,492 @@
1
+ /**
2
+ * QuickPos Payment Gateway Test Suite
3
+ *
4
+ * Bu dosya tüm ödeme sağlayıcılarının temel fonksiyonlarını test eder.
5
+ * Not: Gerçek testler için her provider'ın sandbox/test API anahtarları gereklidir.
6
+ */
7
+
8
+ const QuickPos = require('./app');
9
+
10
+ // Test konfigürasyonu
11
+ const testConfig = {
12
+ providers: {
13
+ // Midtrans Test
14
+ midtrans: {
15
+ serverKey: 'SB-Mid-server-YOUR_SERVER_KEY',
16
+ clientKey: 'SB-Mid-client-YOUR_CLIENT_KEY',
17
+ isProduction: false
18
+ },
19
+
20
+ // Plisio Test
21
+ plisio: {
22
+ apiKey: 'your-test-api-key'
23
+ },
24
+
25
+ // Tripay Test
26
+ tripay: {
27
+ apiKey: 'your-test-api-key',
28
+ privateKey: 'your-test-private-key',
29
+ merchantCode: 'T1234',
30
+ isProduction: false
31
+ },
32
+
33
+ // ToyyibPay Test
34
+ toyyibpay: {
35
+ secretKey: 'your-test-secret-key',
36
+ categoryCode: 'your-test-category-code'
37
+ },
38
+
39
+ // Zarinpal Test
40
+ zarinpal: {
41
+ merchantId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
42
+ sandbox: true
43
+ },
44
+
45
+ // CoinPayments Test
46
+ coinpayments: {
47
+ publicKey: 'your-test-public-key',
48
+ privateKey: 'your-test-private-key',
49
+ ipnSecret: 'your-test-ipn-secret'
50
+ },
51
+
52
+ // Checkout.com Test
53
+ checkout: {
54
+ secretKey: 'sk_test_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
55
+ publicKey: 'pk_test_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
56
+ sandbox: true
57
+ },
58
+
59
+ // Paytm Test
60
+ paytm: {
61
+ merchantId: 'YOUR_MERCHANT_ID',
62
+ merchantKey: 'YOUR_MERCHANT_KEY',
63
+ websiteName: 'WEBSTAGING',
64
+ sandbox: true
65
+ },
66
+
67
+ // Cardcom Test
68
+ cardcom: {
69
+ terminalNumber: 'your-terminal-number',
70
+ userName: 'your-username'
71
+ },
72
+
73
+ // Paycom Test
74
+ paycom: {
75
+ merchantId: 'your-merchant-id',
76
+ secretKey: 'your-secret-key'
77
+ },
78
+
79
+ // PayID19 Test
80
+ payid19: {
81
+ apiKey: 'your-test-api-key',
82
+ secretKey: 'your-test-secret-key'
83
+ },
84
+
85
+ // Paysend Test
86
+ paysend: {
87
+ apiKey: 'your-test-api-key',
88
+ sandbox: true
89
+ },
90
+
91
+ // Volet Test
92
+ volet: {
93
+ merchantId: 'YOUR_MERCHANT_ID',
94
+ secretKey: 'YOUR_SECRET_KEY'
95
+ },
96
+
97
+ // BitPay Test
98
+ bitpay: {
99
+ apiToken: 'YOUR_TEST_API_TOKEN',
100
+ environment: 'test'
101
+ },
102
+
103
+ // Payriff Test
104
+ payriff: {
105
+ merchantId: 'YOUR_MERCHANT_ID',
106
+ secretKey: 'YOUR_SECRET_KEY'
107
+ },
108
+
109
+ // Epoint Test
110
+ epoint: {
111
+ merchantId: 'YOUR_MERCHANT_ID',
112
+ privateKey: 'YOUR_PRIVATE_KEY'
113
+ },
114
+
115
+ // Payoneer Test
116
+ payoneer: {
117
+ programId: 'YOUR_PROGRAM_ID',
118
+ username: 'YOUR_USERNAME',
119
+ password: 'YOUR_PASSWORD',
120
+ sandbox: true
121
+ },
122
+
123
+ // PortWallet Test
124
+ portwallet: {
125
+ apiKey: 'YOUR_API_KEY',
126
+ merchantId: 'YOUR_MERCHANT_ID',
127
+ secretKey: 'YOUR_SECRET_KEY'
128
+ },
129
+
130
+ // 2Checkout Test
131
+ '2checkout': {
132
+ merchantCode: 'YOUR_MERCHANT_CODE',
133
+ secretKey: 'YOUR_SECRET_KEY',
134
+ sandbox: true
135
+ },
136
+
137
+ // CoinGate Test
138
+ coingate: {
139
+ apiKey: 'YOUR_API_KEY',
140
+ environment: 'sandbox'
141
+ },
142
+
143
+ // ShurjoPay Test
144
+ shurjopay: {
145
+ username: 'YOUR_USERNAME',
146
+ password: 'YOUR_PASSWORD',
147
+ prefix: 'YOUR_PREFIX',
148
+ sandbox: true
149
+ },
150
+
151
+ // Cashfree Test
152
+ cashfree: {
153
+ appId: 'YOUR_APP_ID',
154
+ secretKey: 'YOUR_SECRET_KEY',
155
+ environment: 'sandbox'
156
+ },
157
+
158
+ // PaySpace Test
159
+ payspace: {
160
+ merchantId: 'YOUR_MERCHANT_ID',
161
+ apiKey: 'YOUR_API_KEY'
162
+ },
163
+
164
+ // PayU Latam Test
165
+ payulatam: {
166
+ apiKey: 'YOUR_API_KEY',
167
+ apiLogin: 'YOUR_API_LOGIN',
168
+ merchantId: 'YOUR_MERCHANT_ID',
169
+ accountId: 'YOUR_ACCOUNT_ID',
170
+ sandbox: true
171
+ },
172
+
173
+ // PayU India Test
174
+ payuindia: {
175
+ merchantKey: 'YOUR_MERCHANT_KEY',
176
+ salt: 'YOUR_SALT',
177
+ sandbox: true
178
+ },
179
+
180
+ // ePay Test
181
+ epay: {
182
+ merchantId: 'YOUR_MERCHANT_ID',
183
+ secretKey: 'YOUR_SECRET_KEY'
184
+ },
185
+
186
+ // PayNet Test
187
+ paynet: {
188
+ merchantId: 'YOUR_MERCHANT_ID',
189
+ secretKey: 'YOUR_SECRET_KEY'
190
+ },
191
+
192
+ // PayNetTR Test
193
+ paynettr: {
194
+ merchantId: 'YOUR_MERCHANT_ID',
195
+ secretKey: 'YOUR_SECRET_KEY'
196
+ },
197
+
198
+ // Doku Test
199
+ doku: {
200
+ clientId: 'YOUR_CLIENT_ID',
201
+ secretKey: 'YOUR_SECRET_KEY',
202
+ sharedKey: 'YOUR_SHARED_KEY',
203
+ sandbox: true
204
+ },
205
+
206
+ // Coinbase Commerce Test
207
+ coinbase: {
208
+ apiKey: 'YOUR_API_KEY',
209
+ webhookSecret: 'YOUR_WEBHOOK_SECRET'
210
+ },
211
+
212
+ // Amazon Pay Test
213
+ amazonpay: {
214
+ merchantId: 'YOUR_MERCHANT_ID',
215
+ accessKey: 'YOUR_ACCESS_KEY',
216
+ secretKey: 'YOUR_SECRET_KEY',
217
+ region: 'us',
218
+ sandbox: true
219
+ },
220
+
221
+ // Perfect Money Test
222
+ perfectmoney: {
223
+ accountId: 'YOUR_ACCOUNT_ID',
224
+ passPhrase: 'YOUR_PASSPHRASE',
225
+ alternatePassPhrase: 'YOUR_ALTERNATE_PASSPHRASE'
226
+ },
227
+
228
+ // Paddle Test
229
+ paddle: {
230
+ vendorId: 'YOUR_VENDOR_ID',
231
+ apiKey: 'YOUR_API_KEY',
232
+ publicKey: 'YOUR_PUBLIC_KEY',
233
+ sandbox: true
234
+ },
235
+
236
+ // Instamojo Test
237
+ instamojo: {
238
+ apiKey: 'YOUR_API_KEY',
239
+ authToken: 'YOUR_AUTH_TOKEN',
240
+ sandbox: true
241
+ },
242
+
243
+ // FreeKassa Test
244
+ freekassa: {
245
+ shopId: 'YOUR_SHOP_ID',
246
+ secretKey1: 'YOUR_SECRET_KEY_1',
247
+ secretKey2: 'YOUR_SECRET_KEY_2'
248
+ },
249
+
250
+ // PicPay Test
251
+ picpay: {
252
+ token: 'YOUR_TOKEN',
253
+ sellerToken: 'YOUR_SELLER_TOKEN'
254
+ },
255
+
256
+ // PayTabs Test
257
+ paytabs: {
258
+ profileId: 'YOUR_PROFILE_ID',
259
+ serverKey: 'YOUR_SERVER_KEY',
260
+ region: 'ARE'
261
+ },
262
+
263
+ // Payssion Test
264
+ payssion: {
265
+ apiKey: 'YOUR_API_KEY',
266
+ secretKey: 'YOUR_SECRET_KEY',
267
+ sandbox: true
268
+ },
269
+
270
+ // PayKun Test
271
+ paykun: {
272
+ merchantId: 'YOUR_MERCHANT_ID',
273
+ accessToken: 'YOUR_ACCESS_TOKEN',
274
+ encryptionKey: 'YOUR_ENCRYPTION_KEY',
275
+ sandbox: true
276
+ },
277
+
278
+ // Omise Test
279
+ omise: {
280
+ publicKey: 'YOUR_PUBLIC_KEY',
281
+ secretKey: 'YOUR_SECRET_KEY'
282
+ },
283
+
284
+ // PhonePe Test
285
+ phonepe: {
286
+ merchantId: 'YOUR_MERCHANT_ID',
287
+ saltKey: 'YOUR_SALT_KEY',
288
+ saltIndex: 1,
289
+ sandbox: true
290
+ },
291
+
292
+ // YouCanPay Test
293
+ youcanpay: {
294
+ privateKey: 'YOUR_PRIVATE_KEY',
295
+ publicKey: 'YOUR_PUBLIC_KEY',
296
+ sandbox: true
297
+ },
298
+
299
+ // YooKassa Test
300
+ yookassa: {
301
+ shopId: 'YOUR_SHOP_ID',
302
+ secretKey: 'YOUR_SECRET_KEY'
303
+ },
304
+
305
+ // URWay Test
306
+ urway: {
307
+ terminalId: 'YOUR_TERMINAL_ID',
308
+ password: 'YOUR_PASSWORD',
309
+ merchantKey: 'YOUR_MERCHANT_KEY',
310
+ testMode: true
311
+ },
312
+
313
+ // Xendit Test
314
+ xendit: {
315
+ apiKey: 'YOUR_API_KEY',
316
+ webhookToken: 'YOUR_WEBHOOK_TOKEN'
317
+ },
318
+
319
+ // Unitpay Test
320
+ unitpay: {
321
+ publicKey: 'YOUR_PUBLIC_KEY',
322
+ secretKey: 'YOUR_SECRET_KEY'
323
+ },
324
+
325
+ // SenangPay Test
326
+ senangpay: {
327
+ merchantId: 'YOUR_MERCHANT_ID',
328
+ secretKey: 'YOUR_SECRET_KEY',
329
+ sandbox: true
330
+ },
331
+
332
+ // Razorpay Test
333
+ razorpay: {
334
+ keyId: 'YOUR_KEY_ID',
335
+ keySecret: 'YOUR_KEY_SECRET'
336
+ }
337
+ }
338
+ };
339
+
340
+ // Test fonksiyonu
341
+ async function testProvider(providerName, provider) {
342
+ console.log(`\n🧪 Testing ${providerName}...`);
343
+ console.log('─'.repeat(50));
344
+
345
+ try {
346
+ // Test createPayment
347
+ console.log('✓ Module loaded successfully');
348
+ console.log('✓ createPayment method exists:', typeof provider.createPayment === 'function');
349
+ console.log('✓ handleCallback method exists:', typeof provider.handleCallback === 'function');
350
+
351
+ // Her provider için özel test verileri
352
+ const testData = getTestDataForProvider(providerName);
353
+
354
+ console.log(`\n📝 Test payment data prepared for ${providerName}`);
355
+ console.log(' Amount:', testData.amount);
356
+ console.log(' Currency:', testData.currency || 'Default');
357
+
358
+ // Not: Gerçek API çağrıları için geçerli credentials gerekli
359
+ // console.log('\n⚠️ Skipping actual API call (requires valid credentials)');
360
+
361
+ return {
362
+ provider: providerName,
363
+ status: 'passed',
364
+ methods: {
365
+ createPayment: typeof provider.createPayment === 'function',
366
+ handleCallback: typeof provider.handleCallback === 'function'
367
+ }
368
+ };
369
+
370
+ } catch (error) {
371
+ console.error(`❌ Error testing ${providerName}:`, error.message);
372
+ return {
373
+ provider: providerName,
374
+ status: 'failed',
375
+ error: error.message
376
+ };
377
+ }
378
+ }
379
+
380
+ // Provider'a özel test verileri
381
+ function getTestDataForProvider(providerName) {
382
+ const baseData = {
383
+ amount: '100',
384
+ email: 'test@example.com',
385
+ name: 'Test User',
386
+ phone: '+1234567890',
387
+ orderId: `TEST-${Date.now()}`,
388
+ callback_link: 'http://localhost:3000/callback'
389
+ };
390
+
391
+ const providerSpecific = {
392
+ midtrans: { currency: 'IDR', amount: '10000' },
393
+ plisio: { currency: 'USD', amount: '10' },
394
+ tripay: { currency: 'IDR', amount: '10000', paymentMethod: 'BRIVA' },
395
+ toyyibpay: { currency: 'MYR', amount: '10' },
396
+ zarinpal: { currency: 'IRT', amount: '1000', mobile: '09123456789' },
397
+ coinpayments: { currency1: 'USD', currency2: 'BTC', amount: '10' },
398
+ checkout: { currency: 'USD', amount: '10', useHostedPage: true },
399
+ paytm: { currency: 'INR', amount: '100', mobile: '9876543210' },
400
+ cardcom: { currency: 'ILS', amount: '100', mobile: '0501234567' },
401
+ paycom: { currency: 'UZS', amount: '10000' },
402
+ payid19: { currency: 'IDR', amount: '10000', paymentMethod: 'all' },
403
+ paysend: { currency: 'USD', amount: '10', cardNumber: '4111111111111111' },
404
+ volet: { currency: 'USD', amount: '10' },
405
+ bitpay: { currency: 'USD', amount: '10' },
406
+ payriff: { currency: 'AZN', amount: '50' },
407
+ epoint: { currency: 'AZN', amount: '100' },
408
+ payoneer: { currency: 'USD', amount: '100', payeeId: 'test@example.com' },
409
+ portwallet: { currency: 'USD', amount: '100' },
410
+ '2checkout': { currency: 'USD', amount: '100', customerName: 'Test User' },
411
+ coingate: { currency: 'USD', amount: '10', receiveCurrency: 'EUR' },
412
+ shurjopay: { currency: 'BDT', amount: '1000', city: 'Dhaka' },
413
+ cashfree: { currency: 'INR', amount: '1000', customerId: 'customer_test' },
414
+ payspace: { currency: 'ZAR', amount: '100' },
415
+ payulatam: { currency: 'COP', amount: '10000', country: 'CO', paymentMethod: 'VISA' },
416
+ payuindia: { currency: 'INR', amount: '1000', productInfo: 'Test Product', firstname: 'John' },
417
+ epay: { currency: 'BGN', amount: '100' },
418
+ paynet: { currency: 'MDL', amount: '100' },
419
+ paynettr: { currency: 'TRY', amount: '100' },
420
+ doku: { currency: 'IDR', amount: '50000' },
421
+ coinbase: { currency: 'USD', amount: '10', pricingType: 'fixed_price' },
422
+ amazonpay: { currency: 'USD', amount: '10', chargePermissionType: 'OneTime' },
423
+ perfectmoney: { currency: 'USD', amount: '10' },
424
+ paddle: { currency: 'USD', amount: '10', title: 'Test Product' },
425
+ instamojo: { currency: 'INR', amount: '1000', purpose: 'Test Payment' },
426
+ freekassa: { currency: 'RUB', amount: '1000' },
427
+ picpay: { currency: 'BRL', amount: '10.50', firstName: 'John', lastName: 'Doe' },
428
+ paytabs: { currency: 'AED', amount: '100', country: 'AE' },
429
+ payssion: { currency: 'USD', amount: '50', paymentMethod: 'boleto_br' },
430
+ paykun: { currency: 'INR', amount: '1000' },
431
+ omise: { currency: 'THB', amount: '1000', sourceType: 'promptpay' },
432
+ phonepe: { currency: 'INR', amount: '100', userId: 'USER123' },
433
+ youcanpay: { currency: 'MAD', amount: '100' },
434
+ yookassa: { currency: 'RUB', amount: '1000' },
435
+ urway: { currency: 'SAR', amount: '100', country: 'SA', merchantIp: '1.1.1.1' },
436
+ xendit: { currency: 'IDR', amount: '100000', paymentMethod: 'invoice' },
437
+ unitpay: { currency: 'RUB', amount: '500', account: 'TEST-001' },
438
+ senangpay: { currency: 'MYR', amount: '50.00' },
439
+ razorpay: { currency: 'INR', amount: '500', merchantName: 'Test Business' }
440
+ };
441
+
442
+ return { ...baseData, ...providerSpecific[providerName] };
443
+ }
444
+
445
+ // Ana test fonksiyonu
446
+ async function runTests() {
447
+ console.log('╔════════════════════════════════════════════════╗');
448
+ console.log('║ QuickPos Payment Gateway Test Suite ║');
449
+ console.log('╚════════════════════════════════════════════════╝\n');
450
+
451
+ const quickPos = new QuickPos(testConfig);
452
+ const results = [];
453
+
454
+ // Her provider'ı test et
455
+ for (const [providerName, provider] of Object.entries(quickPos.providers)) {
456
+ const result = await testProvider(providerName, provider);
457
+ results.push(result);
458
+ }
459
+
460
+ // Sonuçları göster
461
+ console.log('\n\n╔════════════════════════════════════════════════╗');
462
+ console.log('║ Test Results Summary ║');
463
+ console.log('╚════════════════════════════════════════════════╝\n');
464
+
465
+ const passed = results.filter(r => r.status === 'passed').length;
466
+ const failed = results.filter(r => r.status === 'failed').length;
467
+
468
+ results.forEach(result => {
469
+ const icon = result.status === 'passed' ? '✅' : '❌';
470
+ console.log(`${icon} ${result.provider.padEnd(20)} - ${result.status.toUpperCase()}`);
471
+ if (result.error) {
472
+ console.log(` Error: ${result.error}`);
473
+ }
474
+ });
475
+
476
+ console.log('\n' + '─'.repeat(50));
477
+ console.log(`Total: ${results.length} | Passed: ${passed} | Failed: ${failed}`);
478
+ console.log('─'.repeat(50));
479
+
480
+ console.log('\n📋 Notes:');
481
+ console.log(' • All providers loaded successfully');
482
+ console.log(' • createPayment and handleCallback methods verified');
483
+ console.log(' • For actual payment testing, configure valid API credentials');
484
+ console.log(' • Refer to example files for provider-specific usage\n');
485
+ }
486
+
487
+ // Testleri çalıştır
488
+ if (require.main === module) {
489
+ runTests().catch(console.error);
490
+ }
491
+
492
+ module.exports = { runTests, testProvider };
@@ -1,83 +0,0 @@
1
- const Heleket = require('./lib/heleket');
2
- const QuickPos = require('./app');
3
-
4
-
5
-
6
- const quickPos = new QuickPos({
7
- providers: {
8
- heleket: {
9
- merchantId: '6764fdb7-7a2c-4599-962e-fbac2bcd498',
10
- apiKey: ''
11
- }
12
- }
13
- });
14
-
15
- let heleket = quickPos.providers['heleket'];
16
-
17
- // Örnek fatura oluşturma
18
- async function createSampleInvoice() {
19
- try {
20
- const result = await heleket.createInvoice({
21
- amount: "20",
22
- currency: "USDT",
23
- order_id: "test-1234",
24
- network: "tron"
25
- });
26
-
27
- console.log('Fatura oluşturuldu:', result);
28
- } catch (error) {
29
- console.error('Fatura oluşturulurken hata:', error.message);
30
- }
31
- }
32
-
33
- // Örnek ödeme hizmetlerini getirme
34
- async function getServices() {
35
- try {
36
- const services = await heleket.getPaymentServices();
37
- console.log('Ödeme hizmetleri:', services);
38
- } catch (error) {
39
- console.error('Hizmetler alınırken hata:', error.message);
40
- }
41
- }
42
-
43
- // Webhook imzasını doğrulama örneği
44
- function verifyWebhook() {
45
- const webhookData = {
46
- order_id: 'test-123',
47
- status: 'completed',
48
- amount: '20',
49
- currency: 'USDT',
50
- sign: 'example-signature-here'
51
- };
52
-
53
- const isValid = heleket.verifyWebhookSignature(webhookData);
54
- console.log('Webhook geçerli mi:', isValid);
55
- }
56
-
57
- // Webhook callback işleme örneği
58
- async function handleCallbackExample() {
59
- const webhookData = {
60
- order_id: 'test-123',
61
- transaction_id: 'tx-456789',
62
- status: 'completed',
63
- amount: '20',
64
- currency: 'USDT',
65
- network: 'tron',
66
- sign: 'example-signature-here'
67
- };
68
-
69
- try {
70
- const result = await heleket.handleCallback(webhookData);
71
- console.log('Callback işleme sonucu:', result);
72
- } catch (error) {
73
- console.error('Callback işlenirken hata:', error.message);
74
- }
75
- }
76
-
77
- // Örnek fonksiyonları çalıştır
78
- (async () => {
79
- await createSampleInvoice();
80
- // await getServices();
81
- verifyWebhook();
82
- handleCallbackExample();
83
- })();
package/lib/vallet.js DELETED
@@ -1,22 +0,0 @@
1
- class Vallet {
2
- constructor(config) {
3
- this.config = config;
4
- }
5
-
6
- async createPayment(paymentDetails) {
7
- return {
8
- status: 'success',
9
- data: { url: 'https://paytr.com/payment-page' }
10
- };
11
- }
12
-
13
- async handleCallback(callbackData) {
14
- return {
15
- status: 'success',
16
- orderId: callbackData.orderId,
17
- amount: callbackData.amount,
18
- };
19
- }
20
- }
21
-
22
- module.exports = Vallet;
File without changes
File without changes