Skip to content

Commit cd2c692

Browse files
author
Benjamin Piouffle
committed
debt: Remove legacy expense flow code
1 parent 515faba commit cd2c692

File tree

6 files changed

+5
-59
lines changed

6 files changed

+5
-59
lines changed

cron/daily/50-check-virtual-cards-missing-receipts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const processVirtualCard = async (expenses: Array<Expense>) => {
2424
const data = {
2525
expenses: expenses.map(e => ({
2626
...e.info,
27-
url: `${config.host.website}/${collective.slug}/expenses/${e.id}?edit=1`,
27+
url: `${config.host.website}/${collective.slug}/expenses/${e.id}`,
2828
})),
2929
virtualCard,
3030
host: host.info,

server/graphql/v1/CollectiveInterface.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import {
5252
PaginatedPaymentMethodsType,
5353
PaymentMethodBatchInfo,
5454
PaymentMethodType,
55-
PayoutMethodType,
5655
TierType,
5756
UserType,
5857
} from './types';
@@ -608,10 +607,6 @@ export const CollectiveInterfaceType = new GraphQLInterfaceType({
608607
},
609608
},
610609
},
611-
payoutMethods: {
612-
type: new GraphQLList(PayoutMethodType),
613-
description: 'The list of payout methods that this collective can use to get paid',
614-
},
615610
giftCardsBatches: {
616611
type: new GraphQLList(PaymentMethodBatchInfo),
617612
description:
@@ -1649,24 +1644,6 @@ const CollectiveFields = () => {
16491644
return paymentMethods.filter(pm => !pm.expiryDate || pm.expiryDate > now);
16501645
},
16511646
},
1652-
payoutMethods: {
1653-
type: new GraphQLList(PayoutMethodType),
1654-
description: 'The list of payout methods that this collective can use to get paid',
1655-
async resolve(collective, _, req) {
1656-
if (!req.remoteUser || !req.remoteUser.isAdminOfCollective(collective)) {
1657-
return null;
1658-
} else {
1659-
const payoutMethods = await req.loaders.PayoutMethod.byCollectiveId.load(collective.id);
1660-
return payoutMethods.filter(pm => {
1661-
if (pm.type === PayoutMethodTypes.STRIPE && collective.id !== PlatformConstants.OfitechCollectiveId) {
1662-
return false;
1663-
}
1664-
1665-
return true;
1666-
});
1667-
}
1668-
},
1669-
},
16701647
giftCardsBatches: {
16711648
type: new GraphQLList(PaymentMethodBatchInfo),
16721649
description:

server/graphql/v1/types.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { filterContributors } from '../../lib/contributors';
2626
import { sanitizeStripeError } from '../../lib/stripe';
2727
import twoFactorAuthLib from '../../lib/two-factor-authentication';
2828
import models, { Op, sequelize } from '../../models';
29-
import { PayoutMethodTypes } from '../../models/PayoutMethod';
3029
import { canSeeExpenseAttachments, canSeeExpensePayoutMethodPrivateDetails } from '../common/expenses';
3130
import { hasSeenLatestChangelogEntry } from '../common/user';
3231
import { Unauthorized } from '../errors';
@@ -84,36 +83,6 @@ const IsoDateString = new GraphQLScalarType({
8483
},
8584
});
8685

87-
const PayoutMethodTypeEnum = new GraphQLEnumType({
88-
name: 'PayoutMethodTypeEnum',
89-
values: Object.keys(PayoutMethodTypes).reduce((values, key) => {
90-
return { ...values, [key]: { value: PayoutMethodTypes[key] } };
91-
}, {}),
92-
});
93-
94-
// @deprecated Still used in Collective.payoutMethods by `expenseFormPayeeStepCollectivePickerSearchQuery`
95-
export const PayoutMethodType = new GraphQLObjectType({
96-
name: 'PayoutMethod',
97-
description: 'A payout method for expenses',
98-
fields: () => ({
99-
id: {
100-
type: GraphQLInt,
101-
},
102-
type: {
103-
type: PayoutMethodTypeEnum,
104-
},
105-
name: {
106-
type: GraphQLString,
107-
},
108-
isSaved: {
109-
type: GraphQLBoolean,
110-
},
111-
data: {
112-
type: GraphQLJSON,
113-
},
114-
}),
115-
});
116-
11786
export const UserType = new GraphQLObjectType({
11887
name: 'UserDetails',
11988
description: 'This represents the details of a User',

templates/emails/collective.expense.missing.receipt.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For accounting reasons, the Fiscal Host will need a description and receipt. The
1818
<br />
1919

2020
<center>
21-
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}?edit=1" class="btn blue">
21+
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}" class="btn blue">
2222
<div>Submit Receipt</div>
2323
</a>
2424
</center>

templates/emails/virtualcard.purchase.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ Subject: Virtual Card Purchase
1111
<p>
1212
A card attached to {{collective.name}} was charged {{currency amount currency=currency precision=2}} and we need the responsible admin to input additional information.
1313

14-
For accounting reasons, the Fiscal Host will need a description and receipt. Please <a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}?edit=1">upload a receipt</a> if you already have one. The card may be suspended if receipts are not provided.
14+
For accounting reasons, the Fiscal Host will need a description and receipt. Please <a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}">upload a receipt</a> if you already have one. The card may be suspended if receipts are not provided.
1515
</p>
1616

1717
<br />
1818
<br />
1919

2020
<center>
21-
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}?edit=1" class="btn blue">
21+
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}" class="btn blue">
2222
<div>Submit Receipt</div>
2323
</a>
2424
</center>

test/server/paymentProviders/stripe/virtual-cards.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ describe('server/paymentProviders/stripe/virtual-cards', () => {
8484
expect(emailTo).to.equal(collectiveAdmin.email);
8585
expect(subject).to.equal('Virtual Card Purchase');
8686
expect(body).to.contain('A card attached to Open Collective was charged $1.00.');
87-
expect(body).to.contain(`<a href="${config.host.website}/${collective.slug}/expenses/${expense.id}?edit=1"`);
87+
expect(body).to.contain(`<a href="${config.host.website}/${collective.slug}/expenses/${expense.id}"`);
8888
});
8989
});

0 commit comments

Comments
 (0)