orchard-api-client-anm 0.1.3 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/Gemfile +0 -6
- data/README.md +8 -8
- data/lib/orchard/api/base.rb +7 -3
- data/lib/orchard/api/check_transaction_status.rb +12 -0
- data/lib/orchard/api/send_payment_request.rb +1 -1
- data/lib/orchard/api/send_sms.rb +1 -1
- data/lib/orchard/api/service_lookup_request.rb +12 -0
- data/lib/orchard/api_client.rb +13 -5
- data/lib/orchard/constants.rb +2 -0
- data/lib/orchard/version.rb +1 -1
- data/lib/orchard.rb +2 -0
- data/orchard.gemspec +5 -12
- metadata +18 -4
- data/.byebug_history +0 -109
- data/Gemfile.lock +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3007289bbba240cda4e268f7bf7fd8823aa69bf8c21b63fe535dce5fa16d275
|
4
|
+
data.tar.gz: 42ec0f1b0b65a2b4474ceb0e212825cf9fd7d00f77b137b4176dd7895496a676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdda46bb8b86634bd29e540a2509d9b9c1061d4b5c1cd9fca191b28f5ecbc5322d899d5593fb6b8142f415f4e89158ba2281ce3a9104fa04b685f52ebc7b08c8
|
7
|
+
data.tar.gz: a48c383dff8a228f6bc89ba872331a7634df7ed0e877f96df21f565353a3cc5872bc8b7a2fa56f1d4645eb29aa0cc6f029dc6c1ce9c12ffb4c0c63cade51f015
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -41,9 +41,9 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
41
41
|
nw = allowed_parameters['MTN','VOD','AIR']
|
42
42
|
|
43
43
|
payment_request_payload = {
|
44
|
-
customer_number: '',
|
45
|
-
reference: '',
|
46
|
-
amount: '',
|
44
|
+
customer_number: '0550000000',
|
45
|
+
reference: 'AppsNmobile Pay',
|
46
|
+
amount: '1',
|
47
47
|
exttrid: processing_id,
|
48
48
|
nw: 'MTN',
|
49
49
|
trans_type: 'CTM',
|
@@ -53,16 +53,16 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
53
53
|
voucher_code: ''
|
54
54
|
}
|
55
55
|
|
56
|
-
response = client.send_payment_request(payment_request_payload,
|
56
|
+
response = client.send_payment_request(payment_request_payload, request_configurations)
|
57
57
|
|
58
58
|
#Send Sms
|
59
59
|
sms_payload = {
|
60
|
-
sender_id: '',
|
61
|
-
recipient_number: '',
|
62
|
-
msg_body: '',
|
60
|
+
sender_id: 'ANM',
|
61
|
+
recipient_number: '0550000000',
|
62
|
+
msg_body: 'Sample text message',
|
63
63
|
trans_type: 'SMS',
|
64
64
|
service_id: ENV['SERVICE_ID']
|
65
65
|
}
|
66
66
|
|
67
|
-
response = client.send_sms(sms_payload
|
67
|
+
response = client.send_sms(sms_payload)
|
68
68
|
```
|
data/lib/orchard/api/base.rb
CHANGED
@@ -20,8 +20,8 @@ module Orchard
|
|
20
20
|
OpenSSL::HMAC.hexdigest(digest, @secret_token.to_s, @payload.to_json)
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
24
|
-
response = @connection.
|
23
|
+
def make_request(method)
|
24
|
+
response = @connection.send(method) do |request|
|
25
25
|
request.url @endpoint
|
26
26
|
request.options.timeout = @timeout
|
27
27
|
request.body = @payload.to_json
|
@@ -30,9 +30,13 @@ module Orchard
|
|
30
30
|
|
31
31
|
JSON.parse(response.body)
|
32
32
|
rescue StandardError => e
|
33
|
+
error_response(e)
|
34
|
+
end
|
35
|
+
|
36
|
+
def error_response(error)
|
33
37
|
{
|
34
38
|
"res_code" => "999",
|
35
|
-
"res_desc" =>
|
39
|
+
"res_desc" => error.message
|
36
40
|
}
|
37
41
|
end
|
38
42
|
end
|
data/lib/orchard/api/send_sms.rb
CHANGED
data/lib/orchard/api_client.rb
CHANGED
@@ -6,21 +6,29 @@ module Orchard
|
|
6
6
|
@secret_token = params[:secret_token]
|
7
7
|
@client_token = params[:client_token]
|
8
8
|
@url = params[:url]
|
9
|
-
|
9
|
+
create_connection
|
10
10
|
end
|
11
11
|
|
12
12
|
def send_payment_request(payload, request_configurations = {})
|
13
|
-
Orchard::API::SendPaymentRequest.call(
|
13
|
+
Orchard::API::SendPaymentRequest.call(payload_with_client_data(payload), request_configurations)
|
14
14
|
end
|
15
15
|
|
16
16
|
def send_sms(payload, request_configurations = {})
|
17
|
-
Orchard::API::SendSMS.call(
|
17
|
+
Orchard::API::SendSMS.call(payload_with_client_data(payload), request_configurations)
|
18
|
+
end
|
19
|
+
|
20
|
+
def service_lookup_request(payload, request_configurations = {})
|
21
|
+
Orchard::API::ServiceLookupRequest.call(payload_with_client_data(payload), request_configurations)
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_transaction_status(payload, request_configurations = {})
|
25
|
+
Orchard::API::CheckTransactionStatus.call(payload_with_client_data(payload), request_configurations)
|
18
26
|
end
|
19
27
|
|
20
28
|
private
|
21
29
|
|
22
30
|
def create_connection
|
23
|
-
Faraday.new(
|
31
|
+
@connection = Faraday.new(
|
24
32
|
url: @url.to_s,
|
25
33
|
headers: {
|
26
34
|
"Content-Type" => "application/json"
|
@@ -28,7 +36,7 @@ module Orchard
|
|
28
36
|
)
|
29
37
|
end
|
30
38
|
|
31
|
-
def
|
39
|
+
def payload_with_client_data(payload)
|
32
40
|
{
|
33
41
|
payload: payload,
|
34
42
|
secret_token: @secret_token,
|
data/lib/orchard/constants.rb
CHANGED
data/lib/orchard/version.rb
CHANGED
data/lib/orchard.rb
CHANGED
@@ -7,5 +7,7 @@ require_relative "orchard/constants"
|
|
7
7
|
require_relative "orchard/api/base"
|
8
8
|
require_relative "orchard/api/send_payment_request"
|
9
9
|
require_relative "orchard/api/send_sms"
|
10
|
+
require_relative "orchard/api/service_lookup_request"
|
11
|
+
require_relative "orchard/api/check_transaction_status"
|
10
12
|
|
11
13
|
require_relative "orchard/api_client"
|
data/orchard.gemspec
CHANGED
@@ -18,24 +18,17 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.metadata["homepage_uri"] = spec.homepage
|
19
19
|
spec.metadata["source_code_uri"] = "https://github.com/appsnmobile-solutions/orchard_api_client_gem"
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
spec.add_development_dependency "byebug"
|
22
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
23
|
+
spec.add_development_dependency "rubocop", "~> 1.21"
|
24
|
+
spec.add_dependency "faraday", "~> 2.6"
|
25
|
+
|
23
26
|
spec.files = Dir.chdir(__dir__) do
|
24
27
|
`git ls-files -z`.split("\x0").reject do |f|
|
25
28
|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
29
|
end
|
27
30
|
end
|
28
|
-
|
29
31
|
spec.bindir = "exe"
|
30
32
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
31
33
|
spec.require_paths = ["lib"]
|
32
|
-
|
33
|
-
# Uncomment to register a new dependency of your gem
|
34
|
-
spec.add_development_dependency "byebug"
|
35
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
-
spec.add_dependency "faraday", "~> 2.6"
|
37
|
-
|
38
|
-
|
39
|
-
# For more information and examples about making a new gem, check out our
|
40
|
-
# guide at: https://bundler.io/guides/creating_gem.html
|
41
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchard-api-client-anm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sydney Dapilah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.21'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.21'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: faraday
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,20 +73,20 @@ executables: []
|
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
|
-
- ".byebug_history"
|
63
76
|
- ".rspec"
|
64
77
|
- ".rubocop.yml"
|
65
78
|
- CHANGELOG.md
|
66
79
|
- CODE_OF_CONDUCT.md
|
67
80
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
81
|
- LICENSE.txt
|
70
82
|
- README.md
|
71
83
|
- Rakefile
|
72
84
|
- lib/orchard.rb
|
73
85
|
- lib/orchard/api/base.rb
|
86
|
+
- lib/orchard/api/check_transaction_status.rb
|
74
87
|
- lib/orchard/api/send_payment_request.rb
|
75
88
|
- lib/orchard/api/send_sms.rb
|
89
|
+
- lib/orchard/api/service_lookup_request.rb
|
76
90
|
- lib/orchard/api_client.rb
|
77
91
|
- lib/orchard/constants.rb
|
78
92
|
- lib/orchard/version.rb
|
data/.byebug_history
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
exit
|
2
|
-
"2343333333333333"[-9..]
|
3
|
-
"2343333333333333".[-9..]
|
4
|
-
r
|
5
|
-
exit
|
6
|
-
client.send_sms(sms_payload, {timeout: 5})
|
7
|
-
client.send_sms(sms_payload, {timeout: 10})
|
8
|
-
r
|
9
|
-
exit
|
10
|
-
r
|
11
|
-
exit
|
12
|
-
r
|
13
|
-
exit
|
14
|
-
client
|
15
|
-
exit
|
16
|
-
@connection
|
17
|
-
r
|
18
|
-
exit
|
19
|
-
eit
|
20
|
-
@endpoint
|
21
|
-
r
|
22
|
-
exit
|
23
|
-
r
|
24
|
-
exit
|
25
|
-
r
|
26
|
-
exit
|
27
|
-
r
|
28
|
-
exit
|
29
|
-
r
|
30
|
-
exit
|
31
|
-
continue
|
32
|
-
@timeout
|
33
|
-
exit
|
34
|
-
@timeout
|
35
|
-
exit
|
36
|
-
r
|
37
|
-
exit
|
38
|
-
r
|
39
|
-
exit
|
40
|
-
r
|
41
|
-
exit
|
42
|
-
r.body
|
43
|
-
r.success?
|
44
|
-
r.success
|
45
|
-
r.body
|
46
|
-
r.data
|
47
|
-
r
|
48
|
-
exit
|
49
|
-
@url
|
50
|
-
exit
|
51
|
-
response
|
52
|
-
exit
|
53
|
-
response
|
54
|
-
exit
|
55
|
-
response
|
56
|
-
continue
|
57
|
-
"#{@client_token}:#{compute_signature}"
|
58
|
-
@client_token
|
59
|
-
@clieint_token
|
60
|
-
@payload
|
61
|
-
exit
|
62
|
-
@payload
|
63
|
-
Orchard::API::Constants::SEND_PAYMENT_REQUEST_URL
|
64
|
-
OpenSSL::HMAC.hexdigest(digest, @secret_token.to_s, @payload.to_json)
|
65
|
-
@client_token
|
66
|
-
@payload
|
67
|
-
@secrete_token
|
68
|
-
digest
|
69
|
-
exit
|
70
|
-
digist
|
71
|
-
client.ctm_request(payload)
|
72
|
-
exit
|
73
|
-
payload
|
74
|
-
client.ctm_request(payload)
|
75
|
-
exit
|
76
|
-
client.ctm_request(payload)
|
77
|
-
exit
|
78
|
-
client.ctm_request(payload)
|
79
|
-
exit
|
80
|
-
params
|
81
|
-
client
|
82
|
-
client.ctm_request(payload)
|
83
|
-
exit
|
84
|
-
client.ctm_request(payload)
|
85
|
-
exit
|
86
|
-
client.ctm_request(payload)
|
87
|
-
exit
|
88
|
-
client.ctm_request(payload)
|
89
|
-
exit
|
90
|
-
Orchard::API::SendPaymentRequest.call(payload)
|
91
|
-
client.ctm_request(payload)
|
92
|
-
client
|
93
|
-
payload
|
94
|
-
client.ctm_request(payload)
|
95
|
-
exit
|
96
|
-
payload
|
97
|
-
client.ctm_request(payload)
|
98
|
-
exit
|
99
|
-
client.ctm_request(payload)
|
100
|
-
exit
|
101
|
-
client.ctm_request(payload)
|
102
|
-
exit
|
103
|
-
client.ctm_request(payload)
|
104
|
-
payload
|
105
|
-
exit
|
106
|
-
Orchard::ApiClient.new(params).ctm_request
|
107
|
-
exit
|
108
|
-
CLIENT_TOKEN="JYAX4rhY3FI3LtzFwKGoVdnAMOkH3a51hAu3TdHv0cYiCTD4AjqqecZTzdgFjRcuDlGSEnhZQ2HC5BobsHLERQ=="
|
109
|
-
SECRETE_TOKEN="Na+oh2ElZk3fDy3kKQItvXm0L+9vZ5j2cPfTX2/bLpFnDZOOxhINR4ouc0kBinwZSeX/68eHkPvwByMhNx7raw=="
|
data/Gemfile.lock
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
orchard-api-client-anm (0.1.1)
|
5
|
-
byebug
|
6
|
-
faraday (~> 2.6)
|
7
|
-
rspec (~> 3.0)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
ast (2.4.2)
|
13
|
-
byebug (11.1.3)
|
14
|
-
diff-lcs (1.5.0)
|
15
|
-
faraday (2.6.0)
|
16
|
-
faraday-net_http (>= 2.0, < 3.1)
|
17
|
-
ruby2_keywords (>= 0.0.4)
|
18
|
-
faraday-net_http (3.0.1)
|
19
|
-
json (2.6.2)
|
20
|
-
parallel (1.22.1)
|
21
|
-
parser (3.1.2.1)
|
22
|
-
ast (~> 2.4.1)
|
23
|
-
rainbow (3.1.1)
|
24
|
-
rake (13.0.6)
|
25
|
-
regexp_parser (2.6.0)
|
26
|
-
rexml (3.2.5)
|
27
|
-
rspec (3.11.0)
|
28
|
-
rspec-core (~> 3.11.0)
|
29
|
-
rspec-expectations (~> 3.11.0)
|
30
|
-
rspec-mocks (~> 3.11.0)
|
31
|
-
rspec-core (3.11.0)
|
32
|
-
rspec-support (~> 3.11.0)
|
33
|
-
rspec-expectations (3.11.1)
|
34
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
-
rspec-support (~> 3.11.0)
|
36
|
-
rspec-mocks (3.11.1)
|
37
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.11.0)
|
39
|
-
rspec-support (3.11.1)
|
40
|
-
rubocop (1.36.0)
|
41
|
-
json (~> 2.3)
|
42
|
-
parallel (~> 1.10)
|
43
|
-
parser (>= 3.1.2.1)
|
44
|
-
rainbow (>= 2.2.2, < 4.0)
|
45
|
-
regexp_parser (>= 1.8, < 3.0)
|
46
|
-
rexml (>= 3.2.5, < 4.0)
|
47
|
-
rubocop-ast (>= 1.20.1, < 2.0)
|
48
|
-
ruby-progressbar (~> 1.7)
|
49
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
50
|
-
rubocop-ast (1.22.0)
|
51
|
-
parser (>= 3.1.1.0)
|
52
|
-
ruby-progressbar (1.11.0)
|
53
|
-
ruby2_keywords (0.0.5)
|
54
|
-
unicode-display_width (2.3.0)
|
55
|
-
|
56
|
-
PLATFORMS
|
57
|
-
x86_64-linux
|
58
|
-
|
59
|
-
DEPENDENCIES
|
60
|
-
faraday (~> 2.6)
|
61
|
-
orchard-api-client-anm!
|
62
|
-
rake (~> 13.0)
|
63
|
-
rspec (~> 3.0)
|
64
|
-
rubocop (~> 1.21)
|
65
|
-
|
66
|
-
BUNDLED WITH
|
67
|
-
2.3.20
|