import MainLayout from '../layouts/main';
import PaymentVerifyContainer from './container';
import PaymentFailure from './payment-failure';
import Segment from '../shared/segment';
import useQueryParams from '../../hooks/query-params';

function PaymentVerifyPage() {
  const { status, code, error } = useQueryParams();

  return (
    <MainLayout>
      <Segment>
        {status === '200' ? (
          <PaymentVerifyContainer code={code} />
        ) : (
          <PaymentFailure code={code} error={error} />
        )}
      </Segment>
    </MainLayout>
  );
}

export default PaymentVerifyPage;
