Skip to content

Commit

Permalink
Matching invoiceId for API call (#2745)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-barraza authored Feb 28, 2024
1 parent 65c1cb2 commit fa83cab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion auth-web/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 auth-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auth-web",
"version": "2.5.13",
"version": "2.5.14",
"appName": "Auth Web",
"sbcName": "SBC Common Components",
"private": true,
Expand Down
11 changes: 8 additions & 3 deletions auth-web/src/views/pay/RefundView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,13 @@ export default defineComponent({
refundResponse: ''
})
function fetchInvoice () {
function matchInvoiceId (invoiceId: string) {
// Should resolve REG0031233 -> 31233 etc.
const invoiceId = state.invoiceId.match(/\d+/)
return invoiceId.match(/\d+/)
}
function fetchInvoice () {
const invoiceId = matchInvoiceId(state.invoiceId)
state.orgStore.getInvoice({ invoiceId: invoiceId }).then((invoice: Invoice) => {
state.invoicePaid = invoice.paid
state.paymentLineItems = invoice.lineItems ? invoice.lineItems.map(item => ({
Expand Down Expand Up @@ -239,7 +243,8 @@ export default defineComponent({
})
}
const response = await state.orgStore.refundInvoice(state.invoiceId, refundPayload)
const invoiceId = matchInvoiceId(state.invoiceId)
const response = await state.orgStore.refundInvoice(invoiceId, refundPayload)
state.refundResponse = 'Refund successful.'
console.log('Refund successful:', response)
} catch (error) {
Expand Down

0 comments on commit fa83cab

Please sign in to comment.