diff --git a/auth-web/package-lock.json b/auth-web/package-lock.json index 5eafa5e904..97efc9ae48 100644 --- a/auth-web/package-lock.json +++ b/auth-web/package-lock.json @@ -1,12 +1,12 @@ { "name": "auth-web", - "version": "2.5.10", + "version": "2.5.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "auth-web", - "version": "2.5.9", + "version": "2.5.11", "dependencies": { "@bcrs-shared-components/base-address": "2.0.3", "@bcrs-shared-components/bread-crumb": "1.0.8", diff --git a/auth-web/package.json b/auth-web/package.json index 3cc7f30762..29fdbf0a57 100644 --- a/auth-web/package.json +++ b/auth-web/package.json @@ -1,6 +1,6 @@ { "name": "auth-web", - "version": "2.5.10", + "version": "2.5.11", "appName": "Auth Web", "sbcName": "SBC Common Components", "private": true, diff --git a/auth-web/src/models/refund.ts b/auth-web/src/models/refund.ts new file mode 100644 index 0000000000..38c88f9e5c --- /dev/null +++ b/auth-web/src/models/refund.ts @@ -0,0 +1,10 @@ +export interface RefundRequest { + reason: string + refundRevenue?: RefundRevenueType[] +} + +export interface RefundRevenueType { + paymentLineItemId: string + refundAmount: number + refundType: string +} diff --git a/auth-web/src/routes/router.ts b/auth-web/src/routes/router.ts index 37be425b15..01b54b2c60 100644 --- a/auth-web/src/routes/router.ts +++ b/auth-web/src/routes/router.ts @@ -54,6 +54,7 @@ import PaymentView from '@/views/pay/PaymentView.vue' import PendingApprovalView from '@/views/auth/PendingApprovalView.vue' import PriceListView from '@/views/auth/PriceListView.vue' import ProfileDeactivatedView from '@/views/auth/ProfileDeactivatedView.vue' +import RefundViewVue from '@/views/pay/RefundView.vue' import RequestNameView from '@/views/auth/home/RequestNameView.vue' import RestrictedProductView from '@/views/auth/RestrictedProductView.vue' import ReviewAccountView from '@/views/auth/staff/ReviewAccountView.vue' @@ -829,6 +830,16 @@ export function getRoutes (): RouteConfig[] { }, props: (route) => ({ shortNameId: route.params.shortNameId }) }, + { + path: '/pay/refund', + name: 'refund', + component: RefundViewVue, + props: true, + meta: { + requiresAuth: true, + allowedRoles: [Role.CreateCredits, Role.FasRefund] + } + }, { path: '*', name: 'notfound', component: PageNotFound } ] diff --git a/auth-web/src/services/payment.services.ts b/auth-web/src/services/payment.services.ts index f476524c2c..461b5e4ac1 100644 --- a/auth-web/src/services/payment.services.ts +++ b/auth-web/src/services/payment.services.ts @@ -16,6 +16,7 @@ import ConfigHelper from '@/util/config-helper' import { LinkedShortNameFilterParams } from '@/models/pay/short-name' import { Payment } from '@/models/Payment' import { PaymentTypes } from '@/util/constants' +import { RefundRequest } from '@/models/refund' import { axios } from '@/util/http-util' export default class PaymentService { @@ -45,6 +46,11 @@ export default class PaymentService { ) } + static refundInvoice (invoiceId: string, refundPayload: RefundRequest): AxiosPromise { + const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${invoiceId}/refunds` + return axios.post(url, refundPayload) + } + static downloadOBInvoice (paymentId: string): AxiosPromise { const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${paymentId}/reports` const headers = { diff --git a/auth-web/src/stores/org.ts b/auth-web/src/stores/org.ts index 7e4b507cf1..5fdc44ad13 100644 --- a/auth-web/src/stores/org.ts +++ b/auth-web/src/stores/org.ts @@ -53,6 +53,7 @@ import KeyCloakService from 'sbc-common-components/src/services/keycloak.service import OrgService from '@/services/org.services' import PaymentService from '@/services/payment.services' import PermissionService from '@/services/permission.services' +import { RefundRequest } from './../models/refund' import StaffService from '@/services/staff.services' import UserService from '@/services/user.services' import { UserSettings } from 'sbc-common-components/src/models/userSettings' @@ -811,6 +812,11 @@ export const useOrgStore = defineStore('org', () => { return response?.data || {} } + async function refundInvoice (invoiceId, refundPayload: RefundRequest) { + const response = await PaymentService.refundInvoice(invoiceId, refundPayload) + return response?.data || {} + } + async function updateInvoicePaymentMethodAsCreditCard (invoicePayload) { const response = await PaymentService.updateInvoicePaymentMethodAsCreditCard(invoicePayload.paymentId, invoicePayload.accountId) return response?.data || {} @@ -1108,6 +1114,7 @@ export const useOrgStore = defineStore('org', () => { getProductList, addToCurrentSelectedProducts, resetoCurrentSelectedProducts, + refundInvoice, setSubscribedProducts, currentSelectedProductsPremiumOnly, fetchCurrentOrganizationGLInfo, diff --git a/auth-web/src/util/constants.ts b/auth-web/src/util/constants.ts index 86b036a0cc..8b60e8736f 100644 --- a/auth-web/src/util/constants.ts +++ b/auth-web/src/util/constants.ts @@ -48,7 +48,9 @@ export enum Role { ManageGlCodes = 'manage_gl_codes', FasSearch = 'fas_search', ViewAllTransactions = 'view_all_transactions', - ManageEft = 'manage_eft' + ManageEft = 'manage_eft', + CreateCredits = 'create_credits', + FasRefund = 'fas_refund' } export enum Pages { diff --git a/auth-web/src/views/pay/RefundView.vue b/auth-web/src/views/pay/RefundView.vue new file mode 100644 index 0000000000..49d244743c --- /dev/null +++ b/auth-web/src/views/pay/RefundView.vue @@ -0,0 +1,303 @@ + + +