@halix/action-sdk 1.0.38 → 1.0.40
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/README.md +31 -0
- package/lib/cjs/data-crud.js +174 -34
- package/lib/cjs/index.js +13 -2
- package/lib/cjs/lists.js +57 -0
- package/lib/cjs/payments.js +87 -0
- package/lib/cjs/types/data-crud.d.ts +38 -5
- package/lib/cjs/types/data-crud.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/lists.d.ts +64 -3
- package/lib/cjs/types/lists.d.ts.map +1 -1
- package/lib/cjs/types/payments.d.ts +75 -0
- package/lib/cjs/types/payments.d.ts.map +1 -0
- package/lib/esm/data-crud.js +165 -33
- package/lib/esm/data-crud.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/index.mjs +8 -2
- package/lib/esm/lists.js +57 -0
- package/lib/esm/lists.js.map +1 -1
- package/lib/esm/payments.js +78 -0
- package/lib/esm/payments.js.map +1 -0
- package/lib/esm/types/data-crud.d.ts +38 -5
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/lists.d.ts +64 -3
- package/lib/esm/types/payments.d.ts +74 -0
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Halix SDK License v1.0
|
|
2
|
+
// Copyright (c) 2025 halix.io LLC.
|
|
3
|
+
//
|
|
4
|
+
// This source code is licensed for use **only** within applications
|
|
5
|
+
// running on the Halix platform, in accordance with Halix SDK guidelines.
|
|
6
|
+
//
|
|
7
|
+
// Unauthorized use outside the Halix platform is prohibited.
|
|
8
|
+
// Full license terms available in the LICENSE file.
|
|
9
|
+
/**
|
|
10
|
+
* @module @halix/action-sdk/payments
|
|
11
|
+
* @description Payment completion helpers for the Halix Platform action SDK. This module provides
|
|
12
|
+
* a wrapper around the `standalonePayment` backend route, which finalizes a payment after a gateway
|
|
13
|
+
* component has already produced a preauthorization result.
|
|
14
|
+
*
|
|
15
|
+
* Typical flow:
|
|
16
|
+
* 1. Client/UI code collects payment details and obtains a gateway preauth result.
|
|
17
|
+
* 2. Action code calls `submitStandalonePayment(...)` with the payer, payee, host object, and preauth result.
|
|
18
|
+
* 3. The platform completes the payment, updates the host object's payment summary field, and optionally
|
|
19
|
+
* generates a sales transaction.
|
|
20
|
+
*/
|
|
21
|
+
import axios from 'axios';
|
|
22
|
+
import { from, lastValueFrom } from 'rxjs';
|
|
23
|
+
import { sandboxKey, serviceAddress, getAuthToken, userContext } from './sdk-general';
|
|
24
|
+
const STANDALONE_PAYMENT_URL = 'payments/sandboxes/:sandboxKey/standalonePayment';
|
|
25
|
+
const ASSUMED_PAYER_TYPE = 'SolutionUserProxy';
|
|
26
|
+
const ASSUMED_PAYMENT_GATEWAY = 'stripe';
|
|
27
|
+
const BANK_ACCOUNT_PAYMENT_METHODS = new Set(['us_bank_account', 'USBankAccount', 'bankAccount']);
|
|
28
|
+
function resolveBankAccountPayment(request) {
|
|
29
|
+
if (request.bankAccountPayment !== undefined) {
|
|
30
|
+
return request.bankAccountPayment;
|
|
31
|
+
}
|
|
32
|
+
return BANK_ACCOUNT_PAYMENT_METHODS.has(request.preAuthResult?.paymentMethod || '');
|
|
33
|
+
}
|
|
34
|
+
function resolveOrganizationKey() {
|
|
35
|
+
const organizationKey = userContext?.orgKey;
|
|
36
|
+
if (!organizationKey) {
|
|
37
|
+
throw new Error('userContext.orgKey is required for standalone payments; check that initialize(event) has been called with a full userContext');
|
|
38
|
+
}
|
|
39
|
+
return organizationKey;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Completes a previously preauthorized standalone payment.
|
|
43
|
+
*
|
|
44
|
+
* This endpoint performs the final charge, updates the host object's payment summary attribute,
|
|
45
|
+
* persists billing address information back to the payer, and can optionally generate a linked
|
|
46
|
+
* sales transaction.
|
|
47
|
+
*/
|
|
48
|
+
export async function submitStandalonePayment(request) {
|
|
49
|
+
if (!getAuthToken) {
|
|
50
|
+
const errorMessage = 'SDK not initialized.';
|
|
51
|
+
console.error(errorMessage);
|
|
52
|
+
throw new Error(errorMessage);
|
|
53
|
+
}
|
|
54
|
+
const url = `${serviceAddress}/${STANDALONE_PAYMENT_URL.replace(':sandboxKey', sandboxKey)}`;
|
|
55
|
+
const authToken = await lastValueFrom(getAuthToken());
|
|
56
|
+
const payload = {
|
|
57
|
+
...request,
|
|
58
|
+
organizationKey: resolveOrganizationKey(),
|
|
59
|
+
payerType: ASSUMED_PAYER_TYPE,
|
|
60
|
+
bankAccountPayment: resolveBankAccountPayment(request),
|
|
61
|
+
preAuthResult: {
|
|
62
|
+
paymentGateway: ASSUMED_PAYMENT_GATEWAY,
|
|
63
|
+
...request.preAuthResult,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
console.log('Sending POST request to ' + url + ' with token ' + authToken);
|
|
67
|
+
const response = await axios.post(url, payload, {
|
|
68
|
+
headers: { Authorization: `Bearer ${authToken}` },
|
|
69
|
+
});
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Observable version of submitStandalonePayment. See submitStandalonePayment for details.
|
|
74
|
+
*/
|
|
75
|
+
export function submitStandalonePaymentAsObservable(request) {
|
|
76
|
+
return from(submitStandalonePayment(request));
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/payments.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,0EAA0E;AAC1E,EAAE;AACF,6DAA6D;AAC7D,oDAAoD;AAEpD;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAc,aAAa,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEtF,MAAM,sBAAsB,GAAG,kDAAkD,CAAC;AAClF,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAC/C,MAAM,uBAAuB,GAAG,QAAQ,CAAC;AACzC,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC;AAkElG,SAAS,yBAAyB,CAAC,OAAiC;IAChE,IAAI,OAAO,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO,OAAO,CAAC,kBAAkB,CAAC;IACtC,CAAC;IAED,OAAO,4BAA4B,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,IAAI,EAAE,CAAC,CAAC;AACxF,CAAC;AAED,SAAS,sBAAsB;IAC3B,MAAM,eAAe,GAAG,WAAW,EAAE,MAAM,CAAC;IAE5C,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,8HAA8H,CAAC,CAAC;IACpJ,CAAC;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,OAAiC;IAC3E,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,sBAAsB,CAAC;QAC5C,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,GAAG,GAAG,GAAG,cAAc,IAAI,sBAAsB,CAAC,OAAO,CAAC,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC;IAC7F,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG;QACZ,GAAG,OAAO;QACV,eAAe,EAAE,sBAAsB,EAAE;QACzC,SAAS,EAAE,kBAAkB;QAC7B,kBAAkB,EAAE,yBAAyB,CAAC,OAAO,CAAC;QACtD,aAAa,EAAE;YACX,cAAc,EAAE,uBAAuB;YACvC,GAAG,OAAO,CAAC,aAAa;SAC3B;KACJ,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,0BAA0B,GAAG,GAAG,GAAG,cAAc,GAAG,SAAS,CAAC,CAAC;IAE3E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE;QAC5C,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,SAAS,EAAE,EAAE;KACpD,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,OAAiC;IACjF,OAAO,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -5,7 +5,10 @@ import { Observable } from 'rxjs';
|
|
|
5
5
|
export interface SaveOptions {
|
|
6
6
|
/** Whether to bypass validation */
|
|
7
7
|
bypassValidation?: boolean;
|
|
8
|
+
/** Optional relationships to include as nested objects in the saved response */
|
|
9
|
+
fetchedRelationships?: string[];
|
|
8
10
|
}
|
|
11
|
+
type SaveBody = string | object;
|
|
9
12
|
/**
|
|
10
13
|
* Retrieves a single object by dataElementId and key. Optionally fetch related objects.
|
|
11
14
|
*
|
|
@@ -46,20 +49,49 @@ export declare function getAccessibleObjects(dataElementId: string, filter?: str
|
|
|
46
49
|
*/
|
|
47
50
|
export declare function getAccessibleObjectsAsObservable(dataElementId: string, filter?: string, fetchedRelationships?: string[], applyContext?: boolean): Observable<any[]>;
|
|
48
51
|
/**
|
|
49
|
-
*
|
|
52
|
+
* Retrieves accessible objects for a data element from a specific key list.
|
|
53
|
+
* Only objects that are accessible to the current user are returned. If applyContext is true, keyed objects outside the current navigation context are also omitted.
|
|
54
|
+
*
|
|
55
|
+
* @param dataElementId - Data element ID
|
|
56
|
+
* @param keys - Object keys to retrieve
|
|
57
|
+
* @param filter - Optional filter; call `dataexpr_agent` to generate the filter expression. Must be less than 200 characters.
|
|
58
|
+
* @param fetchedRelationships - Optional relationships to include as nested objects
|
|
59
|
+
* @param applyContext - Optional flag to apply navigation context scoping. When true, navigation context is read from UserContext.navigationContext and results are limited by the navigation context org proxy.
|
|
60
|
+
* @returns Promise<any[]>
|
|
61
|
+
*/
|
|
62
|
+
export declare function getObjectsByKeys(dataElementId: string, keys: string[], filter?: string, fetchedRelationships?: string[], applyContext?: boolean): Promise<any[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Observable version of getObjectsByKeys. See getObjectsByKeys for details.
|
|
65
|
+
*/
|
|
66
|
+
export declare function getObjectsByKeysAsObservable(dataElementId: string, keys: string[], filter?: string, fetchedRelationships?: string[], applyContext?: boolean): Observable<any[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Saves an object without establishing a parent relationship. Returns saved object with any server-assigned values (objKey, calculated fields).
|
|
69
|
+
*
|
|
70
|
+
* @param dataElementId - Data element ID for the object being saved
|
|
71
|
+
* @param objectToSave - Object data or JSON string of object data
|
|
72
|
+
* @param opts - Optional save options (e.g., bypassValidation, fetchedRelationships)
|
|
73
|
+
* @returns Promise<any> - saved object with updates including server-assigned values (objKey, calculated fields)
|
|
74
|
+
*/
|
|
75
|
+
export declare function saveObject(dataElementId: string, objectToSave: SaveBody, opts?: SaveOptions): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* Observable version of saveObject. See saveObject for details.
|
|
78
|
+
*/
|
|
79
|
+
export declare function saveObjectAsObservable(dataElementId: string, objectToSave: SaveBody, opts?: SaveOptions): Observable<any>;
|
|
80
|
+
/**
|
|
81
|
+
* Saves a related object and establishes or updates its relationship to a parent. Returns saved object with any server-assigned values (objKey, calculated fields).
|
|
50
82
|
*
|
|
51
83
|
* @param parentElementId - Parent element ID
|
|
52
84
|
* @param parentKey - Parent object key; important: this establishes the scope of the save operation; use an appropriate scope Key
|
|
53
85
|
* @param elementId - Child element ID for the object being saved
|
|
54
|
-
* @param objectToSave - JSON string of object data
|
|
55
|
-
* @param opts - Optional save options (e.g., bypassValidation)
|
|
86
|
+
* @param objectToSave - Object data or JSON string of object data
|
|
87
|
+
* @param opts - Optional save options (e.g., bypassValidation, fetchedRelationships)
|
|
56
88
|
* @returns Promise<any> - saved object with updates including server-assigned values (objKey, calculated fields)
|
|
57
89
|
*/
|
|
58
|
-
export declare function saveRelatedObject(parentElementId: string, parentKey: string, elementId: string, objectToSave:
|
|
90
|
+
export declare function saveRelatedObject(parentElementId: string, parentKey: string, elementId: string, objectToSave: SaveBody, opts?: SaveOptions): Promise<any>;
|
|
59
91
|
/**
|
|
60
92
|
* Observable version of saveRelatedObject. See saveRelatedObject for details.
|
|
61
93
|
*/
|
|
62
|
-
export declare function saveRelatedObjectAsObservable(parentElementId: string, parentKey: string, elementId: string, objectToSave:
|
|
94
|
+
export declare function saveRelatedObjectAsObservable(parentElementId: string, parentKey: string, elementId: string, objectToSave: SaveBody, opts?: SaveOptions): Observable<any>;
|
|
63
95
|
/**
|
|
64
96
|
* Deletes a single object related to a parent.
|
|
65
97
|
*
|
|
@@ -81,3 +113,4 @@ export declare function deleteRelatedObjects(parentElementId: string, parentKey:
|
|
|
81
113
|
* Observable version of deleteRelatedObjects. See deleteRelatedObjects for details.
|
|
82
114
|
*/
|
|
83
115
|
export declare function deleteRelatedObjectsAsObservable(parentElementId: string, parentKey: string, childElementId: string, childKeys: string[]): Observable<boolean>;
|
|
116
|
+
export {};
|
package/lib/esm/types/index.d.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
* platform. This is the main entry point that provides a unified interface for all SDK functionality.
|
|
5
5
|
*/
|
|
6
6
|
export { getAuthToken, sandboxKey, serviceAddress, actionSubject, userContext, params, useBody, initialize, type UserContext, type IncomingEventBody, type BaseActionResponse, type ActionResponse, type NotificationConfig, type ListActionResponse, type FormTemplateActionResponse, type PageTemplateActionResponse, type ObjectSaveActionResponse, type CalculatedFieldActionResponse, type SingleValueActionResponse, type ErrorResponse, prepareSuccessResponse, prepareErrorResponse } from './sdk-general';
|
|
7
|
-
export { type SaveOptions, getObject, getObjectAsObservable, getRelatedObjects, getRelatedObjectsAsObservable, getAccessibleObjects, getAccessibleObjectsAsObservable, saveRelatedObject, saveRelatedObjectAsObservable, deleteRelatedObject, deleteRelatedObjectAsObservable, deleteRelatedObjects, deleteRelatedObjectsAsObservable } from './data-crud';
|
|
7
|
+
export { type SaveOptions, getObject, getObjectAsObservable, getRelatedObjects, getRelatedObjectsAsObservable, getAccessibleObjects, getAccessibleObjectsAsObservable, getObjectsByKeys, getObjectsByKeysAsObservable, saveObject, saveObjectAsObservable, saveRelatedObject, saveRelatedObjectAsObservable, deleteRelatedObject, deleteRelatedObjectAsObservable, deleteRelatedObjects, deleteRelatedObjectsAsObservable } from './data-crud';
|
|
8
8
|
export { type ContentResource, getOrCreateResource, getOrCreateResourceAsObservable, saveResource, saveResourceAsObservable, sendFileContents, sendFileContentsAsObservable, createOrUpdateResource, createOrUpdateResourceAsObservable } from './content';
|
|
9
9
|
export { MessageMethod, type MessageRequest, sendMessage, sendMessageAsObservable } from './messaging';
|
|
10
10
|
export { getUserPreference, getOrganizationPreference, getUserPreferenceAsObservable, getOrganizationPreferenceAsObservable } from './preferences';
|
|
11
11
|
export { type SortField, type DataSortField, type BaseListDataRequest, type PagedListDataRequest, type ListDataResponse, type ListDataOptions, type ListDataSearchOptions, type MassEditValueType, type MassEditRequest, type MassDeleteRequest, type MassChangeResponse, getListData, getListDataAsObservable, massEdit, massEditAsObservable, massDelete, massDeleteAsObservable } from './lists';
|
|
12
12
|
export { AggregationResponse, type AggregationRequest, type AggregationRow, type AggregationGroup, type AggregationSort, type Aggregation, type AggregationGroupTransform, type TransformType, type AggregationType, getAggregateData, getAggregateDataAsObservable } from './data-aggregate';
|
|
13
|
+
export { type GatewayPaymentPreauthResult, type StandalonePaymentRequest, type StandalonePaymentResult, submitStandalonePayment, submitStandalonePaymentAsObservable } from './payments';
|
|
13
14
|
export { type AIRequestOptions, sendAIMessage, sendAIMessageAsObservable } from './ai';
|
|
14
15
|
export { sortObjectArray, compareValues, getValueFromObject, debounceFn } from './utilities';
|
package/lib/esm/types/lists.d.ts
CHANGED
|
@@ -40,18 +40,22 @@ export interface BaseListDataRequest {
|
|
|
40
40
|
* The dataElementId must be related to this through a foreign key or key array.
|
|
41
41
|
* Works with parentKey to scope results. This is often an organization proxy
|
|
42
42
|
* or user proxy element, but not necessarily so.
|
|
43
|
+
*
|
|
44
|
+
* Note: in most cases, this can be omitted in which case the system will automatically
|
|
45
|
+
* return only the records the user can access.
|
|
43
46
|
*/
|
|
44
|
-
parentDataElementId
|
|
47
|
+
parentDataElementId?: string;
|
|
45
48
|
/**
|
|
46
49
|
* The key of an object that all records must be related to.
|
|
47
50
|
* Works with parentDataElementId to scope results.
|
|
48
51
|
*
|
|
49
|
-
*
|
|
52
|
+
* Note: in most cases, this can be omitted in which case the system will automatically
|
|
53
|
+
* return only the records the user can access.
|
|
50
54
|
*/
|
|
51
55
|
parentKey?: string;
|
|
52
56
|
/**
|
|
53
57
|
* Optional field to specify the foreign key field on the root element that defines
|
|
54
|
-
* the relationship to the parent. If omitted, a derived key is assumed.
|
|
58
|
+
* the relationship to the parent. If omitted, a derived key is assumed. Works with parentDataElementId to scope results.
|
|
55
59
|
*/
|
|
56
60
|
parentKeyField?: string;
|
|
57
61
|
/**
|
|
@@ -205,11 +209,50 @@ export interface MassChangeResponse {
|
|
|
205
209
|
/**
|
|
206
210
|
* Retrieves paginated list data. Supports authenticated/public access, filtering, sorting, and binary search.
|
|
207
211
|
*
|
|
212
|
+
* Common usage:
|
|
213
|
+
* - For most custom-element list UIs, start with only `dataElementId`, pagination fields,
|
|
214
|
+
* and `displayFields`.
|
|
215
|
+
* - Omit `parentDataElementId` and `parentKey` when you want the records the current user
|
|
216
|
+
* can already access.
|
|
217
|
+
* - Add `parentDataElementId` and `parentKey` only when the list must be anchored to a
|
|
218
|
+
* specific parent record.
|
|
219
|
+
* - Most callers should omit `options`. Use `options.search` only for binary-search
|
|
220
|
+
* navigation scenarios, and use `options.bypassTotal` only when you explicitly do not
|
|
221
|
+
* need the total count.
|
|
222
|
+
*
|
|
223
|
+
* Request shape:
|
|
224
|
+
* - `dataElementId` (required): root data element to retrieve
|
|
225
|
+
* - `pageNumber` / `pageSize` (optional): pagination
|
|
226
|
+
* - `displayFields` (optional): fields to populate in returned objects
|
|
227
|
+
* - `sort` (optional): sort fields such as `[{ attributeId: 'name' }]`
|
|
228
|
+
* - `filter` (optional): filter expression
|
|
229
|
+
* - `parentDataElementId` / `parentKey` (optional): explicit parent scope
|
|
230
|
+
*
|
|
208
231
|
* @param request - List configuration including dataElementId, parentDataElementId, parentKey, pagination, sort, filter
|
|
209
232
|
* @param options - Optional: isPublic, bypassTotal, search
|
|
210
233
|
* @returns Promise<ListDataResponse> with data array, total count, pageNumber
|
|
211
234
|
*
|
|
212
235
|
* @example
|
|
236
|
+
* // Most common case: one page of records the current user can access.
|
|
237
|
+
* const response = await getListData({
|
|
238
|
+
* dataElementId: 'student',
|
|
239
|
+
* pageNumber: 1,
|
|
240
|
+
* pageSize: 10,
|
|
241
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade']
|
|
242
|
+
* });
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* // Custom element pagination with an optional sort.
|
|
246
|
+
* const response = await getListData({
|
|
247
|
+
* dataElementId: 'student',
|
|
248
|
+
* pageNumber: currentPage,
|
|
249
|
+
* pageSize: 10,
|
|
250
|
+
* displayFields: ['name', 'studentNumber', 'email', 'grade'],
|
|
251
|
+
* sort: [{ attributeId: 'name' }]
|
|
252
|
+
* });
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* // Explicit parent scoping when the list must be anchored to a specific parent.
|
|
213
256
|
* const listData = await getListData({
|
|
214
257
|
* dataElementId: 'customer',
|
|
215
258
|
* parentDataElementId: 'company',
|
|
@@ -218,6 +261,24 @@ export interface MassChangeResponse {
|
|
|
218
261
|
* pageSize: 50,
|
|
219
262
|
* displayFields: ['firstName', 'lastName', 'email']
|
|
220
263
|
* });
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* // options is rarely needed; omit it unless you need one of these behaviors.
|
|
267
|
+
* const response = await getListData(
|
|
268
|
+
* {
|
|
269
|
+
* dataElementId: 'student',
|
|
270
|
+
* pageNumber: 1,
|
|
271
|
+
* pageSize: 10,
|
|
272
|
+
* displayFields: ['name']
|
|
273
|
+
* },
|
|
274
|
+
* {
|
|
275
|
+
* search: {
|
|
276
|
+
* attributeId: 'name',
|
|
277
|
+
* value: 'Ada',
|
|
278
|
+
* total: 100
|
|
279
|
+
* }
|
|
280
|
+
* }
|
|
281
|
+
* );
|
|
221
282
|
*/
|
|
222
283
|
export declare function getListData(request: PagedListDataRequest, options?: ListDataOptions): Promise<ListDataResponse>;
|
|
223
284
|
/**
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* Simplified Stripe-oriented gateway preauth result shape accepted by the standalone payment endpoint.
|
|
4
|
+
*
|
|
5
|
+
* The SDK assumes Stripe and injects `paymentGateway: 'stripe'` when sending the request. Other gateway-specific
|
|
6
|
+
* fields may still be required by the backend decoder and payment processor, so unknown additional fields are
|
|
7
|
+
* preserved and sent through unchanged.
|
|
8
|
+
*/
|
|
9
|
+
export interface GatewayPaymentPreauthResult {
|
|
10
|
+
/** Billing info captured during payment entry. */
|
|
11
|
+
userBillingInfo: Record<string, any>;
|
|
12
|
+
/** Payment method identifier such as `creditCardOrOther` or `us_bank_account`. */
|
|
13
|
+
paymentMethod?: string;
|
|
14
|
+
/** Final amount that was preauthorized, including fees when applicable. */
|
|
15
|
+
totalAmount?: number;
|
|
16
|
+
/** Additional Stripe preauth data required by the backend, such as token IDs or saved payment method info. */
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Request payload for the standalone payment route.
|
|
21
|
+
*
|
|
22
|
+
* Notes:
|
|
23
|
+
* - `organizationKey` is sourced from `userContext.orgKey`.
|
|
24
|
+
* - `payerType` is assumed to be `SolutionUserProxy`.
|
|
25
|
+
* - `hostObjectKey`, `hostElementId`, and `hostAttributeId` identify the solution-defined object field that will be
|
|
26
|
+
* updated with the returned payment summary when processing completes.
|
|
27
|
+
*/
|
|
28
|
+
export interface StandalonePaymentRequest {
|
|
29
|
+
/** Payer object key. */
|
|
30
|
+
payerKey: string;
|
|
31
|
+
/** Organization key receiving the payment. */
|
|
32
|
+
payeeKey: string;
|
|
33
|
+
/** Base payment amount before any processing fee adjustments. */
|
|
34
|
+
paymentAmount: number;
|
|
35
|
+
/** Gateway preauthorization result produced by the payment UI flow. */
|
|
36
|
+
preAuthResult: GatewayPaymentPreauthResult;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this payment should be completed as a bank-account/ACH payment.
|
|
39
|
+
*
|
|
40
|
+
* If omitted, the SDK infers it from `preAuthResult.paymentMethod` for common ACH method values.
|
|
41
|
+
*/
|
|
42
|
+
bankAccountPayment?: boolean;
|
|
43
|
+
/** Key of the host object to update with payment results. */
|
|
44
|
+
hostObjectKey: string;
|
|
45
|
+
/** Data element ID of the host object to update with payment results. */
|
|
46
|
+
hostElementId: string;
|
|
47
|
+
/** Attribute ID on the host object that must exist in the solution data model to store the payment summary. */
|
|
48
|
+
hostAttributeId: string;
|
|
49
|
+
/** If true, the backend also creates a non-POS sales transaction linked to the host object. */
|
|
50
|
+
generateTransaction?: boolean;
|
|
51
|
+
/** Optional override for the payment/transaction description. */
|
|
52
|
+
chargeDescription?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Result returned by the standalone payment route.
|
|
56
|
+
*/
|
|
57
|
+
export interface StandalonePaymentResult {
|
|
58
|
+
/** Persisted payment object key. */
|
|
59
|
+
paymentKey: string;
|
|
60
|
+
/** User-facing payment summary string written back to the host attribute. */
|
|
61
|
+
paymentSummary: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Completes a previously preauthorized standalone payment.
|
|
65
|
+
*
|
|
66
|
+
* This endpoint performs the final charge, updates the host object's payment summary attribute,
|
|
67
|
+
* persists billing address information back to the payer, and can optionally generate a linked
|
|
68
|
+
* sales transaction.
|
|
69
|
+
*/
|
|
70
|
+
export declare function submitStandalonePayment(request: StandalonePaymentRequest): Promise<StandalonePaymentResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Observable version of submitStandalonePayment. See submitStandalonePayment for details.
|
|
73
|
+
*/
|
|
74
|
+
export declare function submitStandalonePaymentAsObservable(request: StandalonePaymentRequest): Observable<StandalonePaymentResult>;
|