SVClient 1.0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+ #=Overview
7
+ # List of Gift card supported transactions and the respective transaction type id's
8
+ #
9
+
10
+ class SVGiftCardCodes
11
+ PURCHASE_ONLY = 21
12
+ PURCHASE_ONLY_REVERSAL = 105
13
+ ACTIVATE_ONLY = 22
14
+ ACTIVATE_ONLY_REVERSAL = 105
15
+ ACTIVATE = 5
16
+ ACTIVATE_REVERSAL = 105
17
+ CREATE_AND_ISSUE = 5
18
+ CREATE_AND_ISSUE_REVERSAL = 105
19
+ REDEEM = 2
20
+ REDEEM_REVERSAL = 102
21
+ BALANCE = 6
22
+ RELOAD = 3
23
+ RELOAD_REVERSAL = 103
24
+ PARAM_DOWNLOAD = 19
25
+ BATCH_CLOSE = 20
26
+ CANCEL_RELOAD = 13
27
+ CANCEL_RELOAD_REVERSAL = 113
28
+ CANCEL_REDEEM = 12
29
+ CANCEL_REDEEM_REVERSAL = 112
30
+ DEACTIVATE = 4
31
+ CANCEL_ACTIVATE = 28
32
+ CANCEL_ACTIVATE_REVERSAL = 128
33
+ VIEW_LAST_TRANSACTION = 18
34
+ GET_CUSTOMER_INFO = 129
35
+ end
@@ -0,0 +1,96 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+
7
+ require 'SVClient/SVRecentTransactions'
8
+
9
+ # =Overview
10
+ # This class contains values of Recent Transaction attributes which is returned from the server.
11
+ #
12
+ # SVResponse.getgiftrecenttransactions() method would return the Array of objects of this class type.
13
+ # If server responds with any recent transactions in the response.
14
+ class SVGiftRecentTransactions < SVRecentTransactions
15
+
16
+ # ===return
17
+ # String - the Card Number of the selected recent transaction.
18
+ def getcardnumber
19
+ @cardnumber
20
+ end
21
+
22
+ # ===return
23
+ # DateTime - the transaction date at which the selected recent transaction happened.
24
+ def gettransactiondate
25
+ SVUtils::getdate(@transactiondate, SVUtils::QC_DATE_FORMAT)
26
+ end
27
+
28
+ # ===return
29
+ # DateTime - the transaction date at server on which the selected recent transaction happened.
30
+ # If this date differs from Transaction Date then the transaction might have happened offline.
31
+ def gettransactiondateatserver
32
+ @transactiondateatserver
33
+ end
34
+
35
+ # ===return
36
+ # String - the descriptive Outlet Name on which the selected recent transaction happened.
37
+ def getoutletname
38
+ @outletname
39
+ end
40
+
41
+ # ===return
42
+ # String - the descriptive Outlet Code on which the selected recent transaction happened.
43
+ def getoutletcode
44
+ @outletcode
45
+ end
46
+
47
+ # ===return
48
+ # String - the Invoice Number of the selected recent transaction.
49
+ def getinvoicenumber
50
+ @invoicenumber
51
+ end
52
+
53
+ # ===return
54
+ # String - the Transaction Type of the selected recent transaction.
55
+ def gettransactiontype
56
+ @transactiontype
57
+ end
58
+
59
+ # ===return
60
+ # Float - the Transaction Amount of the selected recent transaction.
61
+ def gettransactionamount
62
+ @transactionamount
63
+ end
64
+
65
+ # ===return
66
+ # Float - the Card Balance of the selected recent transaction.
67
+ def getcardbalance
68
+ @cardbalance
69
+ end
70
+
71
+ def setvalue(keypaircollection)
72
+ tempcoll = keypaircollection.split(/~/)
73
+ key = tempcoll[0]
74
+ value = tempcoll[1]
75
+ case key
76
+ when "CardNumber"
77
+ @cardnumber = value
78
+ when "TransactionDate"
79
+ @transactiondate = value
80
+ when "TransactionDateAtServer"
81
+ @transactiondateatserver = value
82
+ when "OutletName"
83
+ @outletname = value
84
+ when "OutletCode"
85
+ @outletcode = value
86
+ when "InvoiceNumber"
87
+ @invoicenumber = value
88
+ when "TransactionType"
89
+ @transactiontype = value
90
+ when "TransactionAmount"
91
+ @transactionamount = value
92
+ when "CardBalance"
93
+ @cardbalance = value
94
+ end
95
+ end
96
+ end
@@ -0,0 +1,24 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+
7
+ require 'SVClient/SVRequest'
8
+ require 'SVClient/SVGiftCardCodes'
9
+
10
+ class SVParamDownload < SVRequest
11
+ def initialize(type)
12
+ super(type)
13
+ end
14
+
15
+ protected
16
+ def gettransactiontypeid
17
+ @txntypeid = 0
18
+ case @requestType
19
+ when SVType::WEBPOS_GIFTCARD
20
+ @txntypeid = SVGiftCardCodes::PARAM_DOWNLOAD
21
+ end
22
+ return @txntypeid
23
+ end
24
+ end
@@ -0,0 +1,329 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+
7
+ require 'SVClient/SVTags'
8
+ require 'SVClient/SVType'
9
+
10
+ # =Overview
11
+ # This class contains values of parameters required to perform transactions with QwikCilver Server.
12
+ # Create an instance of this class, Populate the necessary parameters and pass it as a parameter to GCWebPos.initlibrary() method.
13
+ #
14
+ # GCWebPos.initlibrary() method returns an instance of this class which contains values of parameters provided by QwikCilver Server.
15
+ # The values contained in the returned object MUST be provided to each operation that needs to be performed with the QwikCilver Server
16
+ class SVProperties
17
+
18
+ protected
19
+ attr_accessor :parameters
20
+
21
+ private
22
+ @@DEFAULT_CONNECTION_TIMEOUT = 17000
23
+ @@CONNECTION_TIMEOUT = 'connectionTimeout'
24
+ @@TRANSACTION_TIMEOUT = 'transactionTimeout'
25
+ @@SVTYPE = 'svType'
26
+ @@SERVER_URL = 'serverURL'
27
+ @@ERROR_CODE = 'errorCode'
28
+ @@ERROR_MESSAGE = 'errorMessage'
29
+
30
+ def getvalue(key)
31
+ return nil if (key == nil)
32
+ return @parameters[key]
33
+ end
34
+
35
+ def setvalue(key, value = nil)
36
+ @parameters[key] = value
37
+ end
38
+
39
+ def update(src)
40
+ src.parameters.each { |key, value|
41
+ setvalue(key, value)
42
+ }
43
+ end
44
+
45
+ public
46
+ def initialize(src = nil)
47
+ @parameters = Hash.new
48
+ setvalue(@@CONNECTION_TIMEOUT, @@DEFAULT_CONNECTION_TIMEOUT)
49
+ setvalue(@@TRANSACTION_TIMEOUT, @@DEFAULT_CONNECTION_TIMEOUT)
50
+ setvalue(SVTags::TERMINAL_APP_VERSION, '0101')
51
+ update(src) if (src != nil)
52
+ setvalue(@@SVTYPE, SVType::WEBPOS_GIFTCARD)
53
+ end
54
+
55
+ # ===return
56
+ # String - the Forwarding Entity ID
57
+ def getforwardingentityid
58
+ return getvalue(SVTags::FORWARDING_ENTITY_ID)
59
+ end
60
+
61
+ # The value for this is pre-assigned by QwikCilver and provided to the Caller
62
+ #
63
+ # ===param
64
+ # String - Forwarding entity ID
65
+ def setforwardingentityid(value)
66
+ setvalue(SVTags::FORWARDING_ENTITY_ID, value)
67
+ end
68
+
69
+ # ===return
70
+ # String - The ForwardingEntityPassword
71
+ def getforwardingentitypassword
72
+ return getvalue(SVTags::FORWARDING_ENTITY_PASSWORD)
73
+ end
74
+
75
+ # The value for this is pre-assigned by QwikCilver and provided to the Caller
76
+ #
77
+ # ===param
78
+ # String - Forwarding Entity Password
79
+ def setforwardingentitypassword(value)
80
+ setvalue(SVTags::FORWARDING_ENTITY_PASSWORD, value)
81
+ end
82
+
83
+ # ===return
84
+ # String - The Server URL
85
+ def getserverurl
86
+ return getvalue(@@SERVER_URL)
87
+ end
88
+
89
+ # The value for this is pre-assigned by QwikCilver and provided to the Caller
90
+ #
91
+ # ===param
92
+ # String - Server URL
93
+ def setserverurl(value)
94
+ setvalue(@@SERVER_URL, value)
95
+ end
96
+
97
+ # ===return
98
+ # String - the Connection Timeout
99
+ def getconnectiontimeout()
100
+ return getvalue(@@CONNECTION_TIMEOUT)
101
+ end
102
+
103
+ # Set the Time Out value (in seconds) used for connections to QwikCilver Server.
104
+ # The value for this should have been pre-approved by QwikCilver
105
+ #
106
+ # ===param
107
+ # String - The Time Out value (in seconds) used for connections to QwikCilver Server
108
+ def setconnectiontimeout(timeout)
109
+ setvalue(@@CONNECTION_TIMEOUT, timeout)
110
+ end
111
+
112
+ # ===return
113
+ # String - The TransactionTimeout
114
+ def gettransactiontimeout()
115
+ return getvalue(@@TRANSACTION_TIMEOUT)
116
+ end
117
+
118
+ # Set the Time Out value (in seconds) used for connections to QwikCilver Server.
119
+ # The value for this should have been pre-approved by QwikCilver
120
+ #
121
+ # ===param
122
+ # String - The Time Out value (in seconds) used for connections to QwikCilver Server
123
+ def settransactiontimeout(timeout)
124
+ setvalue(@@TRANSACTION_TIMEOUT, timeout)
125
+ end
126
+
127
+ # ===return string - the acquirerId
128
+ def getacquirerid()
129
+ return getvalue(SVTags::ACQUIRER_ID)
130
+ end
131
+
132
+ # The value for this is pre-assigned by QwikCilver and provided to the Caller
133
+ #
134
+ # ===param
135
+ # String - Acquirer Id
136
+ def setacquirerid(value)
137
+ setvalue(SVTags::ACQUIRER_ID, value)
138
+ end
139
+
140
+ # ===return
141
+ # String - The username
142
+ def getusername()
143
+ return getvalue(SVTags::USER_ID)
144
+ end
145
+
146
+ # ===param
147
+ # String - username
148
+ def setusername(value)
149
+ setvalue(SVTags::USER_ID, value)
150
+ end
151
+
152
+
153
+ # ===return
154
+ # String - the password
155
+ def getpassword()
156
+ return getvalue(SVTags::PASSWORD)
157
+ end
158
+
159
+ # ===param
160
+ # String - password
161
+ def setpassword(value)
162
+ setvalue(SVTags::PASSWORD, value)
163
+ end
164
+
165
+
166
+ # ===return
167
+ # String - The Terminal ID
168
+ def getterminalid()
169
+ return getvalue(SVTags::TERMINAL_ID)
170
+ end
171
+
172
+ # ===param
173
+ # String - Terminal ID
174
+ def setterminalid(value)
175
+ setvalue(SVTags::TERMINAL_ID, value)
176
+ end
177
+
178
+ # ===return
179
+ # String - The Terminal App Version
180
+ def getterminalappversion()
181
+ return getvalue(SVTags::TERMINAL_APP_VERSION)
182
+ end
183
+
184
+ # ===param
185
+ # String - The Terminal App Version
186
+ def setterminalappversion(value)
187
+ setvalue(SVTags::TERMINAL_APP_VERSION, value)
188
+ end
189
+
190
+ # ===return
191
+ # String - The Merchant Outlet Name
192
+ def getmerchantoutletname()
193
+ return getvalue(SVTags::MERCHANT_OUTLET_NAME)
194
+ end
195
+
196
+ # ===param
197
+ # String - Merchant Outlet Name
198
+ def setmerchantoutletname(value)
199
+ setvalue(SVTags::MERCHANT_OUTLET_NAME, value)
200
+ end
201
+
202
+ # ===return
203
+ # String - The Organization Name
204
+ def getorganizationname()
205
+ return getvalue(SVTags::ORGANIZATION_NAME)
206
+ end
207
+
208
+ # ===param
209
+ # String - Organization Name
210
+ def setorganizationname(value)
211
+ setvalue(SVTags::ORGANIZATION_NAME, value)
212
+ end
213
+
214
+ # ===return
215
+ # String - The Pos Name
216
+ def getposname()
217
+ return getvalue(SVTags::POS_NAME)
218
+ end
219
+
220
+ # ===param
221
+ # String - Pos Name
222
+ def setposname(value)
223
+ setvalue(SVTags::POS_NAME, value)
224
+ end
225
+
226
+ # ===return
227
+ # String - The Track Data
228
+ def gettrackdata()
229
+ return getvalue(SVTags::TRACK_DATA)
230
+ end
231
+
232
+ # ===param
233
+ # String - Track Data
234
+ def settrackdata(value)
235
+ setvalue(SVTags::TRACK_DATA, value)
236
+ end
237
+
238
+ # ===return
239
+ # String - The Current Batch Number
240
+ def getcurrentbatchnumber()
241
+ return getvalue(SVTags::CURRENT_BATCH_NUMBER)
242
+ end
243
+
244
+ # ===param
245
+ # String - Current Batch Number
246
+ def setcurrentbatchnumber(value)
247
+ setvalue(SVTags::CURRENT_BATCH_NUMBER, value)
248
+ end
249
+
250
+ # ===return
251
+ # String - The Transaction ID
252
+ def gettransactionid()
253
+ return getvalue(SVTags::TRANSACTION_ID)
254
+ end
255
+
256
+ # ===param
257
+ # String - Transaction ID
258
+ def settransactionid(transactionId)
259
+ setvalue(SVTags::TRANSACTION_ID, transactionId)
260
+ end
261
+
262
+ # ===return
263
+ # String - The Pos Type ID
264
+ def getpostypeid()
265
+ return getvalue(SVTags::POS_TYPE_ID)
266
+ end
267
+
268
+ # ===param
269
+ # String - POS Type ID
270
+ def setpostypeid(value)
271
+ setvalue(SVTags::POS_TYPE_ID, value)
272
+ end
273
+
274
+ # ===return
275
+ # String - The Pos Entry Mode
276
+ def getposentrymode()
277
+ return getvalue(SVTags::POS_ENTRY_MODE)
278
+ end
279
+
280
+ # ===param
281
+ # String - POS Entry Mode
282
+ def setposentrymode(value)
283
+ setvalue(SVTags::POS_ENTRY_MODE, value)
284
+ end
285
+
286
+ # ===return
287
+ # String - The Merchant Name
288
+ def getmerchantname()
289
+ return getvalue(SVTags::MERCHANT_NAME)
290
+ end
291
+
292
+ # ===param
293
+ # String - Merchant Name
294
+ def setmerchantname(value)
295
+ setvalue(SVTags::MERCHANT_NAME, value)
296
+ end
297
+
298
+ # ===return
299
+ # Fixnum - The return value which indicates SUCESS or FAILURE
300
+ def geterrorcode()
301
+ return getvalue(@@ERROR_CODE)
302
+ end
303
+
304
+ # ===param
305
+ # Fixnum - Error code
306
+ def seterrorcode(value)
307
+ setvalue(@@ERROR_CODE, value)
308
+ end
309
+
310
+ # ===return
311
+ # String - The Error message
312
+ def geterrormessage()
313
+ return getvalue(@@ERROR_MESSAGE)
314
+ end
315
+
316
+ # ===param
317
+ # String - Error message
318
+ def seterrormessage(value)
319
+ setvalue(@@ERROR_MESSAGE, value)
320
+ end
321
+
322
+ def setsvtype(type)
323
+ setvalue(@@SVTYPE, type)
324
+ end
325
+
326
+ def getsvtype()
327
+ return getvalue(@@SVTYPE)
328
+ end
329
+ end