@agentforge-io/sdk-server 4.89.0 → 4.91.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/errors.d.ts +28 -0
- package/dist/errors.js +30 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.js +4 -2
- package/dist/resources/cases.d.ts +159 -1
- package/dist/resources/cases.js +236 -6
- package/dist/types.d.ts +603 -9
- package/package.json +1 -1
package/dist/errors.d.ts
CHANGED
|
@@ -64,6 +64,34 @@ export declare class AgentForgeCreditError extends AgentForgeError {
|
|
|
64
64
|
readonly code: AgentForgeCreditErrorCode;
|
|
65
65
|
constructor(status: number, code: AgentForgeCreditErrorCode, message: string, body?: string);
|
|
66
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* PDK-RENTAL-DEAL R7 — the coded refusals of the partial-payment routes (`cases.recordPayment` / `refundPayment` / `confirmPayment` /
|
|
69
|
+
* `rejectPayment` / `waiveAnticipo` / `extendAnticipo`, `transition`, `createDirectRental`, `sendQuote`). `code` narrows to this union.
|
|
70
|
+
* 400: `invalid_payment_plan` / `invalid_cancel_policy` (the plan), `deposit_due` (a transition while the anticipo is owed; `err.anticipoDueCents`),
|
|
71
|
+
* `exceeds_balance` (`err.balanceCents`), `exceeds_due`, `exceeds_paid` (`err.paidCents`), `reason_required` (a retention that differs from the policy,
|
|
72
|
+
* or a confirmation for less than reported; `err.suggestedRetainedCents`), `note_required`, `total_pending`, `not_accepted`, `case_closed`, `on_account`,
|
|
73
|
+
* `nothing_due`, `no_anticipo`, `not_waiting`, `method_required`, `invalid_*`; 404 `entry_not_found`;
|
|
74
|
+
* 409 `report_pending` (a customer report waits: confirm or reject it first), `already_paid`, `already_waived`, `entry_resolved`,
|
|
75
|
+
* `deposit_expired` (the anticipo expired: the case is being cancelled), `idempotency_conflict` (the key was used for another request).
|
|
76
|
+
* A refusal is final: do not retry it with another key. On a timeout, repeat the call with the SAME `idempotencyKey`.
|
|
77
|
+
*/
|
|
78
|
+
export type AgentForgePaymentErrorCode = 'invalid_payment_plan' | 'invalid_cancel_policy' | 'deposit_due' | 'deposit_expired' | 'exceeds_balance' | 'exceeds_due' | 'exceeds_paid' | 'invalid_retention' | 'reason_required' | 'note_required' | 'total_pending' | 'not_accepted' | 'case_closed' | 'on_account' | 'nothing_due' | 'no_anticipo' | 'already_waived' | 'not_waiting' | 'already_paid' | 'report_pending' | 'entry_not_found' | 'entry_resolved' | 'idempotency_conflict' | 'invalid_idempotency_key' | 'invalid_amount' | 'invalid_kind' | 'invalid_source' | 'invalid_account' | 'invalid_method' | 'method_required' | 'invalid_hours' | 'invalid_body' | 'ledger_guard_missing';
|
|
79
|
+
export declare const AGENTFORGE_PAYMENT_ERROR_CODES: readonly AgentForgePaymentErrorCode[];
|
|
80
|
+
export declare class AgentForgePaymentError extends AgentForgeError {
|
|
81
|
+
readonly code: AgentForgePaymentErrorCode;
|
|
82
|
+
/** `deposit_due`: the anticipo the case still waits for (cents). */
|
|
83
|
+
readonly anticipoDueCents?: number;
|
|
84
|
+
/** `exceeds_balance`: what the case still owes (cents). */
|
|
85
|
+
readonly balanceCents?: number;
|
|
86
|
+
/** `exceeds_due`: what is asked now (cents). */
|
|
87
|
+
readonly dueNowCents?: number;
|
|
88
|
+
/** `exceeds_paid`: what is paid (cents). */
|
|
89
|
+
readonly paidCents?: number;
|
|
90
|
+
/** `reason_required` on a refund: what the policy suggests retaining, and the refund that implies (cents). */
|
|
91
|
+
readonly suggestedRetainedCents?: number;
|
|
92
|
+
readonly refundCents?: number;
|
|
93
|
+
constructor(status: number, code: AgentForgePaymentErrorCode, message: string, body?: string);
|
|
94
|
+
}
|
|
67
95
|
export declare class AgentForgeNetworkError extends Error {
|
|
68
96
|
readonly cause: Error;
|
|
69
97
|
constructor(message: string, cause: Error);
|
package/dist/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AgentForgeNetworkError = exports.AgentForgeCreditError = exports.AGENTFORGE_CREDIT_ERROR_CODES = exports.AgentForgeBillingError = exports.AGENTFORGE_BILLING_ERROR_CODES = exports.AgentForgeDuplicateContactError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = void 0;
|
|
3
|
+
exports.AgentForgeNetworkError = exports.AgentForgePaymentError = exports.AGENTFORGE_PAYMENT_ERROR_CODES = exports.AgentForgeCreditError = exports.AGENTFORGE_CREDIT_ERROR_CODES = exports.AgentForgeBillingError = exports.AGENTFORGE_BILLING_ERROR_CODES = exports.AgentForgeDuplicateContactError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = void 0;
|
|
4
4
|
class AgentForgeError extends Error {
|
|
5
5
|
constructor(status, message, body, code) {
|
|
6
6
|
super(message);
|
|
@@ -116,6 +116,35 @@ class AgentForgeCreditError extends AgentForgeError {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
exports.AgentForgeCreditError = AgentForgeCreditError;
|
|
119
|
+
exports.AGENTFORGE_PAYMENT_ERROR_CODES = [
|
|
120
|
+
'invalid_payment_plan', 'invalid_cancel_policy', 'deposit_due', 'deposit_expired', 'exceeds_balance', 'exceeds_due', 'exceeds_paid',
|
|
121
|
+
'invalid_retention', 'reason_required', 'note_required', 'total_pending', 'not_accepted', 'case_closed', 'on_account', 'nothing_due',
|
|
122
|
+
'no_anticipo', 'already_waived', 'not_waiting', 'already_paid', 'report_pending', 'entry_not_found', 'entry_resolved',
|
|
123
|
+
'idempotency_conflict', 'invalid_idempotency_key', 'invalid_amount', 'invalid_kind', 'invalid_source', 'invalid_account',
|
|
124
|
+
'invalid_method', 'method_required', 'invalid_hours', 'invalid_body', 'ledger_guard_missing',
|
|
125
|
+
];
|
|
126
|
+
class AgentForgePaymentError extends AgentForgeError {
|
|
127
|
+
constructor(status, code, message, body) {
|
|
128
|
+
super(status, message, body, code);
|
|
129
|
+
this.name = 'AgentForgePaymentError';
|
|
130
|
+
if (body) {
|
|
131
|
+
try {
|
|
132
|
+
const b = JSON.parse(body);
|
|
133
|
+
const n = (k) => (typeof b[k] === 'number' ? b[k] : undefined);
|
|
134
|
+
this.anticipoDueCents = n('anticipoDueCents');
|
|
135
|
+
this.balanceCents = n('balanceCents');
|
|
136
|
+
this.dueNowCents = n('dueNowCents');
|
|
137
|
+
this.paidCents = n('paidCents');
|
|
138
|
+
this.suggestedRetainedCents = n('suggestedRetainedCents');
|
|
139
|
+
this.refundCents = n('refundCents');
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
/* no extras */
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.AgentForgePaymentError = AgentForgePaymentError;
|
|
119
148
|
class AgentForgeNetworkError extends Error {
|
|
120
149
|
constructor(message, cause) {
|
|
121
150
|
super(message);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export { AgentForgeClient, INSTALLED_TENANT_HEADER } from './client';
|
|
2
2
|
export type { AgentForgeClientOptions, RequestOptions } from './client';
|
|
3
|
-
export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, AgentForgeDuplicateContactError, AgentForgeBillingError, AGENTFORGE_BILLING_ERROR_CODES, AgentForgeCreditError, AGENTFORGE_CREDIT_ERROR_CODES, } from './errors';
|
|
4
|
-
export type { AgentForgeBillingErrorCode, AgentForgeCreditErrorCode } from './errors';
|
|
3
|
+
export { AgentForgeError, AgentForgeAuthError, AgentForgeNotFoundError, AgentForgeNetworkError, AgentForgeDuplicateContactError, AgentForgeBillingError, AGENTFORGE_BILLING_ERROR_CODES, AgentForgeCreditError, AGENTFORGE_CREDIT_ERROR_CODES, AgentForgePaymentError, AGENTFORGE_PAYMENT_ERROR_CODES, } from './errors';
|
|
4
|
+
export type { AgentForgeBillingErrorCode, AgentForgeCreditErrorCode, AgentForgePaymentErrorCode } from './errors';
|
|
5
5
|
export { CreditResource, CreditAccountsResource } from './resources/credit';
|
|
6
|
-
export type { CreateDirectRentalInput, UpdateCaseRentalInput, CaseRental, RentalPeriodUnit } from './types';
|
|
6
|
+
export type { CreateDirectRentalInput, UpdateCaseRentalInput, CaseRental, RentalPeriodUnit, RentalOptionMode } from './types';
|
|
7
|
+
export type { CancelPolicy, CancelPolicyTier, CancelBy, CancellationOutcome, CaseCancellation, CasePaymentPlanInput, CasePaymentPlan, CasePaymentEntry, CasePaymentEntryKind, CasePaymentEntryStatus, CasePaymentEntrySource, PublicCasePaymentEntry, RecordCasePaymentInput, RefundCasePaymentInput, CasePaymentWriteResult, } from './types';
|
|
8
|
+
export type { CaseQuote, CaseQuoteStatus, CaseQuoteVersion, CaseQuoteVersionStatus, CaseQuoteLine, CaseQuotePrice, CaseQuoteExtra, CaseQuoteAction, CaseQuoteAnswerInput, CaseCustomerRequestKind, CaseReceiptQuote, CaseReceiptQuoteVersion, SendCaseQuoteInput, } from './types';
|
|
7
9
|
export type { CreditEntryKind, CreditAgingBucket, CreditAccountStatus, CreditEntry, CreditAllocation, CreditDebt, CreditAccount, CreditWriteResult, CreditStatementRow, CreditAccountListRow, CreditAccountsQuery, CreditAccountsPage, CreditStatementQuery, CreditStatement, UpdateCreditAccountInput, CreditPayInput, CreditReversePaymentInput, CreditWriteOffInput, CreditOpeningInput, CreditPayoutInput, } from './resources/credit';
|
|
8
10
|
export { BillingResource } from './resources/billing';
|
|
9
11
|
export type { BillingCurrency, BillingEntitlement, BillingEntitlementStatus, BillingInterval, BillingLimits, BillingPlan, BillingInvoice, BillingInvoicePage, BillingInvoicesQuery, BillingPaymentMethod, BillingCheckoutInput, BillingStartTrialInput, AppBillingWebhookEvent, AppBillingWebhookEventName, AppBillingWebhookData, } from './resources/billing';
|
|
10
12
|
export { APP_WEBHOOK_HEADERS, TOOL_CALLBACK_HEADERS, ToolCallbackSignatureError, signToolCallbackPayload, verifyAppWebhook, verifyToolCallbackSignature, } from './webhooks';
|
|
11
13
|
export { WebhookResource, type SetAppWebhookInput } from './resources/webhook';
|
|
12
|
-
export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, 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, ThemedColor, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, CheckSystemTemplateResult, SetSystemAppProfileResult, SystemAppProfileView, TemplatePublishIssue, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseContactLink, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, CaseOffCatalogLine, CaseOffCatalogView, ConfirmCaseLineInput, SetCaseLinePriceInput, CaseLinePrices, CaseLinePriceEntry, CaseLinePriceHistoryEntry, CaseLinePriceSet, CaseLinePriceActor, CaseLinePriceBreakdownItem, CreateOffCatalogLineInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseClosingReceivables, CaseAccount, SetOnAccountInput, SetOnAccountResult, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, ReferenceMatchItemInput, ReferenceMatchDecisionKind, ReferenceMatchCandidate, ReferenceMatchDecision, ReferenceMatchInput, ReferenceMatchResult, ReferenceProductInput, ReferenceProductsBulkInput, ReferenceProductsBulkResult, ReferenceProduct, ListReferenceProductsInput, ReferenceProductPage, GoogleCalendarAccount, GoogleCalendarEventInput, GoogleCalendarUpsertResult, GoogleCalendarBusyInput, GoogleCalendarBusyResult, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
14
|
+
export type { AppWebhook, AppWebhookEvent, AppWebhookEventName, AppCaseWebhookEvent, AppCaseWebhookEventName, AppConversationMessageWebhookEvent, AppChannelStatusWebhookEvent, 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, ThemedColor, TeamBusinessHours, TeamWeekday, TeamProfileBlock, ProfileBlockPlacement, ProfileBlockPosition, CatalogBlockPreview, ServiceCta, ServiceCtaAction, CatalogServicesBlockConfig, AppInstallation, TemplateConfigField, TemplateSummary, TemplateDetail, TemplateInstallStats, TemplatePublisher, TemplateAuthor, AppTemplatePolicy, TemplateCategoryRef, MarketplaceCategory, MarketplaceCategoryGroup, MarketplaceLocale, TemplateInstallResult, CheckSystemTemplateResult, SetSystemAppProfileResult, SystemAppProfileView, TemplatePublishIssue, UpsertSystemTemplateInput, UpsertSystemTemplateResult, TemplateReview, TemplateRatingSummary, TemplateReviewsPage, BusinessReview, BusinessReviewsPage, ProductRatingSummary, ProductReview, ProductReviewOwner, ProductReviewsPage, ProductReviewsOwnerPage, ListProductReviewsInput, ListProductReviewsForOwnerInput, HideProductReviewInput, ProductLikeResult, ReceiptReviewable, ReceiptReviewables, SaveReceiptReviewInput, ListTemplateReviewsInput, SaveTemplateReviewInput, TemplateReportKind, CreateTemplateReportInput, TenantConfigEntry, Place, PlaceSuggestion, SearchPlacesInput, AutocompletePlacesInput, PlacesScope, CaseField, CaseBusinessState, CaseType, CaseState, CaseStateType, CasePayment, CasePaymentAccount, CasePaymentStatus, CaseReceiptPayment, CaseDestination, CaseView, CaseContactLink, CaseStateStep, CreateDirectOrderInput, CreateOpenOrderInput, CaseOffCatalogLine, CaseOffCatalogView, ConfirmCaseLineInput, SetCaseLinePriceInput, CaseLinePrices, CaseChangeInput, CaseChangeKind, CaseChangeLine, CaseChangeReason, CasePendingChange, CaseLinePriceEntry, CaseLinePriceHistoryEntry, CaseLinePriceSet, CaseLinePriceActor, CaseLinePriceBreakdownItem, CreateOffCatalogLineInput, OpenOrderFreeLine, OpenOrderLineMark, OpenOrderPayment, CreateDirectBookingInput, MoveCaseSlotInput, CaseSlot, CatalogAttendedAt, CatalogBookingRule, CaseOrigin, CaseOriginChannel, DirectOrderForm, DirectPaymentOption, CaseClosingMethod, CaseClosingOrder, CaseClosingReport, CaseClosingReceivables, CaseAccount, SetOnAccountInput, SetOnAccountResult, CaseReportPage, CaseReceipt, CaseReceiptLine, CaseProposal, CaseProposalAnswer, CaseProposalChange, CaseProposalInput, ListCasesInput, AddressValue, DeliveryLocalPricing, DeliverySettings, PaymentMethodKind, PaymentSettings, PaymentSettingsInput, PaymentAccount, PaymentCountry, PaymentFieldDef, PaymentMethodDef, StructuredConfigInput, StructuredConfigEntry, DeliveryQuoteStatus, DeliveryQuoteInput, DeliveryPricePreview, DeliveryPricingPreview, DeliveryPricingPreviewInput, DeliveryRoute, DeliveryRouteInput, DeliveryQuote, AppSelf, AppOwner, AppSelfConnector, AppSelfConnectors, AppSelfConnectorTools, AppSelfConnectorToolsResponse, RegisterToolInput, RegisterToolsInput, BusinessRoleEntry, Catalog, CatalogCheckoutCta, CatalogCategory, CatalogProduct, CatalogProductPhoto, CatalogProductKind, CatalogProductStatus, CatalogPriceKind, CatalogAvailability, CatalogLockableField, CatalogProductPage, UpsertCatalogInput, CreateCatalogCategoryInput, ListCatalogCategoriesInput, UpdateCatalogCategoryInput, CreateCatalogProductInput, UpdateCatalogProductInput, ListCatalogProductsInput, CatalogPhotoUploadTarget, SignCatalogPhotoUploadInput, AttachCatalogPhotoInput, AttachCatalogCategoryImageInput, CatalogImportItem, CatalogImportPreview, CatalogImportApplyResult, CatalogFileMapping, CatalogFilePlan, CatalogFilePreview, CatalogFileApplyResult, CatalogFileInput, CatalogFilePreviewInput, CatalogMenuItem, CatalogMenuRead, CatalogMenuReadInput, CatalogMenuAttachInput, CatalogMenuChatFile, CatalogMenuKeepInSyncInput, CatalogMenuKeepInSyncResult, CatalogOption, CatalogOptionGroup, SaveCatalogOptionGroupInput, CatalogOptionChoice, CatalogOptionChange, CatalogOptionChangesPlan, CatalogUnit, SaveCatalogUnitInput, CatalogSaleRule, CatalogFileApplyInput, CatalogFileErrorCode, CatalogImportSourceStatus, CatalogImportColumnMapping, CatalogImportRunResult, CatalogImportSource, CreateCatalogImportSourceInput, UpdateCatalogImportSourceInput, PreviewCatalogImportSourceInput, CatalogImportSourcePreview, CatalogSheetTab, CatalogTemplateSheet, CreateCatalogTemplateSheetInput, ReferenceMatchItemInput, ReferenceMatchDecisionKind, ReferenceMatchCandidate, ReferenceMatchDecision, ReferenceMatchInput, ReferenceMatchResult, ReferenceProductInput, ReferenceProductsBulkInput, ReferenceProductsBulkResult, ReferenceProduct, ListReferenceProductsInput, ReferenceProductPage, GoogleCalendarAccount, GoogleCalendarEventInput, GoogleCalendarUpsertResult, GoogleCalendarBusyInput, GoogleCalendarBusyResult, GoogleSheetsPickerInput, GoogleSheetsPickerSession, GoogleSheetsPickerErrorCode, GoogleSheetsPickerResult, RegisterToolsResult, ToolCallbackPayload, ToolCallRecord, ToolPermission, ToolPermissionMode, TokenUsage, TenantSecretEntry, UpdateAgentInput, InboxThreadMode, InboxMessageDirection, InboxMessageSource, InboxMessageType, InboxThreadCustomerProfileView, InboxThreadView, InboxMessageView, SupportKpiTotals, SupportKpiResponse, AgentAttentionLogRow, } from './types';
|
|
13
15
|
export { AgentsResource } from './resources/agents';
|
|
14
16
|
export { AnalyticsResource } from './resources/analytics';
|
|
15
17
|
export type { GetSupportKpisInput, GetAgentAttentionLogInput, } from './resources/analytics';
|
package/dist/index.js
CHANGED
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
// const payload = af.tools.verifyCallback({ rawBody, signatureHeader, secretPlaintext });
|
|
29
29
|
// await af.tools.respondToCallback({ resultUrl: payload.resultUrl, tenantId: payload.tenantId, secret, result });
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.
|
|
32
|
-
exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogUnitsResource = exports.CatalogOptionGroupsResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogReviewsResource = exports.CatalogProductLikesResource = exports.CatalogProductReviewsResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = void 0;
|
|
31
|
+
exports.CasesResource = exports.DeliveryResource = exports.FilesResource = exports.ContactListsResource = exports.ContactTagsResource = exports.ContactAddressesResource = exports.ContactVerificationResource = exports.ContactsResource = exports.PlacesResource = exports.TenantConfigResource = exports.MarketplaceResource = exports.REFERENCE_BULK_MAX_ITEMS = exports.REFERENCE_MATCH_MAX_ITEMS = exports.AgentForgeReferenceLimitError = exports.ReferenceProductsResource = exports.ReferenceResource = exports.TemplateReportsResource = exports.TemplateReviewsResource = exports.TemplatesResource = exports.InstallationsResource = exports.InboxResource = exports.parseGoogleSheetsPickerResult = exports.ConnectorsResource = exports.ChatResource = exports.AppsResource = exports.AnalyticsResource = exports.AgentsResource = exports.WebhookResource = exports.verifyToolCallbackSignature = exports.verifyAppWebhook = exports.signToolCallbackPayload = exports.ToolCallbackSignatureError = exports.TOOL_CALLBACK_HEADERS = exports.APP_WEBHOOK_HEADERS = exports.BillingResource = exports.CreditAccountsResource = exports.CreditResource = exports.AGENTFORGE_PAYMENT_ERROR_CODES = exports.AgentForgePaymentError = exports.AGENTFORGE_CREDIT_ERROR_CODES = exports.AgentForgeCreditError = exports.AGENTFORGE_BILLING_ERROR_CODES = exports.AgentForgeBillingError = exports.AgentForgeDuplicateContactError = exports.AgentForgeNetworkError = exports.AgentForgeNotFoundError = exports.AgentForgeAuthError = exports.AgentForgeError = exports.INSTALLED_TENANT_HEADER = exports.AgentForgeClient = void 0;
|
|
32
|
+
exports.ToolsResource = exports.TeamsResource = exports.SecretsResource = exports.ProvisioningResource = exports.CATALOG_IMPORT_MAX_ITEMS = exports.AgentForgeCatalogImportLimitError = exports.CatalogSourcesResource = exports.CatalogUnitsResource = exports.CatalogOptionGroupsResource = exports.CatalogMenuImportResource = exports.CatalogFileImportResource = exports.CatalogImportResource = exports.CatalogPhotosResource = exports.CatalogReviewsResource = exports.CatalogProductLikesResource = exports.CatalogProductReviewsResource = exports.CatalogProductsResource = exports.CatalogCategoriesResource = exports.CatalogResource = exports.BusinessRolesResource = void 0;
|
|
33
33
|
var client_1 = require("./client");
|
|
34
34
|
Object.defineProperty(exports, "AgentForgeClient", { enumerable: true, get: function () { return client_1.AgentForgeClient; } });
|
|
35
35
|
Object.defineProperty(exports, "INSTALLED_TENANT_HEADER", { enumerable: true, get: function () { return client_1.INSTALLED_TENANT_HEADER; } });
|
|
@@ -43,6 +43,8 @@ Object.defineProperty(exports, "AgentForgeBillingError", { enumerable: true, get
|
|
|
43
43
|
Object.defineProperty(exports, "AGENTFORGE_BILLING_ERROR_CODES", { enumerable: true, get: function () { return errors_1.AGENTFORGE_BILLING_ERROR_CODES; } });
|
|
44
44
|
Object.defineProperty(exports, "AgentForgeCreditError", { enumerable: true, get: function () { return errors_1.AgentForgeCreditError; } });
|
|
45
45
|
Object.defineProperty(exports, "AGENTFORGE_CREDIT_ERROR_CODES", { enumerable: true, get: function () { return errors_1.AGENTFORGE_CREDIT_ERROR_CODES; } });
|
|
46
|
+
Object.defineProperty(exports, "AgentForgePaymentError", { enumerable: true, get: function () { return errors_1.AgentForgePaymentError; } });
|
|
47
|
+
Object.defineProperty(exports, "AGENTFORGE_PAYMENT_ERROR_CODES", { enumerable: true, get: function () { return errors_1.AGENTFORGE_PAYMENT_ERROR_CODES; } });
|
|
46
48
|
var credit_1 = require("./resources/credit");
|
|
47
49
|
Object.defineProperty(exports, "CreditResource", { enumerable: true, get: function () { return credit_1.CreditResource; } });
|
|
48
50
|
Object.defineProperty(exports, "CreditAccountsResource", { enumerable: true, get: function () { return credit_1.CreditAccountsResource; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentForgeClient } from '../client';
|
|
2
|
-
import type { CaseAccount, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateDirectRentalInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SetCaseLinePriceInput, SetOnAccountInput, SetOnAccountResult, UpdateCaseRentalInput } from '../types';
|
|
2
|
+
import type { CancellationOutcome, CasePaymentEntry, CasePaymentWriteResult, RecordCasePaymentInput, RefundCasePaymentInput, CaseAccount, CaseChangeInput, CaseCustomerRequestKind, CaseQuoteAnswerInput, ConfirmCaseLineInput, CaseClosingReport, CaseProposalAnswer, CaseProposalInput, CaseReportPage, CasePaymentStatus, CaseReceipt, CaseState, CaseView, CreateDirectBookingInput, CreateDirectOrderInput, CreateDirectRentalInput, CreateOpenOrderInput, DirectOrderForm, ListCasesInput, MoveCaseSlotInput, ProductReview, ReceiptReviewables, SaveReceiptReviewInput, SendCaseQuoteInput, SetCaseLinePriceInput, SetOnAccountInput, SetOnAccountResult, UpdateCaseRentalInput } from '../types';
|
|
3
3
|
export declare class CasesResource {
|
|
4
4
|
private readonly client;
|
|
5
5
|
constructor(client: AgentForgeClient);
|
|
@@ -71,6 +71,56 @@ export declare class CasesResource {
|
|
|
71
71
|
* Returns the updated case.
|
|
72
72
|
*/
|
|
73
73
|
setLinePrice(caseId: string, input: SetCaseLinePriceInput): Promise<CaseView>;
|
|
74
|
+
/**
|
|
75
|
+
* `POST /api/v1/cases/:id/quote` — PDK-RENTAL-DEAL R1: the business sends a rental QUOTE (a case made with `createDirectRental({ quote: true })`)
|
|
76
|
+
* as numbered, immutable version N: a price for every line nobody priced (a catalog line with a `quote` option, a free line the customer typed),
|
|
77
|
+
* optional extra lines (transporte, depósito…), a validity (`validUntil`) and a conditions `note`. The customer gets a proposal
|
|
78
|
+
* (`CaseView.proposal.quote`, `requiresAnswer`) and answers it on the receipt (`receiptAnswerQuote`) or you record it (`answerQuote`).
|
|
79
|
+
* NOTHING is applied until they accept: a rejected, expired or replaced version leaves lines, prices and total as they were. A version still
|
|
80
|
+
* waiting is `superseded` by the next one. Poodleck-style flow: `requested` → `sent` → (`changes_requested` → `sent` …) → `accepted`.
|
|
81
|
+
* 400 `not_a_quote` / `quote_closed` (already accepted) / `prices_missing` (`lines`) / `unknown_line` / `not_priceable` / `price_overflow` /
|
|
82
|
+
* `invalid_valid_until` / invalid body, 409 another proposal is waiting. Returns the updated case (`quote.versions`). The App gets
|
|
83
|
+
* `case.proposal` with `proposal: 'quote_sent'` and `quoteVersion`.
|
|
84
|
+
*/
|
|
85
|
+
sendQuote(caseId: string, input: SendCaseQuoteInput): Promise<CaseView>;
|
|
86
|
+
/**
|
|
87
|
+
* `POST /api/v1/cases/:id/quote/answer` — PDK-RENTAL-DEAL R1: the business records the customer's answer to the quote waiting (they said it by
|
|
88
|
+
* phone). Same body and effects as `receiptAnswerQuote`.
|
|
89
|
+
*/
|
|
90
|
+
answerQuote(caseId: string, input: CaseQuoteAnswerInput): Promise<CaseView>;
|
|
91
|
+
/**
|
|
92
|
+
* `POST /api/v1/cases/receipts/:token/quote/answer` — PDK-RENTAL-DEAL R1: the customer answers the quote version waiting on their receipt.
|
|
93
|
+
*
|
|
94
|
+
* - `accept` — that version is the agreement: its prices and extras are applied, the receipt is re-issued (same link, revision + 1, total
|
|
95
|
+
* frozen = the version's `totalCents`) and the case becomes `accepted` (the customer is asked how to pay; `receiptChoosePayment` opens).
|
|
96
|
+
* - `reject` — the case ends `rejected` (its units are released like any undone close); `comment` = the reason.
|
|
97
|
+
* - `changes_requested` — `comment` required (≤ 1000): the case stays open waiting for the business's next version.
|
|
98
|
+
*
|
|
99
|
+
* `version` (optional) guards against answering a version that was replaced meanwhile. 400 `no_quote_waiting` / invalid body,
|
|
100
|
+
* 409 `quote_stale` (replaced, or the order changed since) or `quote_expired` (past `validUntil`: the case ends `cancelled`).
|
|
101
|
+
* Returns the receipt as it is now (`quote`). The App gets `case.proposal` with `proposal: 'quote_accepted' | 'quote_rejected' | 'quote_changes_requested'`.
|
|
102
|
+
*/
|
|
103
|
+
receiptAnswerQuote(token: string, input: CaseQuoteAnswerInput): Promise<CaseReceipt>;
|
|
104
|
+
/**
|
|
105
|
+
* `POST /api/v1/cases/:id/customer-request` — PDK-RENTAL-DEAL R1b (App sk_ key; 403 otherwise): records ON the case what the customer asked
|
|
106
|
+
* the business for — `asks_cancel` («Pedir cancelación», after your cutoff) or `asks_change` («pedir cambio de fechas») — as the assistant's
|
|
107
|
+
* requests do. It shows as `CaseView.customerRequest` (`kind: 'cancel' | 'change'`, `text`, `at`) until the business moves the case, and the
|
|
108
|
+
* App gets `case.customer_request` (`request`, `by: 'customer'`). `text` ≤ 500 (a default per kind when omitted). Only a case the business
|
|
109
|
+
* already accepted; 400 before that (the customer cancels/changes it directly) and when closed. The platform applies no policy: you enforce yours.
|
|
110
|
+
*/
|
|
111
|
+
customerRequest(caseId: string, input: {
|
|
112
|
+
kind: CaseCustomerRequestKind;
|
|
113
|
+
text?: string;
|
|
114
|
+
}): Promise<CaseView>;
|
|
115
|
+
/**
|
|
116
|
+
* `POST /api/v1/cases/:id/cancel-for-customer` — PDK-RENTAL-DEAL R1b (App sk_ key; 403 otherwise): cancels on the customer's behalf when YOUR policy
|
|
117
|
+
* allows it (e.g. before the cutoff), also once the case is `confirmed` — which `receiptCancel` refuses and keeps refusing. The case closes
|
|
118
|
+
* `cancelled` with `by: 'customer'` (history and `case.closed` say so), the note is `reason` (≤ 500) and its units go back like any undone close;
|
|
119
|
+
* a quote still waiting is withdrawn. 400 `in_progress` while it is under way (`en_obra`, `devuelta`, out for delivery) and 400 when already closed.
|
|
120
|
+
*/
|
|
121
|
+
cancelForCustomer(caseId: string, input?: {
|
|
122
|
+
reason?: string;
|
|
123
|
+
}): Promise<CaseView>;
|
|
74
124
|
/**
|
|
75
125
|
* `POST /api/v1/cases/:id/weigh` — AGF-UNITS U3: what a line sold by value
|
|
76
126
|
* («$3.000 de queso») really weighed, in the product's unit (`line` = the
|
|
@@ -130,6 +180,49 @@ export declare class CasesResource {
|
|
|
130
180
|
*/
|
|
131
181
|
receiptReopen(token: string): Promise<CaseReceipt>;
|
|
132
182
|
receiptRedoProposal(token: string): Promise<CaseReceipt>;
|
|
183
|
+
/**
|
|
184
|
+
* `POST /api/v1/cases/receipts/:token/change` — PDK-SERVICE-CHANGES S3: the customer asks to change their request
|
|
185
|
+
* (replaces `receiptReopen` for the new flow). The change is kept APART (`pendingChange`): the case keeps its state, holds,
|
|
186
|
+
* payment and progress until the business answers (`answerChange`); nothing is held or charged before. It is validated like a
|
|
187
|
+
* direct order (products exist and are sellable, options, the booking's/rental's shape) and priced — `pendingChange.previewTotalCents`
|
|
188
|
+
* (line prices, rental rates, delivery) — so you can show the new total. One at a time: a new request replaces the pending one.
|
|
189
|
+
*
|
|
190
|
+
* Read `receipt.changeAllowed` / `changeReason` / `changeKind` / `changeUntil` / `pendingChange` first to render the right form:
|
|
191
|
+
* `items` (the cart: send the FULL new `lines`), `service` (answers + address), `booking` (`slot`), `rental` (`rental`, and `lines`
|
|
192
|
+
* for the units), `mixed`. Rules per kind (409 with `code`): `change_window_closed` — products until confirmed, a quote until the
|
|
193
|
+
* customer accepted a price, a service until it is in progress, a booking/rental until `changeWindowHours` (type setting, default 24)
|
|
194
|
+
* before it starts —; `case_closed`; `case_not_sent`; `change_pending` (a change from the business waits); `not_enough_stock`.
|
|
195
|
+
* 400 on a bad body (`code: 'invalid_change' | 'empty_change' | 'product_not_available' | 'not_a_booking' | 'not_a_rental' …`).
|
|
196
|
+
* You own availability of a booking's time / a rental's range: check it before sending. Returns the receipt.
|
|
197
|
+
*/
|
|
198
|
+
receiptRequestChange(token: string, input: CaseChangeInput): Promise<CaseReceipt>;
|
|
199
|
+
/**
|
|
200
|
+
* `DELETE /api/v1/cases/receipts/:token/change` — the customer takes their pending change back (or leaves without sending: the
|
|
201
|
+
* case was never touched, so nothing needs undoing). 409 `no_pending_change`, or `change_pending` when the change is the business's.
|
|
202
|
+
*/
|
|
203
|
+
receiptWithdrawChange(token: string): Promise<CaseReceipt>;
|
|
204
|
+
/**
|
|
205
|
+
* `POST /api/v1/cases/:id/change` — PDK-SERVICE-CHANGES S3: the App asks a change on behalf of the customer (the same body as
|
|
206
|
+
* `receiptRequestChange`). It is kept apart (`pendingChange.by: 'business'`) until `answerChange`; the business is not held to
|
|
207
|
+
* the customer's window (a closed case still answers 409). Returns the case.
|
|
208
|
+
*/
|
|
209
|
+
requestChange(caseId: string, input: CaseChangeInput): Promise<CaseView>;
|
|
210
|
+
/**
|
|
211
|
+
* `POST /api/v1/cases/:id/change/answer` — the business answers the pending change.
|
|
212
|
+
*
|
|
213
|
+
* `accept: true` applies it in one go: the lines' holds are swapped (old released, new taken, discounted too when the business
|
|
214
|
+
* already took the order — a stock failure answers 409 `not_enough_stock` and leaves the case exactly as it was, still pending),
|
|
215
|
+
* the answers/address/time/range are replaced, line prices follow the lines that survive (a removed line's price is unset, its
|
|
216
|
+
* history kept as `outcome: 'removed'`), and the receipt is re-issued (revision + 1). The payment is kept; when the total moved
|
|
217
|
+
* after it was reported or made, `payment.differenceCents` says what is still owed (+) or given back (−) until the business
|
|
218
|
+
* settles it. The case state is NOT reset (no `submitted` again) and its progress stays. A price quote waiting is withdrawn.
|
|
219
|
+
* `accept: false` discards it and tells the customer (`note` goes with it). Emits `case.change` (`accepted` / `rejected`).
|
|
220
|
+
* 409 `no_pending_change`. Returns the case.
|
|
221
|
+
*/
|
|
222
|
+
answerChange(caseId: string, input: {
|
|
223
|
+
accept: boolean;
|
|
224
|
+
note?: string;
|
|
225
|
+
}): Promise<CaseView>;
|
|
133
226
|
/**
|
|
134
227
|
* `POST /api/v1/cases/receipts/:token/cancel` — «Cancelar pedido»: the customer cancels from
|
|
135
228
|
* the receipt while the order is a draft (sent, accepted, being prepared or redone, changes
|
|
@@ -144,6 +237,8 @@ export declare class CasesResource {
|
|
|
144
237
|
* PDK-OFF-CATALOG: moving to a confirmed state (`confirmed`, ready, out for delivery, `completed`) is refused with
|
|
145
238
|
* 400 `code: 'lines_pending'` while a free line is still pending (`offCatalog.pendingCount > 0`): confirm them
|
|
146
239
|
* first. `cancelled` / `rejected` stay allowed.
|
|
240
|
+
* PDK-RENTAL-DEAL R7: a rental whose required anticipo is not in is refused with 400 `deposit_due` (`AgentForgePaymentError`, `err.anticipoDueCents`):
|
|
241
|
+
* record it (`recordPayment`) or `waiveAnticipo` first.
|
|
147
242
|
*/
|
|
148
243
|
transition(caseId: string, state: CaseState, opts?: {
|
|
149
244
|
note?: string;
|
|
@@ -207,6 +302,9 @@ export declare class CasesResource {
|
|
|
207
302
|
* `confirmation: 'instant'`. 400 for a bad range (end ≤ start, > 366 days, a count below what the range spans) or a
|
|
208
303
|
* line with `variantId`/`amountCents`; 409 when a product lacks stock. A retried `idempotencyKey` returns the same rental.
|
|
209
304
|
* R2d: `lines[].periodRateCents` (App sk_ key) prices a line with YOUR rate of one period instead of the catalog; still multiplied here.
|
|
305
|
+
* PDK-RENTAL-DEAL R1: `lines[].optionPricing` (App key) charges an option `per_trip` (once per unit) or leaves it «a cotizar» (`quote`); `quote: true`
|
|
306
|
+
* makes the rental a QUOTE REQUEST (stays `submitted`, `receipt.pricePending`, never instant) and allows `allowOffCatalog` + `offCatalogLines`
|
|
307
|
+
* (free-text extras with a pending price); anything pending without `quote: true` is a 400 `quote_required`. The business then answers with `sendQuote`.
|
|
210
308
|
*/
|
|
211
309
|
createDirectRental(input: CreateDirectRentalInput): Promise<CaseView>;
|
|
212
310
|
/**
|
|
@@ -290,7 +388,67 @@ export declare class CasesResource {
|
|
|
290
388
|
contentType: 'image/jpeg' | 'image/png' | 'image/webp';
|
|
291
389
|
dataBase64: string;
|
|
292
390
|
};
|
|
391
|
+
/**
|
|
392
|
+
* PDK-RENTAL-DEAL R7 — on a case paid in parts: how much the customer reports (positive whole cents, at most what is due now; default: all of it).
|
|
393
|
+
* 400 `exceeds_due` / `nothing_due`; 409 `report_pending` (one report at a time) / `deposit_expired` (`AgentForgePaymentError`).
|
|
394
|
+
*/
|
|
395
|
+
amountCents?: number;
|
|
293
396
|
}): Promise<CaseReceipt>;
|
|
397
|
+
/** `GET /api/v1/cases/:id/payments` — the case's payment entries (anticipo, saldo, refunds, customer reports), oldest first, with the owner's data. */
|
|
398
|
+
payments(caseId: string): Promise<{
|
|
399
|
+
entries: CasePaymentEntry[];
|
|
400
|
+
}>;
|
|
401
|
+
/**
|
|
402
|
+
* `POST /api/v1/cases/:id/payments` — record money that came in (cash at the door, a transfer you saw): a confirmed entry. Returns the case
|
|
403
|
+
* (`payment.paidCents`, `balanceCents`, status `partially_paid` | `paid`…), the entry and `replayed`. 400 `not_accepted` / `case_closed` /
|
|
404
|
+
* `on_account` / `total_pending` / `exceeds_balance` (`err.balanceCents`) / `method_required` / `invalid_*`; 409 `already_paid` / `report_pending` /
|
|
405
|
+
* `deposit_expired` / `idempotency_conflict`. Same `idempotencyKey` + same body = replay.
|
|
406
|
+
*/
|
|
407
|
+
recordPayment(caseId: string, input: RecordCasePaymentInput): Promise<CasePaymentWriteResult>;
|
|
408
|
+
/**
|
|
409
|
+
* `POST /api/v1/cases/:id/payments/refund` — money given back. On a case cancelled under a policy, retaining anything but the suggestion needs a
|
|
410
|
+
* `reason` (400 `reason_required`, with `err.suggestedRetainedCents` / `err.refundCents`). 400 `exceeds_paid` (`err.paidCents`) / `invalid_retention` /
|
|
411
|
+
* `not_accepted` / `on_account`; 409 `idempotency_conflict`.
|
|
412
|
+
*/
|
|
413
|
+
refundPayment(caseId: string, input: RefundCasePaymentInput): Promise<CasePaymentWriteResult>;
|
|
414
|
+
/**
|
|
415
|
+
* `POST /api/v1/cases/:id/payments/:entryId/confirm` — the reported payment arrived. `amountCents` = what the bank shows (at most what was reported;
|
|
416
|
+
* a lower one needs a `note`: 400 `reason_required`). 404 `entry_not_found`; 409 `entry_resolved`; 400 `exceeds_balance`.
|
|
417
|
+
*/
|
|
418
|
+
confirmPayment(caseId: string, entryId: string, input?: {
|
|
419
|
+
amountCents?: number;
|
|
420
|
+
note?: string;
|
|
421
|
+
}): Promise<CasePaymentWriteResult>;
|
|
422
|
+
/**
|
|
423
|
+
* `POST /api/v1/cases/:id/payments/:entryId/reject` — the reported payment did not arrive. After the anticipo deadline the customer gets 12 h more (once).
|
|
424
|
+
* 404 `entry_not_found`; 409 `entry_resolved`.
|
|
425
|
+
*/
|
|
426
|
+
rejectPayment(caseId: string, entryId: string, input?: {
|
|
427
|
+
note?: string;
|
|
428
|
+
}): Promise<CasePaymentWriteResult>;
|
|
429
|
+
/**
|
|
430
|
+
* `POST /api/v1/cases/:id/payment/waive-anticipo` — «Sin anticipo»: removes the `deposit_due` gate (an instant rental confirms itself). `note` is required
|
|
431
|
+
* (400 `note_required`). 400 `no_anticipo`; 409 `already_waived`.
|
|
432
|
+
*/
|
|
433
|
+
waiveAnticipo(caseId: string, input: {
|
|
434
|
+
note: string;
|
|
435
|
+
}): Promise<CaseView>;
|
|
436
|
+
/**
|
|
437
|
+
* `POST /api/v1/cases/:id/payment/extend-anticipo` — «Dar más tiempo»: the anticipo deadline moves to the later of now and the deadline, plus `hours` (whole 1–168).
|
|
438
|
+
* 400 `invalid_hours` / `no_anticipo` / `not_waiting`; 409 `deposit_expired`.
|
|
439
|
+
*/
|
|
440
|
+
extendAnticipo(caseId: string, input: {
|
|
441
|
+
hours: number;
|
|
442
|
+
note?: string;
|
|
443
|
+
}): Promise<CaseView>;
|
|
444
|
+
/**
|
|
445
|
+
* `GET /api/v1/cases/:id/cancellation-preview?by=customer|business` — what cancelling now would retain and refund under the frozen policy (no write).
|
|
446
|
+
* `by: 'customer'` (default) applies the policy; `business` cancels without a penalty by default. A case already cancelled answers its frozen figures (`frozen: true`).
|
|
447
|
+
*/
|
|
448
|
+
cancellationPreview(caseId: string, by?: 'customer' | 'business'): Promise<CancellationOutcome>;
|
|
449
|
+
/** `GET /api/v1/cases/receipts/:token/cancellation-preview` — the same, from the customer's link (the customer cancels; no `tierIndex`). */
|
|
450
|
+
receiptCancellationPreview(token: string): Promise<CancellationOutcome>;
|
|
451
|
+
private paymentWrite;
|
|
294
452
|
/**
|
|
295
453
|
* `GET /api/v1/cases/receipts/:token/image.png` — the receipt as a PNG:
|
|
296
454
|
* `wide` (1200×630, what a shared link previews) or `tall` (1080×1350, to send or save).
|