Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELEASE] 0.2.1 #10

Merged
merged 65 commits into from
Jan 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
7857fc6
Add customer new features(Listagem, Criação de cartão de credito, Exc…
danielfnz Dec 12, 2017
7a5b87c
Add bankaccount feature(Criação, Consulta, Listagem, Exclusão)
danielfnz Dec 12, 2017
0307ea2
Add account transparent feature(Criação e Consulta)
danielfnz Dec 12, 2017
67b6e82
Update readme
danielfnz Dec 12, 2017
1f295b8
Update readme
danielfnz Dec 12, 2017
573ee52
Refer account+ bankaccount on index.js
danielfnz Dec 12, 2017
35a39ef
Change account basic auth to OAuth
danielfnz Dec 12, 2017
16e6851
Update readme
danielfnz Dec 12, 2017
b7eee8f
Change bankAccount Basic Auth To OAuth
danielfnz Dec 12, 2017
fc56aa2
Update readme bankAccount
danielfnz Dec 12, 2017
a3f5ac5
Fix Extra semicolon semi
danielfnz Dec 12, 2017
6499422
Change patch bankaccount to bankAccount
danielfnz Dec 12, 2017
727b06d
Change patch bankaccount to bankAccount
danielfnz Dec 12, 2017
3ce9724
Change OAuth to accessToken (Pré-Requisito) and README.md
danielfnz Dec 12, 2017
d9236ce
Payment refund, Payment pre-autorized capture, Payment pre-autorized …
danielfnz Dec 14, 2017
c9fca97
Update readme(Pre-Authorization
danielfnz Dec 14, 2017
b142bf7
Update readme(Pre-Authorization
danielfnz Dec 14, 2017
d0339a4
Change Autorization -> Authorization
danielfnz Dec 14, 2017
204fcad
Merge pull request #2 from danielfnz/master
somentelucas Dec 14, 2017
5493c27
Merge pull request #4 from danielfnz/dev
somentelucas Dec 14, 2017
dcf66f7
Merge branch 'master' of https://github.com/moip/moip-sdk-node into d…
Dec 14, 2017
6439525
Updating Moip Account and Refund titles
Dec 14, 2017
4d5d33b
Adjusting indentation of Add Credit Card to Customer section
Dec 14, 2017
b392158
Merge pull request #5 from moip/updates_to_readme
somentelucas Dec 17, 2017
e1fb792
feat(connect): adding authorization URL and tests
Dec 18, 2017
6ff06f0
Removing unused header
Dec 18, 2017
cff807c
Linting
Dec 18, 2017
c5856a2
Fixing authorize payment simulation URL
Dec 18, 2017
4936d0d
Merge pull request #7 from moip/feat/connect
somentelucas Dec 19, 2017
4c30401
Changing to ES6 syntax
Jan 3, 2018
6a2c32b
Adding missing files that were not added in the previous commit
Jan 3, 2018
c2b9e48
Finding a way to get authorization
Jan 3, 2018
dcc1feb
Transforming customers to ES6
Jan 4, 2018
b10c1ac
Transforming Payments to ES6
Jan 5, 2018
a3f986b
Adding /dist to gitignore
Jan 5, 2018
ca592ed
Transforming Notifications in ES6
Jan 5, 2018
e9bb11c
Change connect to ES6 syntax
Jan 5, 2018
a329824
Transforming bank accounts to ES6
Jan 7, 2018
f181ddf
Adding credit card tests to customer
Jan 7, 2018
d7dbe41
Adding escrow
Jan 7, 2018
cd64643
Adding refund to order and refund tests
Jan 7, 2018
f5cee65
Transforming webhooks to ES6
Jan 7, 2018
6cc1e31
Refactoring how to initialize the SDK so it doesn't use global variables
Jan 23, 2018
4744365
Moving specs to root of the project and renaming to 'test'
Jan 24, 2018
4aaa845
Linting
Jan 24, 2018
2ae8127
Fixing Connect tests and adding code coverage
Jan 24, 2018
36e095e
Refactoring all the subscriptions endpoints to ES6
Jan 26, 2018
49efebe
Linting
Jan 26, 2018
9a9296b
Adding delay between refund tests
Jan 26, 2018
e8b3299
Setting delay also for order refund tests
Jan 26, 2018
6084203
Removing space
Jan 26, 2018
e63a322
Showing CI on Readme
Jan 26, 2018
3bd12d2
Adding coverage
Jan 26, 2018
70d73ef
Adding coverage
Jan 26, 2018
6161554
Configuring coverage to run locally
Jan 26, 2018
e2682ce
Adding /dist
Jan 26, 2018
202943f
Defaulting import to /dist
Jan 26, 2018
b381f2a
Updating examples in readme
Jan 26, 2018
55809b3
Translating readme to english
Jan 27, 2018
e4e204e
Reodering readme
Jan 27, 2018
48d7c49
Fixing readme links
Jan 27, 2018
f35c292
0.2.0
Jan 27, 2018
7d56436
Merge pull request #9 from moip/es6_2
somentelucas Jan 27, 2018
46eebe0
Changing package github url
Jan 27, 2018
337a249
0.2.1
Jan 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Transforming Payments to ES6
  • Loading branch information
Lucas Garcia authored and Lucas Garcia committed Jan 5, 2018
commit b10c1aca4ed1dd29e9014b82266ace3bd46ea255
5 changes: 3 additions & 2 deletions dist/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ var _endpoints2 = _interopRequireDefault(_endpoints);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var get = function get(endpoint, id) {
var get = function get(endpoint, id, opts) {
var options = {
url: '' + _endpoints2.default['sandbox'].v2.url + endpoint + '/' + (id || ''),
url: opts && opts.customUrl ? opts.customUrl : '' + _endpoints2.default['sandbox'].v2.url + endpoint + '/' + (id || ''),
headers: {
'Authorization': _authorization2.default.get()
},
method: 'GET',
json: true
};

return (0, _requestPromise2.default)(options);
};

Expand Down
8 changes: 4 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ exports.default = {
init: _authorization2.default.set,
customer: _customer2.default,
order: _order2.default,
payment: _payment2.default,
connect: _connect2.default,
account: _account2.default,
bankAccount: _bankAccount2.default
payment: _payment2.default
// connect,
// account,
// bankAccount
// webhook,
// notification,
// plan,
Expand Down
82 changes: 16 additions & 66 deletions dist/resources/order.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,29 @@
'use strict';

var request = require('request');
var moip = require('../client/endpoints');
Object.defineProperty(exports, "__esModule", {
value: true
});

var basicAuth = null;
var endpoint = null;
var _api = require('../api');

var order = {};
var _api2 = _interopRequireDefault(_api);

order.getOne = function (id, callback) {
var options = {
url: endpoint.v2.url + '/orders/' + id,
headers: {
'Authorization': basicAuth
},
method: 'GET',
json: true
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var getOne = function getOne(_id) {
return _api2.default.get('/orders', _id);
};

order.getAll = function (callback) {
var options = {
url: endpoint.v2.url + '/orders',
headers: {
'Authorization': basicAuth
},
method: 'GET',
json: true
};

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var getAll = function getAll() {
return _api2.default.get('/orders');
};

order.create = function (order, callback) {
var options = {
url: endpoint.v2.url + '/orders',
headers: {
'Authorization': basicAuth
},
method: 'POST',
body: order,
json: true
};

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var create = function create(order) {
return _api2.default.post('/orders', order);
};

module.exports = function (_basicAuth, _production) {
basicAuth = _basicAuth;

if (_production) {
endpoint = moip.production;
} else {
endpoint = moip.sandbox;
}

return order;
exports.default = {
getOne: getOne,
getAll: getAll,
create: create
};
144 changes: 28 additions & 116 deletions dist/resources/payment.js
Original file line number Diff line number Diff line change
@@ -1,136 +1,48 @@
'use strict';

var request = require('request');
var moip = require('../client/endpoints');
Object.defineProperty(exports, "__esModule", {
value: true
});

var basicAuth = null;
var endpoint = null;
var _api = require('../api');

var payment = {};
var _api2 = _interopRequireDefault(_api);

payment.getOne = function (id, callback) {
var options = {
url: endpoint.v2.url + '/payments/' + id,
headers: {
'Authorization': basicAuth
},
method: 'GET',
json: true
};
var _endpoints = require('../client/endpoints');

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
};
var _endpoints2 = _interopRequireDefault(_endpoints);

payment.create = function (orderId, payment, callback) {
var options = {
url: endpoint.v2.url + '/orders/' + orderId + '/payments',
headers: {
'Authorization': basicAuth
},
method: 'POST',
body: payment,
json: true
};
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var getOne = function getOne(_id) {
return _api2.default.get('/payments', _id);
};

payment.refund = function (payment_id, callback) {
var options = {
url: endpoint.v2.url + '/orders/' + payment_id + '/refunds',
headers: {
'Authorization': basicAuth
},
method: 'POST',
json: true
};

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var create = function create(order_id, payment) {
return _api2.default.post('/orders/' + order_id + '/payments', payment);
};

payment.preAuthorizationCapture = function (payment_id, callback) {
var options = {
url: endpoint.v2.url + '/payments/' + payment_id + '/capture',
headers: {
'Authorization': basicAuth
},
method: 'POST',
json: true
};

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var refund = function refund(_id) {
return _api2.default.post('/payments/' + _id + '/refunds');
};

payment.preAuthorizationCancel = function (orderId, callback) {
var options = {
url: endpoint.v2.url + '/payments/' + payment_id + '/void',
headers: {
'Authorization': basicAuth
},
method: 'POST',
json: true
};

request(options, function (error, response, body) {
if (body) {
callback(error, body, response);
} else {
callback(error);
}
});
var preAuthorizationCapture = function preAuthorizationCapture(_id) {
return _api2.default.post('/payments/' + _id + '/capture');
};

payment.authorize = function (id, amount, callback) {
var options = {
url: endpoint.v2.authorizePaymentSimulationUrl + '?payment_id=' + id + '&amount=' + amount,
headers: {
'Authorization': basicAuth
},
method: 'GET',
json: true
};

request(options, function (error, response) {
if (response) {
callback(error, response);
} else {
callback(error);
}
});
var preAuthorizationCancel = function preAuthorizationCancel(_id) {
return _api2.default.post('/payments/' + _id + '/void');
};

module.exports = function (_basicAuth, _production) {
basicAuth = _basicAuth;

if (_production) {
endpoint = moip.production;
} else {
endpoint = moip.sandbox;
}
var _authorize = function _authorize(_id, amount) {
return _api2.default.get(null, null, { customUrl: _endpoints2.default.sandbox.v2.authorizePaymentSimulationUrl + '?payment_id=' + _id + '&amount' + amount });
};

return payment;
exports.default = {
getOne: getOne,
create: create,
refund: refund,
preAuthorizationCapture: preAuthorizationCapture,
preAuthorizationCancel: preAuthorizationCancel,
_authorize: _authorize
};
4 changes: 3 additions & 1 deletion dist/specs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

require('babel-polyfill');

require('./customer.spec');
require('./order.spec');

require('./payment.spec');
Loading