paymentsds-mpesa 0.1.0.pre.alpha.46 → 0.1.0.pre.alpha.47

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/lib/paymentsds/mpesa/result.rb +6 -10
  3. data/lib/paymentsds/mpesa/service.rb +18 -2
  4. data/lib/paymentsds/mpesa/version.rb +1 -1
  5. metadata +1 -56
  6. data/paymentsds-mpesa-0.1.0.pre.alpha.31/checksums.yaml.gz +0 -0
  7. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data.tar.gz +0 -0
  8. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/.gitignore +0 -13
  9. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/.overcommit.yml +0 -0
  10. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/.rspec +0 -3
  11. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/.rubocop.yml +0 -0
  12. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/.travis.yml +0 -6
  13. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/Gemfile +0 -7
  14. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/LICENSE +0 -201
  15. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/README.md +0 -261
  16. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/Rakefile +0 -6
  17. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/bin/console +0 -14
  18. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/bin/setup +0 -8
  19. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa.rb +0 -17
  20. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/client.rb +0 -29
  21. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/configuration.rb +0 -59
  22. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/constants.rb +0 -164
  23. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/environment.rb +0 -17
  24. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/error_type.rb +0 -8
  25. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/constants.rb +0 -50
  26. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/direct_debt_missing.rb +0 -9
  27. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/duplicate_direct_debt.rb +0 -9
  28. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/errors.rb +0 -26
  29. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/inactive_account.rb +0 -9
  30. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/initiator_authentication.rb +0 -9
  31. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/insuficient_balance.rb +0 -9
  32. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_amount.rb +0 -9
  33. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_initiator_identifier.rb +0 -9
  34. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_language_code.rb +0 -9
  35. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_market.rb +0 -9
  36. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_missing_properties.rb +0 -9
  37. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_msisdn.rb +0 -9
  38. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_receiver.rb +0 -9
  39. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_reference.rb +0 -9
  40. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_security_credential.rb +0 -9
  41. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_shortcode.rb +0 -9
  42. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_thirdparty_reference.rb +0 -9
  43. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_transaction_id.rb +0 -9
  44. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_transaction_reference.rb +0 -9
  45. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/profile_problems.rb +0 -0
  46. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/request_timeout.rb +0 -9
  47. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/transaction_cancelled.rb +0 -9
  48. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/transaction_failed.rb +0 -9
  49. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/unavailabe_server.rb +0 -9
  50. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/unknown.rb +0 -9
  51. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/unknown_status.rb +0 -9
  52. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/validation.rb +0 -9
  53. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/operation.rb +0 -28
  54. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/patterns.rb +0 -12
  55. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/result.rb +0 -18
  56. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/service.rb +0 -311
  57. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/version.rb +0 -7
  58. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/paymentsds-mpesa.gemspec +0 -32
  59. data/paymentsds-mpesa-0.1.0.pre.alpha.31/data/publish.sh +0 -6
  60. data/paymentsds-mpesa-0.1.0.pre.alpha.31/metadata.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 93991abc8c45dc201d51722fe3f3c5ef4fc2b7d6a1a28a7bc23ba094b3ffa755
4
- data.tar.gz: 753f4fe312425b07a78e36fa50811c8afccddfa33214c8ac812f30371b2c4ac2
3
+ metadata.gz: 66ff2d7900add05d00db7332c324e645e30cc8656f1246ab2aa3de67566a80e8
4
+ data.tar.gz: e74768d669130a8a4be33fe2a273777b9badf92820c538499513fd9dee15b956
5
5
  SHA512:
