pesapal 1.5.3 → 1.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +2 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +11 -10
- data/lib/pesapal/merchant.rb +2 -0
- data/lib/pesapal/version.rb +1 -1
- data/spec/pesapal_merchant_spec.rb +116 -26
- data/spec/spec_helper.rb +6 -0
- metadata +3 -2
data/.rspec
ADDED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,8 +2,9 @@ Pesapal RubyGem
|
|
2
2
|
===============
|
3
3
|
|
4
4
|
<a href="http://badge.fury.io/rb/pesapal"><img src="https://badge.fury.io/rb/pesapal@2x.png" alt="Gem Version" height="18"></a>
|
5
|
-
[![Build Status](https://travis-ci.org/itsmrwave/pesapal-
|
6
|
-
[![
|
5
|
+
[![Build Status](https://travis-ci.org/itsmrwave/pesapal-gem.png?branch=master)](https://travis-ci.org/itsmrwave/pesapal-gem)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/itsmrwave/pesapal-gem.png)](https://codeclimate.com/github/itsmrwave/pesapal-gem)
|
7
|
+
[![Dependency Status](https://gemnasium.com/itsmrwave/pesapal-gem.png)](https://gemnasium.com/itsmrwave/pesapal-gem)
|
7
8
|
|
8
9
|
|
9
10
|
Make authenticated Pesapal API calls without the fuss! Handles all the [oAuth
|
@@ -276,19 +277,19 @@ they want as long as they provide attribution and waive liability.
|
|
276
277
|
[3]: http://guides.rubygems.org/make-your-own-gem/
|
277
278
|
[4]: http://developer.pesapal.com/how-to-integrate/api-reference
|
278
279
|
[5]: https://github.com/itsmrwave/pesapal-php#pesapal-php-api-reference-unofficial
|
279
|
-
[6]: https://github.com/itsmrwave/pesapal-
|
280
|
+
[6]: https://github.com/itsmrwave/pesapal-gem/issues
|
280
281
|
[7]: http://rubygems.org/gems/pesapal
|
281
|
-
[8]: https://github.com/itsmrwave/pesapal-
|
282
|
-
[9]: https://github.com/itsmrwave/pesapal-
|
282
|
+
[8]: https://github.com/itsmrwave/pesapal-gem/fork
|
283
|
+
[9]: https://github.com/itsmrwave/pesapal-gem#contributing
|
283
284
|
[10]: http://kingori.co/
|
284
|
-
[11]: https://github.com/itsmrwave/pesapal-
|
285
|
-
[12]: https://github.com/itsmrwave/pesapal-
|
285
|
+
[11]: https://github.com/itsmrwave/pesapal-gem/blob/master/LICENSE.txt
|
286
|
+
[12]: https://github.com/itsmrwave/pesapal-gem/releases/
|
286
287
|
[13]: http://rubydoc.info/gems/pesapal/
|
287
288
|
[14]: https://github.com/itsmrwave/mo
|
288
289
|
[15]: https://github.com/itsmrwave/mo/tree/master/convention#-convention
|
289
290
|
[16]: http://kingori.co/articles/2013/09/modus-operandi/
|
290
|
-
[17]: https://github.com/itsmrwave/pesapal-
|
291
|
+
[17]: https://github.com/itsmrwave/pesapal-gem/pulls
|
291
292
|
[18]: http://developer.pesapal.com/how-to-integrate/step-by-step
|
292
|
-
[19]: https://github.com/itsmrwave/pesapal-
|
293
|
+
[19]: https://github.com/itsmrwave/pesapal-gem/graphs/contributors
|
293
294
|
[20]: http://guides.rubyonrails.org/
|
294
|
-
[21]: https://github.com/itsmrwave/pesapal-
|
295
|
+
[21]: https://github.com/itsmrwave/pesapal-gem/blob/master/CHANGELOG.md#changelog
|
data/lib/pesapal/merchant.rb
CHANGED
@@ -163,6 +163,8 @@ module Pesapal
|
|
163
163
|
@api_endpoints[:postpesapaldirectorderv4] = "#{@api_domain}/API/PostPesapalDirectOrderV4"
|
164
164
|
@api_endpoints[:querypaymentstatus] = "#{@api_domain}/API/QueryPaymentStatus"
|
165
165
|
@api_endpoints[:querypaymentdetails] = "#{@api_domain}/API/QueryPaymentDetails"
|
166
|
+
|
167
|
+
return @api_endpoints
|
166
168
|
end
|
167
169
|
|
168
170
|
# set credentialts through hash, uses default if nothing is input
|
data/lib/pesapal/version.rb
CHANGED
@@ -2,45 +2,135 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Pesapal::Merchant do
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
context 'when mode not specified' do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
@pesapal = Pesapal::Merchant.new
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '#new' do
|
12
|
+
|
13
|
+
it 'is valid object' do
|
14
|
+
expect(@pesapal).to be_an_instance_of(Pesapal::Merchant)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'sets default environment variable' do
|
18
|
+
expect(@pesapal.send(:env)).to eq 'development'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'sets default credentials' do
|
22
|
+
expect(@pesapal.config).to eq({ :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
|
23
|
+
:consumer_key => '<YOUR_CONSUMER_KEY>',
|
24
|
+
:consumer_secret => '<YOUR_CONSUMER_SECRET>'
|
25
|
+
})
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'sets default order details' do
|
29
|
+
expect(@pesapal.order_details).to eq({})
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#set_env' do
|
34
|
+
|
35
|
+
it 'sets default environment variable' do
|
36
|
+
@pesapal.set_env
|
37
|
+
expect(@pesapal.send(:env)).to eq 'development'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'sets endpoints for default environment' do
|
41
|
+
expect(@pesapal.set_env).to eq({:postpesapaldirectorderv4 => 'http://demo.pesapal.com/API/PostPesapalDirectOrderV4',
|
42
|
+
:querypaymentstatus=>'http://demo.pesapal.com/API/QueryPaymentStatus',
|
43
|
+
:querypaymentdetails=>'http://demo.pesapal.com/API/QueryPaymentDetails'
|
44
|
+
})
|
45
|
+
end
|
46
|
+
end
|
9
47
|
end
|
10
48
|
|
11
|
-
|
49
|
+
context 'when mode is specified as development' do
|
12
50
|
|
13
|
-
|
14
|
-
@pesapal.
|
15
|
-
@pesapal.send(:env).should_not == 'production'
|
51
|
+
before :each do
|
52
|
+
@pesapal = Pesapal::Merchant.new(:development)
|
16
53
|
end
|
17
54
|
|
18
|
-
|
19
|
-
|
20
|
-
|
55
|
+
describe '#new(:development)' do
|
56
|
+
|
57
|
+
it 'is valid object' do
|
58
|
+
expect(@pesapal).to be_an_instance_of(Pesapal::Merchant)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'sets environment variable' do
|
62
|
+
expect(@pesapal.send(:env)).to eq 'development'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'sets credentials' do
|
66
|
+
expect(@pesapal.config).to eq({ :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
|
67
|
+
:consumer_key => '<YOUR_CONSUMER_KEY>',
|
68
|
+
:consumer_secret => '<YOUR_CONSUMER_SECRET>'
|
69
|
+
})
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'sets order details' do
|
73
|
+
expect(@pesapal.order_details).to eq({})
|
74
|
+
end
|
21
75
|
end
|
22
76
|
|
23
|
-
|
24
|
-
|
25
|
-
|
77
|
+
describe '#set_env(:development)' do
|
78
|
+
|
79
|
+
it 'sets environment variable' do
|
80
|
+
@pesapal.set_env :development
|
81
|
+
expect(@pesapal.send(:env)).to eq 'development'
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'sets endpoints for environment' do
|
85
|
+
expect(@pesapal.set_env :development).to eq({:postpesapaldirectorderv4 => 'http://demo.pesapal.com/API/PostPesapalDirectOrderV4',
|
86
|
+
:querypaymentstatus=>'http://demo.pesapal.com/API/QueryPaymentStatus',
|
87
|
+
:querypaymentdetails=>'http://demo.pesapal.com/API/QueryPaymentDetails'
|
88
|
+
})
|
89
|
+
end
|
26
90
|
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when mode is specified as production' do
|
27
94
|
|
28
|
-
|
29
|
-
|
30
|
-
@pesapal.should be_an_instance_of Pesapal::Merchant
|
95
|
+
before :each do
|
96
|
+
@pesapal = Pesapal::Merchant.new(:production)
|
31
97
|
end
|
32
98
|
|
33
|
-
#
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
99
|
+
describe '#new(:production)' do
|
100
|
+
|
101
|
+
it 'is valid object' do
|
102
|
+
expect(@pesapal).to be_an_instance_of(Pesapal::Merchant)
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'sets environment variable' do
|
106
|
+
expect(@pesapal.send(:env)).to eq 'production'
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'sets credentials' do
|
110
|
+
expect(@pesapal.config).to eq({ :callback_url => 'http://0.0.0.0:3000/pesapal/callback',
|
111
|
+
:consumer_key => '<YOUR_CONSUMER_KEY>',
|
112
|
+
:consumer_secret => '<YOUR_CONSUMER_SECRET>'
|
113
|
+
})
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'sets order details' do
|
117
|
+
expect(@pesapal.order_details).to eq({})
|
118
|
+
end
|
39
119
|
end
|
40
120
|
|
41
|
-
#
|
42
|
-
|
43
|
-
|
121
|
+
describe '#set_env(:production)' do
|
122
|
+
|
123
|
+
it 'sets environment variable' do
|
124
|
+
@pesapal.set_env :production
|
125
|
+
expect(@pesapal.send(:env)).to eq 'production'
|
126
|
+
end
|
127
|
+
|
128
|
+
it 'sets endpoints for environment' do
|
129
|
+
expect(@pesapal.set_env :production).to eq({:postpesapaldirectorderv4 => 'https://www.pesapal.com/API/PostPesapalDirectOrderV4',
|
130
|
+
:querypaymentstatus=>'https://www.pesapal.com/API/QueryPaymentStatus',
|
131
|
+
:querypaymentdetails=>'https://www.pesapal.com/API/QueryPaymentDetails'
|
132
|
+
})
|
133
|
+
end
|
44
134
|
end
|
45
135
|
end
|
46
136
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pesapal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -83,6 +83,7 @@ extensions: []
|
|
83
83
|
extra_rdoc_files: []
|
84
84
|
files:
|
85
85
|
- .gitignore
|
86
|
+
- .rspec
|
86
87
|
- .travis.yml
|
87
88
|
- CHANGELOG.md
|
88
89
|
- Gemfile
|