vibecash 0.2.3 → 0.2.5

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.
Files changed (2) hide show
  1. package/dist/index.js +24 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -181,14 +181,15 @@ function registerWalletCommands(program2) {
181
181
  // src/commands/product.ts
182
182
  function registerProductCommands(program2) {
183
183
  const product = program2.command("product").description("Manage products");
184
- product.command("create <name>").description("Create a new product").option("-d, --description <description>", "Product description").action(async (name, opts) => {
184
+ product.command("create <name>").description("Create a new product").option("-d, --description <description>", "Product description").option("-w, --webhook-url <url>", "Webhook URL for this product").action(async (name, opts) => {
185
185
  try {
186
186
  const body = { name };
187
187
  if (opts.description) body.description = opts.description;
188
+ if (opts.webhookUrl) body.webhookUrl = opts.webhookUrl;
188
189
  const data = await apiRequest("POST", "/products", body);
189
190
  success("Product created");
190
191
  output(data, (d) => `Product ID: ${d.id}
191
- Name: ${d.name}`);
192
+ Name: ${d.name}${d.webhookUrl ? "\nWebhook: " + d.webhookUrl : ""}`);
192
193
  } catch (err) {
193
194
  console.error(`Error: ${err.message}`);
194
195
  process.exit(1);
@@ -218,6 +219,7 @@ Name: ${d.name}`);
218
219
  `Product ID: ${d.id}`,
219
220
  `Name: ${d.name}`,
220
221
  `Description: ${d.description || "N/A"}`,
222
+ `Webhook: ${d.webhookUrl || "N/A (using wallet default)"}`,
221
223
  `Created: ${fmtDate(d.createdAt)}`
222
224
  ].join("\n"));
223
225
  } catch (err) {
@@ -225,11 +227,12 @@ Name: ${d.name}`);
225
227
  process.exit(1);
226
228
  }
227
229
  });
228
- product.command("update <id>").description("Update a product").option("-n, --name <name>", "New product name").option("-d, --description <description>", "New product description").action(async (id, opts) => {
230
+ product.command("update <id>").description("Update a product").option("-n, --name <name>", "New product name").option("-d, --description <description>", "New product description").option("-w, --webhook-url <url>", "Webhook URL for this product").action(async (id, opts) => {
229
231
  try {
230
232
  const body = {};
231
233
  if (opts.name) body.name = opts.name;
232
234
  if (opts.description) body.description = opts.description;
235
+ if (opts.webhookUrl) body.webhookUrl = opts.webhookUrl;
233
236
  await apiRequest("PATCH", `/products/${id}`, body);
234
237
  success("Product updated");
235
238
  } catch (err) {
@@ -521,7 +524,7 @@ function registerCustomerCommands(program2) {
521
524
  // src/commands/link.ts
522
525
  function registerLinkCommands(program2) {
523
526
  const link = program2.command("link").description("Manage payment links");
524
- link.command("create <amount>").description("Create a new payment link (amount in cents, e.g. 1000 = $10.00)").option("-c, --currency <currency>", "Currency code", "SGD").option("-n, --name <name>", "Link name").option("-d, --description <description>", "Link description").option("--success-url <url>", "URL to redirect after successful payment").option("--cancel-url <url>", "URL to redirect on cancel").option("--methods <methods>", "Payment methods (comma-separated: card,alipay,paynow,wechat)").action(async (amount, opts) => {
527
+ link.command("create <amount>").description("Create a new payment link (amount in cents, e.g. 1000 = $10.00)").option("-c, --currency <currency>", "Currency code", "SGD").option("-n, --name <name>", "Link name").option("-d, --description <description>", "Link description").option("--success-url <url>", "URL to redirect after successful payment").option("--cancel-url <url>", "URL to redirect on cancel").option("--methods <methods>", "Payment methods (comma-separated: card,alipay,paynow,wechat)").option("-w, --webhook-url <url>", "Webhook URL for this payment link").action(async (amount, opts) => {
525
528
  try {
526
529
  const body = {
527
530
  amount: parseInt(amount, 10),
@@ -532,6 +535,7 @@ function registerLinkCommands(program2) {
532
535
  if (opts.successUrl) body.successUrl = opts.successUrl;
533
536
  if (opts.cancelUrl) body.cancelUrl = opts.cancelUrl;
534
537
  if (opts.methods) body.paymentMethodTypes = opts.methods.split(",").map((m) => m.trim());
538
+ if (opts.webhookUrl) body.webhookUrl = opts.webhookUrl;
535
539
  const data = await apiRequest("POST", "/payment_links", body);
536
540
  success("Payment link created");
537
541
  output(data, (d) => {
@@ -580,6 +584,7 @@ function registerLinkCommands(program2) {
580
584
  `Amount: ${fmtAmount(d.amount, d.currency)}`,
581
585
  `Active: ${d.active ? "yes" : "no"}`,
582
586
  `Desc: ${d.description || "N/A"}`,
587
+ `Webhook: ${d.webhookUrl || "N/A (using wallet default)"}`,
583
588
  `Created: ${fmtDate(d.createdAt)}`
584
589
  ].join("\n");
585
590
  });
@@ -588,6 +593,21 @@ function registerLinkCommands(program2) {
588
593
  process.exit(1);
589
594
  }
590
595
  });
596
+ link.command("update <id>").description("Update a payment link").option("-n, --name <name>", "New link name").option("-d, --description <description>", "New description").option("--success-url <url>", "Success redirect URL").option("--cancel-url <url>", "Cancel redirect URL").option("-w, --webhook-url <url>", "Webhook URL").action(async (id, opts) => {
597
+ try {
598
+ const body = {};
599
+ if (opts.name) body.name = opts.name;
600
+ if (opts.description) body.description = opts.description;
601
+ if (opts.successUrl) body.successUrl = opts.successUrl;
602
+ if (opts.cancelUrl) body.cancelUrl = opts.cancelUrl;
603
+ if (opts.webhookUrl) body.webhookUrl = opts.webhookUrl;
604
+ await apiRequest("PATCH", `/payment_links/${id}`, body);
605
+ success("Payment link updated");
606
+ } catch (err) {
607
+ console.error(`Error: ${err.message}`);
608
+ process.exit(1);
609
+ }
610
+ });
591
611
  link.command("deactivate <id>").description("Deactivate a payment link").action(async (id) => {
592
612
  try {
593
613
  await apiRequest("PATCH", `/payment_links/${id}`, { active: false });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibecash",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "VibeCash CLI - Payment infrastructure for the AI era. Accept cards, e-wallets, and QR payments in Southeast Asia.",
5
5
  "type": "module",
6
6
  "bin": {