6
- metadata.gz: 88de69c4c6a81a4167ed05aa25415b42015ed02f7329014c0b8d56490152ea9c06d35e425379aec84d755b981c9ccf46d943083d21e45896d835f26bd3331922
7
- data.tar.gz: c745cbb736e48fc7b40d09d5750a91d4a699889f456cac0e6eb157f681ba43ebb77c92a727060bb973cbdb9c0aae627346ae53b7133f9c4d95843fdb50f67c6d
6
+ metadata.gz: 6d29eb9059e54023ee84e5f1e36abf35a0b9addf9cdd94bcbe7df6a2c7404d64eb838357381fd31d5d43abf2cec4470446d8e24686dbdea781ba1adcc5d2df0b
7
+ data.tar.gz: 66befe33577f24780ae116503b9f9c10f82f240c1bd25081f0e164918a2a7aa283c60192567af0dc17e98183ccbb25526db0eadcd4875ffad9d1b2aebd6b0407
@@ -1,17 +1,13 @@
1
1
  module Paymentsds
2
2
  module MPesa
3
3
  class Result
4
- attr_reader :error
5
- attr_reader :data
4
+ attr_accessor :response
5
+ attr_accessor :transaction_id
6
+ attr_accessor :conversation_id
7
+ attr_accessor :third_party_reference
6
8
 
7
- def initialize(success, error, data)
8
- @success = success
9
- @error = error
10
- @data = data
11
- end
12
-
13
- def success?
14
- @success
9
+ def initialize
10
+ yield(self) if block_given?
15
11
  end
16
12
  end
17
13
  end
@@ -184,7 +184,15 @@ module Paymentsds
184
184
  when 200
185
185
  case result.body["output_ResponseCode"].to_sym
186
186
  when Paymentsds::MPesa::INS0
187
- response = Paymentsds::MPesa::Result.new(result.success?, nil, result.body)
187
+
188
+ response = Paymentsds::MPesa::Result.new do |r|
189
+ r.response =
190
+ r.transaction_id = result.body["output_TransactionID"]
191
+ r.conversation = result.body["output_ConversationID"]
192
+ r.reference = result.body["output_ThirdPartyReference"]
193
+ end
194
+
195
+ return response
188
196
  else
189
197
  raise Paymentsds::MPesa::UnknownError
190
198
  end
@@ -192,7 +200,15 @@ module Paymentsds
192
200
  when 201
193
201
  case result.body["output_ResponseCode"].to_sym
194
202
  when Paymentsds::MPesa::INS0
195
- response = Paymentsds::MPesa::Result.new(result.success?, nil, result.body)
203
+
204
+ response = Paymentsds::MPesa::Result.new do |r|
205
+ r.response =
206
+ r.transaction_id = result.body["output_TransactionID"]
207
+ r.conversation = result.body["output_ConversationID"]
208
+ r.reference = result.body["output_ThirdPartyReference"]
209
+ end
210
+
211
+ return response
196
212
  else
197
213
  raise Paymentsds::MPesa::UnknownError
198
214
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Paymentsds
4
4
  module MPesa
5
- VERSION = '0.1.0.pre.alpha.46'
5
+ VERSION = '0.1.0.pre.alpha.47'
6
6
  end
7
7
  end
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.46
4
+ version: 0.1.0.pre.alpha.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edson Michaque
@@ -162,61 +162,6 @@ files:
162
162
  - lib/paymentsds/mpesa/result.rb
163
163
  - lib/paymentsds/mpesa/service.rb
164
164
  - lib/paymentsds/mpesa/version.rb
