Skip to content

Commit 353d40e

Browse files
committed
Build
1 parent ede4b80 commit 353d40e

File tree

2 files changed

+122
-5
lines changed

2 files changed

+122
-5
lines changed

lib/teamsnap.js

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,20 @@ exports.loadMemberPayments = function(params, callback) {
13381338
} else if (!(params && typeof params === 'object')) {
13391339
throw new TSArgsError('teamsnap.loadMemberPayments', 'must provide a teamId or query parameters');
13401340
}
1341-
return this.loadItem('memberPayment', params, callback);
1341+
return this.loadItems('memberPayment', params, callback);
1342+
};
1343+
1344+
exports.saveMemberPayment = function(memberPayment, callback) {
1345+
if (!memberPayment) {
1346+
throw new TSArgsError('teamsnap.saveMemberPayment', '`memberPayment` must be provided');
1347+
}
1348+
if (!this.isItem(memberPayment, 'memberPayment')) {
1349+
throw new TSArgsError('teamsnap.saveMemberPayment', "`memberPayment.type` must be 'memberPayment'");
1350+
}
1351+
if (!memberPayment.memberId) {
1352+
return this.reject('You must choose a member.', 'memberId', callback);
1353+
}
1354+
return this.saveItem(memberPayment, callback);
13421355
};
13431356

13441357
});
@@ -1681,6 +1694,48 @@ exports.deleteOpponent = function(opponent, callback) {
16811694

16821695
});
16831696

