arispay 0.1.1 → 0.1.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 (3) hide show
  1. package/dist/cli.js +35 -9
  2. package/package.json +1 -1
  3. package/src/cli.ts +28 -7
package/dist/cli.js CHANGED
@@ -188,26 +188,52 @@ ${bold("Add a payment method")}`);
188
188
  const methodChoice = await prompt(` Enter choice: `);
189
189
  if (methodChoice === "1") {
190
190
  console.log(`
191
- ${dim("Starting card setup...")}`);
191
+ ${dim("Enter your card details below. They are sent directly to Fiserv for")}`);
192
+ console.log(` ${dim("tokenization \u2014 ArisPay never sees or stores your full card number.")}
193
+ `);
194
+ const cardNumber = await promptSecret(` Card number: `);
195
+ if (!cardNumber) {
196
+ console.log(dim(" Cancelled."));
197
+ return;
198
+ }
199
+ const expiry = await prompt(` Expiry ${dim("(MM/YY)")}: `);
200
+ if (!expiry) {
201
+ console.log(dim(" Cancelled."));
202
+ return;
203
+ }
204
+ const securityCode = await promptSecret(` CVV: `);
205
+ if (!securityCode) {
206
+ console.log(dim(" Cancelled."));
207
+ return;
208
+ }
209
+ const [expiryMonth, expiryYear] = expiry.split("/").map((s) => s.trim());
210
+ if (!expiryMonth || !expiryYear) {
211
+ console.log(` ${dim("Invalid expiry format. Use MM/YY.")}`);
212
+ return;
213
+ }
214
+ console.log(`
215
+ ${dim("Tokenizing card...")}`);
192
216
  try {
193
217
  const result = await client.users.addPaymentMethod({
194
218
  userId,
195
219
  type: "card",
196
- returnUrl: "https://app.arispay.app/card-setup/complete"
220
+ cardNumber: cardNumber.replace(/\s/g, ""),
221
+ expiryMonth,
222
+ expiryYear: expiryYear.length === 2 ? `20${expiryYear}` : expiryYear,
223
+ securityCode
197
224
  });
198
225
  const r = result;
199
226
  console.log();
200
- success(`Card setup ready!
201
- `);
202
- console.log(` ${bold("Open this URL to securely enter your card details:")}
227
+ success(`Card tokenized!
203
228
  `);
204
- console.log(` ${cyan(r.setupUrl)}
205
- `);
206
- console.log(` ${dim("Your card is tokenized \u2014 ArisPay never sees or stores the full number.")}
229
+ console.log(` ${bold("Card:")} ${r.cardBrand?.toUpperCase() || "Card"} ending in ${r.cardLast4 || "****"}`);
230
+ console.log(` ${bold("Token:")} ${dim(r.tokenId || "stored securely")}`);
231
+ console.log(`
232
+ ${dim("Your card is now linked to your agent. You can make test payments.")}
207
233
  `);
208
234
  } catch (e) {
209
235
  console.log();
210
- console.error(` \x1B[31m\u2717\x1B[0m ${e.message || "Failed to start card setup"}`);
236
+ console.error(` \x1B[31m\u2717\x1B[0m ${e.message || "Failed to tokenize card"}`);
211
237
  }
212
238
  } else if (methodChoice === "2") {
213
239
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arispay",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "SDK and CLI for enabling agent-initiated payments via Visa TAP + Fiserv",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/cli.ts CHANGED
@@ -210,22 +210,43 @@ async function wizardAddPaymentMethod(client: ArisPayClient): Promise<void> {
210
210
  const methodChoice = await prompt(` Enter choice: `);
211
211
 
212
212
  if (methodChoice === '1') {
213
- console.log(`\n ${dim('Starting card setup...')}`);
213
+ console.log(`\n ${dim('Enter your card details below. They are sent directly to Fiserv for')}`);
214
+ console.log(` ${dim('tokenization — ArisPay never sees or stores your full card number.')}\n`);
215
+
216
+ const cardNumber = await promptSecret(` Card number: `);
217
+ if (!cardNumber) { console.log(dim(' Cancelled.')); return; }
218
+
219
+ const expiry = await prompt(` Expiry ${dim('(MM/YY)')}: `);
220
+ if (!expiry) { console.log(dim(' Cancelled.')); return; }
221
+
222
+ const securityCode = await promptSecret(` CVV: `);
223
+ if (!securityCode) { console.log(dim(' Cancelled.')); return; }
224
+
225
+ const [expiryMonth, expiryYear] = expiry.split('/').map(s => s.trim());
226
+ if (!expiryMonth || !expiryYear) {
227
+ console.log(` ${dim('Invalid expiry format. Use MM/YY.')}`);
228
+ return;
229
+ }
230
+
231
+ console.log(`\n ${dim('Tokenizing card...')}`);
214
232
  try {
215
233
  const result = await client.users.addPaymentMethod({
216
234
  userId,
217
235
  type: 'card',
218
- returnUrl: 'https://app.arispay.app/card-setup/complete',
236
+ cardNumber: cardNumber.replace(/\s/g, ''),
237
+ expiryMonth,
238
+ expiryYear: expiryYear.length === 2 ? `20${expiryYear}` : expiryYear,
239
+ securityCode,
219
240
  });
220
241
  const r = result as any;
221
242
  console.log();
222
- success(`Card setup ready!\n`);
223
- console.log(` ${bold('Open this URL to securely enter your card details:')}\n`);
224
- console.log(` ${cyan(r.setupUrl)}\n`);
225
- console.log(` ${dim('Your card is tokenized ArisPay never sees or stores the full number.')}\n`);
243
+ success(`Card tokenized!\n`);
244
+ console.log(` ${bold('Card:')} ${r.cardBrand?.toUpperCase() || 'Card'} ending in ${r.cardLast4 || '****'}`);
245
+ console.log(` ${bold('Token:')} ${dim(r.tokenId || 'stored securely')}`);
246
+ console.log(`\n ${dim('Your card is now linked to your agent. You can make test payments.')}\n`);
226
247
  } catch (e: any) {
227
248
  console.log();
228
- console.error(` \x1b[31m✗\x1b[0m ${e.message || 'Failed to start card setup'}`);
249
+ console.error(` \x1b[31m✗\x1b[0m ${e.message || 'Failed to tokenize card'}`);
229
250
  }
230
251
  } else if (methodChoice === '2') {
231
252
  console.log();