From 18b0e436c9a0655b4119086d56a988ce95b4c950 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 2 Sep 2026 01:45:23 +0000 Subject: [PATCH] fix(paperfly): send paperflykey + Basic Auth on both create & track; v2.3.1 --- package.json | 2 +- src/adapters/paperfly.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7ef4450..65c4291 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aura-courier-mcp", - "version": "2.3.0", + "version": "2.3.1", "description": "Universal Bangladesh courier MCP server — Steadfast, Pathao, RedX & Paperfly with a built-in fraud-risk engine — for Claude, Antigravity, Cursor & n8n AI agents. Runs as a local npx (STDIO) server or a remote HTTP endpoint.", "main": "dist/index.js", "type": "module", diff --git a/src/adapters/paperfly.ts b/src/adapters/paperfly.ts index a705054..3a872aa 100644 --- a/src/adapters/paperfly.ts +++ b/src/adapters/paperfly.ts @@ -22,7 +22,7 @@ export class PaperflyAdapter implements CourierAdapter { this.username = username; this.password = password; this.storeName = storeName; - this.enabled = Boolean(apiKey && storeName); + this.enabled = Boolean(apiKey && username && password); this.client = axios.create({ baseURL: baseUrl, timeout: 15000, @@ -36,7 +36,10 @@ export class PaperflyAdapter implements CourierAdapter { async createParcel(req: ParcelCreateRequest): Promise { if (!this.enabled) { - throw new Error("Paperfly credentials (paperflykey + store name) are not configured."); + throw new Error("Paperfly credentials (paperflykey + merchant username & password) are not configured."); + } + if (!this.storeName) { + throw new Error("Paperfly store name is required to create a parcel."); } const payload = { merchantOrderReference: req.invoice, @@ -50,6 +53,7 @@ export class PaperflyAdapter implements CourierAdapter { }; const response = await this.client.post("/merchant/api/service/new_order_v2.php", payload, { headers: { paperflykey: this.apiKey }, + auth: { username: this.username, password: this.password }, }); const data = response.data; const ok = data?.success; @@ -82,7 +86,7 @@ export class PaperflyAdapter implements CourierAdapter { const response = await this.client.post( "/API-Order-Tracking", { ReferenceNumber: trackingCode }, - { auth: { username: this.username, password: this.password } } + { headers: { paperflykey: this.apiKey }, auth: { username: this.username, password: this.password } } ); const data = response.data; const st = data?.success?.trackingStatus?.[0] || {};