arispay 0.1.0 → 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 +43 -15
  2. package/package.json +1 -1
  3. package/src/cli.ts +34 -13
package/dist/cli.js CHANGED
@@ -141,6 +141,10 @@ ${bold("Connect your agent to ArisPay")}`);
141
141
  saveConfig(BRAND, { ...config, agentId: a.id });
142
142
  console.log();
143
143
  success(`Agent connected!
144
+ `);
145
+ console.log(` ${dim("ArisPay generated an Ed25519 keypair for your agent \u2014 this is its")}`);
146
+ console.log(` ${dim("cryptographic identity for signing payments (RFC 9421 TAP).")}`);
147
+ console.log(` ${dim("A circuit breaker has been set up to auto-pause if anything looks off.")}
144
148
  `);
145
149
  console.log(` ${bold("Agent ID:")} ${a.id}`);
146
150
  console.log(` ${bold("Name:")} ${a.name}`);
@@ -155,18 +159,16 @@ ${bold("Connect your agent to ArisPay")}`);
155
159
  async function wizardAddPaymentMethod(client) {
156
160
  console.log(`
157
161
  ${bold("Add a payment method")}`);
158
- console.log(` ${dim("Before your agent can spend, you need a funding source.")}
162
+ console.log(` ${dim("Before your agent can spend, you need a funding source.")}`);
163
+ console.log(` ${dim("Your account details are always available on your dashboard.")}
159
164
  `);
160
165
  const config = loadConfig(BRAND);
161
166
  let userId = config.endUserId;
162
167
  if (!userId) {
163
- const email = await prompt(` Your email ${dim("(for payment receipts)")}: `);
164
- console.log(`
165
- ${dim("Setting up your account...")}`);
168
+ console.log(` ${dim("Setting up your account...")}`);
166
169
  try {
167
170
  const user = await client.users.create({
168
- externalId: `cli_${Date.now()}`,
169
- email: email || void 0
171
+ externalId: `cli_${Date.now()}`
170
172
  });
171
173
  userId = user.id;
172
174
  saveConfig(BRAND, { ...config, endUserId: userId });
@@ -186,26 +188,52 @@ ${bold("Add a payment method")}`);
186
188
  const methodChoice = await prompt(` Enter choice: `);
187
189
  if (methodChoice === "1") {
188
190
  console.log(`
189
- ${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...")}`);
190
216
  try {
191
217
  const result = await client.users.addPaymentMethod({
192
218
  userId,
193
219
  type: "card",
194
- 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
195
224
  });
196
225
  const r = result;
197
226
  console.log();
198
- success(`Card setup ready!
199
- `);
200
- console.log(` ${bold("Open this URL to securely enter your card details:")}
227
+ success(`Card tokenized!
201
228
  `);
202
- console.log(` ${cyan(r.setupUrl)}
203
- `);
204
- 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.")}
205
233
  `);
206
234
  } catch (e) {
207
235
  console.log();
208
- 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"}`);
209
237
  }
210
238
  } else if (methodChoice === "2") {
211
239
  console.log();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arispay",
3
- "version": "0.1.0",
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
@@ -163,6 +163,9 @@ async function wizardConnectAgent(client: ArisPayClient): Promise<void> {
163
163
 
164
164
  console.log();
165
165
  success(`Agent connected!\n`);
166
+ console.log(` ${dim('ArisPay generated an Ed25519 keypair for your agent — this is its')}`);
167
+ console.log(` ${dim('cryptographic identity for signing payments (RFC 9421 TAP).')}`);
168
+ console.log(` ${dim('A circuit breaker has been set up to auto-pause if anything looks off.')}\n`);
166
169
  console.log(` ${bold('Agent ID:')} ${a.id}`);
167
170
  console.log(` ${bold('Name:')} ${a.name}`);
168
171
  console.log(` ${bold('Mode:')} ${a.mode || mode}`);
@@ -177,23 +180,20 @@ async function wizardConnectAgent(client: ArisPayClient): Promise<void> {
177
180
 
178
181
  async function wizardAddPaymentMethod(client: ArisPayClient): Promise<void> {
179
182
  console.log(`\n${bold('Add a payment method')}`);
180
- console.log(` ${dim('Before your agent can spend, you need a funding source.')}\n`);
183
+ console.log(` ${dim('Before your agent can spend, you need a funding source.')}`)
184
+ console.log(` ${dim('Your account details are always available on your dashboard.')}\n`);
181
185
 
182
186
  // Auto-create end user if not already stored in config
183
187
  const config = loadConfig(BRAND);
184
188
  let userId = (config as any).endUserId;
185
189
 
186
190
  if (!userId) {
187
- const email = await prompt(` Your email ${dim('(for payment receipts)')}: `);
188
-
189
- console.log(`\n ${dim('Setting up your account...')}`);
191
+ console.log(` ${dim('Setting up your account...')}`);
190
192
  try {
191
193
  const user = await client.users.create({
192
194
  externalId: `cli_${Date.now()}`,
193
- email: email || undefined,
194
195
  });
195
196
  userId = (user as any).id;
196
- // Store in config so they never have to do this again
197
197
  saveConfig(BRAND, { ...config, endUserId: userId } as any);
198
198
  success('Account ready');
199
199
  } catch (e: any) {
@@ -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();