qr decimal fix
This commit is contained in:
parent
2441ba5141
commit
a0ffff71c4
@ -25,6 +25,7 @@ import com.utsmm.kbz.ui.core_viewmodel.SharedViewModel;
|
||||
import com.utsmm.kbz.util.TransactionUtil;
|
||||
import com.utsmm.kbz.util.ecr.CoreUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
@ -135,10 +136,14 @@ public class QRConnectingFragment extends DataBindingFragment implements DataBin
|
||||
}
|
||||
|
||||
private void generateQR() {
|
||||
|
||||
long originalAmount = payDetail.getAmount();
|
||||
|
||||
// String amount = String.format(Locale.getDefault(), "%.2f", payDetail.getAmount()/100.0);
|
||||
String amount = String.format(Locale.getDefault(), "%d", (int)(payDetail.getAmount()/100.0));
|
||||
// String amount = String.format(Locale.getDefault(), "%d", (int)(payDetail.getAmount()/100.0)); //this method have problem for 10055 to 100.00 auto convert (should convert to 100.55)
|
||||
|
||||
double realAmount = payDetail.getAmount() / 100.0;
|
||||
DecimalFormat df = new DecimalFormat("0.00");
|
||||
String amount = df.format(realAmount);
|
||||
|
||||
|
||||
KPayQRRequest.QrRequest kPayQRRequest = KPayViewModel.createQR(amount, merchantId);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user