Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Add method to create notification for App #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions dist/resources/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ var create = function create(opts, preferences) {
return _api2.default.post(opts, '/preferences/notifications', preferences);
};

var createForApp = function createForApp(opts, appId, preferences) {
return _api2.default.post(opts, '/preferences/' + appId + '/notifications', preferences);
};

var remove = function remove(opts, _id) {
return _api2.default.remove(opts, '/preferences/notifications/' + _id);
};
Expand All @@ -30,5 +34,6 @@ exports.default = {
getOne: getOne,
getAll: getAll,
create: create,
createForApp: createForApp,
remove: remove
};
16 changes: 8 additions & 8 deletions test/refund.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Moip Payment Refunds', () => {

it('Should successfully create an order', (done) => {
moip.order.create(orderModel)
.then(({body}) => {
.then(({ body }) => {
orderId = body.id
done()
})
Expand All @@ -32,7 +32,7 @@ describe('Moip Payment Refunds', () => {

it('Should successfully create a payment for an order', (done) => {
moip.payment.create(orderId, paymentModel)
.then(({body}) => {
.then(({ body }) => {
// Verify and add to schema
body.should.have.property('id')
paymentModel.id = body.id
Expand All @@ -43,7 +43,7 @@ describe('Moip Payment Refunds', () => {

it('Should successfully refund the payment', (done) => {
moip.payment.refunds.create(paymentModel.id)
.then(({body}) => {
.then(({ body }) => {
body.should.have.property('id')
body.should.have.property('status')
body.status.should.be.eql('COMPLETED')
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('Moip Order Refunds', () => {

it('Should successfully create an order', (done) => {
moip.order.create(orderModel)
.then(({body}) => {
.then(({ body }) => {
orderId = body.id
done()
})
Expand All @@ -86,7 +86,7 @@ describe('Moip Order Refunds', () => {

it('Should successfully create a payment for an order', (done) => {
moip.payment.create(orderId, paymentModel)
.then(({body}) => {
.then(({ body }) => {
// Verify and add to schema
body.should.have.property('id')
paymentModel.id = body.id
Expand All @@ -97,19 +97,19 @@ describe('Moip Order Refunds', () => {

it('Should successfully refund the order', (done) => {
moip.order.refunds.create(orderId)
.then(({body}) => {
.then(({ body }) => {
refundId = body.id
body.should.have.property('id')
body.should.have.property('status')
body.status.should.be.eql('COMPLETED')
done()
})
})
.catch(done)
})

it('Should successfully get the refund', (done) => {
moip.refund.get(refundId)
.then(({body}) => {
.then(({ body }) => {
body.should.have.property('id')
done()
})
Expand Down