@simpleapps-com/augur-api
Version:
TypeScript client library for Augur microservices API endpoints
722 lines • 41.2 kB
JavaScript
import { z } from 'zod';
import { BaseServiceClient } from '../../core/base-client';
import { BaseResponseSchema } from '../../core/schemas';
// Create flexible response schemas using the STANDARD 8-field response format
// All APIs must use this format - no response validation per OpenAPI spec requirements
const UnknownResponseSchema = BaseResponseSchema(z.unknown());
const UnknownArrayResponseSchema = BaseResponseSchema(z.array(z.unknown()));
import { AddressSchema, CashDrawerSchema, CompanySchema, P21CodeSchema, LocationSchema, PaymentTypeSchema, HealthCheckResponseSchema, AddressListParamsSchema, AddressCorpListParamsSchema, AddressEnableParamsSchema, CashDrawerListParamsSchema, CompanyListParamsSchema, CompanyDetailParamsSchema, P21CodeListParamsSchema, LocationListParamsSchema, PaymentTypeListParamsSchema, } from './schemas';
/**
* P21 Core API Client
* @description Client for interacting with P21 Core system API endpoints for address management, cash drawer operations, company data, location management, and payment processing within the Prophet 21 ERP system
* @fullPath api.p21Core
* @service p21-core
* @domain enterprise-resource-planning
* @discoverable true
* @searchTerms ["p21-core", "prophet 21", "ERP", "addresses", "cash drawer", "company data", "locations", "payment types", "shipping methods", "business operations", "corporate addresses"]
* @relatedEndpoints ["api.p21Core.address", "api.p21Core.cashDrawer", "api.p21Core.company", "api.p21Core.location", "api.p21Core.paymentTypes", "api.p21Core.codes"]
* @commonPatterns ["ERP data management", "Address and shipping setup", "Cash drawer operations", "Company configuration", "Location management", "Payment processing setup"]
* @workflow ["erp-setup", "address-management", "financial-operations", "location-configuration", "payment-processing"]
* @prerequisites ["Valid P21 system access", "ERP authentication", "Company-specific permissions"]
* @nextSteps ["api.commerce.cartHeaders for e-commerce integration", "api.orders for order processing", "api.pricing for pricing management"]
* @businessRules ["Company-scoped data access", "Location-based permissions", "Cash drawer security controls", "Address validation for shipping"]
* @functionalArea "enterprise-resource-planning"
* @caching "Cache company and location data for 30 minutes, real-time for cash drawer operations"
* @performance "Supports pagination for all list operations, optimized for ERP transaction volumes"
* @example
* ```typescript
* import { HTTPClient } from '@augur/api-client/core';
* import { P21CoreClient } from '@augur/api-client/services/p21-core';
*
* const client = new P21CoreClient(new HTTPClient({ baseURL: 'https://p21-core.augur-api.com' }));
*
* // List companies with pagination
* const companies = await client.company.list({ limit: 20, offset: 0 });
* console.log(companies.data); // Company[]
*
* // Get company details
* const company = await client.company.get({ companyUid: 123 });
* console.log(company.data); // Company
*
* // List addresses for shipping configuration
* const addresses = await client.address.list({ carrierFlag: 'Y' });
* console.log(addresses.data); // Address[]
*
* // Get cash drawer status
* const cashDrawers = await client.cashDrawer.list({ statusCd: 704 });
* ```
*/
export class P21CoreClient extends BaseServiceClient {
// Ensure schemas are referenced to avoid unused import warnings
get schemaRefs() {
return this._schemaRefs;
}
/**
* Create a new P21CoreClient instance
* @param http Configured HTTPClient instance with authentication
* @param baseUrl Base URL for the P21 Core API (default: https://p21-core.augur-api.com)
*/
constructor(http, baseUrl = 'https://p21-core.augur-api.com') {
super('p21-core', http, baseUrl);
// Schema references for 100% coverage - ensuring all exports are imported
this._schemaRefs = {
AddressSchema,
CashDrawerSchema,
CompanySchema,
P21CodeSchema,
LocationSchema,
PaymentTypeSchema,
};
/**
* Address management operations for shipping and delivery configuration
* @fullPath api.p21Core.address
* @service p21-core
* @domain address-and-shipping-management
* @discoverable true
*/
this.address = {
/**
* List all addresses with filtering capabilities for shipping method configuration
*
* @fullPath api.p21Core.address.list
* @service p21-core
* @domain address-and-shipping-management
* @dataMethod listData - returns only the address array without metadata
* @discoverable true
* @searchTerms ["addresses", "shipping", "delivery", "locations", "carriers", "shipping methods"]
* @relatedEndpoints ["api.p21Core.address.get", "api.p21Core.location.list", "api.commerce.cartHeaders.shipping"]
* @commonPatterns ["List shipping addresses", "Configure delivery options", "Manage carrier settings"]
* @workflow ["address-setup", "shipping-configuration", "delivery-management"]
* @prerequisites ["Valid authentication", "Address management permissions"]
* @nextSteps ["api.p21Core.address.get for details", "api.p21Core.address.enable for activation"]
* @businessRules ["Carrier flag controls shipping availability", "Status codes determine address visibility", "Default codes set primary shipping methods"]
* @functionalArea "address-and-shipping-management"
* @caching "Cache for 15 minutes, invalidate on address changes"
* @performance "Supports filtering by carrier, status, and default flags for efficient queries"
*
* @param params Optional filtering parameters for addresses
* @returns Promise<BaseResponse<Address[]>> Complete response with addresses array and metadata
*
* @example
* ```typescript
* // Get all active shipping addresses
* const response = await client.address.list({ carrierFlag: 'Y', statusCd: 704 });
* console.log(response.data); // Address[]
*
* // Get just the data
* const addresses = await client.address.listData({ enabledCd: 704 });
*
* // Get default shipping methods
* const defaults = await client.address.list({ defaultCd: 704 });
* ```
*/
list: this.createListMethod('/address', AddressListParamsSchema, UnknownArrayResponseSchema),
/**
* Get address details by ID for shipping method configuration
*
* @fullPath api.p21Core.address.get
* @service p21-core
* @domain address-and-shipping-management
* @dataMethod getData - returns only the address object without metadata
* @discoverable true
* @searchTerms ["address details", "shipping method", "delivery configuration", "carrier info"]
* @relatedEndpoints ["api.p21Core.address.list", "api.p21Core.address.corpAddressList", "api.p21Core.location.get"]
* @commonPatterns ["Get shipping address details", "View delivery configuration", "Check carrier settings"]
* @workflow ["address-details", "shipping-setup", "delivery-configuration"]
* @prerequisites ["Valid address ID", "Address access permissions"]
* @nextSteps ["api.p21Core.address.enable for status changes", "api.p21Core.address.setDefault for primary selection"]
* @businessRules ["Address ID must exist in system", "User must have access to address company"]
* @functionalArea "address-and-shipping-management"
* @performance "Direct lookup by ID, very fast response"
*
* @param params Address ID parameter
* @returns Promise<BaseResponse<Address>> Complete response with address details
*/
get: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/address/{id}',
responseSchema: UnknownResponseSchema,
}, undefined, { id: params.id });
},
/**
* Get corporate address list for multi-location shipping setup
*
* @fullPath api.p21Core.address.corpAddressList
* @service p21-core
* @domain address-and-shipping-management
* @dataMethod corpAddressListData - returns only the corporate addresses array
* @discoverable true
* @searchTerms ["corporate addresses", "multi-location", "branch shipping", "company locations"]
* @relatedEndpoints ["api.p21Core.address.get", "api.p21Core.company.list", "api.p21Core.location.list"]
* @commonPatterns ["Setup multi-location shipping", "Configure branch addresses", "Manage corporate locations"]
* @workflow ["multi-location-setup", "corporate-shipping", "branch-management"]
* @prerequisites ["Valid address ID", "Corporate address access permissions"]
* @nextSteps ["api.p21Core.location.list for location details", "api.p21Core.company.get for company info"]
* @businessRules ["Returns addresses associated with specified location", "Supports search filtering", "Pagination for large datasets"]
* @functionalArea "address-and-shipping-management"
* @caching "Cache for 20 minutes, corporate addresses change infrequently"
* @performance "Indexed by address ID and company, supports text search"
*/
corpAddressList: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/address/{id}/corp-address',
paramsSchema: AddressCorpListParamsSchema,
responseSchema: UnknownArrayResponseSchema,
}, params, { id: params.id });
},
/**
* Set address as default shipping method for automated selection
*
* @fullPath api.p21Core.address.setDefault
* @service p21-core
* @domain address-and-shipping-management
* @dataMethod setDefaultData - returns confirmation without metadata
* @discoverable true
* @searchTerms ["default shipping", "primary address", "automatic selection", "shipping defaults"]
* @relatedEndpoints ["api.p21Core.address.list", "api.p21Core.address.enable", "api.commerce.cartHeaders.defaultShipping"]
* @commonPatterns ["Set primary shipping method", "Configure automatic selection", "Update default address"]
* @workflow ["shipping-defaults", "address-configuration", "automatic-selection"]
* @prerequisites ["Valid address ID", "Address modification permissions"]
* @nextSteps ["api.p21Core.address.list to verify changes", "api.commerce.cartHeaders for cart integration"]
* @businessRules ["Only one default per address type", "Must be enabled address", "Updates system-wide defaults"]
* @functionalArea "address-and-shipping-management"
* @performance "Immediate update with cache invalidation"
*/
setDefault: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/address/{id}/default',
responseSchema: UnknownResponseSchema,
}, undefined, { id: params.id });
},
/**
* Enable or disable address as shipping method for availability control
*
* @fullPath api.p21Core.address.enable
* @service p21-core
* @domain address-and-shipping-management
* @dataMethod enableData - returns status confirmation without metadata
* @discoverable true
* @searchTerms ["enable address", "disable shipping", "address status", "shipping availability"]
* @relatedEndpoints ["api.p21Core.address.list", "api.p21Core.address.setDefault", "api.commerce.cartHeaders.availableShipping"]
* @commonPatterns ["Enable shipping method", "Disable delivery option", "Control address availability"]
* @workflow ["address-activation", "shipping-control", "availability-management"]
* @prerequisites ["Valid address ID", "Address modification permissions"]
* @nextSteps ["api.p21Core.address.list to verify status", "api.p21Core.address.setDefault if enabling primary"]
* @businessRules ["Status codes: 704=enabled, 705=disabled, blank=inherited", "Disabled addresses hidden from selection", "Status affects availability in e-commerce"]
* @functionalArea "address-and-shipping-management"
* @performance "Immediate status update with real-time availability"
*/
enable: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/address/{id}/enable',
paramsSchema: AddressEnableParamsSchema,
responseSchema: UnknownResponseSchema,
}, params, { id: params.id });
},
/**
* Trigger data refresh for address synchronization
*
* @fullPath api.p21Core.address.refresh
* @service p21-core
* @domain address-and-shipping-management
* @dataMethod refreshData - returns refresh status without metadata
* @discoverable true
* @searchTerms ["refresh addresses", "sync data", "update cache", "data synchronization"]
* @relatedEndpoints ["api.p21Core.address.list", "api.p21Core.health.check"]
* @commonPatterns ["Sync address data", "Refresh shipping options", "Update cached information"]
* @workflow ["data-synchronization", "cache-refresh", "system-maintenance"]
* @prerequisites ["System admin permissions", "Data refresh authorization"]
* @nextSteps ["api.p21Core.address.list to verify updated data"]
* @businessRules ["Triggers background synchronization", "May take time for large datasets", "Updates all address-related caches"]
* @functionalArea "address-and-shipping-management"
* @performance "Asynchronous operation, returns immediately"
*/
refresh: async () => {
return this.executeRequest({
method: 'GET',
path: '/address/refresh',
responseSchema: UnknownResponseSchema,
});
},
// Data methods for address operations
listData: async (params) => {
const response = await this.address.list(params);
return response.data;
},
getData: async (params) => {
const response = await this.address.get(params);
return response.data;
},
corpAddressListData: async (params) => {
const response = await this.address.corpAddressList(params);
return response.data;
},
setDefaultData: async (params) => {
const response = await this.address.setDefault(params);
return response.data;
},
enableData: async (params) => {
const response = await this.address.enable(params);
return response.data;
},
refreshData: async () => {
const response = await this.address.refresh();
return response.data;
},
};
/**
* Cash drawer management operations for point-of-sale and financial transactions
* @fullPath api.p21Core.cashDrawer
* @service p21-core
* @domain financial-and-pos-management
* @discoverable true
*/
this.cashDrawer = {
/**
* List cash drawers with filtering for financial management and POS operations
*
* @fullPath api.p21Core.cashDrawer.list
* @service p21-core
* @domain financial-and-pos-management
* @dataMethod listData - returns only the cash drawer array without metadata
* @discoverable true
* @searchTerms ["cash drawers", "point of sale", "POS", "financial", "cash management", "drawer operations"]
* @relatedEndpoints ["api.p21Core.cashDrawer.get", "api.p21Core.company.list", "api.orders.invoices.list"]
* @commonPatterns ["List POS cash drawers", "Financial drawer management", "Cash operation monitoring"]
* @workflow ["pos-operations", "cash-management", "financial-reconciliation"]
* @prerequisites ["Valid authentication", "Cash drawer access permissions", "Company access rights"]
* @nextSteps ["api.p21Core.cashDrawer.get for details", "api.orders.invoices for transaction history"]
* @businessRules ["Status codes control drawer availability", "Company ID filters by location", "Drawer open status affects operations"]
* @functionalArea "financial-and-pos-management"
* @caching "Cache for 5 minutes only, financial data needs freshness"
* @performance "Real-time queries for accurate cash positions, supports company filtering"
*
* @param params Optional filtering parameters for cash drawers
* @returns Promise<BaseResponse<CashDrawer[]>> Complete response with cash drawer array and metadata
*
* @example
* ```typescript
* // Get active cash drawers for a company
* const response = await client.cashDrawer.list({ companyId: 'MAIN', statusCd: 704 });
* console.log(response.data); // CashDrawer[]
*
* // Get just the data
* const drawers = await client.cashDrawer.listData({ statusCd: 704 });
*
* // Search for specific drawer
* const found = await client.cashDrawer.list({ q: 'register1' });
* ```
*/
list: this.createListMethod('/cash_drawer', CashDrawerListParamsSchema, UnknownArrayResponseSchema),
/**
* Get cash drawer details by UID for detailed financial information
*
* @fullPath api.p21Core.cashDrawer.get
* @service p21-core
* @domain financial-and-pos-management
* @dataMethod getData - returns only the cash drawer object without metadata
* @discoverable true
* @searchTerms ["cash drawer details", "POS details", "financial balance", "drawer status", "cash position"]
* @relatedEndpoints ["api.p21Core.cashDrawer.list", "api.orders.invoices.cashTransactions", "api.p21Core.company.get"]
* @commonPatterns ["Get drawer balance", "Check cash position", "View POS status", "Financial reconciliation"]
* @workflow ["cash-operations", "financial-reporting", "pos-management", "drawer-reconciliation"]
* @prerequisites ["Valid cash drawer UID", "Financial access permissions"]
* @nextSteps ["api.orders.invoices for transaction details", "financial reporting systems"]
* @businessRules ["Real-time balance calculations", "Includes opening balance, deposits, withdrawals", "Shows current drawer status (open/closed)"]
* @functionalArea "financial-and-pos-management"
* @performance "Direct lookup by UID, includes calculated balances"
*
* @param params Cash drawer UID parameter
* @returns Promise<BaseResponse<CashDrawer>> Complete response with cash drawer details including balances
*/
get: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/cash_drawer/{cashDrawerUid}',
responseSchema: UnknownResponseSchema,
}, undefined, { cashDrawerUid: params.cashDrawerUid });
},
// Data methods for cash drawer operations
listData: async (params) => {
const response = await this.cashDrawer.list(params);
return response.data;
},
getData: async (params) => {
const response = await this.cashDrawer.get(params);
return response.data;
},
};
/**
* Company management operations for enterprise configuration and corporate data
* @fullPath api.p21Core.company
* @service p21-core
* @domain company-and-corporate-management
* @discoverable true
*/
this.company = {
/**
* List companies with filtering for enterprise management and corporate structure
*
* @fullPath api.p21Core.company.list
* @service p21-core
* @domain company-and-corporate-management
* @dataMethod listData - returns only the company array without metadata
* @discoverable true
* @searchTerms ["companies", "corporate", "enterprise", "business entities", "organizations", "company list"]
* @relatedEndpoints ["api.p21Core.company.get", "api.p21Core.location.list", "api.customers.customer.list"]
* @commonPatterns ["List corporate entities", "Enterprise structure management", "Company directory", "Business organization"]
* @workflow ["corporate-setup", "enterprise-management", "business-configuration", "multi-company-operations"]
* @prerequisites ["Valid authentication", "Company access permissions"]
* @nextSteps ["api.p21Core.company.get for details", "api.p21Core.location.list for company locations"]
* @businessRules ["Company ID filtering by access rights", "Search supports company name and ID", "Ordering by UID or custom fields"]
* @functionalArea "company-and-corporate-management"
* @caching "Cache for 30 minutes, company data changes infrequently"
* @performance "Indexed by company ID and name, supports text search and sorting"
*
* @param params Optional filtering and pagination parameters
* @returns Promise<BaseResponse<Company[]>> Complete response with company array and metadata
*
* @example
* ```typescript
* // Get all companies with pagination
* const response = await client.company.list({ limit: 50, offset: 0 });
* console.log(response.data); // Company[]
*
* // Get just the data
* const companies = await client.company.listData();
*
* // Search for specific company
* const found = await client.company.list({ q: 'Acme Corp' });
*
* // Filter by company ID
* const specific = await client.company.list({ companyId: 'ACME' });
* ```
*/
list: this.createListMethod('/company', CompanyListParamsSchema, UnknownArrayResponseSchema),
/**
* Get company details by UID for detailed corporate information
*
* @fullPath api.p21Core.company.get
* @service p21-core
* @domain company-and-corporate-management
* @dataMethod getData - returns only the company object without metadata
* @discoverable true
* @searchTerms ["company details", "corporate info", "business entity", "organization details", "company profile"]
* @relatedEndpoints ["api.p21Core.company.list", "api.p21Core.location.list", "api.customers.customer.companyCustomers"]
* @commonPatterns ["Get corporate details", "View business information", "Company profile lookup", "Enterprise configuration"]
* @workflow ["company-details", "corporate-profile", "business-configuration", "enterprise-setup"]
* @prerequisites ["Valid company UID", "Company access permissions"]
* @nextSteps ["api.p21Core.location.list for company locations", "api.customers.customer.list for company customers"]
* @businessRules ["Company UID must exist", "Optional company ID parameter for validation", "Includes address and location references"]
* @functionalArea "company-and-corporate-management"
* @performance "Direct lookup by UID, includes related entity references"
*
* @param params Company UID and optional company ID
* @returns Promise<BaseResponse<Company>> Complete response with detailed company information
*/
get: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/company/{companyUid}',
paramsSchema: CompanyDetailParamsSchema,
responseSchema: UnknownResponseSchema,
}, params, { companyUid: params.companyUid });
},
// Data methods for company operations
listData: async (params) => {
const response = await this.company.list(params);
return response.data;
},
getData: async (params) => {
const response = await this.company.get(params);
return response.data;
},
};
/**
* P21 system codes and reference data operations
* @fullPath api.p21Core.codes
* @service p21-core
* @domain system-configuration
* @discoverable true
*/
this.codes = {
/**
* Search P21 system codes for configuration and reference data lookup
*
* @fullPath api.p21Core.codes.search
* @service p21-core
* @domain system-configuration
* @dataMethod searchData - returns only the codes array without metadata
* @discoverable true
* @searchTerms ["P21 codes", "system codes", "reference data", "configuration codes", "lookup values"]
* @relatedEndpoints ["api.p21Core.company.list", "api.p21Core.location.list", "api.items.categories.list"]
* @commonPatterns ["Lookup system codes", "Reference data search", "Configuration values", "Code validation"]
* @workflow ["system-configuration", "reference-lookup", "data-validation", "code-management"]
* @prerequisites ["Valid search query", "System configuration access"]
* @nextSteps ["Use codes for configuration", "api.p21Core.company for related entities"]
* @businessRules ["Search query required", "Code number filtering available", "Language-specific descriptions"]
* @functionalArea "system-configuration"
* @caching "Cache for 60 minutes, system codes rarely change"
* @performance "Full-text search on descriptions, indexed by code numbers"
*
* @param params Search parameters including required query
* @returns Promise<BaseResponse<P21Code[]>> Complete response with matching system codes
*
* @example
* ```typescript
* // Search for status codes
* const response = await client.codes.search({ q: 'status' });
* console.log(response.data); // P21Code[]
*
* // Get just the data
* const codes = await client.codes.searchData({ q: 'shipping' });
*
* // Filter by specific code numbers
* const filtered = await client.codes.search({
* q: 'status',
* codeNoList: '704,705,700'
* });
* ```
*/
search: this.createListMethod('/code-p21', P21CodeListParamsSchema, UnknownArrayResponseSchema),
// Data method for codes operations
searchData: async (params) => {
const response = await this.codes.search(params);
return response.data;
},
};
/**
* Location management operations for warehouse and distribution center configuration
* @fullPath api.p21Core.location
* @service p21-core
* @domain location-and-warehouse-management
* @discoverable true
*/
this.location = {
/**
* List locations with filtering for warehouse and distribution management
*
* @fullPath api.p21Core.location.list
* @service p21-core
* @domain location-and-warehouse-management
* @dataMethod listData - returns only the location array without metadata
* @discoverable true
* @searchTerms ["locations", "warehouses", "distribution centers", "facilities", "branches", "sites"]
* @relatedEndpoints ["api.p21Core.location.get", "api.p21Core.company.list", "api.items.invLoc.list"]
* @commonPatterns ["List warehouse locations", "Distribution center management", "Facility directory", "Branch operations"]
* @workflow ["location-setup", "warehouse-management", "distribution-configuration", "facility-operations"]
* @prerequisites ["Valid authentication", "Location access permissions"]
* @nextSteps ["api.p21Core.location.get for details", "api.items.invLoc for inventory locations"]
* @businessRules ["Delete flag filters inactive locations", "Distribution center flag for DC identification", "Company scoped access"]
* @functionalArea "location-and-warehouse-management"
* @caching "Cache for 20 minutes, location data semi-static"
* @performance "Indexed by location ID and name, supports text search"
*
* @param params Optional filtering and pagination parameters
* @returns Promise<BaseResponse<Location[]>> Complete response with location array and metadata
*
* @example
* ```typescript
* // Get all active locations
* const response = await client.location.list({ deleteFlag: 'N' });
* console.log(response.data); // Location[]
*
* // Get just the data
* const locations = await client.location.listData();
*
* // Search for distribution centers
* const dcs = await client.location.list({ q: 'distribution' });
* ```
*/
list: this.createListMethod('/location', LocationListParamsSchema, UnknownArrayResponseSchema),
/**
* Get location details by ID for warehouse and facility information
*
* @fullPath api.p21Core.location.get
* @service p21-core
* @domain location-and-warehouse-management
* @dataMethod getData - returns only the location object without metadata
* @discoverable true
* @searchTerms ["location details", "warehouse info", "facility details", "distribution center", "branch info"]
* @relatedEndpoints ["api.p21Core.location.list", "api.p21Core.company.get", "api.items.invLoc.locationInventory"]
* @commonPatterns ["Get warehouse details", "View facility information", "Location configuration", "Distribution center setup"]
* @workflow ["location-details", "warehouse-configuration", "facility-management", "shipping-setup"]
* @prerequisites ["Valid location ID", "Location access permissions"]
* @nextSteps ["api.items.invLoc for inventory", "api.p21Core.company for company details"]
* @businessRules ["Location ID must exist", "Includes shipping integration settings", "Company association required"]
* @functionalArea "location-and-warehouse-management"
* @performance "Direct lookup by location ID, includes shipping configurations"
*
* @param params Location ID parameter
* @returns Promise<BaseResponse<Location>> Complete response with detailed location information
*/
get: async (params) => {
return this.executeRequest({
method: 'GET',
path: '/location/{locationId}',
responseSchema: UnknownResponseSchema,
}, undefined, { locationId: params.locationId });
},
// Data methods for location operations
listData: async (params) => {
const response = await this.location.list(params);
return response.data;
},
getData: async (params) => {
const response = await this.location.get(params);
return response.data;
},
};
/**
* Payment type management operations for payment processing configuration
* @fullPath api.p21Core.paymentTypes
* @service p21-core
* @domain payment-processing
* @discoverable true
*/
this.paymentTypes = {
/**
* List payment types for payment processing and checkout configuration
*
* @fullPath api.p21Core.paymentTypes.list
* @service p21-core
* @domain payment-processing
* @dataMethod listData - returns only the payment types array without metadata
* @discoverable true
* @searchTerms ["payment types", "payment methods", "payment processing", "checkout options", "billing methods"]
* @relatedEndpoints ["api.payments.unified.paymentMethods", "api.commerce.checkout.paymentOptions", "api.orders.invoices.paymentHistory"]
* @commonPatterns ["List payment options", "Payment method configuration", "Checkout setup", "Billing configuration"]
* @workflow ["payment-setup", "checkout-configuration", "payment-processing", "billing-management"]
* @prerequisites ["Valid authentication", "Payment configuration access"]
* @nextSteps ["api.payments.unified for payment processing", "api.commerce.checkout for integration"]
* @businessRules ["Payment types define available options", "Configuration affects checkout flow", "Integration with payment processors"]
* @functionalArea "payment-processing"
* @caching "Cache for 45 minutes, payment types change infrequently"
* @performance "Simple list operation, minimal data volume"
*
* @param params Optional pagination parameters
* @returns Promise<BaseResponse<PaymentType[]>> Complete response with payment types array
*
* @example
* ```typescript
* // Get all payment types
* const response = await client.paymentTypes.list();
* console.log(response.data); // PaymentType[]
*
* // Get just the data
* const paymentTypes = await client.paymentTypes.listData();
*
* // Paginated results
* const paged = await client.paymentTypes.list({ limit: 20, offset: 0 });
* ```
*/
list: this.createListMethod('/payment-types', PaymentTypeListParamsSchema, UnknownArrayResponseSchema),
// Data method for payment types operations
listData: async (params) => {
const response = await this.paymentTypes.list(params);
return response.data;
},
};
/**
* Health check operations for service monitoring and system status verification
* @fullPath api.p21Core.health
* @service p21-core
* @domain system-monitoring
* @discoverable true
*/
this.health = {
/**
* Perform health check to verify P21 Core service status and connectivity
*
* @fullPath api.p21Core.health.check
* @service p21-core
* @domain system-monitoring
* @dataMethod checkData - returns only the health status without metadata
* @discoverable true
* @searchTerms ["health check", "service status", "system monitor", "service availability", "connectivity test"]
* @relatedEndpoints ["api.p21Core.ping", "system monitoring endpoints"]
* @commonPatterns ["Check service health", "Monitor system status", "Verify connectivity", "Service diagnostics"]
* @workflow ["system-monitoring", "health-verification", "service-diagnostics"]
* @prerequisites ["System access", "Monitoring permissions"]
* @nextSteps ["Service remediation if unhealthy", "Integration health checks"]
* @businessRules ["Returns site configuration", "Includes system hash for verification", "No authentication required"]
* @functionalArea "system-monitoring"
* @performance "Lightweight check, immediate response"
*
* @returns Promise<BaseResponse<HealthCheckResponse>> Service health status and configuration
*/
check: async () => {
return this.executeRequest({
method: 'GET',
path: '/health-check',
responseSchema: HealthCheckResponseSchema,
});
},
/**
* Ping endpoint for basic connectivity testing and service availability
*
* @fullPath api.p21Core.health.ping
* @service p21-core
* @domain system-monitoring
* @dataMethod pingData - returns only the ping response without metadata
* @discoverable true
* @searchTerms ["ping", "connectivity", "service alive", "basic check", "availability test"]
* @relatedEndpoints ["api.p21Core.health.check"]
* @commonPatterns ["Test connectivity", "Basic availability check", "Service ping", "Network test"]
* @workflow ["connectivity-testing", "basic-monitoring", "network-verification"]
* @prerequisites ["Network access"]
* @nextSteps ["Full health check if ping succeeds"]
* @businessRules ["Minimal response for speed", "No authentication required", "Returns simple pong response"]
* @functionalArea "system-monitoring"
* @performance "Fastest possible response, minimal processing"
*
* @returns Promise<BaseResponse<string>> Simple ping response confirmation
*/
ping: async () => {
return this.executeRequest({
method: 'GET',
path: '/ping',
responseSchema: UnknownResponseSchema,
});
},
// Data methods for health operations
checkData: async () => {
const response = await this.health.check();
return response.data;
},
pingData: async () => {
const response = await this.health.ping();
return response.data;
},
};
/**
* Health Data Operations
* @description Direct access to health check data without response metadata
*/
this.healthData = {
/**
* Get health check data without response metadata
* @returns Promise<unknown> Health status data directly
*/
check: async () => {
const response = await this.health.check();
return response.data;
},
/**
* Get ping data without response metadata
* @returns Promise<unknown> Ping response data directly
*/
ping: async () => {
const response = await this.health.ping();
return response.data;
},
};
// Reference schemas to ensure 100% import coverage
void this.schemaRefs;
}
}
//# sourceMappingURL=client.js.map