mercadopago
Advanced tools
Comparing version 0.1.8 to 0.2.0
@@ -7,9 +7,35 @@ var MP = require ("../../project/lib/mercadopago"), | ||
mp.getPaymentInfo (req.param("id"), function (err, data){ | ||
if (err) { | ||
res.send (err); | ||
} else { | ||
res.render ("jsonOutput", {"result": data}); | ||
} | ||
}); | ||
switch (req.param("topic")) { | ||
case "payment": | ||
mp.getPayment (req.param("id"), function (err, data){ | ||
if (err) { | ||
res.send (err); | ||
} else { | ||
res.render ("jsonOutput", {"result": data}); | ||
} | ||
}); | ||
break; | ||
case "authorized_payment": | ||
mp.getAuthorizedPayment (req.param("id"), function (err, data){ | ||
if (err) { | ||
res.send (err); | ||
} else { | ||
res.render ("jsonOutput", {"result": data}); | ||
} | ||
}); | ||
break; | ||
case "preapproval": | ||
mp.getPreapprovalPayment (req.param("id"), function (err, data){ | ||
if (err) { | ||
res.send (err); | ||
} else { | ||
res.render ("jsonOutput", {"result": data}); | ||
} | ||
}); | ||
break; | ||
} | ||
}; |
@@ -8,3 +8,3 @@ { | ||
"dependencies": { | ||
"mercadopago": ">=0.0.9", | ||
"mercadopago": "*", | ||
"jade": ">=0.27.0", | ||
@@ -11,0 +11,0 @@ "express": ">=3.0.0", |
@@ -61,3 +61,3 @@ var package = require("../package"), | ||
*/ | ||
MP.prototype.getPaymentInfo = function (id) { | ||
MP.prototype.getPayment = MP.prototype.getPaymentInfo = function (id) { | ||
var __self = this; | ||
@@ -89,2 +89,31 @@ | ||
/** | ||
Get information for specific authorized payment | ||
@param id | ||
@return json | ||
*/ | ||
MP.prototype.getAuthorizedPayment = function (id) { | ||
var __self = this; | ||
var next = typeof (arguments[arguments.length -1]) == "function" ? arguments[arguments.length -1] : null; | ||
if (!next) { | ||
throw new Error ("No callback function defined"); | ||
return; | ||
} | ||
this.getAccessToken (function (err, accessToken){ | ||
if (err) { | ||
next (err); | ||
return; | ||
} | ||
MP.restClient.get( | ||
"/authorized_payments/"+id+"?access_token="+accessToken, | ||
config.MIME_JSON, | ||
next | ||
); | ||
}); | ||
}; | ||
/** | ||
Refund accredited payment | ||
@@ -154,2 +183,34 @@ @param id | ||
/** | ||
Cancel preapproval payment | ||
@param id | ||
@return json | ||
*/ | ||
MP.prototype.cancelPreapprovalPayment = function (id) { | ||
var __self = this; | ||
var next = typeof (arguments[arguments.length -1]) == "function" ? arguments[arguments.length -1] : null; | ||
if (!next) { | ||
throw new Error ("No callback function defined"); | ||
return; | ||
} | ||
this.getAccessToken (function (err, accessToken){ | ||
if (err) { | ||
next (err); | ||
return; | ||
} | ||
MP.restClient.put( | ||
"/preapproval/"+id+"?access_token="+accessToken, | ||
{ | ||
"status": "cancelled" | ||
}, | ||
config.MIME_JSON, | ||
next | ||
); | ||
}); | ||
}; | ||
/** | ||
Search payments according to filters, with pagination | ||
@@ -249,3 +310,3 @@ @param filters | ||
/** | ||
Update a checkout preference | ||
Get a checkout preference | ||
@param id | ||
@@ -279,2 +340,62 @@ @param preference | ||
/** | ||
Create a preapproval payment | ||
@param preference | ||
@return json | ||
*/ | ||
MP.prototype.createPreapprovalPayment = function (preapprovalPayment){ | ||
var __self = this; | ||
var next = typeof (arguments[arguments.length -1]) == "function" ? arguments[arguments.length -1] : null; | ||
if (!next) { | ||
throw new Error ("No callback function defined"); | ||
return; | ||
} | ||
this.getAccessToken (function (err, accessToken){ | ||
if (err) { | ||
next (err); | ||
return; | ||
} | ||
MP.restClient.post( | ||
"/preapproval?access_token="+accessToken, | ||
preapprovalPayment, | ||
config.MIME_JSON, | ||
next | ||
); | ||
}); | ||
}; | ||
/** | ||
Get a preapproval payment | ||
@param id | ||
@param preference | ||
@return json | ||
*/ | ||
MP.prototype.getPreapprovalPayment = function (id) { | ||
var __self = this; | ||
var next = typeof (arguments[arguments.length -1]) == "function" ? arguments[arguments.length -1] : null; | ||
if (!next) { | ||
throw new Error ("No callback function defined"); | ||
return; | ||
} | ||
this.getAccessToken (function (err, accessToken){ | ||
if (err) { | ||
next (err); | ||
return; | ||
} | ||
MP.restClient.get( | ||
"/preapproval/"+id+"?access_token="+accessToken, | ||
config.MIME_JSON, | ||
next | ||
); | ||
}); | ||
}; | ||
/*************************************************************************/ | ||
@@ -281,0 +402,0 @@ MP.prototype.__build_query = function (params) { |
{ | ||
"name" : "mercadopago", | ||
"version" : "0.1.8", | ||
"version" : "0.2.0", | ||
"author" : "Horacio Casatti <horacio.casatti@mercadolibre.com>", | ||
@@ -5,0 +5,0 @@ "description" : "Mercadopago SDK module for Payments integration", |
{ | ||
"name" : "mercadopago_test", | ||
"version" : "0.0.1", | ||
"author" : "Horacio Casatti <horacio.casatti@mercadolibre.com>", | ||
"description" : "Tests for Mercadopago SDK module for Payments integration", | ||
"main": "./unitTest.js", | ||
"dependencies" : { | ||
"vows": "0.6.x", | ||
"mercadopago": ">=0.0.6" | ||
}, | ||
"engine" : { | ||
"node" : ">=0.6" | ||
} | ||
"name": "mercadopago_test", | ||
"version": "0.0.1", | ||
"author": "Horacio Casatti <horacio.casatti@mercadolibre.com>", | ||
"description": "Tests for Mercadopago SDK module for Payments integration", | ||
"main": "./unitTest.js", | ||
"dependencies": { | ||
"vows": "0.6.x", | ||
"mercadopago": "~0.2.0" | ||
}, | ||
"engine": { | ||
"node": ">=0.6" | ||
} | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
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
Network access
Supply chain riskThis module accesses the network.
Found 3 instances in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
2
2
1
26652
20
671