SY_Data_Objects.js

A set of data objects utilized by the Mobiliser Smartphone application.

1       /**
2        *  @overview
3        * A set of data objects utilized by the Mobiliser Smartphone application.
4        *
5        * @name SY_Data_Objects.js
6        * @author SAP AG
7        * @version 1.0
8        *
9        */
10      
11      
12      // TODO: check document against implementation (see parameters)
13      
14      /**
15        @class Contains basic information about the customer.
16      
17        @constructor
18      
19        @param customerId
20        @param {string} msisdn The msisdn of the customer
21        @param blacklist An id for blacklistreason to indicate customer account status.
22        @param test test state of customer account.
23        @param typeId The id of customerType
24        @param cancelId The id of cancellationReason of customer account
25        @param modeId The id of mode of txn receipt mode of customer account
26       */
27      function Customer() {
28          this.customerId = '';
29          this.orgUnitId = '';
30          this.blacklist = '';
31          this.active = '';
32          this.test = '';
33          this.displayName = '';
34          this.riskCategoryId = '';
35          this.typeId = '';
36          this.cancelId = '';
37          this.modeId = '';
38      }
39      
40      /**
41        @class TxnData
42      
43        @constructor
44      
45        @param  usecase The usecase id for a transaction
46        @param  amount The amount of a transaction
47        @param  orderId The orderId for a transaction. Holds specific information for certain usecases and txns.
48        @param  text Any text which reminds the user of the transaction.
49       */
50      function TxnData(usecase, amount, orderId, text) {
51          this.usecase = usecase;
52          this.amount = amount;
53          this.orderId = orderId;
54          this.text = text;
55      }
56      
57      /**
58        @class LoginSession This is the session class which stores all of the user's data throughtout a login session.
59      
60        @constructor
61        @param sessionId The session id as returned by the server
62        @param customerId The id of the customer
63        @param displayName The display name of the customer
64        @param msisdn The phone number of the customer
65        @param transaction Is an array of tranasctions
66        @param contacts Is an array of contacts from the address book of the user's smartphone
67        @param billTypes Is an array of avaiable invoic types
68        @param registeredbill A list of all registered bills for the user
69        @param openbill The information of an open bill
70        @param openBillArray A list of all open and due bills for the user
71        @param openRequestArray A list of all open and due demand for payment for the user
72        @param accounts A list of money accounts registered by the user
73        @param offlinesvas A list of offline SVA accounts registered by the user
74        @param totalaccounts total number of money accounts registered by the user
75        @param customer particular information of the user
76        @param svaalert A list of balance alerts registered for SVA of the user
77        @param coupons A list of coupons available for the user
78        @param couponTypes A list of coupon types in system
79        @param categories A list of coupon categories in one level of category tree
80        @param category_grandparent the category node in up two level of current node
81        @param identification A list of identification registered by the user
82        @param customerAlert particular information of an alert for a user
83        @param alertNotificationMessages A list of alert Notification message 
84        @param otherIdentifications A list of additional identification registerd by the user
85        @param transit_value A variable to hold the temporary data between pages in navigation
86        @param image A handler to hold the image 
87        @param uploadUrl The url address in system for uploading a image
88        @param downloads A list of handlers of images to download from system
89        @param locations A list of locations in system
90        @param defaultTermAndConditions A list of default term & conditions in registration
91        @param openTermAndConditions A list of open term & conditions after user login
92        @param gcmregid The GCM registration ID of this application
93       */
94      function LoginSession() {
95          this.sessionId = '';
96          this.sessionTimeoutWindow = MAX_SESSION_TIME;
97          this.msisdn = '';
98          this.transaction = [];
99          this.contacts = [];
100         this.billTypes = [];
101         this.registeredbill = [];
102         this.openbill = '';
103         this.openBillArray = [];
104         this.openRequestArray = [];
105         this.accounts = [];
106     	this.offlinesvas = [];
107         this.totalaccounts = '';
108         this.customer = '';
109         this.svaalert = [];
110         this.coupons = [];
111         this.couponTypes = [];
112         this.categories = [];
113         this.category_grandparent = '';
114         this.identification = '';
115         this.customerAlert = new CustomerAlert();
116         this.alertNotificationMessages = [];
117         this.otherIdentifications = [];
118         this.transit_value = '';
119         this.image = '';
120         this.uploadUrl = '';
121         this.downloads = [];
122         this.locations = '';
123         this.defaultTermAndConditions = '';
124         this.openTermAndConditions = '';
125         this.gcmregid = '';
126         this.pibalance = '';
127     }
128     
129     /**
130     @class Account A class that stores information pertaining to certain account.
131     
132     @constructor
133     @param pIId The paymentInstrument id of an account
134     @param type The type of an account
135     @param no The number related to an account, such as card no. account no.
136     @param info The extra information of an account, alias name of bank account and credit card. balance of SVA
137     @param acctHolderName The name of bank account/credit card Holder
138     @param acctNumber Bank account number/credit card number
139     @param displayNumber The number to be displayed for bank account/credit card.
140     @param extra1 The code of bank or The type of the credit card, master, visa or etc.
141     @param extra2 The code of branch that bank account is opened or The security code of the credit card
142     @param extra3 The name of bank or The year of the expiry date for the card
143     @param extra4 The country of the bank or The month of the expiry date for the card
144     */
145     function Accounts() {
146         this.walletId = '';
147         this.creditPriority = '';
148         this.debitPriority = '';
149         this.pIId = '';
150         this.pIClass = '';
151         this.type = '';
152         this.no = '';
153         this.info = '';
154         this.acctHolderName = '';
155         this.acctNumber = '';
156         this.displayNumber = '';
157         this.extra1 = '';          //bankCode/cardType
158         this.extra2 = '';          //branchCode/securityNumber
159         this.extra3 = '';          //bankName/yearExpiry
160         this.extra4 = '';          //bankCountry/monthExpiry
161     }
162     
163     /**
164       @class Transaction A class that stores information pertaining to certain transcation.
165     
166       @constructor
167       @param transactionId The id of a transaction
168       @param transactionDate The date of the transaction
169       @param amount The amount of the transaction
170       @param usecase The usecase of transaction
171      */
172     function Transaction() {
173         this.transactionId = '';
174         this.transactionDate = '';
175         this.amount = '';
176         this.usecase = '';
177     }
178     
179     /**
180       @class BillTypes is a class that stores information about any invoice that the user has registered for.
181     
182       @constructor
183       @param billTypeId The type id for the invoice.
184       @param billTypeName The name of the invoice/bill registered for.
185      */
186     function BillTypes() {
187         this.billTypeId = '';
188         this.billTypeName = '';
189         this.billTypeGroupId= '';
190     }
191     
192     /**
193       @class OpenBill A class represnting an open invoice which the user has to pay for a certain merchant.
194     
195       @constructor
196       @param billId The id of this invoice/bill
197       @param billTypeName The name of the bill type for this invoice
198       @param dueDate The due date of this bill
199       @param amount The amount due for this bill
200      */
201     function OpenBill() {
202         this.billId = '';
203         this.billTypeName = '';
204         this.dueDate = '';
205         this.amount = '';
206         this.reference = '';
207         this.billreference = '';
208     }
209     
210     /**
211       @class Registeredbill is a class that stores information about any invoice that the user has registered for.
212     
213       @constructor
214       @param billConfigId The id of the bill configuration
215       @param alias The alias name given by the user for this configuration.
216       @param billTypeId The type id for the invoice.
217       @param billTypeName The name of the invoice/bill registered for.
218      */
219     function Registeredbill() {
220         this.billConfigId = '';
221         this.alias = '';
222         this.billTypeId = '';
223         this.reference = '';
224         this.billTypeName = '';
225         this.billTypeGroupId = '';
226     }
227     
228     /**
229     @class BalanceAlert is a class that stores information about a Balance Alert.
230     
231     @constructor
232     @param billConfigId The id of the bill configuration
233     @param alias The alias name given by the user for this configuration.
234     @param billTypeId The type id for the invoice.
235     @param billTypeName The name of the invoice/bill registered for.
236     */
237     function BalanceAlert() {
238         this.id = '';
239         this.paymentInstrumentId = '';
240         this.threshold = '';
241         this.active = '';
242         this.onlyTransition = '';
243         this.templateName = '';
244     }
245     
246     /**
247     @class Contains basic information about a coupon.
248     
249     @constructor
250     
251     @param id
252     @param customerId
253     @param couponType the type of coupon.
254     @param status the coupon's statu.s
255     @param serialNumber The serial number of the coupon
256     @param validTo valid date of the coupon
257     @param code The code of coupon
258     @param views view times of the coupon
259     @param uses usage times of the coupon
260     */
261     function Coupon() {
262       this.id = '';
263       this.customerId = '';
264       this.couponType = new CouponType();
265       this.status = '';
266       this.serialNumber = '';
267       this.validTo = '';
268       this.code = '';
269       this.views = '';
270       this.uses = '';
271     }
272     
273     /**
274     @class Contains basic information about a coupon type.
275     
276     @constructor
277     
278     @param id
279     @param name
280     @param purchasePrice
281     @param purchaseCurrency
282     @param maxViews
283     @param maxUses
284     @param isRestorableByUser
285     @param description Coupon type description.
286     */
287     function CouponType() {
288       this.id = '';
289       this.name = '';
290       this.purchasePrice = '';
291       this.purchaseCurrency = '';
292       this.maxViews = '';
293       this.maxUses = '';
294       this.isRestorableByUser = '';
295       this.description = new CouponTypeDescription();
296     }
297     
298     /**
299     @class Contains basic information about a coupon type description.
300     
301     @constructor
302     
303     @param mimeType
304     @param caption
305     @param content
306     @param thumbnailUrl
307     @param imageUrl
308     */
309     function CouponTypeDescription() {
310       this.mimeType = '';
311       this.caption = '';
312       this.content = '';
313       this.thumbnailUrl = '';
314       this.imageUrl = '';
315     }
316     
317     /**
318     @class Contains basic information about a coupon category.
319     
320     @constructor
321     
322     @param id
323     @param internalName
324     @param caption
325     @param priority
326     @param noOfChildCategories
327     @param parent
328     */
329     function Category() {
330       this.id = '';
331       this.internalName = '';
332       this.caption = '';
333       this.priority = '';
334       this.noOfChildCategories = '';
335       this.parent = '';
336       this.valid = '';
337     }
338     
339     /**
340     @class Contains basic information about geoLocation.
341     
342     @constructor
343     
344     @param id
345     @param internalName
346     */
347     function GeoLocation() {
348       this.latitude = '';
349       this.longitude = '';
350     }
351     
352     /**
353       @class Timer
354     
355       @constructor
356      */
357     function Timer() {
358         this.handle = '';
359         this.on_flag = 0;
360     }
361     
362     /**
363       @class Setting is a connection configurations class to connect to the back-end server.
364       @constructor
365       @param protocol String representing the protocol type. Either "http://" or "https://".
366       @param ipaddress The IP address of the money mobiliser server
367       @param port The port number of the money mobiliser server
368       @param wsname The name of the WS_Core web service;
369      */
370     function Setting() {
371         this.protocol = '${ws.protocol}://';
372         this.ipaddress = '${ws.ipaddress}';
373         this.port = '${ws.port}';
374         this.wsname = '${ws.uri}';
375     
376         this.origin = "MAPP";
377         this.appinfo = {};
378         this.appinfo.device = '';
379         this.appinfo.deviceId = '';
380         this.appinfo.otherDeviceId = '';
381         this.appinfo.application = "MAPP";  // TODO: change app name and add version number (svn revision ? build number ?)
382                                             // Currently, appid used for AuditData expects "MAPP", otherwise user cannot login.
383         this.appinfo.applicationVersion = "5.1.3";
384     }
385     
386     /*Alert specific classes*/
387     /**
388      * @class CustomerAlert which contains alert data set for each alert
389      * @param customerId to which this alert belongs
390      * @param alertTypeId to which this alert belongs
391      * @param alertNotificationMsgId to which notification type this alert is tied to
392      * @param alertDataList array of AlertData objects
393      * @param contactPointList array of ContactPoint objects
394      * @param blackoutList array of Blackout objects
395      * @param created
396      */
397     function CustomerAlert() {
398         this.id = '';
399         this.customerId = '';
400         this.alertTypeId = '';
401         this.active = '';
402         this.alertNotificationMsgId = '';
403         this.notifMaxCnt = ''; //For frequency - 0 for Every time, 1 for First time
404         this.notifMaxRecur = ''; //For frequency - D for Day, W for Week, F - Fortnight, M - Month, Q - Quarter, Y - Year
405         this.alertDataList = [];
406         this.contactPointList = [];
407         this.blackoutList = [];
408         this.created = '';
409     }
410     
411     
412     /**
413      * @class OtherIdentifications this contains other identifications for a
414      *        customer
415      * @param customerId to which this Other Identification belongs
416      * @param type of identification fax, email, phone etc
417      */
418     function OtherIdentification() {
419         this.id = '';
420         this.customerId = '';
421         this.type = '';
422         this.identification = '';
423         this.identificationType = '';
424         this.nickname = '';
425         this.provider = '';
426         this.status = '';
427         this.active = '';
428     }
429     
430     /**
431      * @class ContactPoint holds many to many mapping record between Customer Alert and Other Identification
432      */
433     function ContactPoint() {
434         this.id = '';
435         this.customerAlertId = '';
436         this.identification = new Identification();
437         this.otherIdentification = new OtherIdentification();
438     }
439     
440     /**
441      * @class AlertData this contains key value pair of alert data
442      */
443     function AlertData() {
444         this.id = '';
445         this.customerAlertId = '';
446         this.key = '';
447         this.value = '';
448     }
449     
450     /**
451      * @description Identification of customer
452      * @param id of the Identification record
453      * @param customerId to whom this identification belongs
454      * @param type of identification
455      * @param identification actual value
456      */
457     function Identification() {
458         this.id = '';
459         this.customerId = '';
460         this.type = '';
461         this.identification = '';
462     }
463     
464     /**
465      * @description Alert notification message mapping class
466      * @param id of the mapping record
467      * @param alertTypeId id of alert type
468      * @param notificationMsgTypeId if of notification msg type
469      */
470     function AlertNotificationMessage() {
471         this.id = '';
472         this.alertTypeId = '';
473         this.notificationMsgTypeId = '';
474     }