quickpos 1.0.910 → 1.0.911
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/example-heleket.js +61 -5
- package/lib/heleket.js +67 -1
- package/package.json +1 -1
package/example-heleket.js
CHANGED
|
@@ -6,7 +6,7 @@ const QuickPos = require('./app');
|
|
|
6
6
|
const quickPos = new QuickPos({
|
|
7
7
|
providers: {
|
|
8
8
|
heleket: {
|
|
9
|
-
merchantId: '6764fdb7-7a2c-4599
|
|
9
|
+
merchantId: '6764fdb7-7a2c-4599--fbeac2bcd498',
|
|
10
10
|
apiKey: ''
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -74,10 +74,66 @@ async function handleCallbackExample() {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// Örnek ödeme webhook'u test etme
|
|
78
|
+
async function testPaymentWebhookExample() {
|
|
79
|
+
try {
|
|
80
|
+
const result = await heleket.testPaymentWebhook({
|
|
81
|
+
url_callback: "https://test.speedsmm.com/api/payment/callback/heleket",
|
|
82
|
+
currency: "USDT",
|
|
83
|
+
network: "tron",
|
|
84
|
+
order_id: "aa5a7a7c-7aa3-4d9b-8dc7-ef45b6088d82",
|
|
85
|
+
status: "paid"
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
console.log('Ödeme webhook testi sonucu:', result);
|
|
89
|
+
} catch (error) {
|
|
90
|
+
console.error('Ödeme webhook testi sırasında hata:', error.message);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
testPaymentWebhookExample();
|
|
94
|
+
// Örnek ödeme çıkışı webhook'u test etme
|
|
95
|
+
async function testPayoutWebhookExample() {
|
|
96
|
+
try {
|
|
97
|
+
const result = await heleket.testPayoutWebhook({
|
|
98
|
+
url_callback: "https://your-webhook-url.com/callback",
|
|
99
|
+
currency: "USDT",
|
|
100
|
+
network: "tron",
|
|
101
|
+
order_id: "test-5678",
|
|
102
|
+
status: "paid"
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
console.log('Ödeme çıkışı webhook testi sonucu:', result);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error('Ödeme çıkışı webhook testi sırasında hata:', error.message);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Örnek cüzdan webhook'u test etme
|
|
112
|
+
async function testWalletWebhookExample() {
|
|
113
|
+
try {
|
|
114
|
+
const result = await heleket.testWalletWebhook({
|
|
115
|
+
url_callback: "https://your-webhook-url.com/callback",
|
|
116
|
+
currency: "USDT",
|
|
117
|
+
network: "tron",
|
|
118
|
+
uuid: "e1830f1b-50fc-432e-80ec-15b58ccac867",
|
|
119
|
+
status: "paid"
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
console.log('Cüzdan webhook testi sonucu:', result);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error('Cüzdan webhook testi sırasında hata:', error.message);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
77
128
|
// Örnek fonksiyonları çalıştır
|
|
78
129
|
(async () => {
|
|
79
|
-
await createSampleInvoice();
|
|
80
|
-
// await getServices();
|
|
81
|
-
verifyWebhook();
|
|
82
|
-
handleCallbackExample();
|
|
130
|
+
// await createSampleInvoice();
|
|
131
|
+
// // await getServices();
|
|
132
|
+
// verifyWebhook();
|
|
133
|
+
// handleCallbackExample();
|
|
134
|
+
|
|
135
|
+
// Test webhook fonksiyonlarını çalıştır
|
|
136
|
+
// await testPaymentWebhookExample();
|
|
137
|
+
// await testPayoutWebhookExample();
|
|
138
|
+
// await testWalletWebhookExample();
|
|
83
139
|
})();
|
package/lib/heleket.js
CHANGED
|
@@ -129,7 +129,7 @@ class Heleket {
|
|
|
129
129
|
const data = {...webhookData};
|
|
130
130
|
|
|
131
131
|
// Process successful payments
|
|
132
|
-
if (data.status === '
|
|
132
|
+
if (data.status === 'paid') {
|
|
133
133
|
return {
|
|
134
134
|
status: 'success',
|
|
135
135
|
orderId: data.order_id,
|
|
@@ -146,6 +146,72 @@ class Heleket {
|
|
|
146
146
|
throw new Error(`Error in Heleket callback handling: ${error.message}`);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Test payment webhook
|
|
152
|
+
* @param {object} params - Test parameters
|
|
153
|
+
* @param {string} params.url_callback - URL to which webhooks will be sent
|
|
154
|
+
* @param {string} params.currency - Invoice currency code
|
|
155
|
+
* @param {string} params.network - Invoice network code
|
|
156
|
+
* @param {string} [params.uuid] - UUID of the invoice
|
|
157
|
+
* @param {string} [params.order_id] - Order ID of the invoice
|
|
158
|
+
* @param {string} [params.status=paid] - Payment status
|
|
159
|
+
* @returns {Promise} - Promise resolving to test result
|
|
160
|
+
*/
|
|
161
|
+
testPaymentWebhook(params) {
|
|
162
|
+
if (!params.url_callback || !params.currency || !params.network) {
|
|
163
|
+
throw new Error('Missing required parameters: url_callback, currency, network');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Set default status if not provided
|
|
167
|
+
params.status = params.status || 'paid';
|
|
168
|
+
|
|
169
|
+
return this.request('/v1/test-webhook/payment', params);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Test payout webhook
|
|
174
|
+
* @param {object} params - Test parameters
|
|
175
|
+
* @param {string} params.url_callback - URL to which webhooks will be sent
|
|
176
|
+
* @param {string} params.currency - Payout currency code
|
|
177
|
+
* @param {string} params.network - Payout network code
|
|
178
|
+
* @param {string} [params.uuid] - UUID of the payout
|
|
179
|
+
* @param {string} [params.order_id] - Order ID of the payout
|
|
180
|
+
* @param {string} [params.status=paid] - Payout status
|
|
181
|
+
* @returns {Promise} - Promise resolving to test result
|
|
182
|
+
*/
|
|
183
|
+
testPayoutWebhook(params) {
|
|
184
|
+
if (!params.url_callback || !params.currency || !params.network) {
|
|
185
|
+
throw new Error('Missing required parameters: url_callback, currency, network');
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Set default status if not provided
|
|
189
|
+
params.status = params.status || 'paid';
|
|
190
|
+
|
|
191
|
+
return this.request('/v1/test-webhook/payout', params);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Test wallet webhook
|
|
196
|
+
* @param {object} params - Test parameters
|
|
197
|
+
* @param {string} params.url_callback - URL to which webhooks will be sent
|
|
198
|
+
* @param {string} params.currency - Payment currency code
|
|
199
|
+
* @param {string} params.network - Payment network code
|
|
200
|
+
* @param {string} [params.uuid] - UUID of business wallet
|
|
201
|
+
* @param {string} [params.order_id] - Order ID of the invoice
|
|
202
|
+
* @param {string} [params.status=paid] - Payment status
|
|
203
|
+
* @returns {Promise} - Promise resolving to test result
|
|
204
|
+
*/
|
|
205
|
+
testWalletWebhook(params) {
|
|
206
|
+
if (!params.url_callback || !params.currency || !params.network) {
|
|
207
|
+
throw new Error('Missing required parameters: url_callback, currency, network');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Set default status if not provided
|
|
211
|
+
params.status = params.status || 'paid';
|
|
212
|
+
|
|
213
|
+
return this.request('/v1/test-webhook/wallet', params);
|
|
214
|
+
}
|
|
149
215
|
}
|
|
150
216
|
|
|
151
217
|
module.exports = Heleket;
|