dark-payment
Advanced tools
Comparing version 0.1.4-beta.2 to 0.1.5
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib/payment-client.js'); | ||
module.exports = require('./lib/payment-client.js'); |
@@ -9,3 +9,2 @@ const model = require('./model'); | ||
if (data.message) client.ccToken = data.message; | ||
console.log('data.message =>', data.message); | ||
} catch (e) { | ||
@@ -12,0 +11,0 @@ // console.log("cardConenct listener => ", e.message); |
@@ -64,3 +64,2 @@ // | ||
success(tokenResponse) { | ||
console.log(tokenResponse); | ||
if (fn) fn('success', tokenResponse.token); | ||
@@ -67,0 +66,0 @@ self.cayanClient.restore(); |
@@ -12,2 +12,5 @@ const importFile = require; | ||
cayan: null, | ||
payroc: null, | ||
payrocACH: null, | ||
darkGift: null, | ||
}; | ||
@@ -92,2 +95,3 @@ | ||
) { | ||
if (!this.client.customerTokenCreate) throw new Error('Customer token is not supported!'); | ||
return new Promise((resolve, reject) => | ||
@@ -94,0 +98,0 @@ this.client.customerTokenCreate(customerToken, source, (status, data) => { |
@@ -13,7 +13,6 @@ const request = require('axios'); | ||
contentType: 'application/json', | ||
apisignature: encryptByGCM(`${apiAccountId}.${apiSecretKey}`, darkApiSecretKey), | ||
'x-darkpos-api-signature': encryptByGCM(`${apiAccountId}.${apiSecretKey}`, darkApiSecretKey), | ||
}; | ||
payload.data = source; | ||
console.log(payload); | ||
request(payload) | ||
@@ -24,3 +23,2 @@ .then(res => { | ||
response = response.data || {}; | ||
console.log(response); | ||
if (status === 'error') throw new Error(response.message); | ||
@@ -38,4 +36,43 @@ | ||
// | ||
const getGitCardToken = ( | ||
{ apiAccountId, apiSecretKey, darkApiUrl, darkApiSecretKey, card, partner, usePin }, | ||
fn | ||
) => { | ||
const query = { partner }; | ||
if (card.number) query['sources.number'] = card.number; | ||
if (card.pin && usePin) query['sources.pin'] = card.pin; | ||
return request({ | ||
url: `${darkApiUrl}/wallet/query`, | ||
method: 'POST', | ||
headers: { | ||
contentType: 'application/json', | ||
'x-darkpos-api-signature': encryptByGCM(`${apiAccountId}.${apiSecretKey}`, darkApiSecretKey), | ||
}, | ||
data: { query }, | ||
}) | ||
.then(res => { | ||
const response = res.data || {}; | ||
const { status } = response; | ||
if (status === 'error') throw new Error(response.message); | ||
const wallet = Array.isArray(response.data) && response.data.length && response.data[0]; | ||
if (!wallet || !Array.isArray(wallet.sources) || !wallet.sources[0]) | ||
throw new Error('No gift card found.'); | ||
const source = wallet.sources[0]; | ||
fn('success', source._id); | ||
}) | ||
.catch(err => { | ||
fn( | ||
'error', | ||
(err.response && err.response.data && err.response.data.message) || | ||
err.message || | ||
'Issue with server' | ||
); | ||
}); | ||
}; | ||
module.exports = { | ||
addWalletSource, | ||
getGitCardToken, | ||
}; |
{ | ||
"name": "dark-payment", | ||
"version": "0.1.4-beta.2", | ||
"version": "0.1.5", | ||
"description": "Provide payment client", | ||
@@ -9,7 +9,2 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://gitlab.com/darkpos/dark-payment#README", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@gitlab.com:darkpos/dark-payment.git" | ||
}, | ||
"author": "DarkPOS Dev Team", | ||
@@ -36,2 +31,2 @@ "license": "ISC", | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40200
29
1364
2
2