1697+
require.register("collections/paymentNotes", function(exports, require, module) {
1698+
exports.loadPaymentNotes = function(params, callback) {
1699+
if (this.isId(params)) {
1700+
params = {
1701+
teamId: params
1702+
};
1703+
} else if (!(params && typeof params === 'object')) {
1704+
throw new TSArgsError('teamsnap.loadPaymentNotes', 'must provide a teamId or query parameters');
1705+
}
1706+
return this.loadItems('paymentNote', params, callback);
1707+
};
1708+
1709+
exports.createPaymentNote = function(data) {
1710+
return this.createItem(data, {
1711+
type: 'paymentNote'
1712+
});
1713+
};
1714+
1715+
exports.savePaymentNote = function(paymentNote, callback) {
1716+
if (!paymentNote) {
1717+
throw new TSArgsError('teamsnap.savePaymentNote', '`paymentNote` must be provided');
1718+
}
1719+
if (!this.isItem(paymentNote, 'paymentNote')) {
1720+
throw new TSArgsError('teamsnap.savePaymentNote', "`paymentNote.type` must be 'paymentNote'");
1721+
}
1722+
if (!paymentNote.teamId) {
1723+
return this.reject('You must choose a team.', 'teamId', callback);
1724+
}
1725+
if (!paymentNote.memberPaymentId) {
1726+
return this.reject('You must specify a memberPaymentId.', 'memberPaymentId', callback);
1727+
}
1728+
if (!paymentNote.note) {
1729+
return this.reject('You must provide a note.', 'note', callback);
1730+
}
1731+
if (!paymentNote.description) {
1732+
return this.reject('You must provide a description.', 'description', callback);
1733+
}
1734+
return this.saveItem(paymentNote, callback);
1735+
};
1736+
1737+
});
1738+
16841739
require.register("collections/plans", function(exports, require, module) {
16851740
exports.loadPlans = function(params, callback) {
16861741
if (!(params && typeof params === 'object')) {
@@ -1800,6 +1855,62 @@ exports.loadTeamFees = function(params, callback) {
18001855
return this.loadItems('teamFee', params, callback);
18011856
};
18021857

1858+
exports.createTeamFee = function(data) {
1859+
return this.createItem(data, {
1860+
type: 'teamFee'
1861+
});
1862+
};
1863+
1864+
exports.saveTeamFee = function(teamFee, callback) {
1865+
if (!teamFee) {
1866+
throw new TSArgsError('teamsnap.saveTeamFee', '`teamFee` must be provided');
1867+
}
1868+
if (!this.isItem(teamFee, 'teamFee')) {
1869+
throw new TSArgsError('teamsnap.saveTeamFee', "`teamFee.type` must be 'teamFee'");
1870+
}
1871+
if (!teamFee.teamId) {
1872+
return this.reject('You must choose a team.', 'teamId', callback);
1873+
}
1874+
if (!teamFee.description) {
1875+
return this.reject('You must provide a team fee description.', 'description', callback);
1876+
}
1877+
if (!teamFee.amount) {
1878+
return this.reject('You must provide a fee amount.', 'description', callback);
1879+
}
1880+
return this.saveItem(teamFee, callback);
1881+
};
1882+
1883+
exports.deleteTeamFee = function(teamFee, callback) {
1884+
if (!teamFee) {
1885+
throw new TSArgsError('teamsnap.deleteTeamFee', '`teamFee` must be provided');
1886+
}
1887+
return this.deleteItem(teamFee, callback);
1888+
};
1889+
1890+
});
1891+
1892+
require.register("collections/teamPaypalPreferences", function(exports, require, module) {
1893+
exports.teamPaypalPreferences = function(params, callback) {
1894+
if (this.isId(params)) {
1895+
params = {
1896+
teamId: params
1897+
};
1898+
} else if (!(params && typeof params === 'object')) {
1899+
throw new TSArgsError('teamsnap.teamPaypalPreferences', 'must provide a teamId or query parameters');
1900+
}
1901+
return this.loadItem('teamPaypalPreferences', params, callback);
1902+
};
1903+
1904+
exports.saveTeamPaypalPreferences = function(teamPaypalPreferences, callback) {
1905+
if (!teamPaypalPreferences) {
1906+
throw new TSArgsError('teamsnap.saveTeamPaypalPreferences', "`teamPaypalPreferences` must be provided");
1907+
}
1908+
if (!this.isItem(teamPaypalPreferences, 'teamPaypalPreferences')) {
1909+
throw new TSArgsError('teamsnap.saveTeamPaypalPreferences', "`teamPaypalPreferences.type` must be 'teamPaypalPreferences'");
1910+
}
1911+
return this.saveItem(teamPaypalPreferences, callback);
1912+
};
1913+
18031914
});
18041915

18051916
require.register("collections/teamPreferences", function(exports, require, module) {
@@ -4345,6 +4456,8 @@ add(require('./collections/opponents'));
43454456

43464457
add(require('./collections/opponentResults'));
43474458

4459+
add(require('./collections/paymentNotes'));
4460+
43484461
add(require('./collections/plans'));
43494462

43504463
add(require('./collections/sponsors'));
@@ -4353,6 +4466,8 @@ add(require('./collections/sports'));
43534466

43544467
add(require('./collections/teamFees'));
43554468

4469+
add(require('./collections/teamPaypalPreferences'));
4470+
43564471
add(require('./collections/teamPreferences'));
43574472

43584473
add(require('./collections/teamPublicSites'));
@@ -4437,7 +4552,7 @@ var plural, pluralLookup, singularLookup, teamTypes, teamsnap, type, typeLookup,
44374552

44384553
teamsnap = exports;
44394554

4440-
types = ['user', 'assignment', 'availability', 'broadcastSms', 'contact', 'contactEmailAddress', 'contactPhoneNumber', 'customDatum', 'customField', 'leagueCustomDatum', 'leagueCustomField', 'divisionLocation', 'divisionMember', 'divisionMemberPreferences', 'event', 'forumPost', 'forumSubscription', 'forumTopic', 'leagueRegistrantDocument', 'location', 'member', 'memberEmailAddress', 'memberFile', 'memberLink', 'memberPayment', 'memberPhoneNumber', 'memberPreferences', 'opponent', 'opponentResults', 'plan', 'smsGateway', 'sponsor', 'sport', 'team', 'teamFee', 'teamPreferences', 'teamPublicSite', 'teamResults', 'timeZone', 'trackedItem', 'trackedItemStatus'];
4555+
types = ['user', 'assignment', 'availability', 'broadcastSms', 'contact', 'contactEmailAddress', 'contactPhoneNumber', 'customDatum', 'customField', 'leagueCustomDatum', 'leagueCustomField', 'divisionLocation', 'divisionMember', 'divisionMemberPreferences', 'event', 'forumPost', 'forumSubscription', 'forumTopic', 'leagueRegistrantDocument', 'location', 'member', 'memberEmailAddress', 'memberFile', 'memberLink', 'memberPayment', 'memberPhoneNumber', 'memberPreferences', 'opponent', 'opponentResults', 'paymentNote', 'plan', 'smsGateway', 'sponsor', 'sport', 'team', 'teamFee', 'teamPaypalPreferences', 'teamPreferences', 'teamPublicSite', 'teamResults', 'timeZone', 'trackedItem', 'trackedItemStatus'];
44414556

44424557
teamTypes = types.slice();
44434558

@@ -4461,6 +4576,7 @@ pluralLookup = {
44614576
memberPreferences: 'membersPreferences',
44624577
divisionMemberPreferences: 'divisionMembersPreferences',
44634578
opponentResults: 'opponentsResults',
4579+
teamPaypalPreferences: 'teamsPaypalPreferences',
44644580
teamPreferences: 'teamsPreferences',
44654581
teamResults: 'teamsResults',
44664582
customDatum: 'customData',

0 commit comments

Comments
 (0)