mpesa_stk 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '082084ffdcc3290058eadfdc3e63e59bbd257bfe29a8d346c42a29013abe8116'
4
- data.tar.gz: 152156f9e4df7894afd4fe9ab9836df4ed2b4c5e17355dc33bee978b73e7a84a
3
+ metadata.gz: 94ab99204952e38b30261d8fe99056e6bd73490188168fb7715678ce2441da1c
4
+ data.tar.gz: d2c669caa9c3188c6501e38399bf956558298eb76a8c9d101dc2d15ab4def24f
5
5
  SHA512:
6
- metadata.gz: a096f3653a3018fe7d2cde6e5764ba2c04f1116b055fcbe390e150e1a946b637b01e4bdcd4e3fd53bac1eb0e9d974c1e4efed733bc3f9475c7c8617eeb2411f1
7
- data.tar.gz: d4b2019ef1f775f14e6180b643593a92a140530aade71d020cf5dd12cd81edb315c090b31fa10d3db0dd33419fa9dfdf489ec877a96bdd177e85802b2a57edc0
6
+ metadata.gz: 5e5ba51ab343854857e5cfbc47df4bdfa54c249a91287eabb56db5be22c9b3f440634f7ea6a89bfd1a393bfc1aa30639e2cc01441774b6872307ddfa26ce931d
7
+ data.tar.gz: ae94348ea8d875a3384e6fa64dd58ce96ee3a86fb3525b826d3ec24c41ec887e6f75d5ee6ff1a6dc981f217dcac33f69a937c1241b2c742a0d3eec59a5ce8ae5
File without changes
File without changes
data/.gitignore CHANGED
@@ -9,6 +9,8 @@
9
9
 
10
10
  .env
11
11
  .DS_Store
12
+ ._*
13
+ **/._*
12
14
  *.gem
13
15
  dump.rdb
14
16
 
data/.rubocop.yml CHANGED
@@ -17,6 +17,7 @@ AllCops:
17
17
  - 'vendor/**/*'
18
18
  - 'test/**/*'
19
19
  - 'spec/**/*'
20
+ - '**/._*'
20
21
 
21
22
  # Disable Gemspec/DevelopmentDependencies - it's standard practice for gems
22
23
  # to specify dev dependencies in gemspec
data/.sample.env CHANGED
File without changes
data/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.0.0] - 2026-05-25
9
+
10
+ ### Changed
11
+
12
+ - **Breaking:** Unified public API on `.call` (and `.register` for URL registration endpoints).
13
+ - **Breaking:** Replaced string-key option hashes with keyword arguments (`key:`, `secret:`, `business_short_code:`, etc.).
14
+ - **Breaking:** `MpesaStk::PushPayment` removed; use `MpesaStk::Push.call(amount, phone, type: :pay_bill | :buy_goods)`. PayBill is the default.
15
+ - **Breaking:** IoT entry points: use `IoT.list_sims`, `IoT.send_message`, or `IoT.call(:method_name, ...)`. Removed `IoT.sims` / `IoT.messaging` factories.
16
+ - Added `MpesaStk::Client` base class and `MpesaStk::Config` for shared HTTP, OAuth, and configuration.
17
+ - Added `MpesaStk.configure` block and `MPESA_STK_SKIP_DOTENV` to control Dotenv loading.
18
+
19
+ ### Added
20
+
21
+ - `MIGRATION.md` with a full 2.x → 3.0 upgrade guide.
22
+
8
23
  ## [2.0.0] - 2025-01-XX
9
24
 
10
25
  ### Added
data/CODE_OF_CONDUCT.md CHANGED
File without changes
data/Gemfile CHANGED
@@ -6,3 +6,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  # Specify your gem's dependencies in mpesa_stk.gemspec
8
8
  gemspec
9
+
10
+ gem 'simplecov', '~> 0.22.0', group: :development
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mpesa_stk (2.0.0)
4
+ mpesa_stk (3.0.0)
5
5
  base64 (>= 0.1.0)
6
6
  csv (>= 3.0.0)
7
- httparty (>= 0.15.6, < 0.22.0)
7
+ httparty (>= 0.15.6, < 0.25.0)
8
8
  redis (>= 4.0)
9
9
  redis-namespace (~> 1.5, >= 1.5.3)
10
10
  redis-rack (~> 2.0, >= 2.0.2)
@@ -12,48 +12,50 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- addressable (2.8.8)
15
+ addressable (2.9.0)
16
16
  public_suffix (>= 2.0.2, < 8.0)
17
17
  ast (2.4.3)
18
18
  base64 (0.3.0)
19
- bigdecimal (3.3.1)
19
+ bigdecimal (4.1.2)
20
20
  coderay (1.1.3)
21
21
  connection_pool (3.0.2)
22
22
  crack (1.0.1)
23
23
  bigdecimal
24
24
  rexml
25
25
  csv (3.3.5)
