saved signature
This commit is contained in:
parent
7a317dede7
commit
c8f0da379e
@ -134,8 +134,10 @@ public class SignatureFragment extends DataBindingFragment {
|
|||||||
|
|
||||||
private void updateData() {
|
private void updateData() {
|
||||||
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
PayDetail payDetail = sharedViewModel.payDetail.getValue();
|
||||||
payDetail.setESignHexData(BitmapUtils.bitmapToHexString(mSignaturePad.getSignatureBitmap()));
|
byte[] blob = BitmapUtils.bitmapToBytes(mSignaturePad.getSignatureBitmap());
|
||||||
|
payDetail.setESignBlob(blob);
|
||||||
sharedViewModel.payDetail.setValue(payDetail);
|
sharedViewModel.payDetail.setValue(payDetail);
|
||||||
|
sharedViewModel.updateESignBlob(payDetail.voucherNo, blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ClickEvent {
|
public class ClickEvent {
|
||||||
|
|||||||
@ -485,6 +485,10 @@ public class SharedViewModel extends ViewModel {
|
|||||||
repository.updatePayDetail(payDetail);
|
repository.updatePayDetail(payDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateESignBlob(String voucherNo, byte[] blob) {
|
||||||
|
repository.updateESignBlob(voucherNo, blob);
|
||||||
|
}
|
||||||
|
|
||||||
public void insertPayDetail(PayDetail payDetail) { repository.insertPayDetail(payDetail); }
|
public void insertPayDetail(PayDetail payDetail) { repository.insertPayDetail(payDetail); }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,7 @@ import com.utsmyanmar.paylibs.model.PayDetail;
|
|||||||
MPUCtlsEntity.class,
|
MPUCtlsEntity.class,
|
||||||
BinEntity.class
|
BinEntity.class
|
||||||
},
|
},
|
||||||
version = 13,
|
version = 14,
|
||||||
exportSchema = false
|
exportSchema = false
|
||||||
)
|
)
|
||||||
@TypeConverters({SettleDataConverter.class, TransCVMConverter.class, CardSchemeConverter.class, QRSettleDataConverter.class, CardSettleDataConverter.class})
|
@TypeConverters({SettleDataConverter.class, TransCVMConverter.class, CardSchemeConverter.class, QRSettleDataConverter.class, CardSettleDataConverter.class})
|
||||||
|
|||||||
@ -137,6 +137,9 @@ public interface PayDetailDao {
|
|||||||
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND referNo IN(:referNo)"))
|
@Query(("SELECT * FROM paydetail WHERE isCanceled = 0 AND referNo IN(:referNo)"))
|
||||||
Maybe<PayDetail> searchPayByRefNum(String referNo);
|
Maybe<PayDetail> searchPayByRefNum(String referNo);
|
||||||
|
|
||||||
|
@Query("UPDATE paydetail SET eSignBlob = :blob WHERE voucherNo = :voucherNo")
|
||||||
|
void updateESignBlob(String voucherNo, byte[] blob);
|
||||||
|
|
||||||
@Query(("UPDATE paydetail SET customerMobile =:appName, qrTransId =:transId, approvalCode =:transId WHERE referNo =:refNum AND transactionType = 34"))
|
@Query(("UPDATE paydetail SET customerMobile =:appName, qrTransId =:transId, approvalCode =:transId WHERE referNo =:refNum AND transactionType = 34"))
|
||||||
Completable updateUnfinishedQRTrans(String appName,String transId,String refNum);
|
Completable updateUnfinishedQRTrans(String appName,String transId,String refNum);
|
||||||
|
|
||||||
|
|||||||
@ -327,6 +327,14 @@ public class DatabaseModule {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static final Migration MIGRATION_13_14 = new Migration(14, 15) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
database.execSQL("ALTER TABLE paydetail "
|
||||||
|
+ " ADD COLUMN eSignBlob BLOB");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
@ -339,6 +347,7 @@ public class DatabaseModule {
|
|||||||
.addMigrations(MIGRATION_10_11)
|
.addMigrations(MIGRATION_10_11)
|
||||||
.addMigrations(MIGRATION_11_12)
|
.addMigrations(MIGRATION_11_12)
|
||||||
.addMigrations(MIGRATION_12_13)
|
.addMigrations(MIGRATION_12_13)
|
||||||
|
.addMigrations(MIGRATION_13_14)
|
||||||
.allowMainThreadQueries()
|
.allowMainThreadQueries()
|
||||||
.addCallback(new RoomDatabase.Callback() {
|
.addCallback(new RoomDatabase.Callback() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -145,6 +145,10 @@ public class Repository {
|
|||||||
|
|
||||||
public void updatePayDetail(PayDetail payDetail){payDetailDao.update(payDetail);}
|
public void updatePayDetail(PayDetail payDetail){payDetailDao.update(payDetail);}
|
||||||
|
|
||||||
|
public void updateESignBlob(String voucherNo, byte[] blob) {
|
||||||
|
payDetailDao.updateESignBlob(voucherNo, blob);
|
||||||
|
}
|
||||||
|
|
||||||
public LiveData<PayDetail> getReversalTransaction(String voucherNo) { return payDetailDao.getReversalTransaction(voucherNo);}
|
public LiveData<PayDetail> getReversalTransaction(String voucherNo) { return payDetailDao.getReversalTransaction(voucherNo);}
|
||||||
public LiveData<PayDetail> getLastReversalTransaction() { return payDetailDao.getLastReversalTransactionLive();}
|
public LiveData<PayDetail> getLastReversalTransaction() { return payDetailDao.getLastReversalTransactionLive();}
|
||||||
public LiveData<List<PayDetail>> getAllReversalTransactions() { return payDetailDao.getAllReversalTransactionsLive();}
|
public LiveData<List<PayDetail>> getAllReversalTransactions() { return payDetailDao.getAllReversalTransactionsLive();}
|
||||||
|
|||||||
@ -77,6 +77,8 @@ public class PayDetail implements Serializable {
|
|||||||
public String cardOrgCode = ""; // International credit card company code (domain 63.1)
|
public String cardOrgCode = ""; // International credit card company code (domain 63.1)
|
||||||
public String reference = ""; // Remarks
|
public String reference = ""; // Remarks
|
||||||
public String eSignHexData = ""; // Electronic signature hexadecimal data
|
public String eSignHexData = ""; // Electronic signature hexadecimal data
|
||||||
|
public String eSignBase64 = "";
|
||||||
|
public byte[] eSignBlob;
|
||||||
|
|
||||||
public int transPlatform; // Supported trading platforms: 0: bank card 1: Alipay 2: WeChat 3: UnionPay wallet
|
public int transPlatform; // Supported trading platforms: 0: bank card 1: Alipay 2: WeChat 3: UnionPay wallet
|
||||||
public int transactionType; // 1: Consumption 2: Consumption cancellation; 3: Return 4. Pre-authorization 5. Pre-authorization cancellation 6. Pre-authorization completed 7. Pre-authorization completed cancellation 8. Settlement 9. Sign-in 10. Sign-out 11. Transaction query
|
public int transactionType; // 1: Consumption 2: Consumption cancellation; 3: Return 4. Pre-authorization 5. Pre-authorization cancellation 6. Pre-authorization completed 7. Pre-authorization completed cancellation 8. Settlement 9. Sign-in 10. Sign-out 11. Transaction query
|
||||||
@ -166,7 +168,6 @@ public class PayDetail implements Serializable {
|
|||||||
public List<CardSettleData> cardSettleData;
|
public List<CardSettleData> cardSettleData;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
public CardInfo cardInfo;
|
public CardInfo cardInfo;
|
||||||
|
|
||||||
@ -188,7 +189,9 @@ public class PayDetail implements Serializable {
|
|||||||
boolean isPrinted, boolean eSignIsUploaded, boolean isFreePWD, boolean isFreeSign, String tempKSN, String tempMerchantNo,
|
boolean isPrinted, boolean eSignIsUploaded, boolean isFreePWD, boolean isFreeSign, String tempKSN, String tempMerchantNo,
|
||||||
String tempMerchantName, String tempTerminalNo, long transNum, String customOrderNo, String approvalCode, boolean isSettle,
|
String tempMerchantName, String tempTerminalNo, long transNum, String customOrderNo, String approvalCode, boolean isSettle,
|
||||||
String settleData, String settleList, String otherCardNo, String tradeDateAndTime, String tradeDateTime, String hostName,
|
String settleData, String settleList, String otherCardNo, String tradeDateAndTime, String tradeDateTime, String hostName,
|
||||||
String transDate, String transTime, String invoiceNo, String transId, String qrReferNo, String customerMobile, SettleData settleDataObj,boolean isSettlementEnabled,TransCVM transCVM,List<QRSettleData> qrSettleData,List<CardSettleData> cardSettleData) {
|
String transDate, String transTime, String invoiceNo, String transId, String qrReferNo, String customerMobile,
|
||||||
|
SettleData settleDataObj, boolean isSettlementEnabled, TransCVM transCVM, List<QRSettleData> qrSettleData,
|
||||||
|
List<CardSettleData> cardSettleData, String eSignBase64) {
|
||||||
this.PID = PID;
|
this.PID = PID;
|
||||||
this.sendBag = sendBag;
|
this.sendBag = sendBag;
|
||||||
this.receiverBag = receiverBag;
|
this.receiverBag = receiverBag;
|
||||||
@ -239,6 +242,7 @@ public class PayDetail implements Serializable {
|
|||||||
this.cardOrgCode = cardOrgCode;
|
this.cardOrgCode = cardOrgCode;
|
||||||
this.reference = reference;
|
this.reference = reference;
|
||||||
this.eSignHexData = eSignHexData;
|
this.eSignHexData = eSignHexData;
|
||||||
|
this.eSignBase64 = eSignBase64;
|
||||||
this.transPlatform = transPlatform;
|
this.transPlatform = transPlatform;
|
||||||
this.transactionType = transactionType;
|
this.transactionType = transactionType;
|
||||||
this.qrCodeScanModel = qrCodeScanModel;
|
this.qrCodeScanModel = qrCodeScanModel;
|
||||||
@ -286,7 +290,7 @@ public class PayDetail implements Serializable {
|
|||||||
this.tempTerminalNo = tempTerminalNo;
|
this.tempTerminalNo = tempTerminalNo;
|
||||||
this.transNum = transNum;
|
this.transNum = transNum;
|
||||||
this.customOrderNo = customOrderNo;
|
this.customOrderNo = customOrderNo;
|
||||||
this.approvalCode= approvalCode;
|
this.approvalCode = approvalCode;
|
||||||
this.isSettle = isSettle;
|
this.isSettle = isSettle;
|
||||||
this.settleData = settleData;
|
this.settleData = settleData;
|
||||||
this.settleList = settleList;
|
this.settleList = settleList;
|
||||||
@ -333,9 +337,13 @@ public class PayDetail implements Serializable {
|
|||||||
public PayDetail() {
|
public PayDetail() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSettlementEnabled() { return isSettlementEnabled; }
|
public boolean isSettlementEnabled() {
|
||||||
|
return isSettlementEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSettlementEnabled(boolean settlementEnabled) { this.isSettlementEnabled = settlementEnabled; }
|
public void setSettlementEnabled(boolean settlementEnabled) {
|
||||||
|
this.isSettlementEnabled = settlementEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
public String getOtherCardNo() {
|
public String getOtherCardNo() {
|
||||||
return otherCardNo;
|
return otherCardNo;
|
||||||
@ -706,7 +714,6 @@ public class PayDetail implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public long getAmount() {
|
public long getAmount() {
|
||||||
return this.amount;
|
return this.amount;
|
||||||
}
|
}
|
||||||
@ -1231,7 +1238,7 @@ public class PayDetail implements Serializable {
|
|||||||
public void seteSignHexData(String eSignHexData) {
|
public void seteSignHexData(String eSignHexData) {
|
||||||
this.eSignHexData = eSignHexData;
|
this.eSignHexData = eSignHexData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNeedReversal() {
|
public boolean isNeedReversal() {
|
||||||
return isNeedReversal;
|
return isNeedReversal;
|
||||||
}
|
}
|
||||||
@ -1343,6 +1350,22 @@ public class PayDetail implements Serializable {
|
|||||||
public void setESignHexData(String eSignHexData) {
|
public void setESignHexData(String eSignHexData) {
|
||||||
this.eSignHexData = eSignHexData;
|
this.eSignHexData = eSignHexData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getESignBase64(){
|
||||||
|
return eSignBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setESignBase64(String eSignBase64){
|
||||||
|
this.eSignBase64 = eSignBase64;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getESignBlob() {
|
||||||
|
return eSignBlob;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setESignBlob(byte[] eSignBlob) {
|
||||||
|
this.eSignBlob = eSignBlob;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getIsReversal() {
|
public boolean getIsReversal() {
|
||||||
return this.isReversal;
|
return this.isReversal;
|
||||||
@ -1376,7 +1399,9 @@ public class PayDetail implements Serializable {
|
|||||||
this.qrSettleData = qrSettleData;
|
this.qrSettleData = qrSettleData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CardSettleData> getCardSettleData() {return cardSettleData;}
|
public List<CardSettleData> getCardSettleData() {
|
||||||
|
return cardSettleData;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCardSettleData(List<CardSettleData> cardSettleData) {
|
public void setCardSettleData(List<CardSettleData> cardSettleData) {
|
||||||
this.cardSettleData = cardSettleData;
|
this.cardSettleData = cardSettleData;
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import android.graphics.BitmapFactory;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -248,4 +249,11 @@ public class BitmapUtils {
|
|||||||
// Decode byte array to bitmap
|
// Decode byte array to bitmap
|
||||||
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
|
return BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static byte[] bitmapToBytes(Bitmap bitmap) {
|
||||||
|
if (bitmap == null) return null;
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
|
||||||
|
return outputStream.toByteArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user