globalpay_ruby_gem 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27c87a0f722dbba0502a9a14b4e4c5c2b7bc0575
4
- data.tar.gz: ad37554b83d560e55c557d756ffbee331096a18d
3
+ metadata.gz: 24167cda617700c832e7d49d303fa6004847df16
4
+ data.tar.gz: 5f6d09cb28acb0d7ce1729edbaca3b5a9a22257c
5
5
  SHA512:
6
- metadata.gz: 3d0938a9b2342156ecd5e2e647e61ca0215170071f1c6989c0f53bf49edfa1afa7f414ac51cc0f036299c73aed5533176ddc878ae644f3d1796e8ada256a4909
7
- data.tar.gz: 80d94d79fc812c822371f83b566f3fa1c941475252add353c763526a0fd8b487fe36c68e851e81ddcae3ee80dffc3e579af14efc6af4e48b0ff534af9c74de24
6
+ metadata.gz: 75ecf0df66170fd8371096748d4cb578a2647528459c53e367bf6ff3c4ee81013c2abb9ddebee571112c9e07deaabd69109be83c0d12d1d58423f5ffbdb923f7
7
+ data.tar.gz: 374bd1329167e793e932fdc800389a948170ed69c1446be931783882816e448823781b5968471f2699db889cd94d025ded877009ee3e152397f39505b91e0ecd
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # GlobalpayRubyGem
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/globalpay_ruby_gem`. To experiment with that code, run `bin/console` for an interactive prompt.
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.initialize(access_token,returnurl,merchantreference,description,currencycode,totalamount,customer)
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
 
@@ -1,3 +1,3 @@
1
1
  module GlobalpayRubyGem
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -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 == "True"
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 == "True"
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,islive)
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 == "True"
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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globalpay_ruby_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codegidi