165
- - paymentsds-mpesa-0.1.0.pre.alpha.31/checksums.yaml.gz
166
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data.tar.gz
167
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/.gitignore
168
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/.overcommit.yml
169
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/.rspec
170
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/.rubocop.yml
171
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/.travis.yml
172
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/Gemfile
173
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/LICENSE
174
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/README.md
175
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/Rakefile
176
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/bin/console
177
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/bin/setup
178
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa.rb
179
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/client.rb
180
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/configuration.rb
181
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/constants.rb
182
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/environment.rb
183
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/error_type.rb
184
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/constants.rb
185
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/direct_debt_missing.rb
186
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/duplicate_direct_debt.rb
187
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/errors.rb
188
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/inactive_account.rb
189
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/initiator_authentication.rb
190
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/insuficient_balance.rb
191
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_amount.rb
192
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_initiator_identifier.rb
193
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_language_code.rb
194
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_market.rb
195
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_missing_properties.rb
196
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_msisdn.rb
197
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_receiver.rb
198
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_reference.rb
199
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_security_credential.rb
200
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_shortcode.rb
201
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_thirdparty_reference.rb
202
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_transaction_id.rb
203
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/invalid_transaction_reference.rb
204
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/profile_problems.rb
205
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/request_timeout.rb
206
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/transaction_cancelled.rb
207
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/transaction_failed.rb
208
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/unavailabe_server.rb
209
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/unknown.rb
210
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/unknown_status.rb
211
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/errors/validation.rb
212
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/operation.rb
213
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/patterns.rb
214
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/result.rb
215
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/service.rb
216
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/lib/paymentsds/mpesa/version.rb
217
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/paymentsds-mpesa.gemspec
218
- - paymentsds-mpesa-0.1.0.pre.alpha.31/data/publish.sh
219
- - paymentsds-mpesa-0.1.0.pre.alpha.31/metadata.gz
220
165
  - paymentsds-mpesa.gemspec
221
166
  - publish.sh
