-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppUpdate.js
79 lines (77 loc) · 3.39 KB
/
AppUpdate.js
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
const axios = require('axios');
const JsonData = require("./DummyData");
const uuid = require('./GetUUID.js');
const timeinc = require('./TimeIncrementer.js');
var sendAppUpdateEvent = function(event_url, device_id, user_id, guest_user_profile_id, log_time){
return new Promise((resolve, reject) => {
var postData= {data:JSON.parse(JsonData.empty)}
//POST
postData.data.log_id = uuid.create_UUID();
postData.data.device_id = device_id;
postData.data.user_profile_id = user_id;
postData.data.country = "IN";
postData.data.log_time = log_time;
postData.data.ip = "168.212.226.204";
postData.data.device_details.device_type = "One Plus 9";
postData.data.device_details.os = "android";
postData.data.device_details.platform = "Android";
postData.data.ui_variant = "1";
postData.data.psid = uuid.create_UUID();
postData.data.csid = uuid.create_UUID();
postData.data.ssid = uuid.create_UUID();
postData.data.meta_data = "false";
postData.data.user_details.guest_user_profile_id = guest_user_profile_id;
postData.data.user_details.is_guest = "false";
postData.data.adjust_event_id = "";
postData.data.event_id = "appupdate";
postData.data.event_category = "App Update";
postData.data.event_type = "Page View Event";
postData.data.event_name = "Prompt Update";
postData.data.data.social_media_platform = "Facebook";
postData.data.data.refer.marketing_channel = "Facebook";
postData.data.app_version = "0.1.1";
postData.data.data.experience.is_creation = "false";
axios.post(event_url, postData).then(function (response) {
console.log("1st req");
console.log(postData);
postData.data.log_id = uuid.create_UUID();
postData.data.ssid = uuid.create_UUID();
postData.data.log_time = timeinc.IncreaseTime(postData.data.log_time);
postData.data.adjust_event_id = "appforce";
postData.data.event_id = "appupdate";
postData.data.event_name = "Prompt Force Update";
axios.post(event_url, postData).then(()=>{
console.log("2nd req");
console.log(postData);
postData.data.meta_data = "true";
postData.data.log_id = uuid.create_UUID();
postData.data.ssid = uuid.create_UUID();
postData.data.log_time = timeinc.IncreaseTime(postData.data.log_time);
postData.data.adjust_event_id = "appupnow";
postData.data.event_id = "appupdate";
postData.data.event_type = "CTA";
postData.data.event_name = "Update Now";
axios.post(event_url, postData).then(()=>{
console.log("3rd req");
console.log(postData);
postData.data.log_id = uuid.create_UUID();
postData.data.ssid = uuid.create_UUID();
postData.data.log_time = timeinc.IncreaseTime(postData.data.log_time);
postData.data.adjust_event_id = "appdecup";
postData.data.event_id = "appupdate";
postData.data.event_name = "Declined Update";
axios.post(event_url, postData).then(()=>{
console.log("4rth req");
console.log(postData);
resolve();
})
})
})
})
.catch(function (error) {
console.log(error.data);
reject(err);
});
});
};
module.exports = {sendAppUpdateEvent}