Backend modules from tastefully 8bd93d15: core-libs, core-session, api-gateway, mobile-api, services-auth, services-system, services-counter, services-member, services-log, services-email. solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal from tastefully 8bd93d15. Copied as tracked files only. Literal secrets replaced with environment placeholders: - services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY, MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default) - services-system: JUMIO_TOKEN, JUMIO_SECRET (optional) - services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed - core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default removed, ipgeolocation key read from IPGEOLOCATION_API_KEY - services-system EkycAppConfig: commented Jumio credentials removed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
import { apiGet, apiPost } from "@/app/lib/clientApi";
|
|
import type { AdminTopupPage, AdminTopupRow } from "@/app/lib/types";
|
|
|
|
// Client over the BFF route handlers (app/api/admin/topup/**), which forward
|
|
// the bb_admin JWT to mobile-api. A caller without the BO_WALLET module gets a
|
|
// 4xx from mobile-api and the view renders its not-authorised state (the
|
|
// RequireModule gate fires first). Reverse is a mutation and is always POST — never a GET.
|
|
// add-online-topup-ipay88: the member pays online, so there is no approve/reject.
|
|
|
|
/** Paged pending top-up queue. */
|
|
export async function getPendingTopups(
|
|
page: number,
|
|
pageSize: number,
|
|
sort: { sortBy?: string; sortDir?: "asc" | "desc" } = {},
|
|
): Promise<AdminTopupPage> {
|
|
const params = new URLSearchParams({
|
|
page: String(Math.max(0, page - 1)),
|
|
size: String(pageSize),
|
|
});
|
|
if (sort.sortBy) {
|
|
params.set("sortBy", sort.sortBy);
|
|
if (sort.sortDir) params.set("sortDir", sort.sortDir);
|
|
}
|
|
return apiGet<AdminTopupPage>(`/api/admin/topup/list?${params.toString()}`);
|
|
}
|
|
|
|
/** add-topup-reversal: paged completed and reversed top-ups (the Completed view). */
|
|
export async function getCompletedTopups(
|
|
page: number,
|
|
pageSize: number,
|
|
sort: { sortBy?: string; sortDir?: "asc" | "desc" } = {},
|
|
): Promise<AdminTopupPage> {
|
|
const params = new URLSearchParams({
|
|
page: String(Math.max(0, page - 1)),
|
|
size: String(pageSize),
|
|
view: "completed",
|
|
});
|
|
if (sort.sortBy) {
|
|
params.set("sortBy", sort.sortBy);
|
|
if (sort.sortDir) params.set("sortDir", sort.sortDir);
|
|
}
|
|
return apiGet<AdminTopupPage>(`/api/admin/topup/list?${params.toString()}`);
|
|
}
|
|
|
|
/** add-topup-reversal: reverse a completed top-up with a reason (claws back its rewards). */
|
|
export async function reverseTopup(uuid: string, reason: string): Promise<AdminTopupRow> {
|
|
return apiPost<AdminTopupRow>("/api/admin/topup/reverse", { uuid, reason });
|
|
}
|