Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
issotina committed Dec 18, 2018
2 parents 73ccf71 + 5e044a4 commit 547851b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/src/main/java/co/opensi/kkiapay/momo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,14 @@ private fun request_payement(paymentRequest:PaymentRequest ,cb: (STATUS, String,
when (result) {
is Result.Failure -> {
val error = Gson().fromJson<Error>(String(response.data),Error::class.java)
when(error.status) {
4001 -> cb(STATUS.INVALID_PHONE_NUMBER,paymentRequest.phoneNumber,paymentRequest.transactionId)
4003 -> cb(STATUS.INVALID_API_KEY,paymentRequest.phoneNumber,paymentRequest.transactionId)
else -> cb(STATUS.FAILED,paymentRequest.phoneNumber,paymentRequest.transactionId)
if (error == null) {
cb(STATUS.FAILED,paymentRequest.phoneNumber,paymentRequest.transactionId)
}else {
when(error.status) {
4001 -> cb(STATUS.INVALID_PHONE_NUMBER,paymentRequest.phoneNumber,paymentRequest.transactionId)
4003 -> cb(STATUS.INVALID_API_KEY,paymentRequest.phoneNumber,paymentRequest.transactionId)
else -> cb(STATUS.FAILED,paymentRequest.phoneNumber,paymentRequest.transactionId)
}
}
}

Expand Down

0 comments on commit 547851b

Please sign in to comment.