26
- dotenv (2.8.1)
26
+ docile (1.4.1)
27
+ dotenv (3.2.0)
27
28
  hashdiff (1.2.1)
28
- httparty (0.21.0)
29
+ httparty (0.24.2)
30
+ csv
29
31
  mini_mime (>= 1.0.0)
30
32
  multi_xml (>= 0.5.2)
31
- json (2.17.1)
33
+ json (2.19.5)
32
34
  language_server-protocol (3.17.0.5)
33
35
  lint_roller (1.1.0)
34
- method_source (0.9.2)
36
+ method_source (1.1.0)
35
37
  mini_mime (1.1.5)
36
- minitest (5.26.2)
37
- multi_xml (0.7.2)
38
- bigdecimal (~> 3.1)
39
- parallel (1.27.0)
40
- parser (3.3.10.0)
38
+ minitest (5.27.0)
39
+ multi_xml (0.9.1)
40
+ bigdecimal (>= 3.1, < 5)
41
+ parallel (1.28.0)
42
+ parser (3.3.11.1)
41
43
  ast (~> 2.4.1)
42
44
  racc
43
- prism (1.6.0)
44
- pry (0.12.2)
45
- coderay (~> 1.1.0)
46
- method_source (~> 0.9.0)
47
- pry-nav (0.3.0)
48
- pry (>= 0.9.10, < 0.13.0)
49
- public_suffix (7.0.0)
45
+ prism (1.9.0)
46
+ pry (0.14.2)
47
+ coderay (~> 1.1)
48
+ method_source (~> 1.0)
49
+ pry-nav (1.0.0)
50
+ pry (>= 0.9.10, < 0.15)
51
+ public_suffix (7.0.5)
50
52
  racc (1.8.1)
51
- rack (2.2.21)
53
+ rack (2.2.23)
52
54
  rainbow (3.1.1)
53
- rake (13.3.1)
55
+ rake (13.4.2)
54
56
  redis (5.4.1)
55
57
  redis-client (>= 0.22.0)
56
- redis-client (0.26.2)
58
+ redis-client (0.29.0)
57
59
  connection_pool
58
60
  redis-namespace (1.11.0)
59
61
  redis (>= 4)
@@ -62,27 +64,33 @@ GEM
62
64
  redis-store (>= 1.2, < 2)
63
65
  redis-store (1.11.0)
64
66
  redis (>= 4, < 6)
65
- regexp_parser (2.11.3)
67
+ regexp_parser (2.12.0)
66
68
  rexml (3.4.4)
67
- rubocop (1.81.7)
69
+ rubocop (1.86.2)
68
70
  json (~> 2.3)
69
71
  language_server-protocol (~> 3.17.0.2)
70
72
  lint_roller (~> 1.1.0)
71
- parallel (~> 1.10)
73
+ parallel (>= 1.10)
72
74
  parser (>= 3.3.0.2)
73
75
  rainbow (>= 2.2.2, < 4.0)
74
76
  regexp_parser (>= 2.9.3, < 3.0)
75
- rubocop-ast (>= 1.47.1, < 2.0)
77
+ rubocop-ast (>= 1.49.0, < 2.0)
76
78
  ruby-progressbar (~> 1.7)
77
79
  unicode-display_width (>= 2.4.0, < 4.0)
78
- rubocop-ast (1.48.0)
80
+ rubocop-ast (1.49.1)
79
81
  parser (>= 3.3.7.2)
80
- prism (~> 1.4)
82
+ prism (~> 1.7)
81
83
  ruby-progressbar (1.13.0)
84
+ simplecov (0.22.0)
85
+ docile (~> 1.1)
86
+ simplecov-html (~> 0.11)
87
+ simplecov_json_formatter (~> 0.1)
88
+ simplecov-html (0.13.2)
89
+ simplecov_json_formatter (0.1.4)
82
90
  unicode-display_width (3.2.0)
83
91
  unicode-emoji (~> 4.1)
84
- unicode-emoji (4.1.0)
85
- webmock (3.26.1)
92
+ unicode-emoji (4.2.0)
93
+ webmock (3.26.2)
86
94
  addressable (>= 2.8.0)
87
95
  crack (>= 0.3.2)
88
96
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -92,13 +100,14 @@ PLATFORMS
92
100
 
93
101
  DEPENDENCIES
94
102
  bundler (~> 2.0)
95
- dotenv (~> 2.8)
103
+ dotenv (~> 3.0)
96
104
  minitest (~> 5.20)
97
105
  mpesa_stk!
98
- pry (~> 0.12)
99
- pry-nav (~> 0.3)
106
+ pry (~> 0.14)
107
+ pry-nav (~> 1.0)
100
108
  rake (>= 12.3.3)
101
109
  rubocop (~> 1.0)
110
+ simplecov (~> 0.22.0, ~> 0.22)
102
111
  webmock (~> 3.18)
103
112
 
104
113
  BUNDLED WITH
