Skip to content
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
8 changes: 4 additions & 4 deletions src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {AppState} from 'react-native';
import Onyx from 'react-native-onyx';
import lodashGet from 'lodash/get';
import ONYXKEYS from '../../ONYXKEYS';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import CONST from '../../CONST';
import Log from '../Log';
import Performance from '../Performance';
Expand Down Expand Up @@ -49,13 +49,13 @@ function setCurrentURL(url) {
*/
function setLocale(locale) {
if (currentUserAccountID) {
API.PreferredLocale_Update({name: 'preferredLocale', value: locale});
DeprecatedAPI.PreferredLocale_Update({name: 'preferredLocale', value: locale});
}
Onyx.merge(ONYXKEYS.NVP_PREFERRED_LOCALE, locale);
}

function getLocale() {
API.Get({
DeprecatedAPI.Get({
returnValueList: 'nameValuePairs',
nvpNames: ONYXKEYS.NVP_PREFERRED_LOCALE,
}).then((response) => {
Expand Down Expand Up @@ -125,7 +125,7 @@ function getAppData(shouldSyncPolicyList = true, shouldSyncVBA = true) {
* because some migrations might create new chat reports or their change data.
*/
function fixAccountAndReloadData() {
API.User_FixAccount()
DeprecatedAPI.User_FixAccount()
.then((response) => {
if (!response.changed) {
return;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/BankAccounts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'underscore';
import Onyx from 'react-native-onyx';
import CONST from '../../CONST';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import * as Plaid from './Plaid';
import * as ReimbursementAccount from './ReimbursementAccount';
import ONYXKEYS from '../../ONYXKEYS';
Expand Down Expand Up @@ -51,7 +51,7 @@ function addPersonalBankAccount(account, password, plaidLinkToken) {
const unmaskedAccount = _.find(Plaid.getPlaidBankAccounts(), bankAccount => (
bankAccount.plaidAccountID === account.plaidAccountID
));
API.BankAccount_Create({
DeprecatedAPI.BankAccount_Create({
accountNumber: unmaskedAccount.accountNumber,
addressName: unmaskedAccount.addressName,
allowDebit: false,
Expand Down Expand Up @@ -103,7 +103,7 @@ function addPersonalBankAccount(account, password, plaidLinkToken) {
* @param {Number} bankAccountID
*/
function deleteBankAccount(bankAccountID) {
API.DeleteBankAccount({
DeprecatedAPI.DeleteBankAccount({
bankAccountID,
}).then((response) => {
if (response.jsonCode === 200) {
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/GeoLocation.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable import/prefer-default-export */
import Onyx from 'react-native-onyx';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import ONYXKEYS from '../../ONYXKEYS';

/**
* Makes a request so that we can get the current country code by the users IP address.
*/
function fetchCountryCodeByRequestIP() {
API.GetRequestCountryCode()
DeprecatedAPI.GetRequestCountryCode()
.then((data) => {
Onyx.merge(ONYXKEYS.COUNTRY_CODE, data.countryCode || 1);
});
Expand Down
18 changes: 9 additions & 9 deletions src/libs/actions/IOU.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import _ from 'underscore';
import CONST from '../../CONST';
import ONYXKEYS from '../../ONYXKEYS';
import ROUTES from '../../ROUTES';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import * as Report from './Report';
import Navigation from '../Navigation/Navigation';
import Growl from '../Growl';
Expand All @@ -19,7 +19,7 @@ import Log from '../Log';
* @param {Number} requestParams.chatReportID the ID of the chat report that the IOU report belongs to
*/
function getIOUReportsForNewTransaction(requestParams) {
API.Get({
DeprecatedAPI.Get({
returnValueList: 'reportStuff',
reportIDList: _.pluck(requestParams, 'reportID').join(','),
shouldLoadOptionalKeys: true,
Expand Down Expand Up @@ -109,7 +109,7 @@ function startLoadingAndResetError() {
*/
function createIOUTransaction(params) {
startLoadingAndResetError();
API.CreateIOUTransaction(params)
DeprecatedAPI.CreateIOUTransaction(params)
.then((response) => {
if (response.jsonCode !== 200) {
processIOUErrorResponse(response);
Expand All @@ -134,7 +134,7 @@ function createIOUSplit(params) {
startLoadingAndResetError();

let chatReportID;
API.CreateChatReport({
DeprecatedAPI.CreateChatReport({
emailList: _.map(params.splits, participant => participant.email).join(','),
})
.then((response) => {
Expand All @@ -143,7 +143,7 @@ function createIOUSplit(params) {
}

chatReportID = response.reportID;
return API.CreateIOUSplit({
return DeprecatedAPI.CreateIOUSplit({
...params,
splits: JSON.stringify(params.splits),
reportID: response.reportID,
Expand Down Expand Up @@ -186,7 +186,7 @@ function createIOUSplit(params) {
function createIOUSplitGroup(params) {
startLoadingAndResetError();

API.CreateIOUSplit({
DeprecatedAPI.CreateIOUSplit({
...params,
splits: JSON.stringify(params.splits),
})
Expand Down Expand Up @@ -215,7 +215,7 @@ function rejectTransaction({
Onyx.merge(ONYXKEYS.TRANSACTIONS_BEING_REJECTED, {
[transactionID]: true,
});
API.RejectTransaction({
DeprecatedAPI.RejectTransaction({
reportID,
transactionID,
comment,
Expand Down Expand Up @@ -295,8 +295,8 @@ function payIOUReport({
Onyx.merge(ONYXKEYS.IOU, {loading: true, error: false});

const payIOUPromise = paymentMethodType === CONST.IOU.PAYMENT_TYPE.EXPENSIFY
? API.PayWithWallet({reportID, newIOUReportDetails})
: API.PayIOU({reportID, paymentMethodType, newIOUReportDetails});
? DeprecatedAPI.PayWithWallet({reportID, newIOUReportDetails})
: DeprecatedAPI.PayIOU({reportID, paymentMethodType, newIOUReportDetails});

// Build the url for the user's platform of choice if they have selected something other than a manual settlement or Expensify Wallet e.g. Venmo or PayPal.me
let url;
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Inbox.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Onyx from 'react-native-onyx';
import ONYXKEYS from '../../ONYXKEYS';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import Growl from '../Growl';
import * as Localize from '../Localize';
import Navigation from '../Navigation/Navigation';
Expand All @@ -18,7 +18,7 @@ function requestInboxCall({
taskID, policyID, firstName, lastName, phoneNumber, phoneNumberExtension,
}) {
Onyx.merge(ONYXKEYS.REQUEST_CALL_FORM, {loading: true});
API.Inbox_CallUser({
DeprecatedAPI.Inbox_CallUser({
policyID,
firstName,
lastName,
Expand Down Expand Up @@ -47,7 +47,7 @@ function requestInboxCall({
}

function getInboxCallWaitTime() {
API.Inbox_CallUser_WaitTime()
DeprecatedAPI.Inbox_CallUser_WaitTime()
.then((data) => {
Onyx.set(ONYXKEYS.INBOX_CALL_USER_WAIT_TIME, data.waitTime);
});
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ONYXKEYS from '../../ONYXKEYS';
import Growl from '../Growl';
import * as Localize from '../Localize';
import CONST from '../../CONST';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import CONFIG from '../../CONFIG';
import asyncOpenURL from '../asyncOpenURL';

Expand Down Expand Up @@ -42,7 +42,7 @@ function openOldDotLink(url) {
return `${CONFIG.EXPENSIFY.EXPENSIFY_URL}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${shortLivedAuthToken}&email=${encodeURIComponent(currentUserEmail)}`;
}

asyncOpenURL(API.GetShortLivedAuthToken(), buildOldDotURL);
asyncOpenURL(DeprecatedAPI.GetShortLivedAuthToken(), buildOldDotURL);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/NameValuePair.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import _ from 'underscore';
import Onyx from 'react-native-onyx';
import lodashGet from 'lodash/get';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';

/**
* Gets the value of an NVP
Expand All @@ -11,7 +11,7 @@ import * as API from '../API';
* @param {*} [defaultValue]
*/
function get(name, onyxKey, defaultValue) {
API.Get({
DeprecatedAPI.Get({
returnValueList: 'nameValuePairs',
name,
})
Expand All @@ -29,7 +29,7 @@ function get(name, onyxKey, defaultValue) {
* @param {String} [onyxKeyName]
*/
function set(name, value, onyxKeyName) {
API.SetNameValuePair({name, value: _.isObject(value) ? JSON.stringify(value) : value});
DeprecatedAPI.SetNameValuePair({name, value: _.isObject(value) ? JSON.stringify(value) : value});

// Update the associated onyx key if we've passed the associated key name
if (onyxKeyName) {
Expand Down
12 changes: 6 additions & 6 deletions src/libs/actions/PaymentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {createRef} from 'react';
import lodashGet from 'lodash/get';
import Onyx from 'react-native-onyx';
import ONYXKEYS from '../../ONYXKEYS';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import CONST from '../../CONST';
import Growl from '../Growl';
import * as Localize from '../Localize';
Expand All @@ -20,7 +20,7 @@ import NameValuePair from './NameValuePair';
* @returns {Promise}
*/
function deleteDebitCard(fundID) {
return API.DeleteFund({fundID})
return DeprecatedAPI.DeleteFund({fundID})
.then((response) => {
if (response.jsonCode === 200) {
Growl.show(Localize.translateLocal('paymentsPage.deleteDebitCardSuccess'), CONST.GROWL.SUCCESS, 3000);
Expand Down Expand Up @@ -66,7 +66,7 @@ function continueSetup() {
*/
function getPaymentMethods() {
Onyx.set(ONYXKEYS.IS_LOADING_PAYMENT_METHODS, true);
return API.Get({
return DeprecatedAPI.Get({
returnValueList: 'bankAccountList, fundList, userWallet, nameValuePairs',
name: 'paypalMeAddress',
includeDeleted: false,
Expand Down Expand Up @@ -98,7 +98,7 @@ function getPaymentMethods() {
* @returns {Promise}
*/
function setWalletLinkedAccount(password, bankAccountID, fundID) {
return API.SetWalletLinkedAccount({
return DeprecatedAPI.SetWalletLinkedAccount({
password,
bankAccountID,
fundID,
Expand Down Expand Up @@ -141,7 +141,7 @@ function addBillingCard(params) {
const cardYear = CardUtils.getYearFromExpirationDateString(params.expirationDate);

Onyx.merge(ONYXKEYS.ADD_DEBIT_CARD_FORM, {submitting: true});
API.AddBillingCard({
DeprecatedAPI.AddBillingCard({
cardNumber: params.cardNumber,
cardYear,
cardMonth,
Expand Down Expand Up @@ -208,7 +208,7 @@ function transferWalletBalance(paymentMethod) {
};
Onyx.merge(ONYXKEYS.WALLET_TRANSFER, {loading: true});

API.TransferWalletBalance(parameters)
DeprecatedAPI.TransferWalletBalance(parameters)
.then((response) => {
if (response.jsonCode !== 200) {
throw new Error(response.message);
Expand Down
16 changes: 8 additions & 8 deletions src/libs/actions/PersonalDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Onyx from 'react-native-onyx';
import Str from 'expensify-common/lib/str';
import ONYXKEYS from '../../ONYXKEYS';
import CONST from '../../CONST';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import NameValuePair from './NameValuePair';
import * as LoginUtils from '../LoginUtils';
import * as ReportUtils from '../ReportUtils';
Expand Down Expand Up @@ -121,7 +121,7 @@ function formatPersonalDetails(personalDetailsList) {
* @returns {Promise}
*/
function fetchPersonalDetails() {
return API.Get({
return DeprecatedAPI.Get({
returnValueList: 'personalDetailsList',
})
.then((data) => {
Expand Down Expand Up @@ -201,7 +201,7 @@ function getFromReportParticipants(reports) {
return;
}

API.PersonalDetails_GetForEmails({emailList: participantEmails.join(',')})
DeprecatedAPI.PersonalDetails_GetForEmails({emailList: participantEmails.join(',')})
.then((data) => {
const existingDetails = _.pick(data, participantEmails);

Expand Down Expand Up @@ -274,7 +274,7 @@ function mergeLocalPersonalDetails(details) {
* @param {boolean} shouldGrowl
*/
function setPersonalDetails(details, shouldGrowl) {
API.PersonalDetails_Update({details: JSON.stringify(details)})
DeprecatedAPI.PersonalDetails_Update({details: JSON.stringify(details)})
.then((response) => {
if (response.jsonCode === 200) {
if (details.timezone) {
Expand All @@ -300,7 +300,7 @@ function setPersonalDetails(details, shouldGrowl) {
* @returns {Object}
*/
function getCurrencyList() {
return API.GetCurrencyList()
return DeprecatedAPI.GetCurrencyList()
.then((data) => {
const currencyListObject = JSON.parse(data.currencyList);
Onyx.merge(ONYXKEYS.CURRENCY_LIST, currencyListObject);
Expand All @@ -319,7 +319,7 @@ function fetchLocalCurrency() {
isRetrievingCurrency: true,
});

API.GetLocalCurrency({...coords})
DeprecatedAPI.GetLocalCurrency({...coords})
.then((data) => {
currency = data.currency;
})
Expand All @@ -341,7 +341,7 @@ function fetchLocalCurrency() {
*/
function setAvatar(file) {
setPersonalDetails({avatarUploading: true});
API.User_UploadAvatar({file})
DeprecatedAPI.User_UploadAvatar({file})
.then((response) => {
// Once we get the s3url back, update the personal details for the user with the new avatar URL
if (response.jsonCode !== 200) {
Expand All @@ -366,7 +366,7 @@ function setAvatar(file) {
function deleteAvatar(defaultAvatarURL) {
// We don't want to save the default avatar URL in the backend since we don't want to allow
// users the option of removing the default avatar, instead we'll save an empty string
API.PersonalDetails_Update({details: JSON.stringify({avatar: ''})});
DeprecatedAPI.PersonalDetails_Update({details: JSON.stringify({avatar: ''})});
mergeLocalPersonalDetails({avatar: defaultAvatarURL});
}

Expand Down
6 changes: 3 additions & 3 deletions src/libs/actions/Plaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Str from 'expensify-common/lib/str';
import _ from 'underscore';
import ONYXKEYS from '../../ONYXKEYS';
import CONST from '../../CONST';
import * as API from '../API';
import * as DeprecatedAPI from '../deprecatedAPI';
import Growl from '../Growl';
import * as Localize from '../Localize';

Expand All @@ -30,7 +30,7 @@ function clearPlaidBankAccountsAndToken() {
* Gets the Plaid Link token used to initialize the Plaid SDK
*/
function fetchPlaidLinkToken() {
API.Plaid_GetLinkToken()
DeprecatedAPI.Plaid_GetLinkToken()
.then((response) => {
if (response.jsonCode !== 200) {
return;
Expand All @@ -48,7 +48,7 @@ function fetchPlaidBankAccounts(publicToken, bank) {
bankName = bank;

Onyx.merge(ONYXKEYS.PLAID_BANK_ACCOUNTS, {loading: true});
API.BankAccount_Get({
DeprecatedAPI.BankAccount_Get({
publicToken,
allowDebit: false,
bank,
Expand Down
Loading