globalpay_ruby_gem 1.0.0 → 1.1.0
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/README.md +7 -6
- data/lib/globalpay_ruby_gem/version.rb +1 -1
- data/lib/globalpay_ruby_gem.rb +6 -6
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 24167cda617700c832e7d49d303fa6004847df16
|
|
4
|
+
data.tar.gz: 5f6d09cb28acb0d7ce1729edbaca3b5a9a22257c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75ecf0df66170fd8371096748d4cb578a2647528459c53e367bf6ff3c4ee81013c2abb9ddebee571112c9e07deaabd69109be83c0d12d1d58423f5ffbdb923f7
|
|
7
|
+
data.tar.gz: 374bd1329167e793e932fdc800389a948170ed69c1446be931783882816e448823781b5968471f2699db889cd94d025ded877009ee3e152397f39505b91e0ecd
|
data/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# GlobalpayRubyGem
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
GlobalpayRubyGem is a Ruby Gem for using the [Globalpay] API
|
|
4
4
|
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
|
6
5
|
|
|
7
6
|
## Installation
|
|
8
7
|
|
|
@@ -29,15 +28,17 @@ Or install it yourself as:
|
|
|
29
28
|
* 5. Validate the result by using the Retrieve transaction call
|
|
30
29
|
|
|
31
30
|
### Client Authentication
|
|
32
|
-
globalpay_ruby_gem.authenticate(client_id,client_secret)
|
|
31
|
+
globalpay_ruby_gem.authenticate(client_id,client_secret,is_live{Bool isLive : #True for for live enviroment and false for staging default value false});
|
|
32
|
+
})
|
|
33
|
+
|
|
33
34
|
|
|
34
35
|
### Transaction Initialization
|
|
35
|
-
response = globalpay_ruby_gem.
|
|
36
|
-
|
|
36
|
+
response = globalpay_ruby_gem.initialize_transaction(access_token,returnurl,merchantreference,merchantid,description,currencycode{eg NGN for naira},totalamount,customeremail,customernumber,customerfirstname,customerlastname,is_live{Bool isLive : #True for for live enviroment and false for staging default value false});
|
|
37
|
+
})
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
### Transaction Verification
|
|
40
|
-
globalpay_ruby_gem.retrieve(access_token,merchantid,merchantreference,transactionrequest)
|
|
41
|
+
globalpay_ruby_gem.retrieve(access_token,merchantid,merchantreference,transactionrequest,is_live{Bool isLive : #True for for live enviroment and false for staging default value false})
|
|
41
42
|
|
|
42
43
|
## Development
|
|
43
44
|
|
data/lib/globalpay_ruby_gem.rb
CHANGED
|
@@ -17,7 +17,7 @@ module GlobalpayRubyGem
|
|
|
17
17
|
|
|
18
18
|
def initialize(*args)
|
|
19
19
|
if args.size == 7
|
|
20
|
-
GlobalpayRubyGem.initialize_transaction(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10])
|
|
20
|
+
GlobalpayRubyGem.initialize_transaction(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8],args[9],args[10],args[11])
|
|
21
21
|
else
|
|
22
22
|
response = "{'error':'parameters miss match, expecting 7 paramters'}"
|
|
23
23
|
end
|
|
@@ -37,7 +37,7 @@ module GlobalpayRubyGem
|
|
|
37
37
|
body = 'client_id='+client_id+'&client_secret='+client_secret+'grant_type=client_credentials'
|
|
38
38
|
header = { 'Content-Type' => 'application/x-www-form-urlencoded'}
|
|
39
39
|
|
|
40
|
-
if is_live
|
|
40
|
+
if is_live
|
|
41
41
|
res = http.post(TOKEN_URL_LIVE, body)
|
|
42
42
|
else
|
|
43
43
|
res = http.post(TOKEN_URL_STAGING, body)
|
|
@@ -50,14 +50,14 @@ module GlobalpayRubyGem
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
def initialize_transaction(access_token,returnurl,merchantreference,merchantid,description,currencycode,totalamount,customeremail,customernumber,customerfirstname,customerlastname)
|
|
53
|
+
def initialize_transaction(access_token,returnurl,merchantreference,merchantid,description,currencycode,totalamount,customeremail,customernumber,customerfirstname,customerlastname,is_live)
|
|
54
54
|
http = HTTPClient.new
|
|
55
55
|
body = { 'returnurl' => returnurl,'customerip' => '', 'merchantreference' => merchantreference, 'merchantid' => merchantid, 'description' => description,
|
|
56
56
|
'currencycode' => currencycode, 'totalamount' => totalamount, 'customer' => { 'email' => customeremail,'firstname' => customerfirstname, 'lastname' => customerlastname, 'mobile' => customernumber },
|
|
57
57
|
'paymentmethod' => 'card','transactionType' => 'Payment', 'connectionmode' => 'redirect', 'product' => [{'name' => description, 'unitprice' => totalamount,'quantity' => '1'}]}
|
|
58
58
|
header = { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{access_token}"}
|
|
59
59
|
|
|
60
|
-
if is_live
|
|
60
|
+
if is_live
|
|
61
61
|
res = http.post(BASE_URL_LIVE + '/api/v3/Payment/SetRequest', body,header)
|
|
62
62
|
else
|
|
63
63
|
res = http.post(BASE_URL_STAGING + '/api/v3/Payment/SetRequest', body,header)
|
|
@@ -70,12 +70,12 @@ module GlobalpayRubyGem
|
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
def retrieve_transaction(access_token,merchantid,merchantreference,transactionrequest,
|
|
73
|
+
def retrieve_transaction(access_token,merchantid,merchantreference,transactionrequest,is_live)
|
|
74
74
|
http = HTTPClient.new
|
|
75
75
|
body = { 'merchantId' => merchantid, 'merchantreference' => merchantreference, 'transactionRequest' => transactionrequest}
|
|
76
76
|
header = { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{access_token}"}
|
|
77
77
|
|
|
78
|
-
if is_live
|
|
78
|
+
if is_live
|
|
79
79
|
res = http.post(BASE_URL_LIVE + '/api/v3/Payment/Retrieve', body,header)
|
|
80
80
|
else
|
|
81
81
|
res = http.post(BASE_URL_STAGING + '/api/v3/Payment/Retrieve', body,header)
|