fix(build): add pg and @types/pg dependencies, add master courier fallbacks and compile live tracking (v2.4.1)
This commit is contained in:
Vendored
+15
-1
@@ -5,8 +5,9 @@ export class SteadfastAdapter {
|
||||
enabled;
|
||||
constructor(apiKey, secretKey, baseUrl) {
|
||||
this.enabled = Boolean(apiKey && secretKey);
|
||||
const resolvedBase = baseUrl || "https://portal.steadfast.com.bd/api/v1";
|
||||
this.client = axios.create({
|
||||
baseURL: baseUrl,
|
||||
baseURL: resolvedBase,
|
||||
headers: {
|
||||
"Api-Key": apiKey,
|
||||
"Secret-Key": secretKey,
|
||||
@@ -77,4 +78,17 @@ export class SteadfastAdapter {
|
||||
raw_response: data,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 100% Real Live Steadfast Fraud Check API
|
||||
* Endpoint: GET /fraud_check/{phone}
|
||||
* Returns nationwide parcel history across Bangladesh: total_parcels, total_delivered, total_cancelled
|
||||
*/
|
||||
async fraudCheck(phone) {
|
||||
if (!this.enabled) {
|
||||
throw new Error("Steadfast Courier credentials are not configured.");
|
||||
}
|
||||
const cleanPhone = phone.replace(/\D/g, "");
|
||||
const response = await this.client.get(`/fraud_check/${encodeURIComponent(cleanPhone)}`);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user