generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ORV2-2223-v2
- Loading branch information
Showing
39 changed files
with
3,167 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ concurrency: | |
jobs: | ||
cleanup: | ||
name: Cleanup OpenShift and/or Promote Images | ||
needs: [sleep] | ||
uses: bcgov/quickstart-openshift-helpers/.github/workflows/[email protected] | ||
secrets: | ||
oc_namespace: ${{ vars.OC_NAMESPACE }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
138 changes: 138 additions & 0 deletions
138
frontend/src/features/settings/apiManager/creditAccount.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
import { | ||
CreditAccountData, | ||
CreditAccountLimitType, | ||
CreditAccountStatusType, | ||
} from "../types/creditAccount"; | ||
import { CREDIT_ACCOUNT_API_ROUTES } from "../apiManager/endpoints/endpoints"; | ||
import { | ||
httpDELETERequest, | ||
httpGETRequest, | ||
httpPOSTRequest, | ||
httpPUTRequest, | ||
} from "../../../common/apiManager/httpRequestHandler"; | ||
import { CompanyProfile } from "../../manageProfile/types/manageProfile"; | ||
|
||
/** | ||
* Backend request to create a credit account. | ||
* @param creditAccountData Information about the credit account action for the company | ||
* @returns Result of the credit account action, or error on fail | ||
*/ | ||
export const createCreditAccount = async (data: { | ||
companyId: number; | ||
creditLimit: CreditAccountLimitType; | ||
}) => { | ||
const { companyId, creditLimit } = data; | ||
return await httpPOSTRequest( | ||
CREDIT_ACCOUNT_API_ROUTES.CREATE_CREDIT_ACCOUNT(companyId), | ||
{ creditLimit }, | ||
); | ||
}; | ||
|
||
/** | ||
* Get credit account information for related to the given company ID | ||
* @returns Credit account information for the company | ||
*/ | ||
export const getCreditAccount = async ( | ||
companyId: number, | ||
): Promise<CreditAccountData> => { | ||
const response = await httpGETRequest( | ||
CREDIT_ACCOUNT_API_ROUTES.GET_CREDIT_ACCOUNT(companyId), | ||
); | ||
return response.data; | ||
}; | ||
|
||
/** | ||
* Get credit account users for the given credit account ID | ||
* @param companyId Identifier of the company with which the credit Account is associated | ||
* @param creditAccountId Identifier of the credit account to retrieve | ||
* @returns List of credit account users for the credit account | ||
*/ | ||
export const getCreditAccountUsers = async (data: { | ||
companyId: number; | ||
creditAccountId: number; | ||
}) => { | ||
const { companyId, creditAccountId } = data; | ||
const response = await httpGETRequest( | ||
CREDIT_ACCOUNT_API_ROUTES.GET_CREDIT_ACCOUNT_USERS( | ||
companyId, | ||
creditAccountId, | ||
), | ||
); | ||
return response.data; | ||
}; | ||
|
||
/** | ||
* Add a user to credit account | ||
* @param companyId Identifier of the company with which the credit Account is associated | ||
* @param creditAccountId Id of the credit account we wish to add a user to | ||
* @param userData Id of the company who is being added to the credit account | ||
* @returns companyProfile | ||
*/ | ||
export const addCreditAccountUser = async (data: { | ||
companyId: number; | ||
creditAccountId: number; | ||
userData: CompanyProfile; | ||
}) => { | ||
const { companyId, creditAccountId, userData } = data; | ||
const response = await httpPUTRequest( | ||
CREDIT_ACCOUNT_API_ROUTES.ADD_CREDIT_ACCOUNT_USER( | ||
companyId, | ||
creditAccountId, | ||
), | ||
{ | ||
companyId: userData.companyId, | ||
}, | ||
); | ||
return response; | ||
}; | ||
|
||
/** | ||
* Removes active users of a credit account identified by their client numbers. | ||
* @param companyId Identifier of the company with which the credit Account is associated | ||
* @param userClientNumbers The array of user client numbers of the users to be removed. | ||
* @returns A promise indicating the success or failure of the remove operation. | ||
*/ | ||
export const removeCreditAccountUsers = async (data: { | ||
companyId: number; | ||
creditAccountId: number; | ||
companyIds: number[]; | ||
}) => { | ||
const { companyId, creditAccountId, companyIds } = data; | ||
const response = await httpDELETERequest( | ||
CREDIT_ACCOUNT_API_ROUTES.REMOVE_CREDIT_ACCOUNT_USER( | ||
companyId, | ||
creditAccountId, | ||
), | ||
{ | ||
companyIds, | ||
}, | ||
); | ||
return response; | ||
}; | ||
|
||
/** | ||
* Backend request to hold/unhold/close/reopen a credit account. | ||
* @param companyId Identifier of the company with which the credit Account is associated | ||
* @param creditAccountId Id of the credit account we wish to add a user to | ||
* @param status The intended status for the credit account to be updated to | ||
* @param reason The reason why the status has been updated | ||
* @returns Result of the update action, or error on fail | ||
*/ | ||
|
||
export const updateCreditAccountStatus = async (data: { | ||
companyId: number; | ||
creditAccountId: number; | ||
status: CreditAccountStatusType; | ||
reason?: string; | ||
}) => { | ||
const { companyId, creditAccountId, status, reason } = data; | ||
|
||
const response = await httpPUTRequest( | ||
CREDIT_ACCOUNT_API_ROUTES.UPDATE_ACCOUNT_STATUS(companyId, creditAccountId), | ||
{ | ||
creditAccountStatusType: status, | ||
comment: reason, | ||
}, | ||
); | ||
return response; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.