paymentsds-mpesa 0.1.0.pre.alpha.8 → 0.1.0.pre.alpha.13
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 382655187d79e081000c1ce3b1cd664fa86e8d4d2397958e2add9875cf3b471c
|
4
|
+
data.tar.gz: 144c2c56e1b236296e931db9dc870ef4fbec7f8727682423a3aa33710239a082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45148c1776339bbe17d8538636b97117f137fc0240a5a369c13351db1a0151d6fde8c3a556acd862c78aeb514a9c42b645ced4ded50ed1c80e2072545c16292f
|
7
|
+
data.tar.gz: '094269d5f9de88db2c0092cbd1105ad1e3aca770b44ce77d0fc2956cfb30afe136ce1e0a76561edf97cba80c314bf6b00a10b31fa97c5cd8766f748dcd45844f'
|
data/lib/paymentsds/mpesa.rb
CHANGED
@@ -21,9 +21,23 @@ module Paymentsds
|
|
21
21
|
attr_reader :auth
|
22
22
|
|
23
23
|
def initialize
|
24
|
+
@user_agent = 'Paymentsds Ruby'
|
25
|
+
@origin = "*"
|
26
|
+
@verify_ssl = false
|
27
|
+
@timeout = 0
|
28
|
+
@environment =
|
29
|
+
|
24
30
|
yield(self) if block_given?
|
25
31
|
end
|
26
32
|
|
33
|
+
def apply
|
34
|
+
@environment = if @environment == :production
|
35
|
+
Paymentsds::MPesa::Environment.new('https', 'api.vm.co.mz').freeze
|
36
|
+
else
|
37
|
+
Paymentsds::MPesa::Environment.new('https', 'api.sandbox.vm.co.mz').freeze
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
27
41
|
def generate_access_token
|
28
42
|
has_keys = instance_variable_defined?('@api_key') && instance_variable_defined?('@public_key')
|
29
43
|
has_access_token = instance_variable_defined?('@access_token')
|
@@ -9,6 +9,10 @@ module Paymentsds
|
|
9
9
|
@config = Paymentsds::MPesa::Configuration.new
|
10
10
|
end
|
11
11
|
|
12
|
+
def apply
|
13
|
+
@config.apply
|
14
|
+
end
|
15
|
+
|
12
16
|
def handle_send(intent)
|
13
17
|
operation = detect_operation(intent)
|
14
18
|
handle_request(operation, intent)
|
@@ -71,7 +75,7 @@ module Paymentsds
|
|
71
75
|
errors = []
|
72
76
|
|
73
77
|
intent.each do |k, _v|
|
74
|
-
errors.push(k) unless (intent[k]).match operation
|
78
|
+
errors.push(k) unless (intent[k]).match operation[:validation][k]
|
75
79
|
end
|
76
80
|
|
77
81
|
errors
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paymentsds-mpesa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.alpha.
|
4
|
+
version: 0.1.0.pre.alpha.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edson Michaque
|
@@ -113,6 +113,7 @@ files:
|
|
113
113
|
- lib/paymentsds/mpesa/client.rb
|
114
114
|
- lib/paymentsds/mpesa/configuration.rb
|
115
115
|
- lib/paymentsds/mpesa/constants.rb
|
116
|
+
- lib/paymentsds/mpesa/environment.rb
|
116
117
|
- lib/paymentsds/mpesa/error_type.rb
|
117
118
|
- lib/paymentsds/mpesa/operation.rb
|
118
119
|
- lib/paymentsds/mpesa/patterns.rb
|