mpesarb 0.3.6 → 0.3.7

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: d5629d27ad035e58f3526e8b9e255296fa18b693b1267d6ba99e6825acd6cf8f
4
- data.tar.gz: 9af526343130143acae5a8fbce51105738876e33582e73e232bace44fb1d3ef2
3
+ metadata.gz: abffb99bd570f42920bccfb725ee0c965a6ce04ef8f9b5d513371fd0d4db03b7
4
+ data.tar.gz: 930ebaaba7a3d32e65cfdffa5509dc823772d73d622d5fc365a0f95ffbcbe63d
5
5
  SHA512:
6
- metadata.gz: 31c766e363b1bc3c2295c9b54509cc123a4464d67d7c3162a5268e09801d500a01add96d8ee216e1e4dbd361186295500fc9184693eac31348ded4ab008c6747
7
- data.tar.gz: 55fe4ce347865ee6e5ea4587434bece73d2a9cac219a922c5df323c62e061384524ebb9980fe27f5f65d210e5cf5f4eea8dfc9d491eb9f1ea342be0cf4b71475
6
+ metadata.gz: b2f01929e3417f32d6e75d0959a473cb267db89e79e6e25271b29532d7099412630b802ffebb08826cf6fd0e48f414250abbf6cab4456faf33790abc46c36108
7
+ data.tar.gz: 1525344f68ebd3cc74352514f96261cca78d75eaad815a42370adfea3c20c1d0bc02407848e9ad62c891cbb04be0731da99c7dac71b8ae3f630f011e8d7cf9f4
data/README.md CHANGED
@@ -66,6 +66,7 @@ Lipa na mpesa online(Stk Push)
66
66
  ```ruby
67
67
  response = client.stk(
68
68
  shortcode: "174379",
69
+ # till_no: "379174",
69
70
  pass_key: "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919", # Optional if passed in client initialization
70
71
  amount: "10",
71
72
  phone: "254705112855",
@@ -77,6 +78,7 @@ response = client.stk(
77
78
  response.CheckoutRequestID # "ws_CO_040920212326513616"
78
79
  response.inspect # to see all available attributes
79
80
  ```
81
+ If working with a till number, pass it in the `till_no` param. The shortcode should be the HeadOffice(HO)/Store number.
80
82
 
81
83
  ### STK Query
82
84
 
@@ -15,14 +15,20 @@ module Mpesa
15
15
  'BusinessShortCode': shortcode,
16
16
  'Password': password,
17
17
  'Timestamp': timestamp,
18
- 'TransactionType': 'CustomerPayBillOnline',
19
18
  'Amount': args[:amount],
20
19
  'PartyA': format_phone(args[:phone]),
21
- 'PartyB': shortcode,
22
20
  'PhoneNumber': format_phone(args[:phone]),
23
21
  'CallBackURL': args[:callback_url],
24
22
  'AccountReference': args[:reference],
25
23
  'TransactionDesc': args[:trans_desc]
24
+ }.merge(transaction_details)
25
+ end
26
+
27
+ def transaction_details
28
+ till_no = args[:till_no] unless args[:till_no].nil? || args[:till_no].strip.empty?
29
+ {
30
+ 'TransactionType': till_no.nil? ? 'CustomerPayBillOnline' : 'CustomerBuyGoodsOnline',
31
+ 'PartyB': till_no || shortcode
26
32
  }
27
33
  end
28
34
 
data/lib/mpesa/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mpesa
4
- VERSION = '0.3.6'
4
+ VERSION = '0.3.7'
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpesarb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moses Gathuku
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-11-05 00:00:00.000000000 Z
10
+ date: 2025-11-08 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler