Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BasePaymentsPage to call "OpenPaymentMethods" #10161

Merged
merged 2 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions src/libs/actions/PaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,34 @@ function getPaymentMethods() {
});
}

function openPaymentsPage() {
const onyxData = {
optimisticData: [
{
onyxMethod: 'merge',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB: Looks like we've got a constant for onyxMethod: CONST.ONYX.METHOD.MERGE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a follow up PR for antoher part of this refactor, I'll fix it then

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
*
Expand Down Expand Up @@ -288,6 +316,7 @@ export {
deleteDebitCard,
deletePayPalMe,
getPaymentMethods,
openPaymentsPage,
makeDefaultPaymentMethod,
addBillingCard,
kycWallRef,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class BasePaymentsPage extends React.Component {
}

fetchData() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might just be missing it, but I'm not seeing the use of the onyx key IS_LOADING_PAYMENT_METHODS here - are we using it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its going to be used in KYCWall. Here and another spot.

PaymentMethods.getPaymentMethods();
PaymentMethods.openPaymentsPage();
}

/**
Expand Down