-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaymentService.cs
More file actions
36 lines (27 loc) · 808 Bytes
/
PaymentService.cs
File metadata and controls
36 lines (27 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Threading;
using Confluent.Kafka;
using System.Net.Http;
using Newtonsoft.Json;
using System.IO;
using ECommerceExampleProject;
public static class PaymentData{
public static List<Payment> payments = loadPayments();
public static List<Payment> loadPayments()
{
string filePath = "payment.txt";
string jsonString = File.ReadAllText(filePath);
if (jsonString != null && jsonString != "") return JsonConvert.DeserializeObject<List<Payment>>(jsonString);
else return new List<Payment>();
}
public static void writeJson()
{
File.WriteAllText("payments.txt", JsonConvert.SerializeObject(payments));
}
}
class PaymentService
{
public static void StartService()
{ }
}