@garuhq/node 0.3.0 → 0.4.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/dist/index.cjs CHANGED
@@ -337,7 +337,7 @@ var Customers = class {
337
337
  }
338
338
  http;
339
339
  /**
340
- * Create a customer and link it to the current seller.
340
+ * Register a customer for the current seller.
341
341
  *
342
342
  * @example
343
343
  * const customer = await garu.customers.create({
@@ -402,6 +402,30 @@ var Customers = class {
402
402
  }).then((r) => r)
403
403
  );
404
404
  }
405
+ /**
406
+ * Set or clear the per-seller billing email override.
407
+ *
408
+ * The override is sticky: it takes precedence over the per-seller last-used
409
+ * email and the global `customer.email` for outbound seller→customer emails,
410
+ * and is **never** auto-overwritten by subsequent payments or registrations.
411
+ *
412
+ * @example
413
+ * // Set
414
+ * await garu.customers.setBillingEmailOverride(42, {
415
+ * billingEmailOverride: 'cobrancas@empresa.com.br'
416
+ * });
417
+ *
418
+ * // Clear and fall back to the last-used email
419
+ * await garu.customers.setBillingEmailOverride(42, { billingEmailOverride: null });
420
+ */
421
+ async setBillingEmailOverride(id, params) {
422
+ return this.http.call(
423
+ (signal) => this.http.client.PATCH(`/api/customers/${id}/billing-email-override`, {
424
+ body: params,
425
+ signal
426
+ }).then((r) => r)
427
+ );
428
+ }
405
429
  /**
406
430
  * Remove a customer from the current seller.
407
431
  *
package/dist/index.d.cts CHANGED
@@ -219,8 +219,22 @@ interface CustomerRecord {
219
219
  state?: string | null;
220
220
  createdAt: string;
221
221
  updatedAt: string;
222
+ /**
223
+ * Resolved billing email used for outbound seller→customer emails:
224
+ * `billingEmailOverride ?? per-seller email ?? customer.email`.
225
+ */
226
+ billingEmail?: string;
227
+ /** True when a sticky `billingEmailOverride` is set for this seller. */
228
+ hasBillingEmailOverride?: boolean;
222
229
  [key: string]: unknown;
223
230
  }
231
+ interface SetBillingEmailOverrideParams {
232
+ /**
233
+ * Customer-controlled billing email. Pass `null` to clear and fall back to
234
+ * the per-seller last-used email or the global `customer.email`.
235
+ */
236
+ billingEmailOverride: string | null;
237
+ }
224
238
  type CustomerList = PaginatedList<CustomerRecord>;
225
239
  interface CreateCustomerParams {
226
240
  name: string;
@@ -406,7 +420,7 @@ declare class Customers {
406
420
  private readonly http;
407
421
  constructor(http: HttpClient);
408
422
  /**
409
- * Create a customer and link it to the current seller.
423
+ * Register a customer for the current seller.
410
424
  *
411
425
  * @example
412
426
  * const customer = await garu.customers.create({
@@ -439,6 +453,23 @@ declare class Customers {
439
453
  * const updated = await garu.customers.update(42, { name: 'Maria Santos' });
440
454
  */
441
455
  update(id: number, params: UpdateCustomerParams): Promise<CustomerRecord>;
456
+ /**
457
+ * Set or clear the per-seller billing email override.
458
+ *
459
+ * The override is sticky: it takes precedence over the per-seller last-used
460
+ * email and the global `customer.email` for outbound seller→customer emails,
461
+ * and is **never** auto-overwritten by subsequent payments or registrations.
462
+ *
463
+ * @example
464
+ * // Set
465
+ * await garu.customers.setBillingEmailOverride(42, {
466
+ * billingEmailOverride: 'cobrancas@empresa.com.br'
467
+ * });
468
+ *
469
+ * // Clear and fall back to the last-used email
470
+ * await garu.customers.setBillingEmailOverride(42, { billingEmailOverride: null });
471
+ */
472
+ setBillingEmailOverride(id: number, params: SetBillingEmailOverrideParams): Promise<CustomerRecord>;
442
473
  /**
443
474
  * Remove a customer from the current seller.
444
475
  *
package/dist/index.d.ts CHANGED
@@ -219,8 +219,22 @@ interface CustomerRecord {
219
219
  state?: string | null;
220
220
  createdAt: string;
221
221
  updatedAt: string;
222
+ /**
223
+ * Resolved billing email used for outbound seller→customer emails:
224
+ * `billingEmailOverride ?? per-seller email ?? customer.email`.
225
+ */
226
+ billingEmail?: string;
227
+ /** True when a sticky `billingEmailOverride` is set for this seller. */
228
+ hasBillingEmailOverride?: boolean;
222
229
  [key: string]: unknown;
223
230
  }
231
+ interface SetBillingEmailOverrideParams {
232
+ /**
233
+ * Customer-controlled billing email. Pass `null` to clear and fall back to
234
+ * the per-seller last-used email or the global `customer.email`.
235
+ */
236
+ billingEmailOverride: string | null;
237
+ }
224
238
  type CustomerList = PaginatedList<CustomerRecord>;
225
239
  interface CreateCustomerParams {
226
240
  name: string;
@@ -406,7 +420,7 @@ declare class Customers {
406
420
  private readonly http;
407
421
  constructor(http: HttpClient);
408
422
  /**
409
- * Create a customer and link it to the current seller.
423
+ * Register a customer for the current seller.
410
424
  *
411
425
  * @example
412
426
  * const customer = await garu.customers.create({
@@ -439,6 +453,23 @@ declare class Customers {
439
453
  * const updated = await garu.customers.update(42, { name: 'Maria Santos' });
440
454
  */
441
455
  update(id: number, params: UpdateCustomerParams): Promise<CustomerRecord>;
456
+ /**
457
+ * Set or clear the per-seller billing email override.
458
+ *
459
+ * The override is sticky: it takes precedence over the per-seller last-used
460
+ * email and the global `customer.email` for outbound seller→customer emails,
461
+ * and is **never** auto-overwritten by subsequent payments or registrations.
462
+ *
463
+ * @example
464
+ * // Set
465
+ * await garu.customers.setBillingEmailOverride(42, {
466
+ * billingEmailOverride: 'cobrancas@empresa.com.br'
467
+ * });
468
+ *
469
+ * // Clear and fall back to the last-used email
470
+ * await garu.customers.setBillingEmailOverride(42, { billingEmailOverride: null });
471
+ */
472
+ setBillingEmailOverride(id: number, params: SetBillingEmailOverrideParams): Promise<CustomerRecord>;
442
473
  /**
443
474
  * Remove a customer from the current seller.
444
475
  *
package/dist/index.js CHANGED
@@ -331,7 +331,7 @@ var Customers = class {
331
331
  }
332
332
  http;
333
333
  /**
334
- * Create a customer and link it to the current seller.
334
+ * Register a customer for the current seller.
335
335
  *
336
336
  * @example
337
337
  * const customer = await garu.customers.create({
@@ -396,6 +396,30 @@ var Customers = class {
396
396
  }).then((r) => r)
397
397
  );
398
398
  }
399
+ /**
400
+ * Set or clear the per-seller billing email override.
401
+ *
402
+ * The override is sticky: it takes precedence over the per-seller last-used
403
+ * email and the global `customer.email` for outbound seller→customer emails,
404
+ * and is **never** auto-overwritten by subsequent payments or registrations.
405
+ *
406
+ * @example
407
+ * // Set
408
+ * await garu.customers.setBillingEmailOverride(42, {
409
+ * billingEmailOverride: 'cobrancas@empresa.com.br'
410
+ * });
411
+ *
412
+ * // Clear and fall back to the last-used email
413
+ * await garu.customers.setBillingEmailOverride(42, { billingEmailOverride: null });
414
+ */
415
+ async setBillingEmailOverride(id, params) {
416
+ return this.http.call(
417
+ (signal) => this.http.client.PATCH(`/api/customers/${id}/billing-email-override`, {
418
+ body: params,
419
+ signal
420
+ }).then((r) => r)
421
+ );
422
+ }
399
423
  /**
400
424
  * Remove a customer from the current seller.
401
425
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@garuhq/node",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Official Node.js / TypeScript SDK for the Garu payment gateway.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://garu.com.br",