diff --git a/src/libs/actions/PaymentMethods.js b/src/libs/actions/PaymentMethods.js index dc9ad432fd56..ddfd69f26d06 100644 --- a/src/libs/actions/PaymentMethods.js +++ b/src/libs/actions/PaymentMethods.js @@ -103,6 +103,34 @@ function getPaymentMethods() { }); } +function openPaymentsPage() { + const onyxData = { + optimisticData: [ + { + onyxMethod: 'merge', + key: ONYXKEYS.IS_LOADING_PAYMENT_METHODS, + value: true, + }, + ], + successData: [ + { + onyxMethod: 'merge', + key: ONYXKEYS.IS_LOADING_PAYMENT_METHODS, + value: false, + }, + ], + failureData: [ + { + onyxMethod: 'merge', + key: ONYXKEYS.IS_LOADING_PAYMENT_METHODS, + value: false, + }, + ], + }; + + return API.read('OpenPaymentsPage', {}, onyxData); +} + /** * Sets the default bank account or debit card for an Expensify Wallet * @@ -288,6 +316,7 @@ export { deleteDebitCard, deletePayPalMe, getPaymentMethods, + openPaymentsPage, makeDefaultPaymentMethod, addBillingCard, kycWallRef, diff --git a/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js b/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js index 56f39910e421..6b49dca8356f 100644 --- a/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js +++ b/src/pages/settings/Payments/PaymentsPage/BasePaymentsPage.js @@ -201,7 +201,7 @@ class BasePaymentsPage extends React.Component { } fetchData() { - PaymentMethods.getPaymentMethods(); + PaymentMethods.openPaymentsPage(); } /**