vibecash 0.2.0 → 0.2.2

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 +74 -46
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -165,7 +165,11 @@ function registerWalletCommands(program2) {
165
165
  try {
166
166
  const data = await apiRequest("POST", "/wallets/current/claim_link");
167
167
  output(data, (d) => {
168
- return `Claim Link: ${d.url || d.claimLink || d.link || JSON.stringify(d)}`;
168
+ return [
169
+ `Claim URL: ${d.claimUrl || "N/A"}`,
170
+ `Claim Token: ${d.claimToken || "N/A"}`,
171
+ `Expires At: ${d.expiresAt ? fmtDate(d.expiresAt) : "N/A"}`
172
+ ].join("\n");
169
173
  });
170
174
  } catch (err) {
171
175
  console.error(`Error: ${err.message}`);
@@ -394,18 +398,27 @@ function registerSubscriptionCommands(program2) {
394
398
  process.exit(1);
395
399
  }
396
400
  });
397
- subscription.command("cancel <id>").description("Cancel a subscription").action(async (id) => {
401
+ subscription.command("cancel <id>").description("Cancel a subscription immediately").action(async (id) => {
398
402
  try {
399
- await apiRequest("POST", `/subscriptions/${id}/cancel`);
403
+ await apiRequest("DELETE", `/subscriptions/${id}`);
400
404
  success(`Subscription ${id} cancelled`);
401
405
  } catch (err) {
402
406
  console.error(`Error: ${err.message}`);
403
407
  process.exit(1);
404
408
  }
405
409
  });
406
- subscription.command("resume <id>").description("Resume a cancelled subscription").action(async (id) => {
410
+ subscription.command("pause <id>").description("Set subscription to cancel at end of current period").action(async (id) => {
407
411
  try {
408
- await apiRequest("POST", `/subscriptions/${id}/resume`);
412
+ await apiRequest("PATCH", `/subscriptions/${id}`, { cancelAtPeriodEnd: true });
413
+ success(`Subscription ${id} will cancel at period end`);
414
+ } catch (err) {
415
+ console.error(`Error: ${err.message}`);
416
+ process.exit(1);
417
+ }
418
+ });
419
+ subscription.command("resume <id>").description("Resume a subscription set to cancel at period end").action(async (id) => {
420
+ try {
421
+ await apiRequest("PATCH", `/subscriptions/${id}`, { cancelAtPeriodEnd: false });
409
422
  success(`Subscription ${id} resumed`);
410
423
  } catch (err) {
411
424
  console.error(`Error: ${err.message}`);
@@ -464,11 +477,31 @@ function registerCustomerCommands(program2) {
464
477
  process.exit(1);
465
478
  }
466
479
  });
467
- customer.command("portal <id>").description("Create a customer portal session").action(async (id) => {
480
+ customer.command("delete <id>").description("Delete a customer").action(async (id) => {
468
481
  try {
469
- const data = await apiRequest("POST", `/customers/${id}/portal-session`);
470
- success("Portal session created");
471
- output(data, (d) => `Portal URL: ${d.url || d.portalUrl || JSON.stringify(d)}`);
482
+ await apiRequest("DELETE", `/customers/${id}`);
483
+ success(`Customer ${id} deleted`);
484
+ } catch (err) {
485
+ console.error(`Error: ${err.message}`);
486
+ process.exit(1);
487
+ }
488
+ });
489
+ customer.command("update <id>").description("Update a customer").option("-e, --email <email>", "New email").option("-n, --name <name>", "New name").action(async (id, opts) => {
490
+ try {
491
+ const body = {};
492
+ if (opts.email) body.email = opts.email;
493
+ if (opts.name) body.name = opts.name;
494
+ if (Object.keys(body).length === 0) {
495
+ console.error("Provide at least --email or --name to update.");
496
+ process.exit(1);
497
+ }
498
+ const data = await apiRequest("PATCH", `/customers/${id}`, body);
499
+ success("Customer updated");
500
+ output(data, (d) => [
501
+ `Customer ID: ${d.id}`,
502
+ `Email: ${d.email}`,
503
+ `Name: ${d.name || "N/A"}`
504
+ ].join("\n"));
472
505
  } catch (err) {
473
506
  console.error(`Error: ${err.message}`);
474
507
  process.exit(1);
@@ -586,8 +619,8 @@ function registerCreateCommand(program2) {
586
619
  process.exit(1);
587
620
  }
588
621
  const amountStr = await prompt("Amount (in smallest currency unit, e.g. 1000 for $10.00): ");
589
- const amount = parseInt(amountStr, 10);
590
- if (isNaN(amount) || amount <= 0) {
622
+ const unitAmount = parseInt(amountStr, 10);
623
+ if (isNaN(unitAmount) || unitAmount <= 0) {
591
624
  console.error("Invalid amount.");
592
625
  process.exit(1);
593
626
  }
@@ -613,7 +646,7 @@ function registerCreateCommand(program2) {
613
646
  console.log("Creating price...");
614
647
  const priceBody = {
615
648
  productId: product.id,
616
- amount,
649
+ unitAmount,
617
650
  type,
618
651
  currency
619
652
  };
@@ -621,8 +654,10 @@ function registerCreateCommand(program2) {
621
654
  const price = await apiRequest("POST", "/prices", priceBody);
622
655
  success(`Price created: ${price.id}`);
623
656
  console.log("Creating checkout session...");
657
+ const mode = type === "recurring" ? "subscription" : "payment";
624
658
  const session = await apiRequest("POST", "/checkout/sessions", {
625
- priceId: price.id,
659
+ mode,
660
+ lineItems: [{ priceId: price.id, quantity: 1 }],
626
661
  successUrl,
627
662
  cancelUrl
628
663
  });
@@ -634,7 +669,7 @@ Checkout URL: ${checkoutUrl}`);
634
669
  }
635
670
  output({
636
671
  product: { id: product.id, name: productName },
637
- price: { id: price.id, amount, currency, type, interval },
672
+ price: { id: price.id, unitAmount, currency, type, interval },
638
673
  checkout: { id: session.id, url: checkoutUrl }
639
674
  });
640
675
  } catch (err) {
@@ -721,7 +756,7 @@ function registerBankCommands(program2) {
721
756
  const bank = program2.command("bank").description("Manage bank accounts");
722
757
  bank.command("list").description("List all bank accounts").action(async () => {
723
758
  try {
724
- const data = await apiRequest("GET", "/bank-accounts");
759
+ const data = await apiRequest("GET", "/bank_accounts");
725
760
  output(data, (d) => {
726
761
  const items = d.data || d.bankAccounts || d;
727
762
  if (!Array.isArray(items) || items.length === 0) return "No bank accounts found.";
@@ -744,19 +779,19 @@ function registerBankCommands(program2) {
744
779
  });
745
780
  bank.command("add").description("Add a new bank account").action(async () => {
746
781
  try {
747
- const accountHolderName = await prompt2("Account holder name: ");
782
+ const accountName = await prompt2("Account holder name: ");
748
783
  const bankName = await prompt2("Bank name: ");
749
- const routingNumber = await prompt2("Routing number: ");
784
+ const bankCode = await prompt2("Bank code / routing number (press Enter to skip): ");
750
785
  const accountNumber = await prompt2("Account number: ");
751
- const accountType = await prompt2("Account type (checking/savings, default: checking): ") || "checking";
786
+ const currency = await prompt2("Currency (default: SGD): ") || "SGD";
752
787
  const body = {
753
- accountHolderName,
788
+ accountName,
754
789
  bankName,
755
- routingNumber,
756
790
  accountNumber,
757
- accountType
791
+ currency
758
792
  };
759
- const data = await apiRequest("POST", "/bank-accounts", body);
793
+ if (bankCode) body.bankCode = bankCode;
794
+ const data = await apiRequest("POST", "/bank_accounts", body);
760
795
  success("Bank account added");
761
796
  output(data, (d) => [
762
797
  `Bank Account ID: ${d.id}`,
@@ -770,7 +805,7 @@ function registerBankCommands(program2) {
770
805
  });
771
806
  bank.command("remove <id>").description("Remove a bank account").action(async (id) => {
772
807
  try {
773
- await apiRequest("DELETE", `/bank-accounts/${id}`);
808
+ await apiRequest("DELETE", `/bank_accounts/${id}`);
774
809
  success(`Bank account ${id} removed`);
775
810
  } catch (err) {
776
811
  console.error(`Error: ${err.message}`);
@@ -779,7 +814,7 @@ function registerBankCommands(program2) {
779
814
  });
780
815
  bank.command("set-default <id>").description("Set a bank account as default").action(async (id) => {
781
816
  try {
782
- await apiRequest("PATCH", `/bank-accounts/${id}`, { isDefault: true });
817
+ await apiRequest("PATCH", `/bank_accounts/${id}`, { isDefault: true });
783
818
  success(`Bank account ${id} set as default`);
784
819
  } catch (err) {
785
820
  console.error(`Error: ${err.message}`);
@@ -803,28 +838,22 @@ function registerKycCommands(program2) {
803
838
  const kyc = program2.command("kyc").description("Manage KYC verification");
804
839
  kyc.command("submit").description("Submit KYC verification details").action(async () => {
805
840
  try {
806
- const firstName = await prompt3("First name: ");
807
- const lastName = await prompt3("Last name: ");
841
+ const fullName = await prompt3("Full name: ");
808
842
  const dateOfBirth = await prompt3("Date of birth (YYYY-MM-DD): ");
809
- const address = await prompt3("Street address: ");
810
- const city = await prompt3("City: ");
811
- const state = await prompt3("State/Province: ");
812
- const postalCode = await prompt3("Postal code: ");
813
- const country = await prompt3("Country (2-letter code, e.g. US): ");
814
- const ssnLast4 = await prompt3("SSN last 4 digits (US only, press Enter to skip): ");
843
+ const nationality = await prompt3("Nationality (2-letter code, e.g. SG): ");
844
+ const documentType = await prompt3("Document type (passport / national_id / drivers_license): ");
845
+ const documentNumber = await prompt3("Document number: ");
846
+ const documentFrontUrl = await prompt3("Document front image URL: ");
847
+ const documentBackUrl = await prompt3("Document back image URL (press Enter to skip): ");
815
848
  const body = {
816
- firstName,
817
- lastName,
849
+ fullName,
818
850
  dateOfBirth,
819
- address: {
820
- line1: address,
821
- city,
822
- state,
823
- postalCode,
824
- country
825
- }
851
+ nationality,
852
+ documentType,
853
+ documentNumber,
854
+ documentFrontUrl
826
855
  };
827
- if (ssnLast4) body.ssnLast4 = ssnLast4;
856
+ if (documentBackUrl) body.documentBackUrl = documentBackUrl;
828
857
  const data = await apiRequest("POST", "/kyc", body);
829
858
  success("KYC submission received");
830
859
  output(data, (d) => {
@@ -843,9 +872,8 @@ function registerKycCommands(program2) {
843
872
  const data = await apiRequest("GET", "/kyc/status");
844
873
  output(data, (d) => {
845
874
  return [
846
- `Status: ${d.status || "N/A"}`,
847
- `Verified: ${d.verified ?? "N/A"}`,
848
- `Requirements: ${d.requirements ? JSON.stringify(d.requirements) : "None"}`
875
+ `Account ID: ${d.accountId || "N/A"}`,
876
+ `KYC Status: ${d.kycStatus || "N/A"}`
849
877
  ].join("\n");
850
878
  });
851
879
  } catch (err) {
@@ -953,7 +981,7 @@ function registerWebhookCommands(program2) {
953
981
 
954
982
  // src/index.ts
955
983
  var program = new Command();
956
- program.name("vibecash").description("VibeCash CLI - manage payments from the command line").version("0.2.0").option("--json", "Output in JSON format").hook("preAction", (thisCommand) => {
984
+ program.name("vibecash").description("VibeCash CLI - manage payments from the command line").version("0.2.2").option("--json", "Output in JSON format").hook("preAction", (thisCommand) => {
957
985
  const opts = thisCommand.opts();
958
986
  if (opts.json) setOutputFormat("json");
959
987
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibecash",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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": { "vibecash": "./dist/index.js" },