Skip to content

Commit

Permalink
19802- MVP Basic refund UI for ops only (bcgov#2735)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jxio authored Feb 21, 2024
1 parent 424be3a commit 7b4fcee
Show file tree
Hide file tree
Showing 8 changed files with 343 additions and 4 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.5.10",
"version": "2.5.11",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
10 changes: 10 additions & 0 deletions auth-web/src/models/refund.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export interface RefundRequest {
reason: string
refundRevenue?: RefundRevenueType[]
}

export interface RefundRevenueType {
paymentLineItemId: string
refundAmount: number
refundType: string
}
11 changes: 11 additions & 0 deletions auth-web/src/routes/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 }
]

Expand Down
6 changes: 6 additions & 0 deletions auth-web/src/services/payment.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -45,6 +46,11 @@ export default class PaymentService {
)
}

static refundInvoice (invoiceId: string, refundPayload: RefundRequest): AxiosPromise<any> {
const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${invoiceId}/refunds`
return axios.post(url, refundPayload)
}

static downloadOBInvoice (paymentId: string): AxiosPromise<any> {
const url = `${ConfigHelper.getPayAPIURL()}/payment-requests/${paymentId}/reports`
const headers = {
Expand Down
7 changes: 7 additions & 0 deletions auth-web/src/stores/org.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 || {}
Expand Down Expand Up @@ -1108,6 +1114,7 @@ export const useOrgStore = defineStore('org', () => {
getProductList,
addToCurrentSelectedProducts,
resetoCurrentSelectedProducts,
refundInvoice,
setSubscribedProducts,
currentSelectedProductsPremiumOnly,
fetchCurrentOrganizationGLInfo,
Expand Down
4 changes: 3 additions & 1 deletion auth-web/src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 7b4fcee

Please sign in to comment.