|
@@ -257,21 +257,28 @@ class ChargeImpl : InAppBilling() {
|
|
|
private fun notifyOrder2Backend(activity: Activity, orderId: String, purchase: Purchase, isCache: Boolean = false) {
|
|
|
SdkRequest.instance.notifyOrder(activity, orderId, purchase.originalJson, object : IRequestCallback {
|
|
|
override fun onResponse(resultInfo: ResultInfo) {
|
|
|
- if (resultInfo.code == 1) {
|
|
|
- //消耗订单
|
|
|
- consumeAsync(activity, purchase, isCache)
|
|
|
- } else {
|
|
|
- //失败则缓存订单
|
|
|
- saveOrderInfo(purchase.orderId, orderId)
|
|
|
- dismissDialog()
|
|
|
- disConnection()
|
|
|
- val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
|
|
|
- ResUtils.getResString(activity, "yyxx_charge_tv_error")
|
|
|
- } else {
|
|
|
- resultInfo.msg
|
|
|
+ when (resultInfo.code) {
|
|
|
+ 1 -> {
|
|
|
+ //消耗订单
|
|
|
+ consumeAsync(activity, purchase, isCache)
|
|
|
+ }
|
|
|
+ 2 -> {
|
|
|
+ Logger.d(resultInfo.msg)
|
|
|
+ consumeAsync(activity, purchase, isCache)
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ //失败则缓存订单
|
|
|
+ saveOrderInfo(purchase.orderId, orderId)
|
|
|
+ dismissDialog()
|
|
|
+ disConnection()
|
|
|
+ val msg = if (TextUtils.isEmpty(resultInfo.msg)) {
|
|
|
+ ResUtils.getResString(activity, "yyxx_charge_tv_error")
|
|
|
+ } else {
|
|
|
+ resultInfo.msg
|
|
|
+ }
|
|
|
+ ToastUtils.toastInfo(activity, msg)
|
|
|
+ implCallback.onResult(-1, "发货失败")
|
|
|
}
|
|
|
- ToastUtils.toastInfo(activity, msg)
|
|
|
- implCallback.onResult(-1, "发货失败")
|
|
|
}
|
|
|
}
|
|
|
})
|