@boostengine/collections 1.0.0

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/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # @boostengine/collections
2
+
3
+ > Production-ready **Postman Collections (v2.1.0)** and **Environment Templates** for Indian eCommerce APIs: **Razorpay Payment Gateway** and **EasyEcom WMS & ERP**.
4
+
5
+ Includes a zero-install **CLI tool** (`npx @boostengine/collections export`) to dump ready-to-import Postman JSON files into any project in 1 second.
6
+
7
+ ---
8
+
9
+ ## ⚡ Quickstart (CLI)
10
+
11
+ Export complete collections and environment variables into your current working directory without installing:
12
+
13
+ ```bash
14
+ # Export all collections & environments
15
+ npx @boostengine/collections export all
16
+
17
+ # Or export individually:
18
+ npx @boostengine/collections export razorpay
19
+ npx @boostengine/collections export easyecom
20
+
21
+ # Inspect available endpoints inside terminal:
22
+ npx @boostengine/collections info razorpay
23
+ ```
24
+
25
+ ### 📥 How to Import into Postman / Bruno / Insomnia:
26
+ 1. Open **Postman** (or Insomnia / Bruno / ThunderClient).
27
+ 2. Click **Import** (Top left).
28
+ 3. Drag & drop the exported `*.collection.json` and `*.env.json` files.
29
+ 4. Select the imported Environment from top-right dropdown, paste your API keys, and start sending requests!
30
+
31
+ ---
32
+
33
+ ## 📦 What's Included
34
+
35
+ ### 1. 💳 Razorpay eCommerce API Collection (`razorpay.collection.json`)
36
+ Official REST APIs configured with Basic Authentication:
37
+ * **Orders API**:
38
+ - `POST /v1/orders` (Create order with amount, currency, notes, receipt)
39
+ - `GET /v1/orders/:id` (Fetch order details)
40
+ - `GET /v1/orders/:id/payments` (Fetch all payments attempted against order)
41
+ - `GET /v1/orders` (List recent orders with pagination)
42
+ * **Payments API**:
43
+ - `GET /v1/payments/:id` (Fetch payment status, UPI VPA, card details)
44
+ - `POST /v1/payments/:id/capture` (Manual payment capture)
45
+ - `PATCH /v1/payments/:id` (Update custom payment notes)
46
+ * **Refunds API**:
47
+ - `POST /v1/payments/:id/refund` (Instant & normal customer refunds)
48
+ - `GET /v1/refunds/:id` (Check refund status)
49
+ - `GET /v1/refunds` (List recent refunds)
50
+ * **Webhook Simulator**:
51
+ - `order.paid` mock payload
52
+ - `payment.failed` mock payload
53
+ - `payment.captured` mock payload
54
+ - `refund.processed` mock payload
55
+ - HMAC SHA256 signature verification guidance
56
+
57
+ ---
58
+
59
+ ### 2. 🏬 EasyEcom Warehouse & ERP Collection (`easyecom.collection.json`)
60
+ Official REST APIs configured with Bearer Token Authentication:
61
+ * **Orders API**:
62
+ - `GET /orders/v2/getOrders` (Fetch pending & unfulfilled orders)
63
+ - `POST /orders/v2/createOrder` (Push new storefront orders into ERP)
64
+ - `POST /orders/v2/updateOrderStatus` (Update fulfillment status to Shipped/Delivered)
65
+ - `POST /orders/v2/cancelOrder` (Cancel order and auto-restore warehouse inventory)
66
+ * **Inventory & Multi-Warehouse Stock**:
67
+ - `GET /inventory/v2/getInventoryDetails` (Check sellable stock by SKU)
68
+ - `POST /inventory/v2/updateInventory` (Sync warehouse inventory count)
69
+ - `GET /inventory/v2/getWarehouses` (List all active fulfillment centers)
70
+ * **Master Catalog**:
71
+ - `GET /catalog/v2/getMasterProducts` (Fetch product master records)
72
+ - `POST /catalog/v2/createProduct` (Register master SKU with HSN code & dimensions)
73
+ * **Shipping & Manifests**:
74
+ - `POST /shipping/v2/generateAwb` (Generate shipping label & tracking number)
75
+ - `POST /shipping/v2/createManifest` (Create courier handover manifest PDF)
76
+
77
+ ---
78
+
79
+ ## 💻 Programmatic Node.js / TypeScript Usage
80
+
81
+ You can also install this package as a dev dependency to programmatically parse or mock endpoints in your backend tests:
82
+
83
+ ```bash
84
+ npm install -D @boostengine/collections
85
+ ```
86
+
87
+ ```typescript
88
+ import {
89
+ razorpayCollection,
90
+ easyecomCollection,
91
+ listCollections,
92
+ getCollection,
93
+ exportToDirectory,
94
+ } from '@boostengine/collections';
95
+
96
+ // List available collection summaries
97
+ const available = listCollections();
98
+ console.log(available);
99
+
100
+ // Access raw Postman Schema v2.1.0 JSON object
101
+ console.log(razorpayCollection.info.name);
102
+ console.log(easyecomCollection.item.length);
103
+
104
+ // Programmatically dump files in CI/CD or setup scripts
105
+ exportToDirectory('all', './postman');
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 📄 License
111
+ MIT © [Boost Engine](https://github.com/boostengine)
package/bin/cli.cjs ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const collectionsDir = path.join(__dirname, '..', 'collections');
7
+ const envsDir = path.join(__dirname, '..', 'environments');
8
+
9
+ const collections = {
10
+ razorpay: {
11
+ name: 'Razorpay eCommerce API Collection',
12
+ collectionFile: path.join(collectionsDir, 'razorpay.collection.json'),
13
+ envFile: path.join(envsDir, 'razorpay.env.json'),
14
+ docs: 'https://razorpay.com/docs/api',
15
+ description: 'Orders, Payments, Refunds & Webhook Simulator',
16
+ },
17
+ easyecom: {
18
+ name: 'EasyEcom eCommerce & Warehouse API Collection',
19
+ collectionFile: path.join(collectionsDir, 'easyecom.collection.json'),
20
+ envFile: path.join(envsDir, 'easyecom.env.json'),
21
+ docs: 'https://api.easyecom.com/documentation',
22
+ description: 'Orders, Multi-Warehouse Inventory, Catalog & Shipping Manifests',
23
+ },
24
+ };
25
+
26
+ const args = process.argv.slice(2);
27
+ const command = args[0] || 'help';
28
+
29
+ console.log('\n📦 \x1b[1m\x1b[34m@boostengine/collections\x1b[0m - Indian eCommerce Postman Collections CLI\n');
30
+
31
+ switch (command) {
32
+ case 'list': {
33
+ console.log('Available Production-Ready Collections:\n');
34
+ Object.keys(collections).forEach((key) => {
35
+ const item = collections[key];
36
+ console.log(` \x1b[32m● ${key}\x1b[0m - \x1b[1m${item.name}\x1b[0m`);
37
+ console.log(` Description: ${item.description}`);
38
+ console.log(` Docs: \x1b[36m${item.docs}\x1b[0m\n`);
39
+ });
40
+ console.log('💡 Run: \x1b[33mnpx @boostengine/collections export <name>\x1b[0m to dump JSON files.\n');
41
+ break;
42
+ }
43
+
44
+ case 'export': {
45
+ const target = (args[1] || 'all').toLowerCase();
46
+ const destDir = args[2] ? path.resolve(process.cwd(), args[2]) : process.cwd();
47
+
48
+ if (!fs.existsSync(destDir)) {
49
+ fs.mkdirSync(destDir, { recursive: true });
50
+ }
51
+
52
+ const exportKeys = target === 'all' ? Object.keys(collections) : [target];
53
+
54
+ if (!collections[target] && target !== 'all') {
55
+ console.error(`\x1b[31m❌ Unknown collection "${target}".\x1b[0m`);
56
+ console.log(`Available: ${Object.keys(collections).join(', ')} or "all"\n`);
57
+ process.exit(1);
58
+ }
59
+
60
+ console.log(`🚀 Exporting collections to: \x1b[36m${destDir}\x1b[0m\n`);
61
+
62
+ exportKeys.forEach((key) => {
63
+ const item = collections[key];
64
+ const colDest = path.join(destDir, `${key}.collection.json`);
65
+ const envDest = path.join(destDir, `${key}.env.json`);
66
+
67
+ fs.copyFileSync(item.collectionFile, colDest);
68
+ fs.copyFileSync(item.envFile, envDest);
69
+
70
+ console.log(` ✅ \x1b[32m${key}\x1b[0m:`);
71
+ console.log(` ├── Collection: \x1b[33m${path.basename(colDest)}\x1b[0m`);
72
+ console.log(` └── Environment: \x1b[33m${path.basename(envDest)}\x1b[0m`);
73
+ });
74
+
75
+ console.log('\n✨ Export complete! How to import into Postman:');
76
+ console.log(' 1. Open Postman / Insomnia / Bruno.');
77
+ console.log(' 2. Click "Import" and select the generated *.collection.json and *.env.json files.');
78
+ console.log(' 3. Set your API credentials in the Environment variables & start testing!\n');
79
+ break;
80
+ }
81
+
82
+ case 'info': {
83
+ const target = (args[1] || '').toLowerCase();
84
+ if (!collections[target]) {
85
+ console.error(`\x1b[31m❌ Please specify a valid collection: ${Object.keys(collections).join(', ')}\x1b[0m\n`);
86
+ process.exit(1);
87
+ }
88
+ const item = collections[target];
89
+ const colJson = JSON.parse(fs.readFileSync(item.collectionFile, 'utf8'));
90
+
91
+ console.log(`\x1b[1mCollection:\x1b[0m ${item.name}`);
92
+ console.log(`\x1b[1mDocs:\x1b[0m ${item.docs}`);
93
+ console.log(`\x1b[1mFolders:\x1b[0m`);
94
+ colJson.item.forEach((f) => {
95
+ console.log(` 📁 ${f.name} (${f.item ? f.item.length : 0} requests)`);
96
+ if (f.item) {
97
+ f.item.forEach((req) => {
98
+ const method = req.request?.method || 'GET';
99
+ console.log(` • [${method}] ${req.name}`);
100
+ });
101
+ }
102
+ });
103
+ console.log('');
104
+ break;
105
+ }
106
+
107
+ default: {
108
+ console.log('Commands:');
109
+ console.log(' \x1b[33mnpx @boostengine/collections list\x1b[0m List all available API collections');
110
+ console.log(' \x1b[33mnpx @boostengine/collections export <name>\x1b[0m Export collection (razorpay, easyecom, all)');
111
+ console.log(' \x1b[33mnpx @boostengine/collections export <name> <dir>\x1b[0m Export into custom directory');
112
+ console.log(' \x1b[33mnpx @boostengine/collections info <name>\x1b[0m Inspect folders and endpoints in collection\n');
113
+ break;
114
+ }
115
+ }
@@ -0,0 +1,276 @@
1
+ {
2
+ "info": {
3
+ "_postman_id": "8f21bc90-2134-4b45-9128-b12a83e01290",
4
+ "name": "EasyEcom eCommerce & Warehouse API Collection",
5
+ "description": "Production-ready Postman Collection for EasyEcom Inventory, Orders, Multi-Warehouse Stock, and Courier Manifest APIs. Maintained by Boost Engine (@boostengine/collections).",
6
+ "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
7
+ },
8
+ "auth": {
9
+ "type": "bearer",
10
+ "bearer": [
11
+ {
12
+ "key": "token",
13
+ "value": "{{easyecom_api_token}}",
14
+ "type": "string"
15
+ }
16
+ ]
17
+ },
18
+ "item": [
19
+ {
20
+ "name": "Orders",
21
+ "description": "APIs to push new storefront orders, fetch pending orders, and manage fulfillment status in EasyEcom.",
22
+ "item": [
23
+ {
24
+ "name": "1. Fetch Pending Orders",
25
+ "request": {
26
+ "method": "GET",
27
+ "header": [],
28
+ "url": {
29
+ "raw": "{{easyecom_base_url}}/orders/v2/getOrders?status=pending&limit=20",
30
+ "host": ["{{easyecom_base_url}}"],
31
+ "path": ["orders", "v2", "getOrders"],
32
+ "query": [
33
+ {
34
+ "key": "status",
35
+ "value": "pending"
36
+ },
37
+ {
38
+ "key": "limit",
39
+ "value": "20"
40
+ }
41
+ ]
42
+ },
43
+ "description": "Fetches unfulfilled / pending orders waiting for picklist and invoice generation."
44
+ }
45
+ },
46
+ {
47
+ "name": "2. Create / Push Store Order",
48
+ "request": {
49
+ "method": "POST",
50
+ "header": [
51
+ {
52
+ "key": "Content-Type",
53
+ "value": "application/json"
54
+ }
55
+ ],
56
+ "body": {
57
+ "mode": "raw",
58
+ "raw": "{\n \"order_details\": {\n \"order_reference_id\": \"ORD_BOOST_9821\",\n \"order_date\": \"2026-09-08 18:30:00\",\n \"payment_mode\": \"Prepaid\",\n \"marketplace\": \"CustomStore\",\n \"customer_details\": {\n \"first_name\": \"Rahul\",\n \"last_name\": \"Verma\",\n \"email\": \"rahul.verma@example.com\",\n \"contact_number\": \"9876543210\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"Flat 402, Skyline Residency, Link Road\",\n \"city\": \"Mumbai\",\n \"state\": \"Maharashtra\",\n \"pin_code\": \"400053\",\n \"country\": \"India\"\n },\n \"order_items\": [\n {\n \"sku\": \"TEE-ANIME-BLK-L\",\n \"item_title\": \"Oversized Anime Black T-Shirt (Large)\",\n \"quantity\": 1,\n \"selling_price\": 799,\n \"tax_percentage\": 5,\n \"discount\": 0\n }\n ],\n \"total_amount\": 799,\n \"shipping_charges\": 0\n }\n}"
59
+ },
60
+ "url": {
61
+ "raw": "{{easyecom_base_url}}/orders/v2/createOrder",
62
+ "host": ["{{easyecom_base_url}}"],
63
+ "path": ["orders", "v2", "createOrder"]
64
+ },
65
+ "description": "Pushes a new order from your custom eCommerce store or mobile app into EasyEcom ERP."
66
+ }
67
+ },
68
+ {
69
+ "name": "3. Update Order Status",
70
+ "request": {
71
+ "method": "POST",
72
+ "header": [
73
+ {
74
+ "key": "Content-Type",
75
+ "value": "application/json"
76
+ }
77
+ ],
78
+ "body": {
79
+ "mode": "raw",
80
+ "raw": "{\n \"order_reference_id\": \"ORD_BOOST_9821\",\n \"status\": \"shipped\",\n \"tracking_number\": \"AWB_DELHIVERY_1092831\",\n \"courier_name\": \"Delhivery Surface\"\n}"
81
+ },
82
+ "url": {
83
+ "raw": "{{easyecom_base_url}}/orders/v2/updateOrderStatus",
84
+ "host": ["{{easyecom_base_url}}"],
85
+ "path": ["orders", "v2", "updateOrderStatus"]
86
+ },
87
+ "description": "Updates order fulfillment status (e.g. packed, shipped, delivered, rto)."
88
+ }
89
+ },
90
+ {
91
+ "name": "4. Cancel Order",
92
+ "request": {
93
+ "method": "POST",
94
+ "header": [
95
+ {
96
+ "key": "Content-Type",
97
+ "value": "application/json"
98
+ }
99
+ ],
100
+ "body": {
101
+ "mode": "raw",
102
+ "raw": "{\n \"order_reference_id\": \"ORD_BOOST_9821\",\n \"cancellation_reason\": \"Customer requested cancellation before dispatch\"\n}"
103
+ },
104
+ "url": {
105
+ "raw": "{{easyecom_base_url}}/orders/v2/cancelOrder",
106
+ "host": ["{{easyecom_base_url}}"],
107
+ "path": ["orders", "v2", "cancelOrder"]
108
+ },
109
+ "description": "Cancels an order before it is dispatched and restores inventory in EasyEcom warehouse."
110
+ }
111
+ }
112
+ ]
113
+ },
114
+ {
115
+ "name": "Inventory & Multi-Warehouse Stock",
116
+ "description": "APIs to query and sync live stock levels across central and regional fulfillment centers.",
117
+ "item": [
118
+ {
119
+ "name": "1. Get Inventory by SKU",
120
+ "request": {
121
+ "method": "GET",
122
+ "header": [],
123
+ "url": {
124
+ "raw": "{{easyecom_base_url}}/inventory/v2/getInventoryDetails?sku={{sku}}",
125
+ "host": ["{{easyecom_base_url}}"],
126
+ "path": ["inventory", "v2", "getInventoryDetails"],
127
+ "query": [
128
+ {
129
+ "key": "sku",
130
+ "value": "{{sku}}"
131
+ }
132
+ ]
133
+ },
134
+ "description": "Fetches current physical stock, allocated stock, and sellable stock for a specific SKU."
135
+ }
136
+ },
137
+ {
138
+ "name": "2. Update Warehouse Stock",
139
+ "request": {
140
+ "method": "POST",
141
+ "header": [
142
+ {
143
+ "key": "Content-Type",
144
+ "value": "application/json"
145
+ }
146
+ ],
147
+ "body": {
148
+ "mode": "raw",
149
+ "raw": "{\n \"warehouse_id\": \"{{warehouse_id}}\",\n \"sku\": \"TEE-ANIME-BLK-L\",\n \"quantity\": 50,\n \"update_type\": \"absolute\",\n \"remarks\": \"New batch inward stock from manufacturer\"\n}"
150
+ },
151
+ "url": {
152
+ "raw": "{{easyecom_base_url}}/inventory/v2/updateInventory",
153
+ "host": ["{{easyecom_base_url}}"],
154
+ "path": ["inventory", "v2", "updateInventory"]
155
+ },
156
+ "description": "Updates warehouse inventory. Supports update_type 'absolute' (set exact count) or 'incremental' (add/subtract)."
157
+ }
158
+ },
159
+ {
160
+ "name": "3. Get All Warehouses List",
161
+ "request": {
162
+ "method": "GET",
163
+ "header": [],
164
+ "url": {
165
+ "raw": "{{easyecom_base_url}}/inventory/v2/getWarehouses",
166
+ "host": ["{{easyecom_base_url}}"],
167
+ "path": ["inventory", "v2", "getWarehouses"]
168
+ },
169
+ "description": "Retrieves the list of active warehouse locations and fulfillment centers."
170
+ }
171
+ }
172
+ ]
173
+ },
174
+ {
175
+ "name": "Master Catalog & SKUs",
176
+ "description": "APIs to manage master product catalog, HSN codes, dimensions, and weights.",
177
+ "item": [
178
+ {
179
+ "name": "1. Get Master Products",
180
+ "request": {
181
+ "method": "GET",
182
+ "header": [],
183
+ "url": {
184
+ "raw": "{{easyecom_base_url}}/catalog/v2/getMasterProducts?limit=20&page=1",
185
+ "host": ["{{easyecom_base_url}}"],
186
+ "path": ["catalog", "v2", "getMasterProducts"],
187
+ "query": [
188
+ {
189
+ "key": "limit",
190
+ "value": "20"
191
+ },
192
+ {
193
+ "key": "page",
194
+ "value": "1"
195
+ }
196
+ ]
197
+ },
198
+ "description": "Fetches master product catalog records with weights, dimensions, and barcodes."
199
+ }
200
+ },
201
+ {
202
+ "name": "2. Create / Update Master SKU",
203
+ "request": {
204
+ "method": "POST",
205
+ "header": [
206
+ {
207
+ "key": "Content-Type",
208
+ "value": "application/json"
209
+ }
210
+ ],
211
+ "body": {
212
+ "mode": "raw",
213
+ "raw": "{\n \"sku\": \"TEE-ANIME-BLK-L\",\n \"product_name\": \"Oversized Anime Black T-Shirt (Large)\",\n \"brand\": \"Boost Wear\",\n \"category\": \"Apparel\",\n \"hsn_code\": \"61091000\",\n \"tax_rate\": 5,\n \"mrp\": 1499,\n \"selling_price\": 799,\n \"weight_in_grams\": 250,\n \"dimensions\": {\n \"length\": 30,\n \"width\": 25,\n \"height\": 3\n }\n}"
214
+ },
215
+ "url": {
216
+ "raw": "{{easyecom_base_url}}/catalog/v2/createProduct",
217
+ "host": ["{{easyecom_base_url}}"],
218
+ "path": ["catalog", "v2", "createProduct"]
219
+ },
220
+ "description": "Registers or updates a master SKU with dimensions and HSN code in EasyEcom."
221
+ }
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ "name": "Shipping & Manifests",
227
+ "description": "APIs to generate Airway Bills (AWB), shipping labels, and handover manifests.",
228
+ "item": [
229
+ {
230
+ "name": "1. Generate AWB / Shipping Label",
231
+ "request": {
232
+ "method": "POST",
233
+ "header": [
234
+ {
235
+ "key": "Content-Type",
236
+ "value": "application/json"
237
+ }
238
+ ],
239
+ "body": {
240
+ "mode": "raw",
241
+ "raw": "{\n \"order_reference_id\": \"ORD_BOOST_9821\",\n \"courier_id\": \"delhivery_surface\",\n \"pickup_warehouse_id\": \"{{warehouse_id}}\"\n}"
242
+ },
243
+ "url": {
244
+ "raw": "{{easyecom_base_url}}/shipping/v2/generateAwb",
245
+ "host": ["{{easyecom_base_url}}"],
246
+ "path": ["shipping", "v2", "generateAwb"]
247
+ },
248
+ "description": "Assigns courier and generates shipping label & AWB tracking number for an order."
249
+ }
250
+ },
251
+ {
252
+ "name": "2. Create Courier Handover Manifest",
253
+ "request": {
254
+ "method": "POST",
255
+ "header": [
256
+ {
257
+ "key": "Content-Type",
258
+ "value": "application/json"
259
+ }
260
+ ],
261
+ "body": {
262
+ "mode": "raw",
263
+ "raw": "{\n \"courier_name\": \"Delhivery\",\n \"warehouse_id\": \"{{warehouse_id}}\",\n \"order_ids\": [\"ORD_BOOST_9821\"]\n}"
264
+ },
265
+ "url": {
266
+ "raw": "{{easyecom_base_url}}/shipping/v2/createManifest",
267
+ "host": ["{{easyecom_base_url}}"],
268
+ "path": ["shipping", "v2", "createManifest"]
269
+ },
270
+ "description": "Creates a courier manifest PDF when handing over physical parcels to delivery rider."
271
+ }
272
+ }
273
+ ]
274
+ }
275
+ ]
276
+ }