@@ -298,6 +298,22 @@ def verify_query(transaction_query: dict, required_fields: set) -> bool:
298
298
def customer_to_bussiness (self , transaction_query : dict ) -> dict :
299
299
"""
300
300
Customer to bussiness()
301
+
302
+ Example;
303
+
304
+ >> import pypesa
305
+ >> mpesa = pypesa()
306
+ >> transaction_query = {
307
+ "input_Amount": "10",
308
+ "input_Country": "TZN",
309
+ "input_Currency": "TZS",
310
+ "input_CustomerMSISDN": "000000000001",
311
+ "input_ServiceProviderCode": "000000",
312
+ "input_ThirdPartyConversationID":'2edf7a0206d848f6b6fedea26accdc3a',
313
+ "input_TransactionReference": 'T23434ZE5',
314
+ "input_PurchasedItemsDesc": "Python Book"
315
+ }
316
+ >> mpesa.customer_to_bussiness(transaction_query)
301
317
"""
302
318
303
319
self .verify_query (transaction_query ,
@@ -318,6 +334,24 @@ def customer_to_bussiness(self, transaction_query: dict) -> dict:
318
334
def bussiness_to_customer (self , transaction_query : dict ) -> dict :
319
335
"""
320
336
Bussiness to customer()
337
+
338
+ Example;
339
+
340
+ >> import pypesa
341
+ >> mpesa = pypesa()
342
+ >> transaction_query = {
343
+ 'input_Amount': 250,
344
+ 'input_Country': 'TZN',
345
+ 'input_Currency': 'TZS',
346
+ 'input_CustomerMSISDN': '000000000001',
347
+ 'input_ServiceProviderCode': '000000',
348
+ 'input_ThirdPartyConversationID':'f5e420e99594a9c496d8600',
349
+ 'input_TransactionReference': 'T12345C',
350
+ 'input_PaymentItemsDesc': 'Donation',
351
+ }
352
+
353
+ >> mpesa.bussiness_to_customer(transaction_query)
354
+
321
355
"""
322
356
323
357
self .verify_query (transaction_query ,
@@ -339,6 +373,23 @@ def bussiness_to_customer(self, transaction_query: dict) -> dict:
339
373
def bussiness_to_bussiness (self , transaction_query : dict ) -> dict :
340
374
"""
341
375
Bussiness to bussiness()
376
+
377
+ Example;
378
+
379
+ >> import pypesa
380
+ >> mpesa = pypesa()
381
+ >> transaction_query = {
382
+ 'input_Amount': 10,
383
+ 'input_Country': 'TZN',
384
+ 'input_Currency': 'TZS',
385
+ 'input_PrimaryPartyCode':'000000',
386
+ 'input_ReceiverPartyCode':'000001',
387
+ 'input_ServiceProviderCode': '000000',
388
+ 'input_ThirdPartyConversationID': '8a89835c71f15e99396',
389
+ 'input_TransactionReference': 'T1234C',
390
+ 'input_PurchasedItemsDesc': 'Shoes',
391
+ }
392
+ >> mpesa.bussiness_to_bussiness(transaction_query)
342
393
"""
343
394
344
395
self .verify_query (transaction_query ,
@@ -359,6 +410,20 @@ def bussiness_to_bussiness(self, transaction_query: dict) -> dict:
359
410
def payment_reversal (self , transaction_query : dict ) -> dict :
360
411
"""
361
412
Payment reversal()
413
+
414
+ Example;
415
+
416
+ >> import pypesa
417
+ >> mpesa = pypesa()
418
+ >> transaction_query = {
419
+ 'input_ReversalAmount':10,
420
+ 'input_Country': 'TZN',
421
+ 'input_ServiceProviderCode': '000000',
422
+ 'input_ThirdPartyConversationID':'asvf7ba228d83d0d689761',
423
+ 'input_TransactionID':'4iUThBRRWXMG'
424
+ }
425
+ >> mpesa.payment_reversal(transaction_query)
426
+
362
427
"""
363
428
364
429
self .verify_query (transaction_query , self .urls .re_payment_reversal )
@@ -378,6 +443,19 @@ def payment_reversal(self, transaction_query: dict) -> dict:
378
443
def query_transaction_status (self , transaction_query : dict ) -> dict :
379
444
"""
380
445
Query transaction status()
446
+
447
+ Example;
448
+
449
+ >> import pypesa
450
+ >> mpesa = pypesa()
451
+ >> transaction_query = {
452
+ 'input_QueryReference': '000000000000000000001',
453
+ 'input_ServiceProviderCode': '000000',
454
+ 'input_ThirdPartyConversationID': 'asv02e5958774f7ba228d83d0d689761',
455
+ 'input_Country': 'TZN',
456
+ }
457
+ >> mpesa.query_transaction_status(transaction_query)
458
+
381
459
"""
382
460
383
461
self .verify_query (transaction_query , self .urls .re_transaction_status )
@@ -397,6 +475,23 @@ def query_transaction_status(self, transaction_query: dict) -> dict:
397
475
def create_direct_debit (self , transaction_query : dict ) -> dict :
398
476
"""
399
477
Create direct Debit()
478
+
479
+ >> import pypesa
480
+ >> mpesa = pypesa()
481
+ >> transaction_query = {
482
+ "input_AgreedTC": "1",
483
+ "input_Country": "TZN",
484
+ "input_CustomerMSISDN": "000000000001",
485
+ "input_EndRangeOfDays": "22",
486
+ "input_ExpiryDate": "20211126",
487
+ "input_FirstPaymentDate": "20160324",
488
+ "input_Frequency": "06",
489
+ "input_ServiceProviderCode": "000000",
490
+ "input_StartRangeOfDays": "01",
491
+ "input_ThirdPartyConversationID": "5334a912jbsj1j2kk1",
492
+ "input_ThirdPartyReference": "3333",
493
+ }
494
+ >> mpesa.create_direct_debit(transaction_query)
400
495
"""
401
496
402
497
self .verify_query (transaction_query , self .urls .re_create_direct_debit )
@@ -416,6 +511,20 @@ def create_direct_debit(self, transaction_query: dict) -> dict:
416
511
def direct_debit_payment (self , transaction_query : dict ) -> dict :
417
512
"""
418
513
Direct debit payment ()
514
+
515
+ >> import pypesa
516
+ >> mpesa = pypesa()
517
+ >> transaction_query = {
518
+ "input_Amount": "10",
519
+ "input_Country": "TZN",
520
+ "input_Currency": "TZS",
521
+ "input_CustomerMSISDN": "000000000001",
522
+ "input_ServiceProviderCode": "000000",
523
+ "input_ThirdPartyConversationID": "v2de053v4912jbasdj1j2kk",
524
+ "input_ThirdPartyReference": "5db410b459bd433ca8e5"
525
+ }
526
+ >> mpesa.direct_debit_payment(transaction_query)
527
+
419
528
"""
420
529
self .verify_query (transaction_query , self .urls .re_direct_debit_payment )
421
530
0 commit comments