Skip to content
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
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "name-request",
"version": "5.8.1",
"version": "5.8.2",
"private": true,
"appName": "Name Request UI",
"sbcName": "SBC Common Components",
Expand Down
3 changes: 2 additions & 1 deletion app/src/interfaces/payment-models.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { FilingTypes, Jurisdictions } from '@/enums'
import { FilingTypes, Jurisdictions, PaymentAction } from '@/enums'
import { ErrorI } from '@/interfaces'

export interface NameRequestPaymentResponse {
action: PaymentAction
id: number
nrId: string
nrNum: string
Expand Down
14 changes: 13 additions & 1 deletion app/src/mixins/payment-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useErrorStore, usePaymentStore, useStore } from '@/store'
import { AxiosRequestConfig } from 'axios'
import { ACCEPTED, CREATED, NO_CONTENT, OK, PAYMENT_REQUIRED } from 'http-status-codes'
import { SessionStorageKeys } from 'sbc-common-components/src/util/constants'
import { PaymentStatus, StaffPaymentOptions, NrState, PaymentMethod, SbcPaymentStatus } from '@/enums'
import { PaymentStatus, StaffPaymentOptions, NrState, PaymentMethod, SbcPaymentStatus, PaymentAction } from '@/enums'
import { ActionMixin } from '@/mixins'
import { StaffPaymentIF, RefundParamsIF, NameRequestI, ErrorI, CreatePaymentParams, FetchFeesParams,
NameRequestPaymentResponse } from '@/interfaces'
Expand All @@ -22,6 +22,7 @@ export class PaymentMixin extends Mixins(ActionMixin) {
@Action(usePaymentStore) setPaymentReceipt!: (receipt: any) => void
@Action(usePaymentStore) setPaymentRequest!: (req: any) => void
@Action(usePaymentStore) setSbcPayment!: (payment: any) => void
@Action(useStore) setFolioNumber!: (folioNumber: string) => void
@Action(useStore) setRefundParams!: (refundParams: RefundParamsIF) => void
@Action(useErrorStore) setAppError!: (err: ErrorI) => void

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

this.setPayments(paymentsResponse)

// find the first payment in the returned array that has action = CREATE and has sbcPayment.folioNumber set
const paymentWithFolio = paymentsResponse?.find(
payment =>
payment?.action === PaymentAction.CREATE &&
payment?.sbcPayment?.folioNumber
)
if (paymentWithFolio?.sbcPayment?.folioNumber) {
this.setFolioNumber(paymentWithFolio.sbcPayment.folioNumber)
}

return true
} catch (err) {
// don't console.error - getNameRequestPayments() already did that
Expand Down
Loading