コード例 #1
0
        public static void AddFraudReportToStorage(byte[] fraudId, byte[] reporter, byte[] fakeButValidCertificateHash)
        {
            FraudEntry fraudEntry = new FraudEntry();

            fraudEntry.FraudId  = fraudId;
            fraudEntry.Reporter = reporter;
            fraudEntry.FakeButValidCertificateHash = fakeButValidCertificateHash;
            fraudEntry.ReportDate = TransactionContentUtil.retrieveTransactionTime();
            fraudEntry.Status     = FraudStatus.REPORTED;

            byte[] fraudIdStorageKey = ArrayUtil.Concat(FRAUD_ID_STORAGE_PREFIX, fraudId);
            saveStorageForFraudIdIndex(fraudIdStorageKey, fraudEntry);
            AddFraudToList(FRAUD_LIST_STORAGE_KEY, fraudIdStorageKey);
        }
コード例 #2
0
        public static FraudEntry ReadFraudEntry(byte[] fraudId)
        {
            FraudEntry fraudEntry = new FraudEntry();

            byte[] fraudIdStorageKey
                = ArrayUtil.Concat(FRAUD_ID_STORAGE_PREFIX, fraudId);
            byte[] fraudEntrySerialized = StorageUtil.readFromStorage(fraudIdStorageKey);
            if (fraudEntrySerialized == null)
            {
                return(fraudEntry);
            }

            return((FraudEntry)SerializationUtil.Deserialize(fraudEntrySerialized));
        }
コード例 #3
0
 public static void updateFraudEntry(FraudEntry fraudEntry)
 {
     byte[] fraudIdStorageKey
         = ArrayUtil.Concat(FRAUD_ID_STORAGE_PREFIX, fraudEntry.FraudId);
     saveStorageForFraudIdIndex(fraudIdStorageKey, fraudEntry);
 }
コード例 #4
0
 private static void saveStorageForFraudIdIndex(byte[] fraudIdStorageKey, FraudEntry fraudEntry)
 {
     byte[] fraudEntrySerialized = SerializationUtil.Serialize(fraudEntry);
     StorageUtil.saveToStorage(fraudIdStorageKey,
                               fraudEntrySerialized);
 }