16#include "ByteArrayUtil.h"
25using namespace keyple::core::util;
26using namespace keyple::core::util::cpp;
29 const std::vector<uint8_t>& cardResponse,
const int offset)
30: mOffset(offset), mCardResponse(cardResponse) {}
39 return ByteArrayUtil::extractInt(mCardResponse, mOffset, 2,
true);
44 return ByteArrayUtil::extractInt(mCardResponse, mOffset + 14, 3,
true);
49 std::vector<uint8_t> loadTime(2);
50 loadTime[0] = mCardResponse[mOffset + 4];
51 loadTime[1] = mCardResponse[mOffset + 5];
58 std::vector<uint8_t> loadDate(2);
59 loadDate[0] = mCardResponse[mOffset + 2];
60 loadDate[1] = mCardResponse[mOffset + 3];
67 return mCardResponse[mOffset + 6];
72 std::vector<uint8_t> samId(4);
73 System::arraycopy(mCardResponse, mOffset + 7, samId, 0, 4);
80 std::vector<uint8_t> tnNum(2);
81 tnNum[0] = mCardResponse[mOffset + 17];
82 tnNum[1] = mCardResponse[mOffset + 18];
84 return ByteArrayUtil::extractInt(tnNum, 0, 2,
false);
89 std::vector<uint8_t> samTNum(3);
90 System::arraycopy(mCardResponse, mOffset + 11, samTNum, 0, 3);
92 return ByteArrayUtil::extractInt(samTNum, 0, 3,
false);
97 os <<
"SV_DEBIT_LOG_RECORD_ADAPTER: {"
102 <<
"KVC: " << ra.
getKvc() <<
", "
103 <<
"SAM_ID: " << ra.
getSamId() <<
", "
104 <<
"SV_TRANSACTION_NUMBER: " << ra.
getSvTNum() <<
", "
105 <<
"SV_SAM_TRANSACTION_NUMBER: " << ra.
getSamTNum()
111std::ostream&
operator<<(std::ostream& os,
const std::shared_ptr<SvDebitLogRecordAdapter> ra)
114 os <<
"SV_DEBIT_LOG_RECORD_ADAPTER: null";
125 "\"amount\":" + std::to_string(
getAmount()) +
", " \
126 "\"balance\":" + std::to_string(
getBalance()) +
", " \
127 "\"debitDate\":" + HexUtil::toHex(
getDebitDate()) +
", " \
128 "\"loadTime\":" + HexUtil::toHex(
getDebitDate()) +
", " \
129 "\"kvc\":" + std::to_string(
getKvc()) +
", " \
130 "\"samId\": \"" + HexUtil::toHex(
getSamId()) +
"\", " \
131 "\"svTransactionNumber\":" + std::to_string(
getSvTNum()) +
", " \
132 "\"svSamTransactionNumber\":" + std::to_string(
getSamTNum()) +
"" \
const std::vector< uint8_t > & getRawData() const override
uint8_t getKvc() const override
SvDebitLogRecordAdapter(const std::vector< uint8_t > &cardResponse, const int offset)
int getSamTNum() const override
int getAmount() const override
int getSvTNum() const override
int getBalance() const override
const std::vector< uint8_t > getDebitDate() const override
const std::vector< uint8_t > getSamId() const override
const std::vector< uint8_t > getDebitTime() const override
const std::string toJSONString() const
std::ostream & operator<<(std::ostream &os, const std::shared_ptr< ApduRequestAdapter > ara)