Skip to content

Commit

Permalink
Add payment info for Unit Note submission (#1598)
Browse files Browse the repository at this point in the history
* Add payment info for Unit Notes submission
  • Loading branch information
dimak1 authored Oct 24, 2023
1 parent ce5dc70 commit 1bc668d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ppr-ui/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 ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "2.1.19",
"version": "2.1.20",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
7 changes: 6 additions & 1 deletion ppr-ui/src/composables/mhrInformation/useMhrUnitNote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { storeToRefs } from 'pinia'
import { cloneDeep } from 'lodash'
import { computed } from 'vue-demi'
import { AdminRegistrationNotes, UnitNotesInfo } from '@/resources'
import { useNewMhrRegistration } from '../mhrRegistration'

export const useMhrUnitNote = () => {
const {
Expand All @@ -19,6 +20,10 @@ export const useMhrUnitNote = () => {
setMhrUnitNoteRegistration
} = useStore()

const {
parseStaffPayment
} = useNewMhrRegistration()

// Build Unit Note payload data with all the submission rules
const buildPayload = (unitNoteData: UnitNoteRegistrationIF): UnitNoteRegistrationIF => {
// Person Giving Notice is optional for Decal Replacement (102), Public Note (NPUB), Confidential Note (NCON)
Expand Down Expand Up @@ -76,7 +81,7 @@ export const useMhrUnitNote = () => {
const payloadData = buildPayload(cloneDeep(unitNoteData))
// determine if it's admin registration based on document type
const isAdminRegistration = !!AdminRegistrationNotes.includes(unitNoteData.note.documentType)
return submitMhrUnitNote(getMhrInformation.value.mhrNumber, payloadData, isAdminRegistration)
return submitMhrUnitNote(getMhrInformation.value.mhrNumber, payloadData, isAdminRegistration, parseStaffPayment())
}

// Make optional Person Giving Notice fields for certain Unit Note types
Expand Down
5 changes: 3 additions & 2 deletions ppr-ui/src/utils/mhr-api-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,12 @@ export async function submitMhrTransfer (payloadData, mhrNumber, staffPayment) {
}

// Register a Unit Note on an existing manufactured home.
export async function submitMhrUnitNote (mhrNumber, payloadData, isAdminRegistration) {
export async function submitMhrUnitNote (mhrNumber, payloadData, isAdminRegistration, staffPayment) {
try {
const paymentParams = mhrStaffPaymentParameters(staffPayment)
// different Unit Notes are submitted to different endpoints
const endpoint = isAdminRegistration ? `admin-registrations/${mhrNumber}` : `notes/${mhrNumber}`
const result = await axios.post(endpoint, payloadData, getDefaultConfig())
const result = await axios.post(`${endpoint}?${paymentParams}`, payloadData, getDefaultConfig())
if (!result?.data) {
throw new Error('Invalid API response')
}
Expand Down

0 comments on commit 1bc668d

Please sign in to comment.