feat(payment): sync plans and add coins rules
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
PaymentPlansResponseSchema,
|
||||
type PaymentPlansResponseData,
|
||||
} from "@/data/schemas/payment";
|
||||
import { type Result as ResultT, SpAsyncUtil } from "@/utils";
|
||||
|
||||
import { StorageKeys } from "../storage_keys";
|
||||
|
||||
export class PaymentPlansStorage {
|
||||
private constructor() {}
|
||||
|
||||
static getPlans(): Promise<ResultT<PaymentPlansResponseData | null>> {
|
||||
return SpAsyncUtil.getJson(
|
||||
StorageKeys.paymentPlans,
|
||||
PaymentPlansResponseSchema,
|
||||
);
|
||||
}
|
||||
|
||||
static setPlans(plans: PaymentPlansResponseData): Promise<ResultT<void>> {
|
||||
return SpAsyncUtil.setJson(
|
||||
StorageKeys.paymentPlans,
|
||||
plans,
|
||||
PaymentPlansResponseSchema,
|
||||
);
|
||||
}
|
||||
|
||||
static clearPlans(): Promise<ResultT<void>> {
|
||||
return SpAsyncUtil.remove(StorageKeys.paymentPlans);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user