data/LICENSE.txt CHANGED
File without changes
data/MIGRATION.md ADDED
@@ -0,0 +1,77 @@
1
+ # Migrating from 2.x to 3.0
2
+
3
+ Version 3.0 unifies the public API around `.call` (and `.register` where registration is not a payment). String-key option hashes are removed; use keyword arguments instead.
4
+
5
+ ## Configuration
6
+
7
+ ENV variables from `.sample.env` still work. Optional programmatic overrides:
8
+
9
+ ```ruby
10
+ MpesaStk.configure do |c|
11
+ c[:business_short_code] = '174379'
12
+ c[:key] = 'your_key'
13
+ end
14
+ ```
15
+
16
+ Set `MPESA_STK_SKIP_DOTENV=true` in production if your host app loads environment variables itself.
17
+
18
+ ## API changes
19
+
20
+ | 2.x | 3.0 |
21
+ |-----|-----|
22
+ | `MpesaStk::PushPayment.call(amount, phone)` | `MpesaStk::Push.call(amount, phone)` |
23
+ | `MpesaStk::Push.pay_bill(amount, phone, hash)` | `MpesaStk::Push.call(amount, phone, **opts)` |
24
+ | `MpesaStk::Push.buy_goods(amount, phone, hash)` | `MpesaStk::Push.call(amount, phone, type: :buy_goods, till_number: '...')` |
25
+ | `MpesaStk::B2C.pay(amount, phone, hash)` | `MpesaStk::B2C.call(amount, phone, remarks: '...')` |
26
+ | `MpesaStk::B2B.pay(amount, receiver, hash)` | `MpesaStk::B2B.call(amount, receiver, **opts)` |
27
+ | `MpesaStk::C2B.register_url(hash)` | `MpesaStk::C2B.register(**opts)` |
28
+ | `MpesaStk::C2B.simulate(amount, phone, hash)` | `MpesaStk::C2B.call(amount, phone, **opts)` |
29
+ | `MpesaStk::StkPushQuery.query(id, hash)` | `MpesaStk::StkPushQuery.call(id, **opts)` |
30
+ | `MpesaStk::TransactionStatus.query(id, hash)` | `MpesaStk::TransactionStatus.call(id, **opts)` |
31
+ | `MpesaStk::AccountBalance.query(hash)` | `MpesaStk::AccountBalance.call(**opts)` |
32
+ | `MpesaStk::Reversal.reverse(id, amount, hash)` | `MpesaStk::Reversal.call(id, amount, **opts)` |
33
+ | `MpesaStk::Ratiba.create_standing_order(hash)` | `MpesaStk::Ratiba.call(amount:, party_a:, start_date:, end_date:, **opts)` |
34
+ | `MpesaStk::PullTransactions.register(hash)` | `MpesaStk::PullTransactions.register(**opts)` |
35
+ | `MpesaStk::PullTransactions.query(start, end, hash)` | `MpesaStk::PullTransactions.call(start, end, **opts)` |
36
+ | `MpesaStk::IMSI.check_ati(phone, hash, version:)` | `MpesaStk::IMSI.call(phone, version: 'v1', **opts)` |
37
+ | `MpesaStk::IoT.sims({}).get_all_sims` | `MpesaStk::IoT.list_sims` or `MpesaStk::IoT.call(:get_all_sims, **opts)` |
38
+ | `MpesaStk::IoT.messaging({}).send_single_message(msisdn, msg)` | `MpesaStk::IoT.send_message(msisdn, msg)` |
39
+
40
+ ## Hash to keyword examples
41
+
42
+ ```ruby
43
+ # 2.x
44
+ MpesaStk::B2C.pay(100, '254712345678', { 'command_id' => 'SalaryPayment', 'key' => 'k', 'secret' => 's' })
45
+
46
+ # 3.0
47
+ MpesaStk::B2C.call(100, '254712345678', command_id: 'SalaryPayment', key: 'k', secret: 's')
48
+ ```
49
+
50
+ ```ruby
51
+ # 2.x
52
+ MpesaStk::Push.pay_bill(100, '254712345678', { 'business_short_code' => '174379', 'callback_url' => 'https://...' })
53
+
54
+ # 3.0
55
+ MpesaStk::Push.call(100, '254712345678', business_short_code: '174379', callback_url: 'https://...')
56
+ ```
57
+
58
+ ## IoT
59
+
60
+ Prefer shortcuts:
61
+
62
+ ```ruby
63
+ MpesaStk::IoT.list_sims(page_size: 20)
64
+ MpesaStk::IoT.send_message('0110100606', 'Hello device')
65
+ ```
66
+
67
+ Or dispatch any instance method:
68
+
69
+ ```ruby
70
+ MpesaStk::IoT.call(:query_lifecycle_status, '0110100606')
71
+ ```
72
+
73
+ ## Internal changes
74
+
75
+ - Shared `MpesaStk::Client` base for HTTP and OAuth
76
+ - `MpesaStk::Config` for ENV / configure overrides
77
+ - Removed per-class `get_*` helpers and string-hash constructors