Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dark-payment

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dark-payment - npm Package Compare versions

Comparing version 0.1.4-beta.0 to 0.1.4-beta.1

9

lib/connectors/authorizeNet/index.js

@@ -13,3 +13,3 @@ const $script = require('scriptjs');

self.acceptClient = Accept;
if (fn) fn('success', 'AuthorizeNet initiated successfully.');
fn('success', 'AUTHORIZENET initiated successfully.');
});

@@ -26,5 +26,6 @@ }

res => {
if (res.messages.resultCode === 'Error') {
if (fn) fn('error', JSON.stringify(res.messages.message));
} else if (fn) fn('success', res.opaqueData.dataValue);
if (res.messages.resultCode === 'Error')
return fn('error', JSON.stringify(res.messages.message));
return fn('success', res.opaqueData.dataValue);
}

@@ -31,0 +32,0 @@ );

@@ -16,5 +16,4 @@ const $script = require('scriptjs');

self.bluepay.setCredentials(config.accountId, apiSignature);
if (fn) {
fn('success', 'BLUEPAY initiated successfully.');
}
return fn('success', 'BLUEPAY initiated successfully.');
});

@@ -21,0 +20,0 @@ }

@@ -1,42 +0,62 @@

const $ = require('jquery');
const model = require('./model');
const api = require('../../util/api');
//
const ccListener = client => event => {
try {
const data = JSON.parse(event.data);
if (data.message) client.ccToken = data.message;
console.log('data.message =>', data.message);
} catch (e) {
// console.log("cardConenct listener => ", e.message);
}
};
//
const createIframe = (elementId, url) => {
const oldObject = document.querySelector(`#${elementId}`);
if (!oldObject) throw new Error('oldElement can not be found');
const newObject = document.createElement('iframe');
newObject.src = url;
newObject.frameborder = '0';
newObject.scrolling = 'no';
newObject.width = '100%';
newObject.height = '35px';
if (oldObject.size) newObject.size = oldObject.size;
if (oldObject.className) newObject.className = oldObject.className;
if (oldObject.id) newObject.id = oldObject.className;
if (oldObject.name) newObject.name = oldObject.className;
oldObject.parentNode.replaceChild(newObject, oldObject);
return newObject;
};
module.exports = class StarlitePaymentClient {
init(config, fn) {
const self = this;
self.config = config;
self.ccToken = '';
self.ccListener = event => {
try {
const orgEvent = event.originalEvent || {};
const data = JSON.parse(orgEvent.data);
if (data.message) self.ccToken = data.message;
} catch (e) {
// console.log(e.message);
try {
self.config = config;
self.ccToken = '';
self.addEventListener();
if (self.config.fields.number) {
const numField = self.config.fields.number;
createIframe(numField.id, self.config.iframeUrl);
}
};
self.addEventListener();
if (self.config.fields.number) {
const numField = self.config.fields.number;
const oldElement = $(document).find(`#${numField.id}`);
const newElement = $(`<iframe id="tokenframe" id="${numField.id}"
src=${
self.config.iframeUrl
} frameborder="0" scrolling="no" width="100%" height="35" style="padding:0px;"/>`);
newElement.attr('class', oldElement.attr('class'));
oldElement.replaceWith(newElement);
fn('success', 'CardConnect initiated successfully.');
} catch (e) {
fn('error', e.message);
}
fn('success', 'AuthorizeNet initiated successfully.');
}
addEventListener() {
$(window).on('message', this.ccListener);
this.ccListener = ccListener(this);
window.addEventListener('message', this.ccListener, false);
}
removeEventListener() {
$(window).off('message', this.ccListener, false);
window.removeEventListener('message', this.ccListener, false);
this.ccToken = '';

@@ -46,3 +66,3 @@ }

_tokenCreate({ customerToken, source, fn }) {
if (!this.ccToken) return fn('error', 'token is not defined');
if (!this.ccToken) fn('error', 'token is not defined');
api.addWalletSource(

@@ -49,0 +69,0 @@ {

//
const $ = require('jquery');
const $script = require('scriptjs');

@@ -27,4 +26,6 @@ const { tokenize } = require('../../util/helper');

Object.keys(config.fields).map(el =>
$(`#${config.fields[el].id}`).attr('data-cayan', elements[el])
Object.keys(config.fields).map(name =>
document
.querySelector(`#${config.fields[name].id}`)
.setAttribute('data-cayan', elements[name])
);

@@ -34,3 +35,3 @@

} catch (err) {
fn('error', `Error initializing cayan vendor: `, err.message);
fn('error', `Error initializing cayan vendor: ${err.message}`);
}

@@ -37,0 +38,0 @@ });

{
"name": "dark-payment",
"version": "0.1.4-beta.0",
"version": "0.1.4-beta.1",
"description": "Provide payment client",

@@ -20,3 +20,2 @@ "main": "index.js",

"hmac_sha1": "^0.1.0",
"jquery": "^3.3.1",
"lodash": "^4.17.11",

@@ -23,0 +22,0 @@ "md5": "^2.2.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc