Compare commits
2 Commits
5976f8e088
...
01179d646e
| Author | SHA1 | Date |
|---|---|---|
|
|
01179d646e | |
|
|
7ebb5faa2f |
|
|
@ -1,9 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { useParams, useSearchParams } from 'react-router-dom'
|
import { useParams, useSearchParams } from 'react-router-dom'
|
||||||
import { Alert } from '../components/alert/Alert'
|
|
||||||
import { usePaymentNavigation } from '../features/payments/lib/navigation'
|
import { usePaymentNavigation } from '../features/payments/lib/navigation'
|
||||||
import { usePaymentStatus } from '../features/payments/lib/usePaymentStatus'
|
import { usePaymentStatus } from '../features/payments/lib/usePaymentStatus'
|
||||||
import { Env } from '../lib/env'
|
|
||||||
import type { PaymentStatusResponse } from '../features/payments/lib/midtrans'
|
import type { PaymentStatusResponse } from '../features/payments/lib/midtrans'
|
||||||
import { Logger } from '../lib/logger'
|
import { Logger } from '../lib/logger'
|
||||||
import { CountdownRedirect } from '../components/CountdownRedirect'
|
import { CountdownRedirect } from '../components/CountdownRedirect'
|
||||||
|
|
@ -80,24 +78,6 @@ export function PaymentStatusPage() {
|
||||||
}
|
}
|
||||||
}, [isLoading, error, data])
|
}, [isLoading, error, data])
|
||||||
|
|
||||||
function statusBadgeClass(s: PaymentStatusResponse['status']) {
|
|
||||||
switch (s) {
|
|
||||||
case 'pending':
|
|
||||||
return 'inline-block rounded px-2 py-0.5 text-xs bg-yellow-100 text-yellow-800'
|
|
||||||
case 'settlement':
|
|
||||||
case 'capture':
|
|
||||||
return 'inline-block rounded px-2 py-0.5 text-xs bg-green-100 text-green-800'
|
|
||||||
case 'deny':
|
|
||||||
case 'cancel':
|
|
||||||
case 'expire':
|
|
||||||
case 'refund':
|
|
||||||
case 'chargeback':
|
|
||||||
return 'inline-block rounded px-2 py-0.5 text-xs bg-red-100 text-red-800'
|
|
||||||
default:
|
|
||||||
return 'inline-block rounded px-2 py-0.5 text-xs bg-gray-100 text-gray-800'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// User-friendly status messages
|
// User-friendly status messages
|
||||||
function getStatusMessage(s: PaymentStatusResponse['status']) {
|
function getStatusMessage(s: PaymentStatusResponse['status']) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue