worldpay 1.0.4 → 1.0.5
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/worldpay.rb +48 -8
- data/worldpay-1.0.1.gem +0 -0
- data/worldpay-1.0.2.gem +0 -0
- data/worldpay-1.0.3.gem +0 -0
- data/worldpay-1.0.4.gem +0 -0
- data/worldpay.gemspec +2 -2
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e92644d37cb8da4444775fd15e0baa0499324e37
|
4
|
+
data.tar.gz: 05d4eb59966c00ca06031043c3afe56f398a2454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d768380d5dd922350c15793d05d91e0c8aaf38fe19f44a6617c6a76b9627301cdf4e4987e408b37c47e0c0ef5438cf941c48b161d59e35396535839e6933558
|
7
|
+
data.tar.gz: 027ffd22c1f2ab8e4af06c5891c12f53bc0439cf2a3b875e48d89b2fd7b5855aea6457e64740af1ca5643dd0acd2c3f18542e4e5614c4f042787455ea8a23391
|
data/Gemfile.lock
CHANGED
data/lib/worldpay.rb
CHANGED
@@ -14,7 +14,7 @@ class Worldpay
|
|
14
14
|
@errors = {}
|
15
15
|
@raise_errors = true
|
16
16
|
|
17
|
-
@version = '1.0.
|
17
|
+
@version = '1.0.5'
|
18
18
|
|
19
19
|
|
20
20
|
def initialize(service_key='', timeout=3, raise_errors=true)
|
@@ -59,6 +59,11 @@ class Worldpay
|
|
59
59
|
end
|
60
60
|
|
61
61
|
|
62
|
+
def setEndpoint(endpoint)
|
63
|
+
@endpoint = endpoint
|
64
|
+
end
|
65
|
+
|
66
|
+
|
62
67
|
#Disable SSL Check ~ Use only for testing!
|
63
68
|
def disableSSLCheck(disable = false)
|
64
69
|
@disable_ssl = disable
|
@@ -139,19 +144,30 @@ class Worldpay
|
|
139
144
|
fmt = "%05.2f" % order['amount']
|
140
145
|
cost_cents = fmt.split('.').join('')
|
141
146
|
|
142
|
-
|
147
|
+
request = {
|
143
148
|
'token' => order['token'],
|
144
149
|
'orderDescription' => order['orderDescription'],
|
145
150
|
'amount' => cost_cents,
|
151
|
+
'is3DSOrder' => order['3DS'],
|
146
152
|
'currencyCode' => order['currencyCode'],
|
147
153
|
'name' => order['name'],
|
148
154
|
'orderType' => order['orderType'],
|
149
155
|
'billingAddress' => order['billingAddress'],
|
150
156
|
'customerOrderCode' => order['customerOrderCode'],
|
151
157
|
'customerIdentifiers' => order['customerIdentifiers']
|
152
|
-
}
|
158
|
+
}
|
153
159
|
|
154
|
-
|
160
|
+
if(request['is3DSOrder'] == true)
|
161
|
+
threeDsInfo = {
|
162
|
+
'shopperIpAddress' => order['shopperIpAddress'],
|
163
|
+
'shopperSessionId' => order['shopperSessionId'],
|
164
|
+
'shopperUserAgent' => order['shopperUserAgent'],
|
165
|
+
'shopperAcceptHeader' => order['shopperAcceptHeader']
|
166
|
+
}
|
167
|
+
request.merge!(threeDsInfo)
|
168
|
+
end
|
169
|
+
|
170
|
+
response = sendRequest('orders', request.to_json, true)
|
155
171
|
|
156
172
|
if (response['body']['orderCode'])
|
157
173
|
#success
|
@@ -162,12 +178,36 @@ class Worldpay
|
|
162
178
|
|
163
179
|
end
|
164
180
|
|
181
|
+
def authorise3DSOrder(orderCode, responseCode, threeDsInfo)
|
182
|
+
request = {
|
183
|
+
'threeDSResponseCode' => responseCode,
|
184
|
+
'shopperSessionId' => threeDsInfo['shopperSessionId'],
|
185
|
+
'shopperAcceptHeader' => threeDsInfo['shopperAcceptHeader'],
|
186
|
+
'shopperUserAgent' => threeDsInfo['shopperUserAgent'],
|
187
|
+
'shopperIpAddress' => threeDsInfo['shopperIpAddress']
|
188
|
+
}
|
189
|
+
|
190
|
+
response = sendRequest('orders/'+orderCode, request.to_json, true, 'PUT')
|
191
|
+
|
192
|
+
if (response['body']['orderCode'])
|
193
|
+
#success
|
194
|
+
return response
|
195
|
+
else
|
196
|
+
onError('apierror', response.to_s)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
165
200
|
#Refund Worldpay order
|
166
|
-
def refundOrder(orderCode=false)
|
201
|
+
def refundOrder(orderCode=false, amount=false)
|
167
202
|
if (orderCode==false || orderCode!=orderCode.to_s)
|
168
203
|
onError('ip', @errors['refund']['ordercode'])
|
169
204
|
end
|
170
|
-
|
205
|
+
if (amount!=false)
|
206
|
+
json = {'refundAmount'=>amount}.to_json
|
207
|
+
else
|
208
|
+
json = false
|
209
|
+
end
|
210
|
+
sendRequest('orders/'+orderCode+'/refund', json)
|
171
211
|
end
|
172
212
|
|
173
213
|
|
@@ -176,9 +216,8 @@ class Worldpay
|
|
176
216
|
|
177
217
|
#REQUESTS
|
178
218
|
def sendRequest(action='', json=false, expectResponse=false, method='POST')
|
179
|
-
|
219
|
+
net = Net::HTTP.new(@endpoint, '443')
|
180
220
|
|
181
|
-
net = Net::HTTP.new(url, "443")
|
182
221
|
if (method=="POST")
|
183
222
|
request = Net::HTTP::Post.new('/v1/'+action)
|
184
223
|
elsif (method=="GET")
|
@@ -241,6 +280,7 @@ class Worldpay
|
|
241
280
|
|
242
281
|
response = sendRequest('tokens/'+token, false, true, 'GET')
|
243
282
|
|
283
|
+
|
244
284
|
if (response['body']['paymentMethod'])
|
245
285
|
return response['body']['paymentMethod']
|
246
286
|
else
|
data/worldpay-1.0.1.gem
ADDED
Binary file
|
data/worldpay-1.0.2.gem
ADDED
Binary file
|
data/worldpay-1.0.3.gem
ADDED
Binary file
|
data/worldpay-1.0.4.gem
ADDED
Binary file
|
data/worldpay.gemspec
CHANGED
@@ -4,8 +4,8 @@ $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.
|
8
|
-
spec.authors = ["Andrew Odendaal"]
|
7
|
+
spec.version = "1.0.5"
|
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.}
|
11
11
|
spec.description = %q{Official online.worldpay.com ruby library.}
|
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.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Andrew Odendaal
|
7
|
+
- Andrew Odendaal, Paul Beckford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,6 +59,10 @@ files:
|
|
59
59
|
- worldpay-0.0.2.gem
|
60
60
|
- worldpay-0.0.3.gem
|
61
61
|
- worldpay-1.0.0.gem
|
62
|
+
- worldpay-1.0.1.gem
|
63
|
+
- worldpay-1.0.2.gem
|
64
|
+
- worldpay-1.0.3.gem
|
65
|
+
- worldpay-1.0.4.gem
|
62
66
|
- worldpay.gemspec
|
63
67
|
homepage: https://online.worldpay.com
|
64
68
|
licenses:
|