222
167
  homepage: https://github.com/paymentsds/mpesa-ruby-sdk
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
- /build.shh
10
- /Gemfile.lock
11
- # rspec failure tracking
12
- .rspec_status
13
- *.gem
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.4
@@ -1,7 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in paysuite-mpesa.gemspec
4
- gemspec
5
-
6
- gem 'rake', '~> 12.0'
7
- gem 'rspec', '~> 3.0'
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2020 Edson Michaque, Nélio Macombo
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
@@ -1,261 +0,0 @@
1
- # M-Pesa SDK for Ruby
2
-
3
- M-Pesa SDK for Ruby is an unofficial library aiming to help businesses integrating every [M-Pesa](https://developer.mpesa.vm.co.mz) operations to their Ruby applications.
4
-
5
- ## Contents
6
-
7
- - [Features](#features)
8
- - [Usage](#usage)
9
- - [Quickstart](#usage/scenario-1)
10
- - [Receive Money from a Mobile Account](#usage/scenario-1)
11
- - [Send Money to a Mobile Account](#usage/scenario-2)
12
- - [Send Money to a Business Account](#usage/scenario-3)
13
- - [Revert a Transaction](#usage/scenario-4)
14
- - [Query the Status of a Transaction](#usage/scenario-5)
15
- - [Examples](#usage/scenario-6)
16
- - [Prerequisites](#prerequisites)
17
- - [Installation](#installation)
18
- - [Using RubyGems](#installation/scenario-1)
19
- - [Using Bundler](#installation/scenario-2)
20
- - [Installation Scenario 3](#installation/scenario-3)
21
- - [Installation Scenario 4](#installation/scenario-4)
22
- - [Configuration](#configuration)
23
- - [Configuration Scenario 1](#configuration/scenario-1)
24
- - [Configuration Scenario 2](#configuration/scenario-2)
25
- - [Configuration Scenario 3](#configuration/scenario-3)
26
- - [Configuration Scenario 4](#configuration/scenario-4)
27
- - [Related Projects](#related-projects)
28
- - [Dependencies](#related-projects/dependencies)
29
- - [Friends](#related-projects/friends)
30
- - [Alternatives](#related-projects/alternatives)
31
- - [Contributing](#contributing)
32
- - [Changelog](#changelog)
33
- - [Authors](#authors)
34
- - [Credits](#credits)
35
- - [License](#license)
36
-
37
- ## Features <a name="features"></a>
38
-
39
- - Receive money from a mobile account to a business account
40
- - Send money from a business account to a mobile account
41
- - Send money from a business account to a another business account
42
- - Revert a transaction
43
- - Query the status of a transaction
44
-
45
- ## Usage <a name="usage"></a>
46
-
47
- ### Quickstart <a name="#usage/scenario-1"></a>
48
-
49
- ### Receive Money from a Mobile Account <a name="#usage/scenario-2"></a>
50
-
51
- ```ruby
52
- require 'paymentsds/mpesa'
53
-
54
- client = Paymentsds::MPesa::Client.new do |config|
55
- config.api_key = '<REPLACE>' # API Key
56
- config.public_key = '<REPLACE>' # Public Key
57
- config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
58
- end
59
-
60
- begin
61
- payment_data = {
62
- from: '841234567', # input_CustomerMSISDN
63
- reference: '11114', # input_ThirdPartyReference
64
- transaction: 'T12344CC', # input_TransactionReference
65
- amount: '10' # input_Amount
66
- }
67
-
68
- result = client.receive(payment_data)
69
-
70
- if result.success?
71
- puts result.data
72
- end
73
- rescue
74
- puts 'Operation failed'
75
- end
76
- ```
77
- ### Send Money to a Mobile Account <a name="#usage/scenario-3"></a>
78
-
79
- ```ruby
80
- require 'paymentsds/mpesa'
81
-
82
- client = Paymentsds::MPesa::Client.new do |config|
83
- config.api_key = '<REPLACE>' # API Key
84
- config.public_key = '<REPLACE>' # Public Key
85
- config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
86
- end
87
-
88
- begin
89
- payment_data = {
90
- to: '841234567', # input_CustomerMSISDN
91
- reference: '11114', # input_ThirdPartyReference
92
- transaction: 'T12344CC', # input_TransactionReference
93
- amount: '10' # input_Amount
94
- }
95
-
96
- result = client.send(payment_data)
97
-
98
- if result.success?
99
- puts result.data
100
- end
101
- rescue
102
- puts 'Operation failed'
103
- end
104
- ```
105
-
106
- ### Send Money to a Business Account <a name="#usage/scenario-4"></a>
107
-
108
- ```ruby
109
- require 'paymentsds/mpesa'
110
-
111
- client = Paymentsds::MPesa::Client.new do |config|
112
- config.api_key = '<REPLACE>' # API Key
113
- config.public_key = '<REPLACE>' # Public Key
114
- config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
115
- end
116
-
117
- begin
118
- payment_data = {
119
- to: '979797', # input_ReceiverPartyCode
120
- reference: '11114', # input_ThirdPartyReference
121
- transaction: 'T12344CC', # input_TransactionReference
122
- amount: '10' # input_Amount
123
- }
124
-
125
- result = client.send(payment_data)
126
-
127
- if result.success?
128
- puts result.data
129
- end
130
- rescue
131
- puts 'Operation failed'
132
- end
133
- ```
134
-
135
- ### Revert a Transaction <a name="#usage/scenario-5"></a>
136
-
137
- ```ruby
138
- require 'paymentsds/mpesa'
139
-
140
- client = Paymentsds::MPesa::Client.new do |config|
141
- config.api_key = '<REPLACE>' # API Key
142
- config.public_key = '<REPLACE>' # Public Key
143
- config.service_provider_code = '<REPLACE>' # input_ServiceProviderCode
144
- config.initiator_identifier = '<REPLACE>' # input_InitiatorIdentifier,
145
- config.security_identifier = '<REPLACE>' # input_SecurityCredential
146
- end
147
-
148
- begin
149
- reversion_data = {
150
- reference: '11114', # input_ThirdPartyReference
151
- transaction: 'T12344CC', # input_TransactionReference
152
- amount: '10' # input_ReversalAmounts
153
- }
154
-
155
- result = client.reversion(payment_data)
156
-
157
- if result.success?
158
- # Handle success scenario
159
- end
160
- rescue
161
- # Handle failure scenario
162
- end
163
- ```
164
-
165
- ### Query the Status of a Transaction <a name="#usage/scenario-6"></a>
166
-
167
- ### Examples <a name="usage/scenario-7"></a>
168
-
169
- ## Prerequisites <a name="prerequisites"></a>
170
-
171
- - [Ruby 2.5+](https://www.ruby-lang.org)
172
- - [RubyGems](https://rubygems.org)
173
- - [Bundler](https://bundler.io)
174
-
175
- ## Installation <a name="installation"></a>
176
-
177
- ### Using RubyGems <a name="installation/scenario-1"></a>
178
-
179
- ```bash
180
- gem install paymentsds-mpesa
181
- ```
182
-
183
- ### Using Bundler <a name="installation/scenario-2"></a>
184
-
185
- ```ruby
186
- #Gemfile
187
- gem 'paymentsds-mpesa'
188
- ```
189
-
190
- ### Installation Scenario 3 <a name="installation/scenario-3"></a>
191
-
192
- ## Configuration <a name="configuration"></a>
193
-
194
- ### Configuration Scenario 1 <a name="configuration/scenario-1"></a>
195
-
196
- ### Configuration Scenario 2 <a name="configuration/scenario-2"></a>
197
-
198
- ### Configuration Scenario 3 <a name="configuration/scenario-3"></a>
199
-
200
- ## Related Projects <a name="related-projects"></a>
201
-
202
- ### Dependencies <a name="related-projects/dependencies"></a>
203
-
204
- #### Production Dependencies
205
-
206
- - [Faraday](https://github.com/lostisland/faraday)
207
- - [OpenSSL](https://github.com/ruby/openssl)
208
-
209
-
210
- #### Development Dependencies
211
-
212
- - [RSpec](https://github.com/rspec/rspec)
213
- - [Rake](https://github.com/ruby/rake)
214
- - [RuboCop](https://github.com/rubocop-hq/rubocop)
215
- - [Overcommit](https://github.com/sds/overcommit)
216
-
217
- ### Friends <a name="related-projects/friends"></a>
218
-
219
- - [M-Pesa SDK for Javascript](https://github.com/paymentsds/mpesa-js-sdk)
220
- - [M-Pesa SDK for PHP](https://github.com/paymentsds/mpesa-php-sdk)
221
- - [M-Pesa SDK for Ruby](https://github.com/paymentsds/mpesa-ruby-sdk)
222
- - [M-Pesa SDK for Python](https://github.com/paymentsds/mpesa-python-sdk)
223
-
224
- ### Alternatives <a name="related-projects/alternatives"></a>
225
-
226
- - [Alternative 1](https://github.com/<username>/<project>)
227
- - [Alternative 2](https://github.com/<username>/<project>)
228
- - [Alternative 3](https://github.com/<username>/<project>)
229
- - [Alternative 4](https://github.com/<username>/<project>)
230
-
231
-
232
- ### Inspiration
233
-
234
- - [rosariopfernandes/mpesa-node-api](https://github.com/abdulmueid/mpesa-php-api)
235
- - [karson/mpesa-php-sdk](https://github.com/karson/mpesa-php-sdk)
236
- - [codeonweekends/mpesa-php-sdk](https://github.com/codeonweekends/mpesa-php-sdk)
237
- - [abdulmueid/mpesa-php-api](https://github.com/abdulmueid/mpesa-php-api)
238
- - [realdm/mpesasdk](https://github.com/realdm/mpesasdk)
239
-
240
-
241
- ## Contributing <a name="contributing"></a>
242
-
243
- ## Changelog <a name="changelog"></a>
244
-
245
- ## Authors <a name="authors"></a>
246
-
247
- - [Edson Michaque](https://github.com/edsonmichaque)
248
- - [Nélio Macombo](https://github.com/neliomacombo)
249
-
250
- ## Credits <a name="credits"></a>
251
-
252
- ## License <a name="license"></a>
253
-
254
- Copyright 2020 Anísio Mandlate, Edson Michaque, Elton Laice and Nélio Macombo
255
-
256
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
257
-
258
- http://www.apache.org/licenses/LICENSE-2.0
259
-
260
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
261
-