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,49 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+ #= Overview
7
+ # Class that contains utility methods.
8
+ #
9
+
10
+ require 'date'
11
+
12
+ class SVQcsData
13
+ protected
14
+ @@params = Hash.new
15
+
16
+ public
17
+ # Method to get the value from the params array
18
+ def getvalue(key)
19
+ return @@params[key] if (key != nil)
20
+ return nil
21
+ end
22
+
23
+ def getvalueasfloat(key)
24
+ return SVUtils.getfloat(getvalue(key)[0])
25
+ end
26
+
27
+ def getvalueasint(key)
28
+ value = getvalue(key)
29
+ return value[0].to_i if(value != nil && !SVUtils::isnullorempty(value[0]))
30
+ return nil
31
+ end
32
+
33
+ # Method to set the value to the params array
34
+ def setvalue(key, value)
35
+ @@params[key] = value
36
+ end
37
+
38
+ #Method to get the value in certain date format
39
+ def getdate(key, format)
40
+ @value = getvalue(key)
41
+ return SVUtils::getdate(@value, format)
42
+ end
43
+
44
+ # Method to print the parameters
45
+ def printparams
46
+ return if @@params.empty?
47
+ @@params.each {|key, value| puts "#{key} : #{value}" }
48
+ end
49
+ end
@@ -0,0 +1,10 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+
7
+ class SVRecentTransactions
8
+ attr_accessor :cardnumber, :transactiondate, :transactiondateatserver, :outletname,
9
+ :outletcode, :invoicenumber, :transactiontype, :transactionamount, :cardbalance
10
+ end
@@ -0,0 +1,28 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+ #=Overview
7
+ # Class used by GCWebPos to perform Redeem transaction
8
+ #
9
+
10
+ require 'SVClient/SVRequest'
11
+ require 'SVClient/SVGiftCardCodes'
12
+ require 'SVClient/SVType'
13
+
14
+ class SVRedeem < SVRequest
15
+ def initialize(type)
16
+ super(type)
17
+ end
18
+
19
+ protected
20
+ def gettransactiontypeid
21
+ @txntypeid = 0
22
+ case @requestType
23
+ when SVType::WEBPOS_GIFTCARD
24
+ @txntypeid = SVGiftCardCodes::REDEEM
25
+ end
26
+ return @txntypeid
27
+ end
28
+ end
@@ -0,0 +1,495 @@
1
+ #
2
+ # © 2011 QwikCilver Solutions Private Limited, All Rights Reserved.
3
+ #
4
+ # @author Nityananda
5
+ #
6
+
7
+ require 'net/http'
8
+ require 'uri'
9
+
10
+ require 'SVClient/SVQcsData'
11
+ require 'SVClient/SVStatus'
12
+ require 'SVClient/SVResponse'
13
+
14
+ # Abstract base class for all SVClient Operations.
15
+ #
16
+ # Currently Supported operations (Direct Known Subclasses) are:
17
+ # 1. SVBalanceEnquiry - Class for Balance Enquiry operation
18
+ # 2. SVRedeem - Class for Redeem operation
19
+ # 3. SVCancelRedeem - Class for Load Card operation
20
+ #
21
+ # To perform a desired operation:
22
+ # 1. instantiate the appropriate operation class
23
+ # 2. set all the required attributes/properties
24
+ # 3. call SVRequest.execute() method
25
+ # 4. SVRequest.execute() method returns a SVResponse object
26
+ # 5. check the execution status of SVRequest.execute() method by calling SVResponse.geterrorcode() method
27
+ # 6. if return value is SVStatus.SUCCESS then read the desired attributes/properties using the appropriate getters in SVResponse object
28
+ # 7. if return value is not equal to SVStatus::SUCCESS then get the error message by calling SVResponse.getErrorMessage()
29
+ #
30
+ # *NOTE:*
31
+ # If the value of any key/attribute is set to null then that key/attribute
32
+ # will not be sent to QwikCilver Server as part of the Request data. Only keys/attributes
33
+ # that have a value will be sent to QwikCilver Server as part of the Request data.
34
+ class SVRequest < SVQcsData
35
+ protected
36
+ attr_accessor :requestURL, :txnTimeOut, :requestType, :connectionTimeOut
37
+
38
+ def gettransactiontypeid() return 0 end
39
+
40
+ public
41
+ def initialize(svProps)
42
+ super()
43
+ @requestType = svProps.getsvtype
44
+ @txnTimeOut = svProps.gettransactiontimeout
45
+ @connectionTimeOut = svProps.getconnectiontimeout
46
+ @requestURL = svProps.getserverurl
47
+
48
+ case @requestType
49
+ when SVType::WEBPOS_GIFTCARD
50
+ populatewebposgiftcardparams(svProps)
51
+ #when SVType::WEBPOS_LOYALTY
52
+ # populatewebposloyaltyparams(svProps)
53
+ #else
54
+ # populateallparams(svProps)
55
+ end
56
+ end
57
+
58
+ # ===return
59
+ # String - Card number
60
+ def getcardnumber
61
+ return getvalue(SVTags::CARD_NUMBER)
62
+ end
63
+
64
+ # ===return
65
+ # String - Current batch number
66
+ def getcurrentbatchnumber
67
+ return getvalue(SVTags::CURRENT_BATCH_NUMBER)
68
+ end
69
+
70
+ # ===return
71
+ # String - Transaction ID
72
+ def gettransactionid
73
+ return getvalue(SVTags::TRANSACTION_ID)
74
+ end
75
+
76
+ # ===return
77
+ # String - Original Transaction ID
78
+ def getoriginaltransactionid
79
+ return getvalue(SVTags::ORIGINAL_TRANSACTION_ID)
80
+ end
81
+
82
+ # ===return
83
+ # String - Original Invoice Number
84
+ def getoriginalinvoicenumber
85
+ return getvalue(SVTags::ORIGINAL_INVOICE_NUMBER)
86
+ end
87
+
88
+ # ===return
89
+ # String - Terminal ID
90
+ def getterminalid
91
+ return getvalue(SVTags::TERMINAL_ID)
92
+ end
93
+
94
+ # ===return
95
+ # String - Track Data
96
+ def gettrackdata
97
+ return getvalue(SVTags::TRACK_DATA)
98
+ end
99
+
100
+ # Method for getting the Phone Number.
101
+ #
102
+ # ===return
103
+ # String - Phone number
104
+ def getphonenumber
105
+ return getvalue(SVTags::PHONE_NUMBER)
106
+ end
107
+
108
+ # Method for getting the original approval code.
109
+ #
110
+ # ===return
111
+ # String - Original Approval code
112
+ def getoriginalapprovalcode
113
+ return getvalue(SVTags::ORIGINAL_APPROVAL_CODE)
114
+ end
115
+
116
+ # Method for getting the approval code.
117
+ #
118
+ # ===return
119
+ # String - Approval code
120
+ def getapprovalcode
121
+ return getvalue(SVTags::APPROVAL_CODE)
122
+ end
123
+
124
+ # Method for getting the amount used in an operation on a card.
125
+ #
126
+ # ===return
127
+ # Float - Amount
128
+ def getamount
129
+ return getvalue(SVTags::AMOUNT)
130
+ end
131
+
132
+ # Method for getting the original amount used in an operation on a card.
133
+ #
134
+ # ===return
135
+ # String - Original Amount
136
+ def getoriginalamount
137
+ return getvalue(SVTags::ORIGINAL_AMOUNT)
138
+ end
139
+
140
+ # Method for getting the Corporate Name.
141
+ #
142
+ # ===return
143
+ # String - The Corporate Name.
144
+ def getcorporatename
145
+ return getvalue(SVTags::CORPORATE_NAME)
146
+ end
147
+
148
+ # Method for getting the Card Program Group Name.
149
+ #
150
+ # ===return
151
+ # String - The Card Program Group Name.
152
+ def getcardprogramgroupname
153
+ return getvalue(SVTags::CARD_PROGRAM_GROUP_NAME)
154
+ end
155
+
156
+ # Method for getting the Invoice Number specified for an operation on a card
157
+ #
158
+ # ===return
159
+ # String - the Invoice Number specified for this operation.
160
+ def getinvoicenumber
161
+ return getvalue(SVTags::INVOICE_NUMBER)
162
+ end
163
+
164
+ # Method for getting the Transfer Card Number.
165
+ #
166
+ # ===return
167
+ # String - The Transfer Card Number.
168
+ def gettransfercardnumber
169
+ return getvalue(SVTags::TRANSFER_CARD_NUMBER)
170
+ end
171
+
172
+ # Method for getting the Track Data of the Transfer card
173
+ #
174
+ # ===return
175
+ # String - the Track Data of the Transfer card
176
+ def gettransfertrackdata
177
+ return getvalue(SVTags::TRACK_DATA)
178
+ end
179
+
180
+ # Method for getting the First Name
181
+ #
182
+ # ===return
183
+ # String - The First Name
184
+ def getfirstname
185
+ return getvalue(SVTags::FIRST_NAME)
186
+ end
187
+
188
+ # Method for getting the Last Name
189
+ #
190
+ # ===return
191
+ # String - The Last Name
192
+ def getlastname
193
+ return getvalue(SVTags::LAST_NAME)
194
+ end
195
+
196
+ # Method for getting the AdditionalTxnRef1
197
+ #
198
+ # ===return
199
+ # String - The AdditionalTxnRef1
200
+ #
201
+
202
+ def getadditionaltxnref1
203
+ return getvalue(SVTags::ADDITIONAL_TXN_REF_1)
204
+ end
205
+
206
+ # Method for getting the IIN
207
+ #
208
+ # ===return
209
+ # String - The IIN
210
+ def getiin
211
+ return getvalue(SVTags::IIN)
212
+ end
213
+
214
+ # Method for getting the Settlement Date.
215
+ #
216
+ # ===return
217
+ # Date - The Settlement Date.
218
+ def getsettlementdate
219
+ return getdate(SVTags::SETTLEMENT_DATE, SVUtils::QC_SERVER_DATE_FORMAT)
220
+ end
221
+
222
+ # Method for getting the Activation Amount
223
+ #
224
+ # ===return
225
+ # Float - The Activation amount specified for this operation
226
+ def getactivationamount
227
+ return getvalue(SVTags::ACTIVATION_AMOUNT)
228
+ end
229
+
230
+ # Method for getting the Activation Count
231
+ #
232
+ # ===return
233
+ # Bignum - The Activation Count specified for this operation
234
+ def getactivationcount
235
+ return getvalue(SVTags::ACTIVATION_COUNT)
236
+ end
237
+
238
+ # Method for getting the Cancel Activation Amount
239
+ #
240
+ # ===return
241
+ # Float - The Cancel Activation amount specified for this operation
242
+ def getcancelactivationamount
243
+ return getvalue(SVTags::CANCEL_ACTIVATION_AMOUNT)
244
+ end
245
+
246
+ # Method for getting the Cancel Activation Count
247
+ #
248
+ # ===return
249
+ # Bignum - The Cancel Activation Count specified for this operation
250
+ def getcancelactivationcount
251
+ return getvalue(SVTags::CANCEL_ACTIVATION_COUNT)
252
+ end
253
+
254
+ # Method for getting the Reload Amount
255
+ #
256
+ # ===return
257
+ # Float - The Reload amount specified for this operation
258
+ def getreloadamount
259
+ return getvalue(SVTags::RELOAD_AMOUNT)
260
+ end
261
+
262
+ # Method for getting the Reload Count
263
+ #
264
+ # ===return
265
+ # Bignum - The Reload Count specified for this operation
266
+ def getreloadcount
267
+ return getvalue(SVTags::RELOAD_COUNT)
268
+ end
269
+
270
+ # Method for getting the Cancel Load Amount
271
+ #
272
+ # ===return
273
+ # Float - The Cancel Load amount specified for this operation
274
+ def getcancelloadamount
275
+ return getvalue(SVTags::CANCEL_LOAD_AMOUNT)
276
+ end
277
+
278
+ # Method for getting the Cancel Load Count
279
+ #
280
+ # ===return
281
+ # Bignum - The Cancel Load Count specified for this operation
282
+ def getcancelloadcount
283
+ return getvalue(SVTags::CANCEL_LOAD_COUNT)
284
+ end
285
+
286
+ # Method for getting the Redeem Amount
287
+ #
288
+ # ===return
289
+ # Float - The Redeem amount specified for this operation
290
+ def getredeemamount
291
+ return getvalue(SVTags::REDEEM_AMOUNT)
292
+ end
293
+
294
+ # Method for getting the Redeem Count
295
+ #
296
+ # ===return
297
+ # Bignum - The Redeem Count specified for this operation
298
+ def getredeemcount
299
+ return getvalue(SVTags::REDEEM_COUNT)
300
+ end
301
+
302
+ # Method for getting the Cancel Redeem Amount
303
+ #
304
+ # ===return
305
+ # Float - The Cancel Redeem amount specified for this operation
306
+ def getcancelredeemamount
307
+ return getvalue(SVTags::CANCEL_REDEEM_AMOUNT)
308
+ end
309
+
310
+ # Method for getting the Cancel Redeem Count
311
+ #
312
+ # ===return
313
+ # Bignum - The Cancel Redeem Count specified for this operation
314
+ def getnotes
315
+ return getvalue(SVTags::NOTES)
316
+ end
317
+
318
+ # Method for getting the Notes
319
+ #
320
+ # ===return
321
+ # String - The Notes specified for this operation
322
+ def getcancelredeemcount
323
+ return getvalue(SVTags::CANCEL_REDEEM_COUNT)
324
+ end
325
+
326
+ # Method to get the Bill Amount
327
+ #
328
+ # ===return
329
+ # Float - The Bill Amount for this operation.
330
+ def getbillamount
331
+ return getvalue(SVTags::BILL_AMOUNT)
332
+ end
333
+
334
+ def setterminalid(value) setvalue(SVTags::TERMINAL_ID, value) end
335
+ def setuserid(value) setvalue(SVTags::USER_ID, value) end
336
+ def setpassword(value) setvalue(SVTags::PASSWORD, value) end
337
+ def setforwardingentityid(value) setvalue(SVTags::FORWARDING_ENTITY_ID, value) end
338
+ def setforwardingentitypassword(value) setvalue(SVTags::FORWARDING_ENTITY_PASSWORD, value) end
339
+ def setmerchantoutletname(value) setvalue(SVTags::MERCHANT_OUTLET_NAME, value) end
340
+ def setacquirerid(value) setvalue(SVTags::ACQUIRER_ID, value) end
341
+ def setorganizationname(value) setvalue(SVTags::ORGANIZATION_NAME, value) end
342
+ def setcorporatename(value) setvalue(SVTags::CORPORATE_NAME, value)end
343
+ def setposname(value) setvalue(SVTags::POS_NAME, value) end
344
+ def setterminalappversion(value) setvalue(SVTags::TERMINAL_APP_VERSION, value) end
345
+ def setcurrentbatchnumber(value) setvalue(SVTags::CURRENT_BATCH_NUMBER, value) end
346
+ def settransactionid(value) setvalue(SVTags::TRANSACTION_ID, value) end
347
+ def setposentrymode(value) setvalue(SVTags::POS_ENTRY_MODE, value) end
348
+ def setpostypeid(value) setvalue(SVTags::POS_TYPE_ID, value) end
349
+ def settrackdata(value) setvalue(SVTags::TRACK_DATA, value) end
350
+ def setcardnumber(value) setvalue(SVTags::CARD_NUMBER, value) end
351
+ def setcardpin(value) setvalue(SVTags::CARD_PIN, value) end
352
+ def setinvoicenumber(value) setvalue(SVTags::INVOICE_NUMBER, value) end
353
+ def setamount(value) setvalue(SVTags::AMOUNT, value) end
354
+ def setoriginalinvoicenumber(value) setvalue(SVTags::ORIGINAL_INVOICE_NUMBER, value) end
355
+ def setoriginaltransactionid(value) setvalue(SVTags::ORIGINAL_TRANSACTION_ID, value) end
356
+ def setoriginalbatchnumber(value) setvalue(SVTags::ORIGINAL_BATCH_NUMBER, value) end
357
+ def setoriginalapprovalcode(value) setvalue(SVTags::ORIGINAL_APPROVAL_CODE, value) end
358
+ def setoriginalamount(value) setvalue(SVTags::ORIGINAL_AMOUNT, value) end
359
+ def setcardprogramgroupname(value) setvalue(SVTags::CARD_PROGRAM_GROUP_NAME, value) end
360
+ def setfirstname(value) setvalue(SVTags::FIRST_NAME, value) end
361
+ def setlastname(value) setvalue(SVTags::LAST_NAME, value) end
362
+ def setphonenumber(value) setvalue(SVTags::PHONE_NUMBER, value) end
363
+ def setadditionaltxnref1(value) setvalue(SVTags::ADDITIONAL_TXN_REF_1, value) end
364
+ def setusername(value) setvalue(SVTags::USER_ID, value) end
365
+ def setactivationcount(value) setvalue(SVTags::ACTIVATION_COUNT, value) end
366
+ def setcancelactivationcount(value) setvalue(SVTags::CANCEL_ACTIVATION_COUNT, value) end
367
+ def setredeemcount(value) setvalue(SVTags::REDEEM_COUNT, value) end
368
+ def setcancelredeemcount(value) setvalue(SVTags::CANCEL_REDEEM_COUNT, value) end
369
+ def setreloadcount(value) setvalue(SVTags::RELOAD_COUNT, value) end
370
+ def setcancelloadcount(value) setvalue(SVTags::CANCEL_LOAD_COUNT, value) end
371
+ def setactivationamount(value) setvalue(SVTags::ACTIVATION_AMOUNT, value) end
372
+ def setredeemamount(value) setvalue(SVTags::REDEEM_AMOUNT, value) end
373
+ def setreloadamount(value) setvalue(SVTags::RELOAD_AMOUNT, value) end
374
+ def setcancelactivationamount(value) setvalue(SVTags::CANCEL_ACTIVATION_AMOUNT, value) end
375
+ def setcancelredeemamount(value) setvalue(SVTags::CANCEL_REDEEM_AMOUNT, value) end
376
+ def setcancelloadamount(value) setvalue(SVTags::CANCEL_LOAD_AMOUNT, value) end
377
+ def setaddoncardnumber(value) setvalue(SVTags::ADDON_CARD_NUMBER,value) end
378
+ def setaddoncardtrackdata(value) setvalue(SVTags::ADDON_CARD_TRACK_DATA,value) end
379
+ def settransfercardnumber(value) setvalue(SVTags::TRANSFER_CARD_NUMBER,value) end
380
+ def setnotes(value) setvalue(SVTags::NOTES,value) end
381
+ def setemployeeid(value) setvalue(SVTags::EMPLOYEE_ID,value) end
382
+ def setsalutation(value) setvalue(SVTags::SALUTATION,value) end
383
+ def setaddress1(value) setvalue(SVTags::ADDRESS1,value) end
384
+ def setaddress2(value) setvalue(SVTags::ADDRESS2,value) end
385
+ def setarea(value) setvalue(SVTags::AREA,value) end
386
+ def setcity(value) setvalue(SVTags::CITY,value) end
387
+ def setstate(value) setvalue(SVTags::STATE,value) end
388
+ def setcountry(value) setvalue(SVTags::COUNTRY,value) end
389
+ def setpincode(value) setvalue(SVTags::PIN_CODE,value) end
390
+ def setphonealternate(value) setvalue(SVTags::PHONE_ALTERNATE,value) end
391
+ def setemail(value) setvalue(SVTags::EMAIL,value) end
392
+ def setdob(value) setvalue(SVTags::DOB,value) end
393
+ def setanniversary(value) setvalue(SVTags::ANNIVERSARY,value) end
394
+ def setgender(value) setvalue(SVTags::GENDER,value) end
395
+ def setmaritalstatus(value) setvalue(SVTags::MARITAL_STATUS,value) end
396
+ def setapprovalcode(value) setvalue(SVTags::APPROVAL_CODE, value) end
397
+ def setbillamount(value) setvalue(SVTags::BILL_AMOUNT, value) end
398
+
399
+ def populatewebposgiftcardparams(svProps)
400
+ setvalue(SVTags::DATE_AT_CLIENT, SVUtils::getcurrentdate())
401
+ setvalue(SVTags::FORWARDING_ENTITY_ID, svProps.getforwardingentityid())
402
+ setvalue(SVTags::FORWARDING_ENTITY_PASSWORD, svProps.getforwardingentitypassword())
403
+ setvalue(SVTags::ACQUIRER_ID, svProps.getacquirerid())
404
+ setvalue(SVTags::TERMINAL_APP_VERSION, svProps.getterminalappversion())
405
+ setvalue(SVTags::TRANSACTION_TYPE_ID, gettransactiontypeid())
406
+ setvalue(SVTags::TRANSACTION_ID, svProps.gettransactionid())
407
+ setvalue(SVTags::TERMINAL_ID, svProps.getterminalid())
408
+ setvalue(SVTags::USER_ID, svProps.getusername())
409
+ setvalue(SVTags::PASSWORD, svProps.getpassword())
410
+ setvalue(SVTags::POS_ENTRY_MODE, svProps.getposentrymode())
411
+ setvalue(SVTags::POS_TYPE_ID, svProps.getpostypeid())
412
+ setvalue(SVTags::ORGANIZATION_NAME, svProps.getorganizationname())
413
+ setvalue(SVTags::MERCHANT_NAME, svProps.getmerchantname())
414
+ setvalue(SVTags::MERCHANT_OUTLET_NAME, svProps.getmerchantoutletname())
415
+ setvalue(SVTags::POS_NAME, svProps.getposname())
416
+ setvalue(SVTags::CURRENT_BATCH_NUMBER, svProps.getcurrentbatchnumber())
417
+ end
418
+
419
+ #def populatewebposloyaltyparams(svProps)
420
+ # setvalue(SVTags::DATE_AT_CLIENT, SVUtils::getcurrentdate())
421
+ # setvalue(SVTags::FORWARDING_ENTITY_ID, svProps.getforwardingentityid())
422
+ # setvalue(SVTags::FORWARDING_ENTITY_PASSWORD, svProps.getforwardingentitypassword())
423
+ # setvalue(SVTags::ACQUIRER_ID, svProps.getacquirerid())
424
+ # setvalue(SVTags::TERMINAL_APP_VERSION, svProps.getterminalappversion())
425
+ # setvalue(SVTags::TRANSACTION_TYPE_ID, gettransactiontypeid())
426
+ # setvalue(SVTags::TRANSACTION_ID, svProps.gettransactionid())
427
+ # setvalue(SVTags::TERMINAL_ID, svProps.getterminalid())
428
+ # setvalue(SVTags::USER_ID, svProps.getusername())
429
+ # setvalue(SVTags::PASSWORD, svProps.getpassword())
430
+ # setvalue(SVTags::POS_ENTRY_MODE, svProps.getposentrymode())
431
+ # setvalue(SVTags::POS_TYPE_ID, svProps.getpostypeid())
432
+ # setvalue(SVTags::ORGANIZATION_NAME, svProps.getorganizationname())
433
+ # setvalue(SVTags::MERCHANT_NAME, svProps.getmerchantname())
434
+ # setvalue(SVTags::MERCHANT_OUTLET_NAME, svProps.getmerchantoutletname())
435
+ # setvalue(SVTags::POS_NAME, svProps.getposname())
436
+ # setvalue(SVTags::CURRENT_BATCH_NUMBER, svProps.getcurrentbatchnumber())
437
+ #end
438
+
439
+ #
440
+ def populateallparams(svProps)
441
+ setvalue(SVTags::DATE_AT_CLIENT, SVUtils::getcurrentdate())
442
+ setvalue(SVTags::FORWARDING_ENTITY_ID, svProps.getforwardingentityid())
443
+ setvalue(SVTags::FORWARDING_ENTITY_PASSWORD, svProps.getforwardingentitypassword())
444
+ setvalue(SVTags::ACQUIRER_ID, svProps.getacquirerid())
445
+ setvalue(SVTags::TERMINAL_APP_VERSION, svProps.getterminalappversion())
446
+ setvalue(SVTags::TRANSACTION_TYPE_ID, gettransactiontypeid())
447
+ setvalue(SVTags::TRANSACTION_ID, svProps.gettransactionid())
448
+ setvalue(SVTags::TERMINAL_ID, svProps.getterminalid())
449
+ setvalue(SVTags::USER_ID, svProps.getusername())
450
+ setvalue(SVTags::PASSWORD, svProps.getpassword())
451
+ setvalue(SVTags::POS_ENTRY_MODE, svProps.getposentrymode())
452
+ setvalue(SVTags::POS_TYPE_ID, svProps.getpostypeid())
453
+ setvalue(SVTags::ORGANIZATION_NAME, svProps.getorganizationname())
454
+ setvalue(SVTags::MERCHANT_NAME, svProps.getmerchantname())
455
+ setvalue(SVTags::MERCHANT_OUTLET_NAME, svProps.getmerchantoutletname())
456
+ setvalue(SVTags::POS_NAME, svProps.getposname())
457
+ setvalue(SVTags::CURRENT_BATCH_NUMBER, svProps.getcurrentbatchnumber())
458
+ end
459
+
460
+ # ===return
461
+ # SVResponse SVResponse instance that contains the response data for this operation
462
+ def execute
463
+ url = URI.parse(@requestURL)
464
+ req = Net::HTTP::Post.new(url.path)
465
+ req.set_form_data(@@params)
466
+ @returncode = SVStatus::SUCCESS
467
+ begin
468
+ httpresponse = Net::HTTP.new(url.host, url.port).start {
469
+ |http|
470
+ http.read_timeout = @txnTimeOut
471
+ http.open_timeout = @connectionTimeOut
472
+ http.request(req)
473
+ }
474
+ rescue Timeout::Error
475
+ @returncode = SVStatus::CONNECTION_TIMEOUT_ERROR
476
+ end
477
+
478
+ case httpresponse
479
+ when Net::HTTPBadResponse, Net::HTTPBadGateway, Net::HTTPBadRequest, Net::HTTPExceptions, Net::HTTPError then
480
+ @returncode = SVStatus::UNKNOWN_ERROR
481
+ when Net::HTTPSuccess
482
+ @returncode = SVStatus::SUCCESS
483
+ else
484
+ @returncode = SVStatus::UNKNOWN_ERROR
485
+ end
486
+
487
+ @returnmessage = SVStatus.getmessage(@returncode) if (@returncode != SVStatus::SUCCESS)
488
+ return SVResponse.new(@returncode, @returnmessage, httpresponse)
489
+ end
490
+
491
+ private
492
+ def getcardtype
493
+ return getvalue(SVTags::CARD_TYPE)
494
+ end
495
+ end