mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-26 14:51:52 +03:00
render transactions info properly
This commit is contained in:
parent
19a5f02d66
commit
cbab316607
@ -102,7 +102,7 @@ static void nfc_render_emv_pin_try_counter(uint8_t counter, FuriString* str) {
|
|||||||
|
|
||||||
void nfc_render_emv_transactions(const EmvApplication* apl, FuriString* str) {
|
void nfc_render_emv_transactions(const EmvApplication* apl, FuriString* str) {
|
||||||
if(apl->transaction_counter)
|
if(apl->transaction_counter)
|
||||||
furi_string_cat_printf(str, "Transactions: %d\n", apl->transaction_counter);
|
furi_string_cat_printf(str, "Transactions count: %d\n", apl->transaction_counter);
|
||||||
if(apl->last_online_atc)
|
if(apl->last_online_atc)
|
||||||
furi_string_cat_printf(str, "Last Online ATC: %d\n", apl->last_online_atc);
|
furi_string_cat_printf(str, "Last Online ATC: %d\n", apl->last_online_atc);
|
||||||
|
|
||||||
@ -115,27 +115,31 @@ void nfc_render_emv_transactions(const EmvApplication* apl, FuriString* str) {
|
|||||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||||
FuriString* tmp = furi_string_alloc();
|
FuriString* tmp = furi_string_alloc();
|
||||||
|
|
||||||
//furi_string_cat_printf(str, "Transactions:\n");
|
furi_string_cat_printf(str, "Transactions:\n");
|
||||||
for(int i = 0; i < len; i++) {
|
for(int i = 0; i < len; i++) {
|
||||||
if(!apl->trans[i].amount) continue;
|
//if(!apl->trans[i].amount) continue; - NO Skip here pls
|
||||||
// transaction counter
|
// transaction counter
|
||||||
furi_string_cat_printf(str, "\e#%d: ", apl->trans[i].atc);
|
furi_string_cat_printf(str, "\e#%d: ", apl->trans[i].atc);
|
||||||
|
|
||||||
// Print transaction amount
|
// Print transaction amount
|
||||||
uint8_t* a = (uint8_t*)&apl->trans[i].amount;
|
if(!apl->trans[i].amount) {
|
||||||
bool top = true;
|
furi_string_cat_printf(str, "???");
|
||||||
for(int x = 0; x < 6; x++) {
|
} else {
|
||||||
// cents
|
uint8_t* a = (uint8_t*)&apl->trans[i].amount;
|
||||||
if(x == 5) {
|
bool top = true;
|
||||||
furi_string_cat_printf(str, ".%02X", a[x]);
|
for(int x = 0; x < 6; x++) {
|
||||||
break;
|
// cents
|
||||||
}
|
if(x == 5) {
|
||||||
if(a[x]) {
|
furi_string_cat_printf(str, ".%02X", a[x]);
|
||||||
if(top) {
|
break;
|
||||||
furi_string_cat_printf(str, "%X", a[x]);
|
}
|
||||||
top = false;
|
if(a[x]) {
|
||||||
} else {
|
if(top) {
|
||||||
furi_string_cat_printf(str, "%02X", a[x]);
|
furi_string_cat_printf(str, "%X", a[x]);
|
||||||
|
top = false;
|
||||||
|
} else {
|
||||||
|
furi_string_cat_printf(str, "%02X", a[x]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,7 +159,7 @@ void nfc_render_emv_transactions(const EmvApplication* apl, FuriString* str) {
|
|||||||
if(apl->trans[i].date)
|
if(apl->trans[i].date)
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
str,
|
str,
|
||||||
"%02lx/%02lx/%02lx ",
|
"%02lx.%02lx.%02lx ",
|
||||||
apl->trans[i].date >> 16,
|
apl->trans[i].date >> 16,
|
||||||
(apl->trans[i].date >> 8) & 0xff,
|
(apl->trans[i].date >> 8) & 0xff,
|
||||||
apl->trans[i].date & 0xff);
|
apl->trans[i].date & 0xff);
|
||||||
|
Loading…
Reference in New Issue
Block a user