-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathGatewayRequest.rb
More file actions
229 lines (210 loc) · 7.39 KB
/
GatewayRequest.rb
File metadata and controls
229 lines (210 loc) · 7.39 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#
# Copyright notice:
# (c) Copyright 2020 RocketGate
# All rights reserved.
#
# The copyright notice must not be removed without specific, prior
# written permission from RocketGate.
#
# This software is protected as an unpublished work under the U.S. copyright
# laws. The above copyright notice is not intended to effect a publication of
# this work.
# This software is the confidential and proprietary information of RocketGate.
# Neither the binaries nor the source code may be redistributed without prior
# written permission from RocketGate.
#
# The software is provided "as-is" and without warranty of any kind, express, implied
# or otherwise, including without limitation, any warranty of merchantability or fitness
# for a particular purpose. In no event shall RocketGate be liable for any direct,
# special, incidental, indirect, consequential or other damages of any kind, or any damages
# whatsoever arising out of or in connection with the use or performance of this software,
# including, without limitation, damages resulting from loss of use, data or profits, and
# whether or not advised of the possibility of damage, regardless of the theory of liability.
#
module RocketGate
class GatewayRequest
######################################################################
#
# Define constant hash values.
#
######################################################################
#
VERSION_INDICATOR = "version"
VERSION_NUMBER = "R3.5"
AFFILIATE = "affiliate"
AMOUNT = "amount"
AVS_CHECK = "avsCheck"
BILLING_ADDRESS = "billingAddress"
BILLING_CITY = "billingCity"
BILLING_COUNTRY = "billingCountry"
BILLING_STATE = "billingState"
BILLING_TYPE = "billingType"
BILLING_ZIPCODE = "billingZipCode"
BROWSER_USER_AGENT = "browserUserAgent"
BROWSER_ACCEPT_HEADER = "browserAcceptHeader"
CAPTURE_DAYS = "captureDays"
CARDNO = "cardNo"
CARD_HASH = "cardHash"
CLONE_CUSTOMER_RECORD = "cloneCustomerRecord"
CLONE_TO_CUSTOMER_ID = "cloneToCustomerID"
CURRENCY = "currency"
CUSTOMER_FIRSTNAME = "customerFirstName"
CUSTOMER_LASTNAME = "customerLastName"
CUSTOMER_PASSWORD = "customerPassword"
CUSTOMER_PHONE_NO = "customerPhoneNo"
CVV2 = "cvv2"
CVV2_CHECK = "cvv2Check"
EMAIL = "email"
EMBEDDED_FIELDS_TOKEN = "embeddedFieldsToken"
EXPIRE_MONTH = "expireMonth"
EXPIRE_YEAR = "expireYear"
GENERATE_POSTBACK = "generatePostback"
IOVATION_BLACK_BOX = "iovationBlackBox"
IOVATION_RULE = "iovationRule"
IPADDRESS = "ipAddress"
MERCHANT_ACCOUNT = "merchantAccount"
MERCHANT_CUSTOMER_ID = "merchantCustomerID"
MERCHANT_DESCRIPTOR = "merchantDescriptor"
MERCHANT_DESCRIPTOR_CITY = "merchantDescriptorCity"
MERCHANT_INVOICE_ID = "merchantInvoiceID"
MERCHANT_ID = "merchantID"
MERCHANT_PASSWORD = "merchantPassword"
MERCHANT_PRODUCT_ID = "merchantProductID"
MERCHANT_SITE_ID = "merchantSiteID"
OMIT_RECEIPT = "omitReceipt"
PARES = "PARES"
PARTIAL_AUTH_FLAG = "partialAuthFlag"
PAYINFO_TRANSACT_ID = "payInfoTransactID"
PAY_HASH = "cardHash"
REBILL_FREQUENCY = "rebillFrequency"
REBILL_AMOUNT = "rebillAmount"
REBILL_START = "rebillStart"
REBILL_END_DATE = "rebillEndDate"
REBILL_COUNT = "rebillCount"
REFERENCE_GUID = "referenceGUID"
REFERRING_MERCHANT_ID = "referringMerchantID"
REFERRED_CUSTOMER_ID = "referredCustomerID"
SCRUB = "scrub"
SCRUB_ACTIVITY = "scrubActivity"
SCRUB_NEGDB = "scrubNegDB"
SCRUB_PROFILE = "scrubProfile"
THREATMETRIX_SESSION_ID = "threatMetrixSessionID"
TRANSACT_ID = "referenceGUID"
TRANSACTION_TYPE = "transactionType"
UDF01 = "udf01"
UDF02 = "udf02"
USE_3D_SECURE = "use3DSecure"
USERNAME = "username"
XSELL_MERCHANT_ID = "xsellMerchantID"
XSELL_CUSTOMER_ID = "xsellCustomerID"
XSELL_REFERENCE_XACT = "xsellReferenceXact"
THREED_CHECK = "ThreeDCheck"
THREED_ECI = "ThreeDECI"
THREED_CAVV_UCAF = "ThreeDCavvUcaf"
THREED_XID = "ThreeDXID"
FAILED_SERVER = "failedServer"
FAILED_GUID = "failedGUID"
FAILED_RESPONSE_CODE = "failedResponseCode"
FAILED_REASON_CODE = "failedReasonCode"
GATEWAY_CONNECT_TIMEOUT = "gatewayConnectTimeout"
GATEWAY_READ_TIMEOUT = "gatewayReadTimeout"
ROUTING_NO = "routingNo"
SAVINGS_ACCOUNT = "savingsAccount"
ACCOUNT_NO = "accountNo"
SS_NUMBER = "ssNumber"
THREEDSECURE_DF_REFERENCE_ID = "_3DSECURE_DF_REFERENCE_ID"
THREEDSECURE_REDIRECT_URL = "_3DSECURE_REDIRECT_URL"
BROWSER_JAVA_ENABLED = "BrowserJavaEnabled"
BROWSER_LANGUAGE = "BrowserLanguage"
BROWSER_COLOR_DEPTH = "BrowserColorDepth"
BROWSER_SCREEN_HEIGHT = "BrowserScreenHeight"
BROWSER_SCREEN_WIDTH = "BrowserScreenWidth"
BROWSER_TIME_ZONE = "BrowserTimeZone"
######################################################################
#
# initialize() - Constructor for class.
#
######################################################################
#
def initialize
@parameterList = Hash.new # Create empty hash
self.Set(VERSION_INDICATOR, VERSION_NUMBER)
super # Call superclass
end
######################################################################
#
# Set() - Set a value in the parameter list.
#
######################################################################
#
def Set(key, value)
@parameterList.delete key # Delete existing key
if value != nil # Have a value?
@parameterList[key] = value # Save new value
end
end
######################################################################
#
# Clear() - Clear a value in the parameter list.
#
######################################################################
#
def Clear(key)
@parameterList.delete key # Delete existing key
end
######################################################################
#
# Get() - Get a value from the parameter list.
#
######################################################################
#
def Get(key)
@parameterList[key] # Return desired element
end
######################################################################
#
# ToXML() - Create an XML document from the hash list.
#
######################################################################
#
def ToXML
#
# Build the document header.
#
xmlDocument = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
xmlDocument.concat("<gatewayRequest>")
#
# Loop over each key-value pairs.
#
@parameterList.each_pair do |key, value|
key = key.to_s
value = value.to_s
#
# Open a tag for the key.
#
xmlDocument.concat("<")
xmlDocument.concat(key)
xmlDocument.concat(">")
#
# Clean up the value and add it to the tag.
#
value = value.gsub("&", "&") # Replace &
value = value.gsub("<", "<") # Replace <
value = value.gsub(">", ">") # Replace >
xmlDocument.concat(value)
#
#
# Add the closing tag for this element.
#
xmlDocument.concat("</")
xmlDocument.concat(key)
xmlDocument.concat(">")
end
#
# Close and return the document.
#
xmlDocument.concat("</gatewayRequest>") # Close document
xmlDocument # Final document
end
end
end