Apply patch [skip ci]
This commit is contained in:
parent
9d32ac4968
commit
ee8aa46bbf
@ -30,7 +30,7 @@ export default function PaymentMethodsList(
|
|||||||
ProcessedPaymentMethod[]
|
ProcessedPaymentMethod[]
|
||||||
>([]);
|
>([]);
|
||||||
const [isProcessing, setIsProcessing] = useState(false);
|
const [isProcessing, setIsProcessing] = useState(false);
|
||||||
const [_isOpeningModal, setIsOpeningModal] = useState(openModal);
|
const [_isOpeningModal, _setIsOpeningModal] = useState(openModal);
|
||||||
|
|
||||||
// Process payment methods on component mount and when paymentMethods or userId change
|
// Process payment methods on component mount and when paymentMethods or userId change
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -63,7 +63,7 @@ export default function PaymentMethodsList(
|
|||||||
const updatedMethods: ProcessedPaymentMethod[] = [];
|
const updatedMethods: ProcessedPaymentMethod[] = [];
|
||||||
|
|
||||||
for (const method of paymentMethods) {
|
for (const method of paymentMethods) {
|
||||||
const processedMethod = { ...method };
|
const processedMethod: ProcessedPaymentMethod = { ...method };
|
||||||
|
|
||||||
// Decrypt and mask account number
|
// Decrypt and mask account number
|
||||||
if (method.account_number_encrypted) {
|
if (method.account_number_encrypted) {
|
||||||
@ -75,8 +75,8 @@ export default function PaymentMethodsList(
|
|||||||
if (decryptedData) {
|
if (decryptedData) {
|
||||||
const accountNumber = decryptedData;
|
const accountNumber = decryptedData;
|
||||||
// Show only last 4 digits
|
// Show only last 4 digits
|
||||||
processedMethod.maskedAccountNumber = "****" +
|
processedMethod.maskedAccountNumber =
|
||||||
accountNumber.slice(-4);
|
"****" + accountNumber.slice(-4);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to decrypt account number:", error);
|
console.error("Failed to decrypt account number:", error);
|
||||||
@ -93,8 +93,8 @@ export default function PaymentMethodsList(
|
|||||||
if (decryptedData) {
|
if (decryptedData) {
|
||||||
const routingNumber = decryptedData;
|
const routingNumber = decryptedData;
|
||||||
// Show only last 4 digits
|
// Show only last 4 digits
|
||||||
processedMethod.maskedRoutingNumber = "****" +
|
processedMethod.maskedRoutingNumber =
|
||||||
routingNumber.slice(-4);
|
"****" + routingNumber.slice(-4);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to decrypt routing number:", error);
|
console.error("Failed to decrypt routing number:", error);
|
||||||
@ -147,8 +147,7 @@ export default function PaymentMethodsList(
|
|||||||
{popupAddPaymentMethodDialog}
|
{popupAddPaymentMethodDialog}
|
||||||
|
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
{processedMethods.length === 0
|
{processedMethods.length === 0 ? (
|
||||||
? (
|
|
||||||
<div class="text-center py-12 bg-white rounded-lg shadow">
|
<div class="text-center py-12 bg-white rounded-lg shadow">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@ -172,14 +171,13 @@ export default function PaymentMethodsList(
|
|||||||
</p>
|
</p>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsOpeningModal(true)}
|
onClick={() => _setIsOpeningModal(true)}
|
||||||
class="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-6 rounded-lg transition-colors"
|
class="bg-blue-600 hover:bg-blue-700 text-white font-semibold py-2 px-6 rounded-lg transition-colors"
|
||||||
>
|
>
|
||||||
Add Payment Method
|
Add Payment Method
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
) : (
|
||||||
: (
|
|
||||||
<>
|
<>
|
||||||
<ul class="space-y-4">
|
<ul class="space-y-4">
|
||||||
{processedMethods.map((method) => (
|
{processedMethods.map((method) => (
|
||||||
@ -274,7 +272,7 @@ export default function PaymentMethodsList(
|
|||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsOpeningModal(true)}
|
onClick={() => _setIsOpeningModal(true)}
|
||||||
class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-6 rounded-lg shadow transition-colors flex items-center justify-center gap-2"
|
class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-6 rounded-lg shadow transition-colors flex items-center justify-center gap-2"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user