Skip to content

Commit

Permalink
code cleanup and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MuindiStephen committed Mar 11, 2024
1 parent acdd14b commit e856ae9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ class PaymentFragment : Fragment(), View.OnClickListener {
timestamp = timestamp,
transactionType = Constants.TransactionType.CustomerPayBillOnline,
amount = amount,
partyA = RegEx.sanitizePhoneNumber(phoneNumber)!!,
partyA = RegEx.sanitizePhoneNumber(phoneNumber),
partyB = PARTYB,
phoneNumber = RegEx.sanitizePhoneNumber(phoneNumber)!!,
phoneNumber = RegEx.sanitizePhoneNumber(phoneNumber),
callBackURL = CALLBACKURL,
accountReference = "LIPA NA MPESA",
transactionDesc = "LIPA NA MPESA C2B"
Expand Down Expand Up @@ -168,10 +168,9 @@ class PaymentFragment : Fragment(), View.OnClickListener {
}
}
displaySnackBar("Saved transaction successfully.")
Timber.tag("Post submitted to the API")

Timber.e("Post submitted to the API")
} else {
Timber.tag("Response %s")
Timber.e("Response %s")
}
} catch (e: Exception) {
e.printStackTrace()
Expand All @@ -180,7 +179,6 @@ class PaymentFragment : Fragment(), View.OnClickListener {

override fun onFailure(call: Call<StkPushSuccessResponse>, t: Throwable) {
Timber.tag(TAG).e(httpException, t.printStackTrace().toString())

}
})
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/steve_md/smartmkulima/utils/RegEx.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ object RegEx {

fun getPassword(businessShortCode: String, passkey: String, timestamp: String): String? {
val str = businessShortCode + passkey + timestamp
//encode the password to Base64
return encodeToString(str.toByteArray(), NO_WRAP)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class MainViewModel @Inject constructor(
}
}

// UI State
data class FarmProduceState(
val isLoading: Boolean = false,
val error: String? = null,
Expand Down

0 comments on commit e856ae9

Please sign in to comment.