diff --git a/lib/resources/card.js b/lib/resources/card.js index 6bad8390..583031d8 100644 --- a/lib/resources/card.js +++ b/lib/resources/card.js @@ -4,7 +4,7 @@ var cardModel = require('../models/cardModel'); /** * The cards class is the way to store card data of your customers safely to improve the shopping experience. * This will allow your customers to complete their purchases much faster and easily, since they will not have to complete their card data again. - * This class must be used in conjunction with the [Customer class.]{@link https://www.mercadopago.com.br/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards} + * This class must be used in conjunction with the [Customer class.]{@link https://www.mercadopago.com/developers/en/guides/online-payments/web-tokenize-checkout/customers-and-cards} * @namespace card */ var card = module.exports = { @@ -25,7 +25,7 @@ card.all = requestManager.describe({ /** * Get card from card's id and customer's id - * [Click here for more infos]{@link https://www.mercadopago.com/developers/en/reference/cards/_customers_customer_id_cards/get/} + * [Click here for more infos]{@link https://www.mercadopago.com/developers/en/reference/cards/_customers_customer_id_cards_id/get} * @function get * @param {string} customer_id Customer ID * @param {string} id Card ID @@ -38,6 +38,7 @@ card.get = requestManager.describe({ /** * Get card from card's id and customer's id + * [Click here for more infos]{@link https://www.mercadopago.com/developers/en/reference/cards/_customers_customer_id_cards/get/} * @function findById * @param {string} customer_id Customer ID * @param {string} id Card ID @@ -71,10 +72,11 @@ card.save = card.create; * [Click here for more infos]{@link https://www.mercadopago.com/developers/en/reference/cards/_customers_customer_id_cards_id/put/} * @function update * @param {string} customer_id Customer ID + * @param {string} id Card ID * @memberof card */ card.update = requestManager.describe({ - path: '/v1/customers/:customer_id/cards', + path: '/v1/customers/:customer_id/cards/:id', method: 'PUT' }); @@ -83,6 +85,7 @@ card.update = requestManager.describe({ * [Click here for more infos]{@link https://www.mercadopago.com/developers/en/reference/cards/_customers_customer_id_cards_id/delete/} * @function delete * @param {string} customer_id Customer ID + * @param {string} id Card ID * @memberof card */ card.delete = requestManager.describe({ diff --git a/package.json b/package.json index b0e1dde0..e181f1a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mercadopago", - "version": "1.5.7", + "version": "1.5.8", "description": "Mercadopago SDK for Node.js", "main": "index.js", "scripts": { diff --git a/test/card.js b/test/card.js new file mode 100644 index 00000000..660cf80c --- /dev/null +++ b/test/card.js @@ -0,0 +1,27 @@ +/* eslint-env node, mocha */ +var chai = require('chai'); +var chaiAsPromised = require("chai-as-promised"); + +chai.use(chaiAsPromised); +var expect = chai.expect; +var cardModule = require('../lib/resources/card.js'); + +describe('Card Resource', function () { + + it('Check card update without card id', function () { + + return cardModule.update(undefined, {customer_id: "123"}, undefined).catch(error => { + expect(error.message).to.equal("The JSON is missing the following properties: id") + }); + + }); + + it('Check card update without customer id', function () { + + return cardModule.update(undefined, {id: "123"}, undefined).catch(error => { + expect(error.message).to.equal("The JSON is missing the following properties: customer_id") + }); + + }); + +});