Skip to content

Commit 1d5a40d

Browse files
authored
30032 - NR Payments - Renewal Payments do not have option to add Folio Number (#853)
* bugfix: Add folio number to RENEW payment when the first payment already had it - bump version to 5.8.3 * chore: Update folio number assignment logic to use PaymentAction.CREATE filter * cleanup
1 parent 53255fe commit 1d5a40d

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "name-request",
3-
"version": "5.8.1",
3+
"version": "5.8.2",
44
"private": true,
55
"appName": "Name Request UI",
66
"sbcName": "SBC Common Components",

app/src/interfaces/payment-models.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { FilingTypes, Jurisdictions } from '@/enums'
1+
import { FilingTypes, Jurisdictions, PaymentAction } from '@/enums'
22
import { ErrorI } from '@/interfaces'
33

44
export interface NameRequestPaymentResponse {
5+
action: PaymentAction
56
id: number
67
nrId: string
78
nrNum: string

app/src/mixins/payment-mixin.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useErrorStore, usePaymentStore, useStore } from '@/store'
44
import { AxiosRequestConfig } from 'axios'
55
import { ACCEPTED, CREATED, NO_CONTENT, OK, PAYMENT_REQUIRED } from 'http-status-codes'
66
import { SessionStorageKeys } from 'sbc-common-components/src/util/constants'
7-
import { PaymentStatus, StaffPaymentOptions, NrState, PaymentMethod, SbcPaymentStatus } from '@/enums'
7+
import { PaymentStatus, StaffPaymentOptions, NrState, PaymentMethod, SbcPaymentStatus, PaymentAction } from '@/enums'
88
import { ActionMixin } from '@/mixins'
99
import { StaffPaymentIF, RefundParamsIF, NameRequestI, ErrorI, CreatePaymentParams, FetchFeesParams,
1010
NameRequestPaymentResponse } from '@/interfaces'
@@ -22,6 +22,7 @@ export class PaymentMixin extends Mixins(ActionMixin) {
2222
@Action(usePaymentStore) setPaymentReceipt!: (receipt: any) => void
2323
@Action(usePaymentStore) setPaymentRequest!: (req: any) => void
2424
@Action(usePaymentStore) setSbcPayment!: (payment: any) => void
25+
@Action(useStore) setFolioNumber!: (folioNumber: string) => void
2526
@Action(useStore) setRefundParams!: (refundParams: RefundParamsIF) => void
2627
@Action(useErrorStore) setAppError!: (err: ErrorI) => void
2728

@@ -582,6 +583,17 @@ export class PaymentMixin extends Mixins(ActionMixin) {
582583
if (!paymentsResponse) throw new Error('Got error from getNameRequestPayments()')
583584

584585
this.setPayments(paymentsResponse)
586+
587+
// find the first payment in the returned array that has action = CREATE and has sbcPayment.folioNumber set
588+
const paymentWithFolio = paymentsResponse?.find(
589+
payment =>
590+
payment?.action === PaymentAction.CREATE &&
591+
payment?.sbcPayment?.folioNumber
592+
)
593+
if (paymentWithFolio?.sbcPayment?.folioNumber) {
594+
this.setFolioNumber(paymentWithFolio.sbcPayment.folioNumber)
595+
}
596+
585597
return true
586598
} catch (err) {
587599
// don't console.error - getNameRequestPayments() already did that

0 commit comments

Comments
 (0)