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

mercadopago

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mercadopago - npm Package Compare versions

Comparing version 0.1.8 to 0.2.0

examples/preapproval-payments/button.js

40

examples/instant-payment-notifications/receive-ipn.js

@@ -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;
}
};

2

examples/package.json

@@ -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"
}
}
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