@techzunction/sdk 0.8.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +167 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +362 -2
- package/dist/index.d.ts +362 -2
- package/dist/index.js +167 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -377,16 +377,16 @@ var ScopedClient = class {
|
|
|
377
377
|
return new TZQuery((signal) => this.root.rawRequest("POST", fp, { body: formData, scope: s, signal, sendOrgKey: this.sendOrgKey }));
|
|
378
378
|
}
|
|
379
379
|
/** Paginated GET → TZPaginatedQuery<T> with .next(), .prev(), .goTo() */
|
|
380
|
-
paginated(path, params = {}) {
|
|
380
|
+
paginated(path, params = {}, scope) {
|
|
381
381
|
const page = params.page ?? 1;
|
|
382
382
|
const limit = params.limit ?? 20;
|
|
383
|
-
const
|
|
383
|
+
const resolvedScope = scope ?? this.defaultScope;
|
|
384
384
|
const factory = (p, l) => {
|
|
385
385
|
const merged = { ...params, page: p, limit: l };
|
|
386
386
|
const qs = toQs(merged);
|
|
387
387
|
const fp = this.fullPath(`${path}${qs}`);
|
|
388
388
|
const executor = async (signal) => {
|
|
389
|
-
const rawRes = await this.root.rawRequest("GET", fp, { scope, signal, sendOrgKey: this.sendOrgKey });
|
|
389
|
+
const rawRes = await this.root.rawRequest("GET", fp, { scope: resolvedScope, signal, sendOrgKey: this.sendOrgKey });
|
|
390
390
|
const envelope = rawRes.raw;
|
|
391
391
|
const pagination = envelope["pagination"] ?? { page: p, limit: l, total: 0, totalPages: 0, hasNextPage: false, hasPrevPage: false };
|
|
392
392
|
return {
|
|
@@ -1082,6 +1082,168 @@ function createStorefrontConnectedSources(c) {
|
|
|
1082
1082
|
};
|
|
1083
1083
|
}
|
|
1084
1084
|
|
|
1085
|
+
// src/storefront/banking.ts
|
|
1086
|
+
function createStorefrontBanking(c) {
|
|
1087
|
+
return {
|
|
1088
|
+
// ─── KYC ────────────────────────────────────────────────────────
|
|
1089
|
+
kyc: {
|
|
1090
|
+
submit(data) {
|
|
1091
|
+
return c.post("/banking/kyc", data, "enduser");
|
|
1092
|
+
},
|
|
1093
|
+
getStatus() {
|
|
1094
|
+
return c.get("/banking/kyc/status", "enduser");
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
// ─── Accounts ───────────────────────────────────────────────────
|
|
1098
|
+
accounts: {
|
|
1099
|
+
list() {
|
|
1100
|
+
return c.get("/banking/accounts", "enduser");
|
|
1101
|
+
},
|
|
1102
|
+
get(id) {
|
|
1103
|
+
return c.get(`/banking/accounts/${id}`, "enduser");
|
|
1104
|
+
},
|
|
1105
|
+
getBalance(id) {
|
|
1106
|
+
return c.get(`/banking/accounts/${id}/balance`, "enduser");
|
|
1107
|
+
},
|
|
1108
|
+
updateNickname(id, data) {
|
|
1109
|
+
return c.patch(`/banking/accounts/${id}/nickname`, data, "enduser");
|
|
1110
|
+
},
|
|
1111
|
+
setAutoSweep(id, data) {
|
|
1112
|
+
return c.patch(`/banking/accounts/${id}/auto-sweep`, data, "enduser");
|
|
1113
|
+
},
|
|
1114
|
+
getStatement(id, params) {
|
|
1115
|
+
return c.paginated(`/banking/accounts/${id}/statement`, params, "enduser");
|
|
1116
|
+
}
|
|
1117
|
+
},
|
|
1118
|
+
// ─── Fixed Deposits ─────────────────────────────────────────────
|
|
1119
|
+
fixedDeposits: {
|
|
1120
|
+
list() {
|
|
1121
|
+
return c.get("/banking/accounts/fixed-deposits/list", "enduser");
|
|
1122
|
+
},
|
|
1123
|
+
create(data) {
|
|
1124
|
+
return c.post("/banking/accounts/fixed-deposits", data, "enduser");
|
|
1125
|
+
},
|
|
1126
|
+
close(fdId) {
|
|
1127
|
+
return c.del(`/banking/accounts/fixed-deposits/${fdId}`, "enduser");
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
// ─── Transfers ──────────────────────────────────────────────────
|
|
1131
|
+
transfers: {
|
|
1132
|
+
initiate(data) {
|
|
1133
|
+
return c.post("/banking/transfers", data, "enduser");
|
|
1134
|
+
}
|
|
1135
|
+
},
|
|
1136
|
+
// ─── Beneficiaries ──────────────────────────────────────────────
|
|
1137
|
+
beneficiaries: {
|
|
1138
|
+
list() {
|
|
1139
|
+
return c.get("/banking/transfers/beneficiaries", "enduser");
|
|
1140
|
+
},
|
|
1141
|
+
add(data) {
|
|
1142
|
+
return c.post("/banking/transfers/beneficiaries", data, "enduser");
|
|
1143
|
+
},
|
|
1144
|
+
remove(id) {
|
|
1145
|
+
return c.del(`/banking/transfers/beneficiaries/${id}`, "enduser");
|
|
1146
|
+
},
|
|
1147
|
+
toggleFavorite(id) {
|
|
1148
|
+
return c.patch(`/banking/transfers/beneficiaries/${id}/favorite`, {}, "enduser");
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
// ─── Scheduled Transfers ────────────────────────────────────────
|
|
1152
|
+
scheduledTransfers: {
|
|
1153
|
+
list() {
|
|
1154
|
+
return c.get("/banking/transfers/scheduled", "enduser");
|
|
1155
|
+
},
|
|
1156
|
+
create(data) {
|
|
1157
|
+
return c.post("/banking/transfers/scheduled", data, "enduser");
|
|
1158
|
+
},
|
|
1159
|
+
cancel(id) {
|
|
1160
|
+
return c.del(`/banking/transfers/scheduled/${id}`, "enduser");
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
// ─── Bill Payments ──────────────────────────────────────────────
|
|
1164
|
+
bills: {
|
|
1165
|
+
pay(data) {
|
|
1166
|
+
return c.post("/banking/transfers/bills", data, "enduser");
|
|
1167
|
+
},
|
|
1168
|
+
list(params) {
|
|
1169
|
+
return c.paginated("/banking/transfers/bills", params, "enduser");
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
// ─── Cards ──────────────────────────────────────────────────────
|
|
1173
|
+
cards: {
|
|
1174
|
+
list() {
|
|
1175
|
+
return c.get("/banking/cards", "enduser");
|
|
1176
|
+
},
|
|
1177
|
+
get(id) {
|
|
1178
|
+
return c.get(`/banking/cards/${id}`, "enduser");
|
|
1179
|
+
},
|
|
1180
|
+
generateVirtual(data) {
|
|
1181
|
+
return c.post("/banking/cards", data, "enduser");
|
|
1182
|
+
},
|
|
1183
|
+
block(id) {
|
|
1184
|
+
return c.post(`/banking/cards/${id}/block`, {}, "enduser");
|
|
1185
|
+
},
|
|
1186
|
+
unblock(id) {
|
|
1187
|
+
return c.post(`/banking/cards/${id}/unblock`, {}, "enduser");
|
|
1188
|
+
},
|
|
1189
|
+
updateLimits(id, data) {
|
|
1190
|
+
return c.patch(`/banking/cards/${id}/limits`, data, "enduser");
|
|
1191
|
+
},
|
|
1192
|
+
toggleInternational(id, data) {
|
|
1193
|
+
return c.patch(`/banking/cards/${id}/international`, data, "enduser");
|
|
1194
|
+
},
|
|
1195
|
+
toggleContactless(id, data) {
|
|
1196
|
+
return c.patch(`/banking/cards/${id}/contactless`, data, "enduser");
|
|
1197
|
+
},
|
|
1198
|
+
toggleOnline(id, data) {
|
|
1199
|
+
return c.patch(`/banking/cards/${id}/online`, data, "enduser");
|
|
1200
|
+
}
|
|
1201
|
+
},
|
|
1202
|
+
// ─── Analytics ──────────────────────────────────────────────────
|
|
1203
|
+
analytics: {
|
|
1204
|
+
getSpendingBreakdown(months) {
|
|
1205
|
+
return c.get(`/banking/analytics/spending${toQs({ months })}`, "enduser");
|
|
1206
|
+
},
|
|
1207
|
+
getMonthlyTrends(months) {
|
|
1208
|
+
return c.get(`/banking/analytics/trends${toQs({ months })}`, "enduser");
|
|
1209
|
+
},
|
|
1210
|
+
getCashFlow(startDate, endDate) {
|
|
1211
|
+
return c.get(`/banking/analytics/cash-flow${toQs({ startDate, endDate })}`, "enduser");
|
|
1212
|
+
},
|
|
1213
|
+
getNetWorth() {
|
|
1214
|
+
return c.get("/banking/analytics/net-worth", "enduser");
|
|
1215
|
+
},
|
|
1216
|
+
getCategories() {
|
|
1217
|
+
return c.get("/banking/analytics/categories");
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
// ─── Budgets ────────────────────────────────────────────────────
|
|
1221
|
+
budgets: {
|
|
1222
|
+
list() {
|
|
1223
|
+
return c.get("/banking/analytics/budgets", "enduser");
|
|
1224
|
+
},
|
|
1225
|
+
set(data) {
|
|
1226
|
+
return c.post("/banking/analytics/budgets", data, "enduser");
|
|
1227
|
+
},
|
|
1228
|
+
remove(category) {
|
|
1229
|
+
return c.del(`/banking/analytics/budgets/${category}`, "enduser");
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
// ─── Anomaly Alerts ─────────────────────────────────────────────
|
|
1233
|
+
alerts: {
|
|
1234
|
+
list(params) {
|
|
1235
|
+
return c.paginated("/banking/analytics/alerts", params, "enduser");
|
|
1236
|
+
},
|
|
1237
|
+
markRead(id) {
|
|
1238
|
+
return c.post(`/banking/analytics/alerts/${id}/read`, {}, "enduser");
|
|
1239
|
+
},
|
|
1240
|
+
dismiss(id) {
|
|
1241
|
+
return c.post(`/banking/analytics/alerts/${id}/dismiss`, {}, "enduser");
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1085
1247
|
// src/storefront/index.ts
|
|
1086
1248
|
function createStorefront(c) {
|
|
1087
1249
|
return {
|
|
@@ -1115,7 +1277,8 @@ function createStorefront(c) {
|
|
|
1115
1277
|
help: createStorefrontHelp(c),
|
|
1116
1278
|
rooms: createStorefrontRooms(c),
|
|
1117
1279
|
earnings: createStorefrontEarnings(c),
|
|
1118
|
-
connectedSources: createStorefrontConnectedSources(c)
|
|
1280
|
+
connectedSources: createStorefrontConnectedSources(c),
|
|
1281
|
+
banking: createStorefrontBanking(c)
|
|
1119
1282
|
};
|
|
1120
1283
|
}
|
|
1121
1284
|
|