Skip to content

Commit

Permalink
fix(project): not showing updated payment details
Browse files Browse the repository at this point in the history
  • Loading branch information
RCVZ authored and ChristiaanScheermeijer committed Jun 1, 2023
1 parent 9f0405e commit 30d65c1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion src/containers/AdyenPaymentDetails/AdyenPaymentDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export default function AdyenPaymentDetails({ setProcessing, type, setPaymentErr
setProcessing(true);

await finalizeAdyenPaymentDetails({ redirectResult: decodeURI(redirectResult) }, paymentMethodId);
await reloadActiveSubscription({ delay: 2000 });

setProcessing(false);
navigate(replaceQueryParam(location, 'u', 'payment-method-success'));
Expand Down Expand Up @@ -91,7 +92,6 @@ export default function AdyenPaymentDetails({ setProcessing, type, setPaymentErr

if ('action' in result) {
handleAction(result.action);
return;
}

await reloadActiveSubscription({ delay: 2000 });
Expand Down
6 changes: 0 additions & 6 deletions src/containers/UpdatePaymentMethod/UpdatePaymentMethod.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useEffect, useState } from 'react';
import { useLocation } from 'react-router';

import { useCheckoutStore } from '#src/stores/CheckoutStore';
import { getPaymentMethods, updatePayPalPaymentMethod } from '#src/stores/CheckoutController';
Expand All @@ -10,7 +9,6 @@ import PaymentMethodForm from '#components/PaymentMethodForm/PaymentMethodForm';
import useQueryParam from '#src/hooks/useQueryParam';
import { useAccountStore } from '#src/stores/AccountStore';
import PayPal from '#components/PayPal/PayPal';
import { addQueryParam } from '#src/utils/location';

type Props = {
onCloseButtonClick: () => void;
Expand All @@ -21,7 +19,6 @@ const UpdatePaymentMethod = ({ onCloseButtonClick }: Props) => {
const paymentMethodIdQueryParam = useQueryParam('paymentMethodId');
const parsedPaymentMethodId = paymentMethodIdQueryParam ? parseInt(paymentMethodIdQueryParam) : undefined;

const location = useLocation();
const activePayment = useAccountStore((state) => state.activePayment);
const currentPaymentId = activePayment?.id;
const [paymentError, setPaymentError] = useState<string | undefined>(undefined);
Expand Down Expand Up @@ -69,12 +66,9 @@ const UpdatePaymentMethod = ({ onCloseButtonClick }: Props) => {
const paymentMethod = paymentMethods?.find((method) => method.id === paymentMethodId);

if (paymentMethod?.methodName === 'card') {
const paymentSuccessUrl = addQueryParam(location, 'u', 'payment-method-success');

return (
<AdyenPaymentDetails
paymentMethodId={paymentMethod.id}
paymentSuccessUrl={paymentSuccessUrl}
setPaymentError={setPaymentError}
setProcessing={setProcessing}
error={paymentError}
Expand Down

0 comments on commit 30d65c1

Please sign in to comment.