@agentforge-io/sdk-server 4.28.0 → 4.30.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.d.ts +1 -1
- package/dist/resources/cases.d.ts +28 -1
- package/dist/resources/cases.js +28 -0
- package/dist/resources/config.d.ts +10 -1
- package/dist/resources/config.js +12 -4
- package/dist/types.d.ts +150 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { AgentForgeClientOptions, RequestOptions } from './client';
|
|
|
3
3
|
export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, } from './errors';
|
|
4
4
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
5
5
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
6
|
-
export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, SearchPlacesInput, CaseField, CaseBusinessState, CaseType, CaseState, CaseView, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
6
|
+
export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AgentMe, AgentSummary, AppUserConnectorStatus, ApprovalCopyBundle, ChannelContext, ChatStreamChunk, ChatStreamEvent, ChatTokenRecord, ConnectorDefaultsResult, ConnectorDefaultsSource, ConnectorResourceItem, ConnectorStatus, ConnectorToolInfo, ConversationHistory, ConversationStatus, CreateAgentInput, CreateClickupTaskInput, CreateClickupTaskResult, ExternalToolSummary, IssueChatTokenInput, ListAgentsResult, ListConnectorResourcesResult, McpServerConfig, MessageRecord, MessageRole, PublicAppBranding, PublicProfileBlock, PublicProfileTemplate, PublicTeamLanding, CreateTeamInput, UpdateTeamInput, TeamSummary, TeamDetail, TeamTheme, TeamBusinessHours, TeamWeekday, TeamProfileBlock, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, TenantConfigEntry, Place, SearchPlacesInput, CaseField, CaseBusinessState, CaseType, CaseState, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseView, CaseReceipt, CaseReceiptLine, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryQuote, AppSelf, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
7
7
|
export { AgentsResource } from './resources/agents';
|
|
8
8
|
export { AnalyticsResource } from './resources/analytics';
|
|
9
9
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CaseReceipt, CaseState, CaseView, ListCasesInput } from '../types';
|
|
2
|
+
import type { CasePaymentStatus, CaseReceipt, CaseState, CaseView, ListCasesInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -27,6 +27,33 @@ export declare class CasesResource {
|
|
|
27
27
|
* it was accepted or once closed. Returns the receipt as it is now.
|
|
28
28
|
*/
|
|
29
29
|
receiptReceived(token: string): Promise<CaseReceipt>;
|
|
30
|
+
/**
|
|
31
|
+
* `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
|
|
32
|
+
* payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
|
|
33
|
+
* `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
|
|
34
|
+
* The customer is told of paid, rejected and refunds.
|
|
35
|
+
*/
|
|
36
|
+
setPayment(caseId: string, status: CasePaymentStatus, opts?: {
|
|
37
|
+
note?: string;
|
|
38
|
+
amountCents?: number;
|
|
39
|
+
}): Promise<CaseView>;
|
|
40
|
+
/**
|
|
41
|
+
* `POST /api/v1/cases/receipts/:token/payment/choose` — the customer chooses how
|
|
42
|
+
* to pay on the receipt (an `accountId` from `payment.options`).
|
|
43
|
+
*/
|
|
44
|
+
receiptChoosePayment(token: string, accountId: string): Promise<CaseReceipt>;
|
|
45
|
+
/**
|
|
46
|
+
* `POST /api/v1/cases/receipts/:token/payment/report` — the customer says they
|
|
47
|
+
* paid: the transfer `reference` and/or the `proof` image (jpeg/png/webp, base64,
|
|
48
|
+
* ≤ 700 KB). The payment waits for the business to confirm it.
|
|
49
|
+
*/
|
|
50
|
+
receiptReportPayment(token: string, input: {
|
|
51
|
+
reference?: string;
|
|
52
|
+
proof?: {
|
|
53
|
+
contentType: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
54
|
+
dataBase64: string;
|
|
55
|
+
};
|
|
56
|
+
}): Promise<CaseReceipt>;
|
|
30
57
|
/**
|
|
31
58
|
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
32
59
|
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|
package/dist/resources/cases.js
CHANGED
|
@@ -56,6 +56,34 @@ class CasesResource {
|
|
|
56
56
|
async receiptReceived(token) {
|
|
57
57
|
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/received`, {});
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* `POST /api/v1/cases/:id/payment` — AGF-PAYMENT-ACCOUNTS: the business moves the
|
|
61
|
+
* payment: `paid` (confirmed, or cash received), `rejected` (did not arrive),
|
|
62
|
+
* `refunded`, `partially_refunded` (with `amountCents` returned), `reversed`.
|
|
63
|
+
* The customer is told of paid, rejected and refunds.
|
|
64
|
+
*/
|
|
65
|
+
async setPayment(caseId, status, opts = {}) {
|
|
66
|
+
return this.client.request('POST', `/api/v1/cases/${encodeURIComponent(caseId)}/payment`, {
|
|
67
|
+
status,
|
|
68
|
+
...(opts.note ? { note: opts.note } : {}),
|
|
69
|
+
...(opts.amountCents ? { amountCents: opts.amountCents } : {}),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* `POST /api/v1/cases/receipts/:token/payment/choose` — the customer chooses how
|
|
74
|
+
* to pay on the receipt (an `accountId` from `payment.options`).
|
|
75
|
+
*/
|
|
76
|
+
async receiptChoosePayment(token, accountId) {
|
|
77
|
+
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/payment/choose`, { accountId });
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* `POST /api/v1/cases/receipts/:token/payment/report` — the customer says they
|
|
81
|
+
* paid: the transfer `reference` and/or the `proof` image (jpeg/png/webp, base64,
|
|
82
|
+
* ≤ 700 KB). The payment waits for the business to confirm it.
|
|
83
|
+
*/
|
|
84
|
+
async receiptReportPayment(token, input) {
|
|
85
|
+
return this.client.request('POST', `/api/v1/cases/receipts/${encodeURIComponent(token)}/payment/report`, input);
|
|
86
|
+
}
|
|
59
87
|
/**
|
|
60
88
|
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
61
89
|
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { StructuredConfigEntry, StructuredConfigInput, TenantConfigEntry } from '../types';
|
|
2
|
+
import type { PaymentCountry, PaymentMethodDef, StructuredConfigEntry, StructuredConfigInput, TenantConfigEntry } from '../types';
|
|
3
3
|
export declare class TenantConfigResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -12,6 +12,15 @@ export declare class TenantConfigResource {
|
|
|
12
12
|
* AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
|
|
13
13
|
* `payments`). The variable of the same key holds their readable text.
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* `GET /api/v1/payment-methods?country=CO` — AGF-PAYMENT-ACCOUNTS: the payment
|
|
17
|
+
* methods of a country, each with the fields its accounts ask for (what an
|
|
18
|
+
* accounts editor draws).
|
|
19
|
+
*/
|
|
20
|
+
paymentMethods(country?: PaymentCountry): Promise<{
|
|
21
|
+
country: PaymentCountry;
|
|
22
|
+
methods: PaymentMethodDef[];
|
|
23
|
+
}>;
|
|
15
24
|
readonly structured: {
|
|
16
25
|
/** `GET /api/v1/config/:key/structured` — null when not set. */
|
|
17
26
|
get: (key: string) => Promise<StructuredConfigEntry | null>;
|
package/dist/resources/config.js
CHANGED
|
@@ -8,10 +8,6 @@ exports.TenantConfigResource = void 0;
|
|
|
8
8
|
class TenantConfigResource {
|
|
9
9
|
constructor(client) {
|
|
10
10
|
this.client = client;
|
|
11
|
-
/**
|
|
12
|
-
* AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
|
|
13
|
-
* `payments`). The variable of the same key holds their readable text.
|
|
14
|
-
*/
|
|
15
11
|
this.structured = {
|
|
16
12
|
/** `GET /api/v1/config/:key/structured` — null when not set. */
|
|
17
13
|
get: async (key) => {
|
|
@@ -38,5 +34,17 @@ class TenantConfigResource {
|
|
|
38
34
|
async set(key, value) {
|
|
39
35
|
return this.client.request('PUT', `/api/v1/config/${encodeURIComponent(key)}`, { value });
|
|
40
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* AGF-PDK-DELIVERY — fields of a structured type (`address`, `delivery`,
|
|
39
|
+
* `payments`). The variable of the same key holds their readable text.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* `GET /api/v1/payment-methods?country=CO` — AGF-PAYMENT-ACCOUNTS: the payment
|
|
43
|
+
* methods of a country, each with the fields its accounts ask for (what an
|
|
44
|
+
* accounts editor draws).
|
|
45
|
+
*/
|
|
46
|
+
async paymentMethods(country = 'CO') {
|
|
47
|
+
return this.client.request('GET', `/api/v1/payment-methods?country=${encodeURIComponent(country)}`);
|
|
48
|
+
}
|
|
41
49
|
}
|
|
42
50
|
exports.TenantConfigResource = TenantConfigResource;
|
package/dist/types.d.ts
CHANGED
|
@@ -1470,16 +1470,70 @@ export interface DeliverySettings {
|
|
|
1470
1470
|
etaText?: string;
|
|
1471
1471
|
};
|
|
1472
1472
|
}
|
|
1473
|
+
/** The legacy payment kinds (before payment accounts); read only, in `PaymentSettings.legacy`. */
|
|
1473
1474
|
export type PaymentMethodKind = 'cash' | 'bank_transfer' | 'card_on_delivery' | 'payment_link' | 'card_in_store' | 'other';
|
|
1475
|
+
/** AGF-PAYMENT-ACCOUNTS — countries with a payment catalog. */
|
|
1476
|
+
export type PaymentCountry = 'CO';
|
|
1477
|
+
/** A field an account of a method asks for. */
|
|
1478
|
+
export interface PaymentFieldDef {
|
|
1479
|
+
key: string;
|
|
1480
|
+
label: string;
|
|
1481
|
+
kind: 'text' | 'phone' | 'digits' | 'select' | 'bank';
|
|
1482
|
+
required: boolean;
|
|
1483
|
+
/** `select` / `bank`: the options. */
|
|
1484
|
+
options?: Array<{
|
|
1485
|
+
value: string;
|
|
1486
|
+
label: string;
|
|
1487
|
+
}>;
|
|
1488
|
+
placeholder?: string;
|
|
1489
|
+
/** Shown masked in lists (an account or phone number). */
|
|
1490
|
+
secretish?: boolean;
|
|
1491
|
+
}
|
|
1492
|
+
/** One payment method of a country's catalog (Nequi, Bre-B, Transferencia…). */
|
|
1493
|
+
export interface PaymentMethodDef {
|
|
1494
|
+
key: string;
|
|
1495
|
+
name: string;
|
|
1496
|
+
description: string;
|
|
1497
|
+
/** When the customer pays: before it is sent, or when they get it. */
|
|
1498
|
+
when: 'before' | 'on_delivery';
|
|
1499
|
+
fields: PaymentFieldDef[];
|
|
1500
|
+
/** One per business (cash): no name to tell accounts apart, a second one is refused. */
|
|
1501
|
+
single?: boolean;
|
|
1502
|
+
}
|
|
1503
|
+
/** One way to pay into the business, with the data a customer needs. Several per method allowed. */
|
|
1504
|
+
export interface PaymentAccount {
|
|
1505
|
+
/** Stable (orders point to it); omit it when adding — the platform assigns one. */
|
|
1506
|
+
id: string;
|
|
1507
|
+
method: string;
|
|
1508
|
+
/** "Nequi principal". */
|
|
1509
|
+
label?: string;
|
|
1510
|
+
/** The method's fields, by key (see `PaymentMethodDef.fields`). */
|
|
1511
|
+
fields: Record<string, string>;
|
|
1512
|
+
/** Set from the method. */
|
|
1513
|
+
when: 'before' | 'on_delivery';
|
|
1514
|
+
/** Paused without deleting. */
|
|
1515
|
+
active: boolean;
|
|
1516
|
+
}
|
|
1474
1517
|
export interface PaymentSettings {
|
|
1475
1518
|
locale?: 'es' | 'en';
|
|
1476
|
-
|
|
1477
|
-
|
|
1519
|
+
country: PaymentCountry;
|
|
1520
|
+
accounts: PaymentAccount[];
|
|
1521
|
+
notes?: string;
|
|
1522
|
+
/** Methods of the old shape the catalog no longer has, kept as said until the owner edits. */
|
|
1523
|
+
legacy?: Array<{
|
|
1524
|
+
kind: string;
|
|
1478
1525
|
label?: string;
|
|
1479
1526
|
notes?: string;
|
|
1480
1527
|
}>;
|
|
1481
|
-
notes?: string;
|
|
1482
1528
|
}
|
|
1529
|
+
/** What `PUT … structured` takes for payments: account ids may be omitted (new accounts). */
|
|
1530
|
+
export type PaymentSettingsInput = Omit<PaymentSettings, 'accounts' | 'country'> & {
|
|
1531
|
+
country?: PaymentCountry;
|
|
1532
|
+
accounts: Array<Omit<PaymentAccount, 'id' | 'when' | 'active'> & {
|
|
1533
|
+
id?: string;
|
|
1534
|
+
active?: boolean;
|
|
1535
|
+
}>;
|
|
1536
|
+
};
|
|
1483
1537
|
export type StructuredConfigInput = {
|
|
1484
1538
|
type: 'address';
|
|
1485
1539
|
value: AddressValue;
|
|
@@ -1488,9 +1542,18 @@ export type StructuredConfigInput = {
|
|
|
1488
1542
|
value: DeliverySettings;
|
|
1489
1543
|
} | {
|
|
1490
1544
|
type: 'payments';
|
|
1491
|
-
value:
|
|
1545
|
+
value: PaymentSettingsInput;
|
|
1492
1546
|
};
|
|
1493
|
-
export type StructuredConfigEntry =
|
|
1547
|
+
export type StructuredConfigEntry = ({
|
|
1548
|
+
type: 'address';
|
|
1549
|
+
value: AddressValue;
|
|
1550
|
+
} | {
|
|
1551
|
+
type: 'delivery';
|
|
1552
|
+
value: DeliverySettings;
|
|
1553
|
+
} | {
|
|
1554
|
+
type: 'payments';
|
|
1555
|
+
value: PaymentSettings;
|
|
1556
|
+
}) & {
|
|
1494
1557
|
key: string;
|
|
1495
1558
|
/** The readable text the `{{config:KEY}}` variable now holds. */
|
|
1496
1559
|
text: string;
|
|
@@ -1621,12 +1684,88 @@ export interface CaseView {
|
|
|
1621
1684
|
text: string;
|
|
1622
1685
|
at: string;
|
|
1623
1686
|
} | null;
|
|
1687
|
+
/** AGF-PAYMENT-ACCOUNTS — how it is paid: null before the business took it (or closed undone with nothing chosen). */
|
|
1688
|
+
payment: CasePayment | null;
|
|
1624
1689
|
openedAt: string;
|
|
1625
1690
|
reviewedAt: string | null;
|
|
1626
1691
|
submittedAt: string | null;
|
|
1627
1692
|
closedAt: string | null;
|
|
1628
1693
|
lastActivityAt: string;
|
|
1629
1694
|
}
|
|
1695
|
+
/**
|
|
1696
|
+
* The payment's own lifecycle, apart from the case's states: `unpaid` →
|
|
1697
|
+
* `awaiting_payment` (method chosen) → `pending_confirmation` (the customer
|
|
1698
|
+
* reported it) → `paid` | `rejected`; then `refunded`, `partially_refunded`,
|
|
1699
|
+
* `reversed`; `voided` when the order ended unpaid. Completing never marks it paid.
|
|
1700
|
+
*/
|
|
1701
|
+
export type CasePaymentStatus = 'unpaid' | 'awaiting_payment' | 'pending_confirmation' | 'paid' | 'rejected' | 'refunded' | 'partially_refunded' | 'reversed' | 'voided';
|
|
1702
|
+
/** The account the customer chose, as it was then (a later edit never rewrites a sale). */
|
|
1703
|
+
export interface CasePaymentAccount {
|
|
1704
|
+
id: string;
|
|
1705
|
+
method: string;
|
|
1706
|
+
methodName: string;
|
|
1707
|
+
label?: string;
|
|
1708
|
+
when: 'before' | 'on_delivery';
|
|
1709
|
+
/** "Nequi (Principal): 3001234567 a nombre de Ana Pérez". */
|
|
1710
|
+
line: string;
|
|
1711
|
+
/** What to copy to pay (empty for cash / card terminal). */
|
|
1712
|
+
copy: Array<{
|
|
1713
|
+
label: string;
|
|
1714
|
+
value: string;
|
|
1715
|
+
}>;
|
|
1716
|
+
notes?: string;
|
|
1717
|
+
}
|
|
1718
|
+
export interface CasePayment {
|
|
1719
|
+
status: CasePaymentStatus;
|
|
1720
|
+
statusLabel: string;
|
|
1721
|
+
account?: CasePaymentAccount;
|
|
1722
|
+
reference?: string;
|
|
1723
|
+
/** The proof image the customer sent (for the business). */
|
|
1724
|
+
proofUrl?: string;
|
|
1725
|
+
reportedAt?: string;
|
|
1726
|
+
confirmedAt?: string;
|
|
1727
|
+
refundedCents?: number;
|
|
1728
|
+
/** The business's note on its last move of the payment. */
|
|
1729
|
+
note?: string;
|
|
1730
|
+
/** The receipt's total, when every line has a price. */
|
|
1731
|
+
amountCents: number | null;
|
|
1732
|
+
currency: string | null;
|
|
1733
|
+
/** Where the business may move it now. */
|
|
1734
|
+
nextStatuses: Array<{
|
|
1735
|
+
key: CasePaymentStatus;
|
|
1736
|
+
label: string;
|
|
1737
|
+
}>;
|
|
1738
|
+
history: Array<{
|
|
1739
|
+
status: CasePaymentStatus;
|
|
1740
|
+
by: 'assistant' | 'customer' | 'business' | 'system';
|
|
1741
|
+
at: string;
|
|
1742
|
+
note?: string;
|
|
1743
|
+
amountCents?: number;
|
|
1744
|
+
}>;
|
|
1745
|
+
}
|
|
1746
|
+
/** The payment as a receipt's public link shows it (no proof image, only that one was sent). */
|
|
1747
|
+
export interface CaseReceiptPayment {
|
|
1748
|
+
status: CasePaymentStatus;
|
|
1749
|
+
statusLabel: string;
|
|
1750
|
+
account: CasePaymentAccount | null;
|
|
1751
|
+
amountCents: number | null;
|
|
1752
|
+
currency: string | null;
|
|
1753
|
+
reference: string | null;
|
|
1754
|
+
proofSent: boolean;
|
|
1755
|
+
reportedAt: string | null;
|
|
1756
|
+
confirmedAt: string | null;
|
|
1757
|
+
note: string | null;
|
|
1758
|
+
/** Methods the customer may choose now (`cases.receiptChoosePayment`). */
|
|
1759
|
+
options: Array<{
|
|
1760
|
+
accountId: string;
|
|
1761
|
+
method: string;
|
|
1762
|
+
methodName: string;
|
|
1763
|
+
label?: string;
|
|
1764
|
+
when: 'before' | 'on_delivery';
|
|
1765
|
+
}>;
|
|
1766
|
+
/** The customer may say they paid now (`cases.receiptReportPayment`). */
|
|
1767
|
+
canReport: boolean;
|
|
1768
|
+
}
|
|
1630
1769
|
/** AGF-CASE-RECEIPT — one product line, with the price it had when the receipt was issued. */
|
|
1631
1770
|
export interface CaseReceiptLine {
|
|
1632
1771
|
title: string;
|
|
@@ -1677,6 +1816,8 @@ export interface CaseReceipt {
|
|
|
1677
1816
|
/** Closed without being done (rejected, cancelled, abandoned). */
|
|
1678
1817
|
stopped: boolean;
|
|
1679
1818
|
updatedAt: string;
|
|
1819
|
+
/** AGF-PAYMENT-ACCOUNTS — how it is paid; null before the business took it. */
|
|
1820
|
+
payment: CaseReceiptPayment | null;
|
|
1680
1821
|
business: {
|
|
1681
1822
|
name: string;
|
|
1682
1823
|
description: string | null;
|
|
@@ -1695,7 +1836,7 @@ export interface ListCasesInput {
|
|
|
1695
1836
|
/** 1–200, default 50. */
|
|
1696
1837
|
limit?: number;
|
|
1697
1838
|
}
|
|
1698
|
-
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request';
|
|
1839
|
+
export type AppWebhookEventName = 'case.submitted' | 'case.state_changed' | 'case.closed' | 'case.customer_request' | 'case.payment_changed';
|
|
1699
1840
|
export interface AppWebhook {
|
|
1700
1841
|
url: string;
|
|
1701
1842
|
events: AppWebhookEventName[];
|
|
@@ -1725,6 +1866,9 @@ export interface AppWebhookEvent {
|
|
|
1725
1866
|
/** What people read it by ("K7Q2XM"). */
|
|
1726
1867
|
caseCode?: string;
|
|
1727
1868
|
conversationId: string;
|
|
1869
|
+
/** `case.payment_changed`: where the payment is now, and where it was. */
|
|
1870
|
+
paymentStatus?: CasePaymentStatus;
|
|
1871
|
+
previousPaymentStatus?: CasePaymentStatus;
|
|
1728
1872
|
};
|
|
1729
1873
|
}
|
|
1730
1874
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentforge-io/sdk-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.30.0",
|
|
4
4
|
"description": "Server-side SDK for backend apps integrating with AgentForge platform. Auth via ChatToken, ak_live_ API key or App secret (sk_live_), with App installations across tenants.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|