Class: MpesaStk::PullTransactions
- Inherits:
-
Client
- Object
- Client
- MpesaStk::PullTransactions
show all
- Defined in:
- lib/mpesa_stk/pull_transactions.rb
Overview
Register and query pull transaction callbacks.
Constant Summary
Constants inherited
from Client
Client::AUTH_KEYS
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Client
extract_auth_options, #initialize, #json_headers, #option, #optional_option, #post, #random_reference, #stk_password, #stk_timestamp, #token
Class Method Details
.call(start_date, end_date, **options) ⇒ Object
13
14
15
|
# File 'lib/mpesa_stk/pull_transactions.rb', line 13
def call(start_date, end_date, **options)
new(**options).query_transactions(start_date, end_date)
end
|
.register(**options) ⇒ Object
9
10
11
|
# File 'lib/mpesa_stk/pull_transactions.rb', line 9
def register(**options)
new(**options).register_url
end
|
Instance Method Details
#query_transactions(start_date, end_date) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/mpesa_stk/pull_transactions.rb', line 31
def query_transactions(start_date, end_date)
post(
'pull_transactions_query_url',
{
ShortCode: option('business_short_code', :short_code),
StartDate: start_date,
EndDate: end_date,
OffSetValue: @options.fetch(:offset_value, '0')
},
error_message: 'Failed to query pull transactions'
)
end
|
#register_url ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/mpesa_stk/pull_transactions.rb', line 18
def register_url
post(
'pull_transactions_register_url',
{
ShortCode: option('business_short_code', :short_code),
RequestType: @options.fetch(:request_type, ''),
NominatedNumber: @options.fetch(:nominated_number, ''),
CallBackURL: option('callback_url')
},
error_message: 'Failed to register pull transactions URL'
)
end
|