Skip to content

Commit

Permalink
24491 - EFT Instructions download update (#3175)
Browse files Browse the repository at this point in the history
  • Loading branch information
ochiu authored Dec 10, 2024
1 parent 9f611e2 commit bfb63d3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions auth-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion auth-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth-web",
"version": "2.6.124",
"version": "2.6.125",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
5 changes: 3 additions & 2 deletions auth-web/src/composables/downloader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import CommonUtils from '@/util/common-util'
import DocumentService from '@/services/document.services'
import { PayDocumentTypes } from '@/util/constants'
import PaymentService from '@/services/payment.services'
import { StatementListItem } from '@/models/statement'

export function useDownloader (orgStore, state) {
Expand All @@ -22,7 +23,7 @@ export function useDownloader (orgStore, state) {
async function downloadEFTInstructions () {
state.isLoading = true
try {
const downloadData = await DocumentService.getEftInstructions()
const downloadData = await PaymentService.getDocument(PayDocumentTypes.EFT_INSTRUCTIONS)
CommonUtils.fileDownload(downloadData?.data, `bcrs_eft_instructions.pdf`, downloadData?.headers['content-type'])
} catch (error) {
// eslint-disable-next-line no-console
Expand Down
10 changes: 0 additions & 10 deletions auth-web/src/services/document.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ export default class DocumentService {
})
}

static async getEftInstructions (): Promise<AxiosResponse> {
const instance = Axios.create()
return instance.get(`${ConfigHelper.getFileServerUrl()}/bcrs_eft_instructions.pdf`, {
responseType: 'arraybuffer',
headers: {
'Accept': 'application/pdf'
}
})
}

static async getSignedAffidavit (documentUrl: string, fileName: string): Promise<void> {
const data = await axios.get(documentUrl, {
responseType: 'arraybuffer'
Expand Down
8 changes: 8 additions & 0 deletions auth-web/src/services/payment.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ export default class PaymentService {
return axios.get(url, { params })
}

static getDocument (documentType: string): AxiosPromise<any> {
const headers = {
'Accept': 'application/pdf'
}
const url = `${ConfigHelper.getPayAPIURL()}/documents?documentType=${documentType}`
return axios.get(url, { headers, responseType: 'blob' as 'json' })
}

static downloadOBInvoice (paymentId: string): AxiosPromise<any> {
const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${paymentId}/reports`
const headers = {
Expand Down
4 changes: 4 additions & 0 deletions auth-web/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,10 @@ export enum paymentErrorType {
VALIDATION_ERROR = 'VALIDATION_ERROR',
}

export enum PayDocumentTypes {
EFT_INSTRUCTIONS = 'eftInstructions'
}

export enum StaffCreateAccountsTypes {
DIRECTOR_SEARCH = 'DIRECTOR_SEARCH',
GOVM_BUSINESS = 'GOVM_BUSINESS'
Expand Down

0 comments on commit bfb63d3

Please sign in to comment.