8080
8181<script lang="ts">
8282import { Component , Prop , Vue } from ' vue-property-decorator'
83- import { PaymentTypes , SessionStorageKeys } from ' @/util/constants'
83+ import { InvoiceStatus , PaymentTypes , SessionStorageKeys } from ' @/util/constants'
8484import { isErrorType , normalizeError } from ' @/util/error-util'
8585import { AccountSettings } from ' @/models/account-settings'
8686import CommonUtils from ' @/util/common-util'
@@ -123,6 +123,7 @@ export default class PaymentView extends Vue {
123123 returnUrl: string = ' '
124124 paymentCardData: any
125125 showPayWithOnlyCC: boolean = false
126+ invoiceDeleted: boolean = false
126127 async mounted () {
127128 this .showLoading = true
128129 if (! this .paymentId || ! this .redirectUrl ) {
@@ -137,6 +138,13 @@ export default class PaymentView extends Vue {
137138 // get the invoice and check for OB
138139 try {
139140 const invoice = await this .getInvoice ({ invoiceId: this .paymentId , accountId: accountSettings ?.id })
141+ if ([InvoiceStatus .DELETE_ACCEPTED , InvoiceStatus .DELETED ].includes (invoice ?.statusCode as InvoiceStatus )) {
142+ this .errorMessage = this .$t (' invoiceDeletedMessage' ).toString ()
143+ this .showErrorModal = true
144+ this .showLoading = false
145+ this .invoiceDeleted = true
146+ return
147+ }
140148 if (invoice ?.paymentMethod === PaymentTypes .ONLINE_BANKING ) {
141149 // get account data to show in the UI
142150 const paymentDetails: OrgPaymentDetails = await this .getOrgPayments (accountSettings ?.id )
@@ -159,7 +167,7 @@ export default class PaymentView extends Vue {
159167 console .error (' error in accessing the invoice.Defaulting to CC flow' )
160168 }
161169 }
162- if (! this .showOnlineBanking ) {
170+ if (! this .showOnlineBanking && ! this . invoiceDeleted ) {
163171 await this .doCreateTransaction ()
164172 }
165173 } catch (error ) {
0 commit comments