quickpos 1.0.918 → 1.0.919

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 (2) hide show
  1. package/lib/paytr.js +9 -2
  2. package/package.json +1 -1
package/lib/paytr.js CHANGED
@@ -267,11 +267,18 @@ class PayTR {
267
267
  }
268
268
 
269
269
  handleCallback(callbackData) {
270
- const { merchant_oid, status, total_amount, hash } = callbackData;
270
+ const { merchant_oid, status, total_amount, hash, type = 'iframe' } = callbackData;
271
271
 
272
272
  if (!hash) throw new Error('Hash param missing');
273
273
 
274
- const token = `${merchant_oid}${this.merchantSalt}${status}${total_amount}`;
274
+ let token;
275
+ if (type === 'iframe') {
276
+ token = `${merchant_oid}${this.merchantSalt}${status}${total_amount}`;
277
+ } else if (type === 'link') {
278
+ token = `${callbackData.callback_id}${merchant_oid}${this.merchantSalt}${status}${total_amount}`;
279
+ } else if (type === 'eft') {
280
+ token = `${merchant_oid}${this.merchantSalt}${status}${total_amount}`;
281
+ }
275
282
 
276
283
  const generatedHash = crypto
277
284
  .createHmac('sha256', this.merchantKey)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickpos",
3
- "version": "1.0.918",
3
+ "version": "1.0.919",
4
4
  "main": "app.js",
5
5
  "scripts": {
6
6
  "test": "node test.js"