-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrg_config.py
More file actions
110 lines (80 loc) · 2.51 KB
/
rg_config.py
File metadata and controls
110 lines (80 loc) · 2.51 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
'''
Created on Apr 18, 2019
Revised on June 17, 2022
Language: Python
@author: cdltorre
'''
import time
import math
# MERCHANT TODO: Configure these key variables.
def RG_MERCHANT_URL():
return 'http://example.com/index.html'
def RG_MERCHANT_LOGIN_URL():
return 'http://example.com/login/'
def RG_MERCHANT_ID():
return 1
def RG_GW_PASSWORD():
return 'testpassword'
def RG_HASH_SECRET():
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
'''
def RG_MERCHANT_PASSWORD_SALT():
return 'CHANGETHISVALUE'
# Local Database Configs
def RG_DB_SERVER():
return 'localhost'
def RG_DB_NAME():
return 'demo'
def RG_DB_USERNAME():
return 'rg_demouser'
def RG_DB_PASSWORD():
return 'CHANGETHISVALUE'
# Set to FALSE for production, TRUE for Testing/Dev.
def RG_TEST_MODE():
return True
if RG_TEST_MODE():
def RG_LINK():
return 'https://dev-secure.rocketgate.com/hostedpage/servlet/HostedPagePurchase?'
else:
def RG_LINK():
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.
'''
def postback_response(results, message):
print("Content-Type: text/xml")
print("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"
return retStr; # Send to RocketGate
# end postback_response
'''
Use Timestamp for Customer ID Generators
'''
def uniqueTimeStamp():
milliseconds = microtime()
timestring = milliseconds.split(" ")
sg = timestring[1]
mlsg = (timestring[0])[2:6]
timestamp = sg + mlsg
return timestamp
# end uniqueTimeStamp
'''
Return current Unix timestamp with microseconds
'''
def microtime(get_as_float = False) :
if get_as_float:
return time.time()
else:
return '%f %d' % math.modf(time.time())
# end microtime