worldpay 1.0.6 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/worldpay.rb +394 -314
- data/worldpay-1.0.6.gem +0 -0
- data/worldpay-1.0.7.gem +0 -0
- data/worldpay-1.1.0.gem +0 -0
- data/worldpay.gemspec +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eee0db6849c02df70489b192a32233a483e59879
|
4
|
+
data.tar.gz: 173aebc6ea7f5f2fcb5ba25c35276aa5e039770f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9e7eda93ecf9485f4761c0f4d2c3989195f81d5456a391355a6ebd62fd1e61e020e2719611b64b83ffda68c2d8293dc2acd137348c752c6fb780be9ba8f8544
|
7
|
+
data.tar.gz: bc4cb570ac6766a3631628a2105a7b67cf1231fb680bf61c0c4d8a0d4742f11617015c86f84efb1e431516075a2dab6208a5dbfbae3b45a08c3e6916e8787be4
|
data/lib/worldpay.rb
CHANGED
@@ -6,319 +6,399 @@ require "json"
|
|
6
6
|
|
7
7
|
class Worldpay
|
8
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
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
9
|
+
@service_key = ''
|
10
|
+
@timeout = 0
|
11
|
+
@disable_ssl = false
|
12
|
+
@endpoint = ''
|
13
|
+
|
14
|
+
@errors = {}
|
15
|
+
@raise_errors = true
|
16
|
+
|
17
|
+
@version = '1.0.6'
|
18
|
+
|
19
|
+
@orderTypes = ['ECOM','MOTO','RECURRING']
|
20
|
+
|
21
|
+
|
22
|
+
def initialize(service_key='', timeout=3, raise_errors=true)
|
23
|
+
if service_key.empty?
|
24
|
+
raise "Please set a Service Key"
|
25
|
+
else
|
26
|
+
@service_key = service_key
|
27
|
+
@timeout = timeout
|
28
|
+
|
29
|
+
@disable_ssl = false
|
30
|
+
@endpoint = 'https://api.worldpay.com'
|
31
|
+
|
32
|
+
@errors = {
|
33
|
+
'ip' => 'Invalid parameters',
|
34
|
+
'cine' => 'php_curl was not found',
|
35
|
+
'to' => 'Request timed out',
|
36
|
+
'nf' => 'Not found',
|
37
|
+
'apierror' => 'API Error',
|
38
|
+
'uanv' => 'Worldpay is currently unavailable, please try again later',
|
39
|
+
'contact' => 'Error contacting Worldpay, please try again later',
|
40
|
+
'ssl' => 'You must enable SSL check in production mode',
|
41
|
+
'verify' => 'Worldpay not verifying SSL connection',
|
42
|
+
'orderInput' => {
|
43
|
+
'token' => 'No token found',
|
44
|
+
'orderCode' => 'No order_code entered',
|
45
|
+
'orderDescription' => 'No order_description found',
|
46
|
+
'amount' => 'No amount found, or it is not a whole number',
|
47
|
+
'currencyCode' => 'No currency_code found',
|
48
|
+
'name' => 'No name found',
|
49
|
+
'billingAddress' => 'No billing_address found'
|
50
|
+
},
|
51
|
+
'notificationPost' => 'Notification Error: Not a post',
|
52
|
+
'notificationUnknown' => 'Notification Error: Cannot be processed',
|
53
|
+
'capture' => {
|
54
|
+
'ordercode' => 'No order code entered'
|
55
|
+
},
|
56
|
+
'refund' => {
|
57
|
+
'ordercode' => 'No order code entered'
|
58
|
+
},
|
59
|
+
'json' => 'JSON could not be decoded',
|
60
|
+
'key' => 'Please enter your service key',
|
61
|
+
'sslerror' => 'Worldpay SSL certificate could not be validated'
|
62
|
+
}
|
63
|
+
@raise_errors = raise_errors
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def setEndpoint(endpoint)
|
68
|
+
@endpoint = endpoint
|
69
|
+
end
|
70
|
+
|
71
|
+
#Disable SSL Check ~ Use only for testing!
|
72
|
+
def disableSSLCheck(disable = false)
|
73
|
+
@disable_ssl = disable
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
#Set timeout
|
78
|
+
def setTimeout(timeout = 3)
|
79
|
+
@timeout = timeout
|
80
|
+
end
|
81
|
+
|
82
|
+
#ERRORS
|
83
|
+
def onError(error, message=false, code=nil, httpStatusCode=nil, description=nil, customCode=nil)
|
84
|
+
|
85
|
+
|
86
|
+
if (@raise_errors)
|
87
|
+
raise message.to_s
|
88
|
+
else
|
89
|
+
p message.to_s
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
#ORDERS
|
94
|
+
def checkOrderInput(order)
|
95
|
+
errors2 = []
|
96
|
+
|
97
|
+
if (!order.any?)
|
98
|
+
onError('ip')
|
99
|
+
end
|
100
|
+
if (order['token']==nil)
|
101
|
+
errors2 << @errors['orderInput']['token']
|
102
|
+
end
|
103
|
+
if (order['orderDescription']==nil)
|
104
|
+
errors2 << @errors['orderInput']['orderDescription']
|
105
|
+
end
|
106
|
+
if (order['amount']==nil)
|
107
|
+
errors2 << @errors['orderInput']['amount']
|
108
|
+
end
|
109
|
+
if (order['currencyCode']==nil)
|
110
|
+
errors2 << @errors['orderInput']['currencyCode']
|
111
|
+
end
|
112
|
+
if (order['name']==nil)
|
113
|
+
errors2 << @errors['orderInput']['name']
|
114
|
+
end
|
115
|
+
if (order['billingAddress']==nil)
|
116
|
+
errors2 << @errors['orderInput']['billingAddress']
|
117
|
+
end
|
118
|
+
|
119
|
+
if (errors2.length > 0)
|
120
|
+
onError('ip', errors2.join(', '))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def createOrder(order={})
|
125
|
+
|
126
|
+
self.checkOrderInput(order)
|
127
|
+
|
128
|
+
defaults = {
|
129
|
+
'orderType' => 'ECOM', #Order Type: ECOM/MOTO/RECURRING
|
130
|
+
'customerIdentifiers' => nil,
|
131
|
+
'billingAddress' => nil,
|
132
|
+
'deliveryAddress' => nil
|
133
|
+
}
|
134
|
+
|
135
|
+
order = defaults.merge(order)
|
136
|
+
|
137
|
+
fmt = "%05.2f" % order['amount']
|
138
|
+
cost_cents = fmt.split('.').join('')
|
139
|
+
|
140
|
+
_authorizeOnly = false
|
141
|
+
if order['authorizeOnly']
|
142
|
+
_authorizeOnly = order['authorizeOnly']
|
143
|
+
elsif
|
144
|
+
order['authoriseOnly']
|
145
|
+
_authorizeOnly = order['authoriseOnly']
|
146
|
+
end
|
147
|
+
|
148
|
+
request = {
|
149
|
+
'token' => order['token'],
|
150
|
+
'orderDescription' => order['orderDescription'],
|
151
|
+
'amount' => cost_cents,
|
152
|
+
'is3DSOrder' => order['3DS'],
|
153
|
+
'currencyCode' => order['currencyCode'],
|
154
|
+
'name' => order['name'],
|
155
|
+
'orderType' => order['orderType'] && @orderTypes ? (@orderTypes.include?(order['orderType']) ? order['orderType'] : 'ECOM') : 'ECOM',
|
156
|
+
'authorizeOnly' => _authorizeOnly,
|
157
|
+
'billingAddress' => order['billingAddress'],
|
158
|
+
'deliveryAddress' => order['deliveryAddress'],
|
159
|
+
'customerOrderCode' => order['customerOrderCode'],
|
160
|
+
'customerIdentifiers' => order['customerIdentifiers']
|
161
|
+
}
|
162
|
+
|
163
|
+
if(request['is3DSOrder'] == true)
|
164
|
+
threeDsInfo = {
|
165
|
+
'shopperIpAddress' => order['shopperIpAddress'],
|
166
|
+
'shopperSessionId' => order['shopperSessionId'],
|
167
|
+
'shopperUserAgent' => order['shopperUserAgent'],
|
168
|
+
'shopperAcceptHeader' => order['shopperAcceptHeader']
|
169
|
+
}
|
170
|
+
request.merge!(threeDsInfo)
|
171
|
+
end
|
172
|
+
|
173
|
+
response = sendRequest('orders', request.to_json, true)
|
174
|
+
|
175
|
+
if (response['body']['orderCode'])
|
176
|
+
#success
|
177
|
+
return response
|
178
|
+
else
|
179
|
+
onError('apierror', response.to_s)
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
|
184
|
+
def createAPMOrder(order={})
|
185
|
+
|
186
|
+
self.checkOrderInput(order)
|
187
|
+
|
188
|
+
defaults = {
|
189
|
+
'deliveryAddress' => nil,
|
190
|
+
'billingAddress' => nil,
|
191
|
+
'successUrl' => nil,
|
192
|
+
'pendingUrl' => nil,
|
193
|
+
'failureUrl' => nil,
|
194
|
+
'cancelUrl' => nil
|
195
|
+
}
|
196
|
+
|
197
|
+
order = defaults.merge(order)
|
198
|
+
|
199
|
+
fmt = "%05.2f" % order['amount']
|
200
|
+
cost_cents = fmt.split('.').join('')
|
201
|
+
|
202
|
+
request = {
|
203
|
+
'token' => order['token'],
|
204
|
+
'orderDescription' => order['orderDescription'],
|
205
|
+
'amount' => cost_cents,
|
206
|
+
'currencyCode' => order['currencyCode'],
|
207
|
+
'name' => order['name'],
|
208
|
+
'shopperEmailAddress' => order['shopperEmailAddress'],
|
209
|
+
'billingAddress' => order['billingAddress'],
|
210
|
+
'deliveryAddress' => order['deliveryAddress'],
|
211
|
+
'customerOrderCode' => order['customerOrderCode'],
|
212
|
+
'successUrl' => order['successUrl'],
|
213
|
+
'pendingUrl' => order['pendingUrl'],
|
214
|
+
'failureUrl' => order['failureUrl'],
|
215
|
+
'cancelUrl' => order['cancelUrl'],
|
216
|
+
'statementNarrative' => order['statementNarrative'],
|
217
|
+
'settlementCurrency' => order['settlementCurrency'],
|
218
|
+
'customerIdentifiers' => order['customerIdentifiers']
|
219
|
+
}
|
220
|
+
|
221
|
+
response = sendRequest('orders', request.to_json, true)
|
222
|
+
|
223
|
+
if (response['body']['orderCode'])
|
224
|
+
#success
|
225
|
+
return response
|
226
|
+
else
|
227
|
+
onError('apierror', response.to_s)
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
231
|
+
|
232
|
+
def authorise3DSOrder(orderCode, responseCode, threeDsInfo)
|
233
|
+
request = {
|
234
|
+
'threeDSResponseCode' => responseCode,
|
235
|
+
'shopperSessionId' => threeDsInfo['shopperSessionId'],
|
236
|
+
'shopperAcceptHeader' => threeDsInfo['shopperAcceptHeader'],
|
237
|
+
'shopperUserAgent' => threeDsInfo['shopperUserAgent'],
|
238
|
+
'shopperIpAddress' => threeDsInfo['shopperIpAddress']
|
239
|
+
}
|
240
|
+
|
241
|
+
response = sendRequest('orders/'+orderCode, request.to_json, true, 'PUT')
|
242
|
+
|
243
|
+
if (response['body']['orderCode'])
|
244
|
+
#success
|
245
|
+
return response
|
246
|
+
else
|
247
|
+
onError('apierror', response.to_s)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
#Capture Authorized Worldpay Order
|
252
|
+
def captureAuthorisedOrder(orderCode=false, amount=false)
|
253
|
+
if (orderCode || orderCode.is_a?(String))
|
254
|
+
#
|
255
|
+
else
|
256
|
+
onError('ip', @errors['capture']['ordercode'])
|
257
|
+
end
|
258
|
+
|
259
|
+
if (amount && amount.is_a?(Integer))
|
260
|
+
json = {'captureAmount'=>amount}.to_json
|
261
|
+
end
|
262
|
+
|
263
|
+
sendRequest('orders/'+orderCode+'/capture', (json||false))
|
264
|
+
end
|
265
|
+
|
266
|
+
#Cancel Authorized Worldpay Order
|
267
|
+
def cancelAuthorisedOrder(orderCode=false)
|
268
|
+
if (orderCode || orderCode.is_a?(String))
|
269
|
+
#
|
270
|
+
else
|
271
|
+
onError('ip', @errors['capture']['ordercode'])
|
272
|
+
end
|
273
|
+
|
274
|
+
sendRequest('orders/'+orderCode, false, false, 'DELETE')
|
275
|
+
end
|
276
|
+
|
277
|
+
#Refund Worldpay order
|
278
|
+
def refundOrder(orderCode=false, amount=false)
|
279
|
+
if (orderCode==false || orderCode!=orderCode.to_s)
|
280
|
+
onError('ip', @errors['refund']['ordercode'])
|
281
|
+
end
|
282
|
+
if (amount!=false)
|
283
|
+
json = {'refundAmount'=>amount}.to_json
|
284
|
+
else
|
285
|
+
json = false
|
286
|
+
end
|
287
|
+
sendRequest('orders/'+orderCode+'/refund', json)
|
288
|
+
end
|
289
|
+
|
290
|
+
#REQUESTS
|
291
|
+
def sendRequest(action='', json=false, expectResponse=false, method='POST')
|
292
|
+
uri = URI.parse(@endpoint)
|
293
|
+
|
294
|
+
net = Net::HTTP.new(uri.host, uri.port)
|
295
|
+
|
296
|
+
if (method=="POST")
|
297
|
+
request = Net::HTTP::Post.new('/v1/'+action)
|
298
|
+
elsif (method=="GET")
|
299
|
+
request = Net::HTTP::Get.new('/v1/'+action)
|
300
|
+
elsif (method=="PUT")
|
301
|
+
request = Net::HTTP::Put.new('/v1/'+action)
|
302
|
+
elsif (method=="DELETE")
|
303
|
+
request = Net::HTTP::Delete.new('/v1/'+action)
|
304
|
+
end
|
305
|
+
|
306
|
+
net.use_ssl = true
|
307
|
+
net.verify_mode = @disable_ssl ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
|
308
|
+
|
309
|
+
if (json != false)
|
310
|
+
request.body = json
|
311
|
+
end
|
312
|
+
request.add_field("Authorization", @service_key)
|
313
|
+
request.add_field("Content-Type", "application/json")
|
314
|
+
request.add_field("X-wp-client-user-agent", "os.name="+RUBY_PLATFORM.to_s+";os.version="+RUBY_PLATFORM.to_s+";os.arch="+RUBY_PLATFORM.to_s+";lang.version="+RUBY_VERSION.to_s+";lib.version="+@version.to_s+";api.version=v1;lang=am;owner=worldpay")
|
315
|
+
if (json != false)
|
316
|
+
request.add_field("Content-Length", json.length)
|
317
|
+
end
|
318
|
+
|
319
|
+
net.set_debug_output $stdout #useful to see the raw messages going over the wire
|
320
|
+
net.read_timeout = @timeout
|
321
|
+
net.open_timeout = @timeout
|
322
|
+
|
323
|
+
result = net.start do |http|
|
324
|
+
http.request(request)
|
325
|
+
end
|
326
|
+
|
327
|
+
if (result.read_body && result.read_body.length >= 2)
|
328
|
+
response = JSON.parse(result.read_body)
|
329
|
+
else
|
330
|
+
response = false
|
331
|
+
end
|
332
|
+
|
333
|
+
if (expectResponse && !response.present?)
|
334
|
+
onError('uanv', @errors['json'], 503);
|
335
|
+
end
|
336
|
+
|
337
|
+
if (response && response["httpStatusCode"].present?)
|
338
|
+
|
339
|
+
if (response["httpStatusCode"] != '200')
|
340
|
+
onError(
|
341
|
+
false,
|
342
|
+
response["message"],
|
343
|
+
result.code,
|
344
|
+
response['httpStatusCode'],
|
345
|
+
response['description'],
|
346
|
+
response['customCode']
|
347
|
+
)
|
348
|
+
end
|
349
|
+
elsif (expectResponse && result.code != '200')
|
350
|
+
# If we expect a result and we have an error
|
351
|
+
onError('uanv', @errors['json'], 503)
|
352
|
+
elsif (!expectResponse)
|
353
|
+
if (result.code != '200')
|
354
|
+
onError('apierror', result.read_body, result.code)
|
355
|
+
else
|
356
|
+
response = true
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
return {
|
361
|
+
"code"=>result.code,
|
362
|
+
"body"=>response
|
363
|
+
}
|
364
|
+
|
365
|
+
end
|
366
|
+
|
367
|
+
#RESPONSES
|
368
|
+
def handleResponse(response)
|
369
|
+
response = response.to_json
|
370
|
+
end
|
371
|
+
|
372
|
+
#TOKENS
|
373
|
+
#Get card details from Worldpay token
|
374
|
+
def getStoredCardDetails(token=false)
|
375
|
+
if (token==false || token!=token.to_s)
|
376
|
+
onError('ip', @errors['orderInput']['token'])
|
377
|
+
end
|
378
|
+
|
379
|
+
response = sendRequest('tokens/'+token, false, true, 'GET')
|
380
|
+
|
381
|
+
|
382
|
+
if (response['body']['paymentMethod'])
|
383
|
+
return response['body']['paymentMethod']
|
384
|
+
else
|
385
|
+
return false
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
|
390
|
+
def getOrder(orderCode = false)
|
391
|
+
if (orderCode==false || !orderCode.present?)
|
392
|
+
onError('ip', @errors['orderInput']['orderCode']);
|
393
|
+
end
|
394
|
+
|
395
|
+
response = sendRequest('orders/' + orderCode, false, true, 'GET');
|
396
|
+
|
397
|
+
if (!response['body']['orderCode'].present?)
|
398
|
+
onError('apierror')
|
399
|
+
end
|
400
|
+
|
401
|
+
return response
|
402
|
+
end
|
323
403
|
|
324
404
|
end
|
data/worldpay-1.0.6.gem
ADDED
Binary file
|
data/worldpay-1.0.7.gem
ADDED
Binary file
|
data/worldpay-1.1.0.gem
ADDED
Binary file
|
data/worldpay.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "worldpay"
|
7
|
-
spec.version = "1.0
|
7
|
+
spec.version = "1.2.0"
|
8
8
|
spec.authors = ["Andrew Odendaal, Paul Beckford"]
|
9
9
|
spec.email = ["andrew.odendaal@worldpay.com"]
|
10
10
|
spec.summary = %q{online.worldpay.com ruby lib.}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worldpay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Odendaal, Paul Beckford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -64,6 +64,9 @@ files:
|
|
64
64
|
- worldpay-1.0.3.gem
|
65
65
|
- worldpay-1.0.4.gem
|
66
66
|
- worldpay-1.0.5.gem
|
67
|
+
- worldpay-1.0.6.gem
|
68
|
+
- worldpay-1.0.7.gem
|
69
|
+
- worldpay-1.1.0.gem
|
67
70
|
- worldpay.gemspec
|
68
71
|
homepage: https://online.worldpay.com
|
69
72
|
licenses:
|