forked from socialmoney/corepro-sdk-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.js
More file actions
141 lines (134 loc) · 5.93 KB
/
program.js
File metadata and controls
141 lines (134 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* Created by socialmoneydev on 9/1/2014.
*/
var Requestor = require('./utils/requestor');
var Account = require('./account');
var ExternalAccount = require('./externalaccount');
var ProgramInterestRate = require('./models/programinterestrate');
var ProgramLimit = require('./models/programlimit');
var ProgramECode = require('./models/programecode');
var ProgramChecking = require('./models/programchecking');
var ProgramPrepaid = require('./models/programprepaid');
var ProgramSavings = require('./models/programsavings');
var Program = function() {
var self = this;
self.requestId = null;
self.name = null;
self.verificationType = null;
self.timeZone = null;
self.perUserDailyWithdrawLimit = null;
self.perUserMonthlyWithdrawLimit = null;
self.perProgramDailyWithdrawLimit = null;
self.perUserDailyDepositLimit = null;
self.perUserMonthlyDepositLimit = null;
self.perProgramDailyDepositLimit = null;
self.regDFeeAmount = null;
self.regDMonthlyTransactionWithdrawCountMax = null;
self.website = null;
self.isInternalToInternalTransferEnabled = null;
self.decimalCount = null;
self.isRecurringContributionEnabled = null;
self.filledDate = null;
self.perUserExternalAccountCountMax = null;
self.perUserAccountCountMax = null;
self.perUserTotalAccountBalanceMax = null;
self.accounts = null;
self.externalAccounts = null;
self.checkingProducts = null;
self.eCodeProducts = null;
self.prepaidProducts = null;
self.savingsProducts = null;
self.customMerge = function(propertyName, value){
var r = new Requestor();
if (propertyName === 'interestRates') {
self.interestRates = [];
if (value) {
for (var i = 0; i < value.length; i++) {
self.interestRates.push(r.merge(value[i], new ProgramInterestRate()));
}
}
} else if (propertyName === 'perUserDailyWithdrawLimit') {
self.perUserDailyWithdrawLimit = new ProgramLimit();
self.perUserDailyWithdrawLimit.minimumAmount = value.minimumAmount;
self.perUserDailyWithdrawLimit.maximumAmount = value.maximumAmount;
} else if (propertyName === 'perUserMonthlyWithdrawLimit') {
self.perUserMonthlyWithdrawLimit = new ProgramLimit();
self.perUserMonthlyWithdrawLimit.minimumAmount = value.minimumAmount;
self.perUserMonthlyWithdrawLimit.maximumAmount = value.maximumAmount;
} else if (propertyName === 'perProgramDailyWithdrawLimit') {
self.perProgramDailyWithdrawLimit = new ProgramLimit();
self.perProgramDailyWithdrawLimit.minimumAmount = value.minimumAmount;
self.perProgramDailyWithdrawLimit.maximumAmount = value.maximumAmount;
} else if (propertyName === 'perUserDailyDepositLimit') {
self.perUserDailyDepositLimit = new ProgramLimit();
self.perUserDailyDepositLimit.minimumAmount = value.minimumAmount;
self.perUserDailyDepositLimit.maximumAmount = value.maximumAmount;
} else if (propertyName === 'perUserMonthlyDepositLimit') {
self.perUserMonthlyDepositLimit = new ProgramLimit();
self.perUserMonthlyDepositLimit.minimumAmount = value.minimumAmount;
self.perUserMonthlyDepositLimit.maximumAmount = value.maximumAmount;
} else if (propertyName === 'perProgramDailyDepositLimit') {
self.perProgramDailyDepositLimit = new ProgramLimit();
self.perProgramDailyDepositLimit.minimumAmount = value.minimumAmount;
self.perProgramDailyDepositLimit.maximumAmount = value.maximumAmount;
} else if (propertyName === 'accounts'){
self.accounts = [];
if (value){
for (var i2 = 0; i2 < value.length; i2++) {
self.accounts.push(r.merge(value[i2], new Account()));
}
}
} else if (propertyName === 'externalAccounts'){
self.externalAccounts = [];
if (value){
for (var i3 = 0; i3 < value.length; i3++) {
self.externalAccounts.push(r.merge(value[i3], new ExternalAccount()));
}
}
} else if (propertyName === 'checkingProducts'){
self.checkingProducts = {};
if (value){
for (var prop3 in value){
if (value.hasOwnProperty(prop3)){
self.checkingProducts[prop3] = r.merge(value[prop3], new ProgramChecking());
}
}
}
} else if (propertyName === 'eCodeProducts'){
self.eCodeProducts = {};
if (value){
for (var prop4 in value){
if (value.hasOwnProperty(prop4)){
self.eCodeProducts[prop4] = r.merge(value[prop4], new ProgramECode());
}
}
}
} else if (propertyName === 'prepaidProducts'){
self.prepaidProducts = {};
if (value){
for (var prop5 in value){
if (value.hasOwnProperty(prop5)){
self.prepaidProducts[prop5] = r.merge(value[prop5], new ProgramPrepaid());
}
}
}
} else if (propertyName === 'savingsProducts'){
self.savingsProducts = {};
if (value){
for (var prop6 in value){
if (value.hasOwnProperty(prop6)){
self.savingsProducts[prop6] = r.merge(value[prop6], new ProgramSavings());
}
}
}
} else {
self[propertyName] = value;
}
};
self.get = function (callback, connection, loggingObject) {
new Requestor().get('/program/get', Program, function(ex, data) {
callback(ex, data);
}, connection, loggingObject);
};
};
module.exports = Program;