81 lines
1.7 KiB
TypeScript
81 lines
1.7 KiB
TypeScript
/**
|
|
* Orders Domain - Salesforce Query Helpers
|
|
*
|
|
* Generates the field lists required for querying Salesforce Orders and OrderItems.
|
|
*/
|
|
|
|
const UNIQUE = <T>(values: T[]): T[] => Array.from(new Set(values));
|
|
|
|
export function buildOrderSelectFields(
|
|
additional: string[] = []
|
|
): string[] {
|
|
const fields = [
|
|
"Id",
|
|
"AccountId",
|
|
"Status",
|
|
"Type",
|
|
"EffectiveDate",
|
|
"OrderNumber",
|
|
"TotalAmount",
|
|
"CreatedDate",
|
|
"LastModifiedDate",
|
|
"Pricebook2Id",
|
|
"Activation_Type__c",
|
|
"Activation_Status__c",
|
|
"Activation_Scheduled_At__c",
|
|
"Activation_Error_Code__c",
|
|
"Activation_Error_Message__c",
|
|
"Activation_Last_Attempt_At__c",
|
|
"ActivatedDate",
|
|
"Internet_Plan_Tier__c",
|
|
"Installment_Plan__c",
|
|
"Access_Mode__c",
|
|
"Weekend_Install__c",
|
|
"Hikari_Denwa__c",
|
|
"VPN_Region__c",
|
|
"SIM_Type__c",
|
|
"SIM_Voice_Mail__c",
|
|
"SIM_Call_Waiting__c",
|
|
"EID__c",
|
|
"WHMCS_Order_ID__c",
|
|
"Address_Changed__c",
|
|
];
|
|
|
|
return UNIQUE([...fields, ...additional]);
|
|
}
|
|
|
|
export function buildOrderItemSelectFields(
|
|
additional: string[] = []
|
|
): string[] {
|
|
const fields = [
|
|
"Id",
|
|
"OrderId",
|
|
"Quantity",
|
|
"UnitPrice",
|
|
"TotalPrice",
|
|
"PricebookEntry.Id",
|
|
"Billing_Cycle__c",
|
|
"WHMCS_Service_ID__c",
|
|
];
|
|
|
|
return UNIQUE([...fields, ...additional]);
|
|
}
|
|
|
|
export function buildOrderItemProduct2Fields(
|
|
additional: string[] = []
|
|
): string[] {
|
|
const fields = [
|
|
"Id",
|
|
"Name",
|
|
"StockKeepingUnit",
|
|
"Item_Class__c",
|
|
"Billing_Cycle__c",
|
|
"WH_Product_ID__c",
|
|
"Internet_Offering_Type__c",
|
|
"Internet_Plan_Tier__c",
|
|
"VPN_Region__c",
|
|
];
|
|
|
|
return UNIQUE([...fields, ...additional]);
|
|
}
|