Compare commits
2 Commits
bd90bc4a31
...
4ffdc1f679
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ffdc1f679 | ||
|
|
9dbb722357 |
@ -2,6 +2,7 @@ package com.utsmm.kbz.ui.adapters;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -264,6 +265,19 @@ public class MyBindingAdapter {
|
||||
imageView.setImageBitmap(bitmap);
|
||||
}
|
||||
|
||||
@BindingAdapter("signatureBlob")
|
||||
public static void setSignatureFromBlob(ImageView imageView, byte[] blob) {
|
||||
if (blob != null && blob.length > 0) {
|
||||
Bitmap bitmap = BitmapFactory.decodeByteArray(blob, 0, blob.length);
|
||||
if (bitmap != null) {
|
||||
imageView.setImageBitmap(bitmap);
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
imageView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@BindingAdapter({"mmpayData"})
|
||||
public static void setMMPayQRCode(AppCompatImageView imageView,String data) {
|
||||
//250
|
||||
|
||||
@ -578,6 +578,7 @@ public class ProcessingFragment extends DataBindingFragment {
|
||||
request.setDE14(PrintUtils.getInstance().getFormatExpDate(payDetail.getEXPDate()));
|
||||
request.setDE43(formatDE43(cardHolderName));
|
||||
request.setDE48(payDetail.getAID());
|
||||
request.setDE115("");
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
@ -134,6 +134,7 @@ public class SignatureFragment extends DataBindingFragment {
|
||||
|
||||
private void updateData() {
|
||||
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
||||
payDetail.setESignHexData(BitmapUtils.bitmapToHexString(mSignaturePad.getSignatureBitmap()));
|
||||
byte[] blob = BitmapUtils.bitmapToBytes(mSignaturePad.getSignatureBitmap());
|
||||
payDetail.setESignBlob(blob);
|
||||
sharedViewModel.payDetail.setValue(payDetail);
|
||||
|
||||
@ -452,6 +452,7 @@ public class EmvTransactionProcessViewModel extends EmvBaseViewModel implements
|
||||
public void processVoidDB(PayDetail payResult) {
|
||||
mPayDetail.setIsCanceled(true);
|
||||
updatePayDetail(mPayDetail);
|
||||
payResult.setESignBlob(mPayDetail.getESignBlob());
|
||||
repository.insertPayDetail(updateCurrentDateAndTime(payResult));
|
||||
}
|
||||
|
||||
|
||||
@ -292,6 +292,7 @@ public class TransProcessViewModel extends ViewModel implements ProcessingTransa
|
||||
public void processVoidDB(PayDetail payResult) {
|
||||
payDetail.setIsCanceled(true);
|
||||
updatePayDetail(payDetail);
|
||||
payResult.setESignBlob(payDetail.getESignBlob());
|
||||
repository.insertPayDetail(updateCurrentDateAndTime(payResult));
|
||||
}
|
||||
|
||||
|
||||
@ -478,6 +478,46 @@
|
||||
tools:text="12/12/2024 12:12:12" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Divider -->
|
||||
<View
|
||||
android:id="@+id/signatureDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/colorPrimary"
|
||||
android:alpha="0.2"
|
||||
android:visibility="@{sharedViewModel.payDetail.ESignBlob != null ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<!-- Original Signature -->
|
||||
<LinearLayout
|
||||
android:id="@+id/signatureSection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingVertical="12dp"
|
||||
android:visibility="@{sharedViewModel.payDetail.ESignBlob != null ? View.VISIBLE : View.GONE}">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/txt_signature"
|
||||
android:textColor="@color/colorPrimary"
|
||||
android:textSize="15sp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:alpha="0.8"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivOriginalSignature"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="120dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:background="@drawable/bg_edittext_primary_border"
|
||||
android:padding="4dp"
|
||||
app:signatureBlob="@{sharedViewModel.payDetail.ESignBlob}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
|
||||
@ -461,6 +461,7 @@
|
||||
<string name="txt_batch_number">Batch Number</string>
|
||||
<string name="txt_base_amount">Base Amount</string>
|
||||
<string name="txt_date_time">Date/Time</string>
|
||||
<string name="txt_signature">Signature</string>
|
||||
<string name="txt_tip_adjust_not_allowed">TIP ADJUST NOT ALLOW</string>
|
||||
<string name="txt_wave_pay">WavePay</string>
|
||||
<string name="txt_connecting_to_host">Connecting to host</string>
|
||||
|
||||
@ -25,6 +25,8 @@ public class EReceiptCardRequest {
|
||||
private String DE43;
|
||||
private String DE48;
|
||||
|
||||
private String DE115;
|
||||
|
||||
public EReceiptCardRequest() {}
|
||||
|
||||
// GETTERS
|
||||
@ -87,6 +89,9 @@ public class EReceiptCardRequest {
|
||||
public String getDE38(){ return DE38; }
|
||||
public String getDE22(){ return DE22; }
|
||||
public String getBatchNumber(){ return batchNumber; }
|
||||
public String getDE115(){
|
||||
return DE115;
|
||||
}
|
||||
// SETTERS
|
||||
public void setDE3(String DE3) {
|
||||
this.DE3 = DE3;
|
||||
@ -163,4 +168,8 @@ public class EReceiptCardRequest {
|
||||
public void setDE48(String DE48){
|
||||
this.DE48 = DE48;
|
||||
}
|
||||
|
||||
public void setDE115(String DE115) {
|
||||
this.DE115 = DE115;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1420,11 +1420,14 @@ public abstract class BaseXPrint {
|
||||
}
|
||||
|
||||
private void addSignatureBitmap(PayDetail payDetail) {
|
||||
if (payDetail.getESignHexData() != null) {
|
||||
Bitmap signatureBitmap = BitmapUtils.hexStringToBitmap(payDetail.getESignHexData());
|
||||
byte[] blob = payDetail.getESignBlob();
|
||||
if (blob != null && blob.length > 0) {
|
||||
Bitmap signatureBitmap = android.graphics.BitmapFactory.decodeByteArray(blob, 0, blob.length);
|
||||
if (signatureBitmap != null) {
|
||||
printer.appendImage(signatureBitmap, AlignEnum.CENTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected String beautifyIsoPacket(String isoMsg) {
|
||||
StringBuilder sb = new StringBuilder(isoMsg);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user