Skip to content

Commit

Permalink
Fix retry payment not showing up after #15
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelosalloum committed Feb 9, 2024
1 parent 43e8a7d commit 958d198
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/components/RetryFailedPayment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import { useEffect } from "react";
import { Banner, Icon, Link, Loader } from "@stellar/design-system";
import { useQueryClient } from "@tanstack/react-query";
import { usePaymentsRetry } from "apiQueries/usePaymentsRetry";
import { PaymentDetailsStatusHistoryItem } from "types";
import { PaymentStatus } from "types";

interface RetryFailedPaymentProps {
paymentId: string;
paymentStatus: PaymentDetailsStatusHistoryItem[];
paymentStatus: PaymentStatus;
}

export const RetryFailedPayment = ({
paymentId,
paymentStatus,
}: RetryFailedPaymentProps) => {
const isFailed = paymentStatus.slice(-1)[0]?.status === "FAILED";
console.log("paymentStatus", paymentStatus);
const isFailed = paymentStatus === "FAILED";

console.log("isFailed", isFailed);

const { isFetching, data, isError, isSuccess, error, refetch } =
usePaymentsRetry([paymentId]);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/PaymentDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const PaymentDetails = () => {
<div className="DetailsSection">
<RetryFailedPayment
paymentId={formattedPayment.id}
paymentStatus={formattedPayment.statusHistory}
paymentStatus={formattedPayment.status}
/>

<SectionHeader>
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ export type PaymentDetails = {
senderAddress?: string;
totalAmount: string;
assetCode: string;
status: string;
status: PaymentStatus;
statusHistory: PaymentDetailsStatusHistoryItem[];
externalPaymentId?: string;
};
Expand Down

0 comments on commit 958d198

Please sign in to comment.