Skip to content

Commit

Permalink
Add statement_descriptor on Preferences Model; Allow user to dynamica…
Browse files Browse the repository at this point in the history
…lly change credentials
  • Loading branch information
Nicholas Pedroso committed Dec 3, 2020
1 parent 81e3040 commit 0cbb778
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
11 changes: 7 additions & 4 deletions lib/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ configurationsModule.configure = function (configurations) {
throw new Error('You must provide client_id and client_secret');
}

if (configurations.client_id !== undefined && configurations.client_secret !== undefined
&& (clientId !== undefined || clientSecret !== undefined)) {
throw new Error('Cant change client_id or client_secret because is already set');
}
// ### We commented this next validation.
// ### It is a customer desire to change clientSecret and clientId dynamically

// if (configurations.client_id !== undefined && configurations.client_secret !== undefined
// && (clientId !== undefined || clientSecret !== undefined)) {
// throw new Error('Cant change client_id or client_secret because is already set');
// }

clientId = clientId || configurations.client_id;
clientSecret = clientSecret || configurations.client_secret;
Expand Down
3 changes: 3 additions & 0 deletions lib/models/preferencesModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ module.exports = {
}
}
},
statement_descriptor: {
type: 'string'
},
payment_methods: {
type: 'object',
properties: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mercadopago",
"version": "1.5.1",
"version": "1.5.2",
"description": "Mercadopago SDK for Node.js",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0cbb778

Please sign in to comment.