Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add payment info for Unit Note submission #1598

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading