Skip to content

Commit

Permalink
Changed route related to money request
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham1206agra committed Apr 19, 2024
1 parent 9a115b6 commit ad215c4
Show file tree
Hide file tree
Showing 34 changed files with 352 additions and 210 deletions.
8 changes: 8 additions & 0 deletions .well-known/apple-app-site-association
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
"/": "/split/*",
"comment": "Split Expense"
},
{
"/": "/submit/*",
"comment": "Submit Expense"
},
{
"/": "/request/*",
"comment": "Submit Expense"
Expand All @@ -76,6 +80,10 @@
"/": "/search/*",
"comment": "Search"
},
{
"/": "/pay/*",
"comment": "Pay someone"
},
{
"/": "/send/*",
"comment": "Pay someone"
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/bank-account"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/iou"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/request"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/submit"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/enable-payments"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/statements"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/concierge"/>
Expand All @@ -70,6 +71,7 @@
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/new"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/search"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/send"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/pay"/>
<data android:scheme="https" android:host="new.expensify.com" android:pathPrefix="/money2020"/>

<!-- Staging URLs -->
Expand All @@ -81,6 +83,7 @@
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/bank-account"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/iou"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/request"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/submit"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/enable-payments"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/statements"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/concierge"/>
Expand All @@ -89,6 +92,7 @@
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/new"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/search"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/send"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/pay"/>
<data android:scheme="https" android:host="staging.new.expensify.com" android:pathPrefix="/money2020"/>
</intent-filter>
</activity>
Expand Down
6 changes: 4 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1411,16 +1411,18 @@ const CONST = {
ACTION: {
EDIT: 'edit',
CREATE: 'create',
REQUEST: 'request',
SUBMIT: 'submit',
CATEGORIZE: 'categorize',
SHARE: 'share',
},
DEFAULT_AMOUNT: 0,
TYPE: {
SEND: 'send',
PAY: 'pay',
SPLIT: 'split',
REQUEST: 'request',
TRACK_EXPENSE: 'track-expense',
SUBMIT: 'submit',
TRACK: 'track',
},
REQUEST_TYPE: {
DISTANCE: 'distance',
Expand Down
17 changes: 9 additions & 8 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,20 +418,20 @@ const ROUTES = {
},

MONEY_REQUEST_STATE_SELECTOR: {
route: 'request/state',
route: 'submit/state',

getRoute: (state?: string, backTo?: string, label?: string) =>
`${getUrlWithBackToParam(`request/state${state ? `?state=${encodeURIComponent(state)}` : ''}`, backTo)}${
`${getUrlWithBackToParam(`submit/state${state ? `?state=${encodeURIComponent(state)}` : ''}`, backTo)}${
// the label param can be an empty string so we cannot use a nullish ?? operator
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
label ? `${backTo || state ? '&' : '?'}label=${encodeURIComponent(label)}` : ''
}` as const,
},
IOU_REQUEST: 'request/new',
IOU_SEND: 'send/new',
IOU_SEND_ADD_BANK_ACCOUNT: 'send/new/add-bank-account',
IOU_SEND_ADD_DEBIT_CARD: 'send/new/add-debit-card',
IOU_SEND_ENABLE_PAYMENTS: 'send/new/enable-payments',
IOU_REQUEST: 'submit/new',
IOU_SEND: 'pay/new',
IOU_SEND_ADD_BANK_ACCOUNT: 'pay/new/add-bank-account',
IOU_SEND_ADD_DEBIT_CARD: 'pay/new/add-debit-card',
IOU_SEND_ENABLE_PAYMENTS: 'pay/new/enable-payments',

NEW_TASK: 'new/task',
NEW_TASK_ASSIGNEE: 'new/task/assignee',
Expand Down Expand Up @@ -690,7 +690,7 @@ const ROUTES = {
route: 'referral/:contentType',
getRoute: (contentType: string, backTo?: string) => getUrlWithBackToParam(`referral/${contentType}`, backTo),
},
PROCESS_MONEY_REQUEST_HOLD: 'hold-request-educational',
PROCESS_MONEY_REQUEST_HOLD: 'hold-expense-educational',
ONBOARDING_ROOT: 'onboarding',
ONBOARDING_PERSONAL_DETAILS: 'onboarding/personal-details',
ONBOARDING_PURPOSE: 'onboarding/purpose',
Expand Down Expand Up @@ -733,6 +733,7 @@ const ROUTES = {
*/
const HYBRID_APP_ROUTES = {
MONEY_REQUEST_CREATE: '/request/new/scan',
MONEY_REQUEST_SUBMIT_CREATE: '/submit/new/scan',
} as const;

export {HYBRID_APP_ROUTES, getUrlWithBackToParam};
Expand Down
2 changes: 1 addition & 1 deletion src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ function AttachmentModal({
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(
CONST.IOU.ACTION.EDIT,
CONST.IOU.TYPE.REQUEST,
CONST.IOU.TYPE.SUBMIT,
transaction?.transactionID ?? '',
report?.reportID ?? '',
Navigation.getActiveRouteWithoutParams(),
Expand Down
16 changes: 8 additions & 8 deletions src/components/MoneyRequestConfirmationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ type MoneyRequestConfirmationListProps = MoneyRequestConfirmationListOnyxProps &
iouCurrencyCode?: string;

/** IOU type */
iouType?: IOUType;
iouType?: Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND>;

/** IOU date */
iouCreated?: string;
Expand Down Expand Up @@ -176,7 +176,7 @@ function MoneyRequestConfirmationList({
onSendMoney,
onConfirm,
onSelectParticipant,
iouType = CONST.IOU.TYPE.REQUEST,
iouType = CONST.IOU.TYPE.SUBMIT,
isScanRequest = false,
iouAmount,
policyCategories,
Expand Down Expand Up @@ -216,10 +216,10 @@ function MoneyRequestConfirmationList({
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {canUseViolations} = usePermissions();

const isTypeRequest = iouType === CONST.IOU.TYPE.REQUEST;
const isTypeRequest = iouType === CONST.IOU.TYPE.SUBMIT;
const isTypeSplit = iouType === CONST.IOU.TYPE.SPLIT;
const isTypeSend = iouType === CONST.IOU.TYPE.SEND;
const isTypeTrackExpense = iouType === CONST.IOU.TYPE.TRACK_EXPENSE;
const isTypeSend = iouType === CONST.IOU.TYPE.PAY;
const isTypeTrackExpense = iouType === CONST.IOU.TYPE.TRACK;

const {unit, rate, currency} = mileageRate ?? {
unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES,
Expand Down Expand Up @@ -557,7 +557,7 @@ function MoneyRequestConfirmationList({
return;
}

if (iouType === CONST.IOU.TYPE.SEND) {
if (iouType === CONST.IOU.TYPE.PAY) {
if (!paymentMethod) {
return;
}
Expand Down Expand Up @@ -608,7 +608,7 @@ function MoneyRequestConfirmationList({
return;
}

const shouldShowSettlementButton = iouType === CONST.IOU.TYPE.SEND;
const shouldShowSettlementButton = iouType === CONST.IOU.TYPE.PAY;
const shouldDisableButton = selectedParticipants.length === 0;

const button = shouldShowSettlementButton ? (
Expand Down Expand Up @@ -944,7 +944,7 @@ function MoneyRequestConfirmationList({
: // The empty receipt component should only show for IOU Requests of a paid policy ("Team" or "Corporate")
PolicyUtils.isPaidGroupPolicy(policy) &&
!isDistanceRequest &&
iouType === CONST.IOU.TYPE.REQUEST && (
iouType === CONST.IOU.TYPE.SUBMIT && (
<ReceiptEmptyState
onPress={() =>
Navigation.navigate(
Expand Down
20 changes: 10 additions & 10 deletions src/components/ReportActionItem/MoneyRequestView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function MoneyRequestView({
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(
CONST.IOU.ACTION.EDIT,
CONST.IOU.TYPE.REQUEST,
CONST.IOU.TYPE.SUBMIT,
transaction?.transactionID ?? '',
report.reportID,
Navigation.getActiveRouteWithoutParams(),
Expand All @@ -317,7 +317,7 @@ function MoneyRequestView({
interactive={canEditAmount}
shouldShowRightIcon={canEditAmount}
onPress={() =>
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID))
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_AMOUNT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID))
}
brickRoadIndicator={getErrorForField('amount') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
error={getErrorForField('amount')}
Expand All @@ -333,7 +333,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_DESCRIPTION.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_DESCRIPTION.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID),
)
}
wrapperStyle={[styles.pv2, styles.taskDescriptionMenuItem]}
Expand All @@ -352,7 +352,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_DISTANCE.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_DISTANCE.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID),
)
}
/>
Expand All @@ -367,7 +367,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_MERCHANT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_MERCHANT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID),
)
}
brickRoadIndicator={getErrorForField('merchant') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
Expand All @@ -383,7 +383,7 @@ function MoneyRequestView({
shouldShowRightIcon={canEditDate}
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_DATE.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID))
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_DATE.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID))
}
brickRoadIndicator={getErrorForField('date') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
error={getErrorForField('date')}
Expand All @@ -399,7 +399,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID),
)
}
brickRoadIndicator={getErrorForField('category') ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
Expand All @@ -421,7 +421,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, orderWeight, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_TAG.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, orderWeight, transaction?.transactionID ?? '', report.reportID),
)
}
brickRoadIndicator={getErrorForField('tag', {tagListIndex: index, tagListName: name}) ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
Expand All @@ -448,7 +448,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAX_RATE.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_TAX_RATE.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID),
)
}
/>
Expand All @@ -465,7 +465,7 @@ function MoneyRequestView({
titleStyle={styles.flex1}
onPress={() =>
Navigation.navigate(
ROUTES.MONEY_REQUEST_STEP_TAX_AMOUNT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.REQUEST, transaction?.transactionID ?? '', report.reportID),
ROUTES.MONEY_REQUEST_STEP_TAX_AMOUNT.getRoute(CONST.IOU.ACTION.EDIT, CONST.IOU.TYPE.SUBMIT, transaction?.transactionID ?? '', report.reportID),
)
}
/>
Expand Down
8 changes: 4 additions & 4 deletions src/components/ReportWelcomeText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
const displayNamesWithTooltips = ReportUtils.getDisplayNamesWithTooltips(OptionsListUtils.getPersonalDetailsForAccountIDs(participantAccountIDs, personalDetails), isMultipleParticipant);
const isUserPolicyAdmin = PolicyUtils.isPolicyAdmin(policy);
const roomWelcomeMessage = ReportUtils.getRoomWelcomeMessage(report, isUserPolicyAdmin);
const moneyRequestOptions = ReportUtils.getMoneyRequestOptions(report, policy, participantAccountIDs, canUseTrackExpense);
const moneyRequestOptions = ReportUtils.temporary_getMoneyRequestOptions(report, policy, participantAccountIDs, canUseTrackExpense);
const additionalText = moneyRequestOptions.map((item) => translate(`reportActionsView.iouTypes.${item}`)).join(', ');
const canEditPolicyDescription = ReportUtils.canEditPolicyDescription(policy);
const reportName = ReportUtils.getReportName(report);
Expand Down Expand Up @@ -160,9 +160,9 @@ function ReportWelcomeText({report, policy, personalDetails}: ReportWelcomeTextP
))}
</Text>
)}
{(moneyRequestOptions.includes(CONST.IOU.TYPE.SEND) ||
moneyRequestOptions.includes(CONST.IOU.TYPE.REQUEST) ||
moneyRequestOptions.includes(CONST.IOU.TYPE.TRACK_EXPENSE)) && <Text>{translate('reportActionsView.usePlusButton', {additionalText})}</Text>}
{(moneyRequestOptions.includes(CONST.IOU.TYPE.PAY) || moneyRequestOptions.includes(CONST.IOU.TYPE.SUBMIT) || moneyRequestOptions.includes(CONST.IOU.TYPE.TRACK)) && (
<Text>{translate('reportActionsView.usePlusButton', {additionalText})}</Text>
)}
</View>
</>
);
Expand Down
7 changes: 3 additions & 4 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,10 @@ export default {
welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `Welcome to ${roomName}!`,
usePlusButton: ({additionalText}: UsePlusButtonParams) => `\nYou can also use the + button to ${additionalText}, or assign a task!`,
iouTypes: {
send: 'pay expenses',
pay: 'pay expenses',
split: 'split an expense',
request: 'submit an expense',
// eslint-disable-next-line @typescript-eslint/naming-convention
'track-expense': 'track an expense',
submit: 'submit an expense',
track: 'track an expense',
},
},
reportAction: {
Expand Down
7 changes: 3 additions & 4 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,10 @@ export default {
welcomeToRoom: ({roomName}: WelcomeToRoomParams) => `¡Bienvenido a ${roomName}!`,
usePlusButton: ({additionalText}: UsePlusButtonParams) => `\n¡También puedes usar el botón + de abajo para ${additionalText}, o asignar una tarea!`,
iouTypes: {
send: 'pagar gastos',
pay: 'pagar gastos',
split: 'dividir un gasto',
request: 'presentar un gasto',
// eslint-disable-next-line @typescript-eslint/naming-convention
'track-expense': 'rastrear un gasto',
submit: 'presentar un gasto',
track: 'rastrear un gasto',
},
},
reportAction: {
Expand Down
Loading

0 comments on commit ad215c4

Please sign in to comment.