33
44class MobileMoney < Base
55 def initiate_charge ( data )
6- base_url = flutterwave_object . base_url
7-
6+ base_url = flutterwave_object . base_url
7+
88 # only update the payload with the transaction reference if it isn't already added to the payload
99 if !data . key? ( "tx_ref" )
1010 data . merge! ( { "tx_ref" => Util . transaction_reference_generator } )
1111 end
12- # check the currency to determine the type and the required parameters
12+ # check the currency to determine the type and the required parameters
1313 if data [ "currency" ] == "KES"
1414 required_parameters = [ "amount" , "email" , "phone_number" , "tx_ref" , "currency" ]
1515 type = "mpesa"
@@ -22,12 +22,15 @@ def initiate_charge(data)
2222 elsif data [ "currency" ] == "ZMW"
2323 required_parameters = [ "amount" , "email" , "phone_number" , "tx_ref" , "currency" ]
2424 type = "mobile_money_zambia"
25- elsif data [ "currency" ] == "RWF"
25+ elsif data [ "currency" ] == "RWF"
2626 required_parameters = [ "amount" , "email" , "phone_number" , "tx_ref" , "currency" ]
2727 type = "mobile_money_rwanda"
2828 elsif data [ "currency" ] == "XAF" || data [ "currency" ] == "XOF"
2929 required_parameters = [ "amount" , "email" , "phone_number" , "tx_ref" , "currency" ]
3030 type = "mobile_money_franco"
31+ elsif data [ "currency" ] == "TZS"
32+ required_parameters = [ "amount" , "email" , "phone_number" , "tx_ref" , "currency" ]
33+ type = "mobile_money_tanzania"
3134 else
3235 return "pass a valid currency"
3336 end
@@ -36,7 +39,7 @@ def initiate_charge(data)
3639 type = type
3740 payload = data . to_json
3841
39- response = post_request ( "#{ base_url } #{ BASE_ENDPOINTS ::CHARGE_ENDPOINT } ?type=#{ type } " , payload )
42+ response = post_request ( "#{ base_url } #{ BASE_ENDPOINTS ::CHARGE_ENDPOINT } ?type=#{ type } " , payload )
4043 return response
4144 end
4245
0 commit comments