lot of work on rfplus

This commit is contained in:
Kima
2024-02-28 22:37:21 +01:00
parent 55a9a41722
commit 25464eff79
8 changed files with 214 additions and 30 deletions

View File

@@ -50,6 +50,10 @@ class FilcAPI {
static const allGradeColors = "$gradeColorsGet/all";
static const gradeColorsByID = "$gradeColorsGet/";
// Payment API
static const payment = "$baseUrl/v3/payment";
static const stripeSheet = "$payment/stripe-sheet";
static Future<bool> checkConnectivity() async =>
(await Connectivity().checkConnectivity()) != ConnectivityResult.none;
@@ -340,6 +344,35 @@ class FilcAPI {
}
return null;
}
// payment
static Future<Map?> createPaymentSheet(String product) async {
try {
Map body = {
"product": product,
};
var client = http.Client();
http.Response res = await client.post(
Uri.parse(stripeSheet),
body: body,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
);
if (res.statusCode != 200) {
throw "HTTP ${res.statusCode}: ${res.body}";
}
return jsonDecode(res.body);
} on Exception catch (error, stacktrace) {
log("ERROR: FilcAPI.sendReport: $error $stacktrace");
}
return null;
}
}
class ErrorReport {