Class: MpesaStk::B2B
Overview
Business-to-business payments via Daraja B2B API.
Constant Summary
Constants inherited from Client
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#receiver_party ⇒ Object
readonly
Returns the value of attribute receiver_party.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(amount, receiver_party, **options) ⇒ B2B
constructor
A new instance of B2B.
- #send_payment ⇒ Object
Methods inherited from Client
extract_auth_options, #json_headers, #option, #optional_option, #post, #random_reference, #stk_password, #stk_timestamp, #token
Constructor Details
#initialize(amount, receiver_party, **options) ⇒ B2B
Returns a new instance of B2B.
16 17 18 19 20 |
# File 'lib/mpesa_stk/b2b.rb', line 16 def initialize(amount, receiver_party, **) super(**) @amount = amount @receiver_party = receiver_party end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
14 15 16 |
# File 'lib/mpesa_stk/b2b.rb', line 14 def amount @amount end |
#receiver_party ⇒ Object (readonly)
Returns the value of attribute receiver_party.
14 15 16 |
# File 'lib/mpesa_stk/b2b.rb', line 14 def receiver_party @receiver_party end |
Class Method Details
.call(amount, receiver_party, **options) ⇒ Object
9 10 11 |
# File 'lib/mpesa_stk/b2b.rb', line 9 def call(amount, receiver_party, **) new(amount, receiver_party, **).send_payment end |
Instance Method Details
#send_payment ⇒ Object
22 23 24 |
# File 'lib/mpesa_stk/b2b.rb', line 22 def send_payment post('b2b_url', b2b_payload, error_message: 'Failed to send B2B payment') end |