-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrg_config.js
93 lines (75 loc) · 2.46 KB
/
rg_config.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// MERCHANT TODO: Configure these key variables.
//
'use strict'
exports.RG_MERCHANT_URL = function () {
return 'http://example.com/index.html';
};
exports.RG_MERCHANT_LOGIN_URL = function () {
return 'http://example.com/login/';
}
exports.RG_MERCHANT_ID = function () {
return '1';
}
exports.RG_GW_PASSWORD = function () {
return 'testpassword';
}
exports.RG_HASH_SECRET = function () {
return 'hashsecret';
}
// Salt used for protecting password, don't change after install or you will have different salts used on passwords in the database.
// Modify this to your own value
exports.RG_MERCHANT_PASSWORD_SALT = function () {
return 'sdfj0j80hssflhjsfh8sfh8sgo2';
}
// Local Database Configs
exports.RG_DB_SERVER = function () {
return 'localhost';
}
exports.RG_DB_NAME = function () {
return 'demo';
}
exports.RG_DB_USERNAME = function () {
return 'rg_demouser';
}
// Set to FALSE for production, TRUE for Testing/Dev.
exports.RG_TEST_MODE = function () {
return 'TRUE';
}
if (this.RG_TEST_MODE()) {
exports.RG_LINK = function () {
return ('https://dev-secure.rocketgate.com/hostedpage/servlet/HostedPagePurchase?');
}
}
else {
exports.RG_LINK = function () {
return ('https://secure.rocketgate.com/hostedpage/servlet/HostedPagePurchase?');
}
}
//
// RocketGate requires a response to this postback.
// This function provides a properly formatted response message.
//
// results indicates success or failure. A value of 0 indicates the server has received, parsed and processed the postback.
// A non-zero value indicates that an error occurred.
// message is an optional value that could be used to pass an error description which can be used in debugging the error.
//
exports.postback_response = function (results, message) {
res.writeHead(200, { 'Content-Type': 'text/html' });
res.WriteHead(200, { 'Cache-Control': 'no-cache' });
retStr = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>';
retStr += '<Response>';
retStr += '<results>' + results + '</results>';
if (message != '') retStr += '<message>' + message + "</message>";
retStr += "</Response>\n";
console.log(retStr); // Send to RocketGate
process.exit(); // and quit program
} // end pb_response
//
// Use Timestamp for Customer ID Generators
//
exports.uniqueTimeStamp = function () {
var milliseconds = (new Date).getTime();
var timestamp = milliseconds;
return timestamp.toString();
} // end uniqueTimeStamp