quickpos 1.0.0
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/app.js +44 -0
- package/example.js +103 -0
- package/lib/paytr.js +131 -0
- package/lib/vallet.js +22 -0
- package/package.json +44 -0
- package/readme.md +166 -0
package/app.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
class QuickPos {
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.providers = {};
|
|
6
|
+
this.loadProviders(config.providers);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
loadProviders(providerConfigs) {
|
|
10
|
+
for (const [providerName, providerConfig] of Object.entries(providerConfigs)) {
|
|
11
|
+
try {
|
|
12
|
+
const ProviderClass = require(path.join(__dirname, 'lib', `${providerName}.js`));
|
|
13
|
+
this.providers[providerName] = new ProviderClass(providerConfig);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(`Failed to load provider ${providerName}:`, error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
middleware() {
|
|
21
|
+
return async (req, res, next) => {
|
|
22
|
+
req.quickPos = this.providers;
|
|
23
|
+
next();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
handleCallback(providerName) {
|
|
28
|
+
return async (req, res, next) => {
|
|
29
|
+
if (!this.providers[providerName]) {
|
|
30
|
+
return res.status(400).json({ error: 'Invalid payment provider' });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const result = await this.providers[providerName].handleCallback(req.body);
|
|
35
|
+
req.paymentResult = result;
|
|
36
|
+
next();
|
|
37
|
+
} catch (error) {
|
|
38
|
+
res.status(500).json({ error: error.message });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = QuickPos;
|
package/example.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const express = require('express');
|
|
2
|
+
const bodyParser = require('body-parser');
|
|
3
|
+
const QuickPos = require('./app');
|
|
4
|
+
|
|
5
|
+
const app = express();
|
|
6
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
7
|
+
app.use(bodyParser.json());
|
|
8
|
+
|
|
9
|
+
const quickPos = new QuickPos({
|
|
10
|
+
providers: {
|
|
11
|
+
paytr: {
|
|
12
|
+
merchantId: '347042',
|
|
13
|
+
merchantKey: 'XxXxx',
|
|
14
|
+
merchantSalt: 'XxxXxxX',
|
|
15
|
+
mode: 'test',
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// QuickPos middleware'ini ekleyin
|
|
21
|
+
app.use(quickPos.middleware());
|
|
22
|
+
|
|
23
|
+
// Ödeme oluşturma formu
|
|
24
|
+
app.get('/', (req, res) => {
|
|
25
|
+
res.send(`
|
|
26
|
+
<form action="/payment/paytr" method="post">
|
|
27
|
+
<input type="text" name="amount" placeholder="Amount" required>
|
|
28
|
+
<select name="currency" required>
|
|
29
|
+
<option value="TL">TL</option>
|
|
30
|
+
<option value="USD">USD</option>
|
|
31
|
+
<option value="EUR">EUR</option>
|
|
32
|
+
</select>
|
|
33
|
+
<input type="text" name="orderId" placeholder="Order ID" required>
|
|
34
|
+
<button type="submit">Pay</button>
|
|
35
|
+
</form>
|
|
36
|
+
`);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Ödeme oluşturma rotası
|
|
40
|
+
app.post('/payment/:provider', async (req, res) => {
|
|
41
|
+
const { provider } = req.params;
|
|
42
|
+
|
|
43
|
+
if (!req.quickPos[provider]) {
|
|
44
|
+
return res.status(400).json({ error: 'Invalid payment provider' });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
const result = await req.quickPos[provider].createPayment({
|
|
49
|
+
name: 'Test Product',
|
|
50
|
+
amount: req.body.amount,
|
|
51
|
+
currency: req.body.currency,
|
|
52
|
+
callback_link: `https://mylocalhostx.speedsmm.com/payment-callback/${provider}`,
|
|
53
|
+
callback_id: req.body.orderId,
|
|
54
|
+
maxInstallment: 1,
|
|
55
|
+
expiry_date: '2024-12-25 17:00:00',
|
|
56
|
+
email: 'test@gmail.com',
|
|
57
|
+
// Diğer gerekli alanlar...
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (result.status === 'success') {
|
|
61
|
+
console.log('Redirecting to:', result.data.url); // Redirecting to: https://www.paytr.com/link/RYncnsW
|
|
62
|
+
console.log('Details:', result.data);
|
|
63
|
+
// Details: {
|
|
64
|
+
// transactionId: 'RYncnsW',
|
|
65
|
+
// url: 'https://www.paytr.com/link/RYncnsW',
|
|
66
|
+
// id: 'RYncnsW',
|
|
67
|
+
// qr: 'iVBORw0KGgoAAAANSUhEUgAAAuQAAALkAQMAAAB9arImAAAABlBMVEX///8AAABVwtN+c+A+9/SN9AsBtGNWsJOZRe9v6AgoCd2XcSvlyRJkiRJkiRJkiTph7Wx93Xjne++Xkd+ZLmMTqfT6fS99Xe5jMNgDo8sFTqdTqfTd9ZjfVnVzoEdl/kFFsvodDqdTqevVuUtYh86nU6n0+lf6YGcxSdxo9PpdDqd/kGfbXaas7uVo9PpdDqd/v/vQ++CzA91GZ1Op9Pp2+vz+ufv+QLdjMtfRafT6XT6X9XLwG4XXP/V/HCg0+l0Op0+Xzr76D1vDG/x5SSn0+l0On0bPVaFFAuOyY1+9k10Op1Op++l9y3iIk/j22Z5nx9/DdPpdDqd/vf1QcotPomHl3r8zKbT6XQ6fUP9YX0gi72Hd6TT6XQ6fW+9m8OCPJKPuxlv8Xlq0+l0Op2+nT6sCvN85LbjbG86nU6n0+n3LfLZcR1CahcX+3ya2nQ6nU6n76XnyXvjYrOY6eWyfz+vtqDT6XQ6fUu9m+WxPrBnQ7wAdDqdTqfTzwVlfR/Ow3OzMzqdTqfT6deqkGIG5xvDYI/qMjqdTqfTd9afdxz+Vs5u+9DpdDqdvr3exvogLl++wyNfDWw6nU6n03fTl8O5ld9nh3Ge915NbTqdTqfTt9PLNO6rzoduv8+W+d3yXTqdTqfT6aPeF8yQvPeR96HT6XQ6nb7SAylwbNvyXTqdTqfT6fd5O5va+bnbL7r5QKfT6XQ6vYzf+RCfcZ8+hOl0Op1O31CXJEmSJEmSJEmSJD30D3dYBJaQzBp5AAAAAElFTkSuQmCC'
|
|
68
|
+
// }
|
|
69
|
+
res.json({ redirectUrl: result.data.url });
|
|
70
|
+
// res.redirect(result.data.url);
|
|
71
|
+
} else {
|
|
72
|
+
res.status(400).json(result);
|
|
73
|
+
}
|
|
74
|
+
} catch (error) {
|
|
75
|
+
res.status(500).json({ error: error.message });
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Callback rotası
|
|
80
|
+
app.post('/payment-callback/:provider', quickPos.handleCallback('paytr'), (req, res) => {
|
|
81
|
+
// req.paymentResult içinde işlenmiş ödeme sonucu bulunur
|
|
82
|
+
console.log('Payment result:', req.paymentResult);
|
|
83
|
+
// Payment result: {
|
|
84
|
+
// status: 'success',
|
|
85
|
+
// orderId: 'S1720611701344454893122353174',
|
|
86
|
+
// amount: 2,
|
|
87
|
+
// currency: 'TL',
|
|
88
|
+
// paymentType: 'card'
|
|
89
|
+
// }
|
|
90
|
+
|
|
91
|
+
// Burada kendi iş mantığınızı uygulayabilirsiniz
|
|
92
|
+
if (req.paymentResult.status === 'success') {
|
|
93
|
+
// Ödeme başarılı
|
|
94
|
+
res.send('OK');
|
|
95
|
+
} else {
|
|
96
|
+
// Ödeme başarısız
|
|
97
|
+
res.status(400).send('Payment failed');
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
app.listen(80, () => {
|
|
102
|
+
console.log('Server is running on port 3000');
|
|
103
|
+
});
|
package/lib/paytr.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const jsSHA = require('jssha');
|
|
3
|
+
const axios = require('axios');
|
|
4
|
+
|
|
5
|
+
class PayTR {
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.config = config || {};
|
|
8
|
+
const requiredFields = ['merchantId', 'merchantKey', 'merchantSalt'];
|
|
9
|
+
for (let field of requiredFields) {
|
|
10
|
+
if (!config[field]) throw new Error(`Missing required field: ${field}`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
this.merchantId = config.merchantId;
|
|
14
|
+
this.merchantKey = config.merchantKey;
|
|
15
|
+
this.merchantSalt = config.merchantSalt;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async createPayment(paymentDetails) {
|
|
19
|
+
try {
|
|
20
|
+
let requiredData = ['name', 'amount', 'currency', 'maxInstallment', 'expiry_date'];
|
|
21
|
+
for (let data of requiredData) {
|
|
22
|
+
if (!paymentDetails[data]) throw new Error(`Missing required data: ${data}`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const price = Math.round(paymentDetails.amount * 100).toString();
|
|
26
|
+
const linkType = paymentDetails.linkType || 'product';
|
|
27
|
+
const currency = paymentDetails.currency || 'TL';
|
|
28
|
+
const lang = paymentDetails.lang || 'tr';
|
|
29
|
+
const minCount = paymentDetails.min_count || '1';
|
|
30
|
+
|
|
31
|
+
const required = paymentDetails.name + price + currency + paymentDetails.maxInstallment + linkType + lang + minCount;
|
|
32
|
+
const paytrToken = this.generateToken(required);
|
|
33
|
+
|
|
34
|
+
const formData = {
|
|
35
|
+
merchant_id: this.merchantId,
|
|
36
|
+
name: paymentDetails.name,
|
|
37
|
+
price: price,
|
|
38
|
+
currency: currency,
|
|
39
|
+
max_installment: paymentDetails.maxInstallment,
|
|
40
|
+
link_type: linkType,
|
|
41
|
+
lang: lang,
|
|
42
|
+
min_count: minCount,
|
|
43
|
+
paytr_token: paytrToken,
|
|
44
|
+
expiry_date: paymentDetails?.expiry_date,
|
|
45
|
+
get_qr: '1',
|
|
46
|
+
max_count: Number(paymentDetails?.max_count) || '1',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
let optionalData = ['email', 'callback_link', 'callback_id'];
|
|
50
|
+
for (let data of optionalData) { formData[data] = paymentDetails[data]; }
|
|
51
|
+
|
|
52
|
+
const response = await axios({
|
|
53
|
+
method: 'POST',
|
|
54
|
+
url: 'https://www.paytr.com/odeme/api/link/create',
|
|
55
|
+
headers: {
|
|
56
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
57
|
+
},
|
|
58
|
+
data: new URLSearchParams(formData).toString()
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const responseData = response.data;
|
|
62
|
+
|
|
63
|
+
if (responseData.status === 'success') {
|
|
64
|
+
return {
|
|
65
|
+
status: 'success',
|
|
66
|
+
data: {
|
|
67
|
+
transactionId: responseData.id,
|
|
68
|
+
url: responseData.link,
|
|
69
|
+
id: responseData.id,
|
|
70
|
+
qr: responseData.base64_qr
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
} else {
|
|
74
|
+
throw new Error(responseData.reason || 'Unknown error occurred');
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error.response) {
|
|
78
|
+
// The request was made and the server responded with a status code
|
|
79
|
+
// that falls out of the range of 2xx
|
|
80
|
+
throw new Error(`PayTR API error: ${error.response.data.reason || error.response.statusText}`);
|
|
81
|
+
} else if (error.request) {
|
|
82
|
+
// The request was made but no response was received
|
|
83
|
+
throw new Error('No response received from PayTR API');
|
|
84
|
+
} else {
|
|
85
|
+
// Something happened in setting up the request that triggered an Error
|
|
86
|
+
throw new Error(`Error in PayTR payment creation: ${error.message}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async handleCallback(callbackData) {
|
|
92
|
+
try {
|
|
93
|
+
const token = callbackData.callback_id + callbackData.merchant_oid + this.merchantSalt + callbackData.status + callbackData.total_amount;
|
|
94
|
+
|
|
95
|
+
let paytrToken = this.hashCheck(token, callbackData.hash);
|
|
96
|
+
if (!paytrToken) {
|
|
97
|
+
throw new Error("PAYTR notification failed: bad hash");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (callbackData.status === 'success') {
|
|
101
|
+
return {
|
|
102
|
+
status: 'success',
|
|
103
|
+
orderId: callbackData.merchant_oid,
|
|
104
|
+
amount: parseFloat(callbackData.total_amount) / 100,
|
|
105
|
+
currency: callbackData.currency,
|
|
106
|
+
paymentType: callbackData.payment_type
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
throw new Error("Payment failed");
|
|
110
|
+
}
|
|
111
|
+
} catch (error) {
|
|
112
|
+
throw new Error(`Error in PayTR callback handling: ${error.message}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
generateToken(data) {
|
|
117
|
+
return crypto.createHmac('sha256', this.merchantKey)
|
|
118
|
+
.update(data + this.merchantSalt)
|
|
119
|
+
.digest('base64');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
hashCheck(data, key) {
|
|
123
|
+
let shaObj = new jsSHA("SHA-256", "TEXT");
|
|
124
|
+
shaObj.setHMACKey(this.merchantKey, "TEXT");
|
|
125
|
+
shaObj.update(data);
|
|
126
|
+
if (shaObj.getHMAC("B64") === key) return true;
|
|
127
|
+
else return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
module.exports = PayTR;
|
package/lib/vallet.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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;
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "quickpos",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "app.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"quickpos",
|
|
10
|
+
"multi-gateway",
|
|
11
|
+
"payment-gateway",
|
|
12
|
+
"payment",
|
|
13
|
+
"gateway",
|
|
14
|
+
"pos",
|
|
15
|
+
"paytr",
|
|
16
|
+
"iyzico",
|
|
17
|
+
"vallet",
|
|
18
|
+
"shipy",
|
|
19
|
+
"shopinext",
|
|
20
|
+
"paywant",
|
|
21
|
+
"payizone",
|
|
22
|
+
"weepay",
|
|
23
|
+
"paynet",
|
|
24
|
+
"stripe",
|
|
25
|
+
"paypal"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/fastuptime/QuickPos.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/fastuptime/QuickPos/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/fastuptime/QuickPos",
|
|
35
|
+
"author": "Can & SpeedSMM <fastuptime@gmail.com>",
|
|
36
|
+
"license": "ISC",
|
|
37
|
+
"description": "",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"axios": "^1.7.2",
|
|
40
|
+
"crypto": "^1.0.1",
|
|
41
|
+
"express": "^4.19.2",
|
|
42
|
+
"jssha": "^3.3.1"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# 💳 QuickPos 🚀
|
|
2
|
+
|
|
3
|
+
QuickPos, farklı ödeme sağlayıcılarını destekleyen güçlü bir ödeme entegrasyon modülüdür. Şu anda PayTR sağlayıcısını desteklemektedir ve gelecekte birçok yeni sağlayıcı ile özellik eklemeyi planlamaktadır. Yol haritamıza göz atarak gelecek özellikleri keşfedebilirsiniz.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## ✨ Özellikler
|
|
8
|
+
|
|
9
|
+
- 🔌 **Çoklu Ödeme Sağlayıcı Desteği**: Birden fazla ödeme sağlayıcı ile uyumlu.
|
|
10
|
+
- 🛡️ **Güvenli Ödeme İşlemleri**: Güvenli ve sorunsuz ödeme işlemleri.
|
|
11
|
+
- 🔄 **Kolay Entegrasyon**: Hızlı ve basit entegrasyon.
|
|
12
|
+
- 📊 **Detaylı Ödeme Raporları**: Gelişmiş raporlama özellikleri.
|
|
13
|
+
- 💼 **İşletmeler için Özelleştirilebilir Çözümler**: Özel ihtiyaçlara yönelik çözümler.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 📦 Kurulum
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install quickpos
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🛠️ Kullanım
|
|
26
|
+
|
|
27
|
+
### 1. Sunucu Kurulumu
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
const express = require('express');
|
|
31
|
+
const bodyParser = require('body-parser');
|
|
32
|
+
const QuickPos = require('quickpos');
|
|
33
|
+
|
|
34
|
+
const app = express();
|
|
35
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
36
|
+
app.use(bodyParser.json());
|
|
37
|
+
|
|
38
|
+
const quickPos = new QuickPos({
|
|
39
|
+
providers: {
|
|
40
|
+
paytr: {
|
|
41
|
+
merchantId: 'xXxxXxX',
|
|
42
|
+
merchantKey: 'xXxxXxX',
|
|
43
|
+
merchantSalt: 'xXxxXxX',
|
|
44
|
+
mode: 'test',
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// QuickPos middleware'ini ekleyin
|
|
50
|
+
app.use(quickPos.middleware());
|
|
51
|
+
|
|
52
|
+
// Ödeme oluşturma formu
|
|
53
|
+
app.get('/', (req, res) => {
|
|
54
|
+
res.send(`
|
|
55
|
+
<form action="/payment/paytr" method="post">
|
|
56
|
+
<input type="text" name="amount" placeholder="Amount" required>
|
|
57
|
+
<select name="currency" required>
|
|
58
|
+
<option value="TL">TL</option>
|
|
59
|
+
<option value="USD">USD</option>
|
|
60
|
+
<option value="EUR">EUR</option>
|
|
61
|
+
</select>
|
|
62
|
+
<input type="text" name="orderId" placeholder="Order ID" required>
|
|
63
|
+
<button type="submit">Pay</button>
|
|
64
|
+
</form>
|
|
65
|
+
`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Ödeme oluşturma rotası
|
|
69
|
+
app.post('/payment/:provider', async (req, res) => {
|
|
70
|
+
const { provider } = req.params;
|
|
71
|
+
|
|
72
|
+
if (!req.quickPos[provider]) {
|
|
73
|
+
return res.status(400).json({ error: 'Invalid payment provider' });
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const result = await req.quickPos[provider].createPayment({
|
|
78
|
+
name: 'Test Product',
|
|
79
|
+
amount: req.body.amount,
|
|
80
|
+
currency: req.body.currency,
|
|
81
|
+
callback_link: `https://mylocalhostx.speedsmm.com/payment-callback/${provider}`,
|
|
82
|
+
callback_id: req.body.orderId,
|
|
83
|
+
maxInstallment: 1,
|
|
84
|
+
expiry_date: '2024-12-25 17:00:00',
|
|
85
|
+
email: 'test@gmail.com',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (result.status === 'success') {
|
|
89
|
+
res.json({ redirectUrl: result.data.url });
|
|
90
|
+
} else {
|
|
91
|
+
res.status(400).json(result);
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
res.status(500).json({ error: error.message });
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Callback rotası
|
|
99
|
+
app.post('/payment-callback/:provider', quickPos.handleCallback('paytr'), (req, res) => {
|
|
100
|
+
console.log('Payment result:', req.paymentResult);
|
|
101
|
+
|
|
102
|
+
if (req.paymentResult.status === 'success') {
|
|
103
|
+
res.send('OK');
|
|
104
|
+
} else {
|
|
105
|
+
res.status(400).send('Payment failed');
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
app.listen(80, () => {
|
|
110
|
+
console.log('Server is running on port 80');
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2. Konfigürasyon
|
|
115
|
+
|
|
116
|
+
`QuickPos` örneğini oluştururken ödeme sağlayıcılarını yapılandırın:
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
const quickPos = new QuickPos({
|
|
120
|
+
providers: {
|
|
121
|
+
paytr: {
|
|
122
|
+
merchantId: 'xXxxXxX',
|
|
123
|
+
merchantKey: 'xXxxXxX',
|
|
124
|
+
merchantSalt: 'xXxxXxX',
|
|
125
|
+
mode: 'test',
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Desteklenen Ödeme Sağlayıcıları 🏦
|
|
134
|
+
|
|
135
|
+
- PayTR
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Yol Haritası 🛣️
|
|
140
|
+
|
|
141
|
+
### Gelecek Özellikler
|
|
142
|
+
|
|
143
|
+
- 🏦 Yeni ödeme sağlayıcıları: İyzico, Vallet, Shipy
|
|
144
|
+
- 🌐 Çoklu dil desteği
|
|
145
|
+
- 💸 Çoklu para birimi desteği
|
|
146
|
+
- 📝 Gelişmiş dökümantasyon
|
|
147
|
+
|
|
148
|
+
### İlerleme Durumu
|
|
149
|
+
|
|
150
|
+
- [x] PayTR entegrasyonu
|
|
151
|
+
- [ ] İyzico entegrasyonu
|
|
152
|
+
- [ ] Vallet entegrasyonu
|
|
153
|
+
- [ ] Shipy entegrasyonu
|
|
154
|
+
- [ ] Shopinext entegrasyonu
|
|
155
|
+
- [ ] Paywant entegrasyonu
|
|
156
|
+
- [ ] Payizone entegrasyonu
|
|
157
|
+
- [ ] Weepay entegrasyonu
|
|
158
|
+
- [ ] Paynet entegrasyonu
|
|
159
|
+
- [ ] Stripe entegrasyonu
|
|
160
|
+
- [ ] PayPal entegrasyonu
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Katkıda Bulunma 🤝
|
|
165
|
+
|
|
166
|
+
Katkılarınızı bekliyoruz! Lütfen [katkı yönergelerimizi](CONTRIBUTING.md) okuyun.
|