Skip to content
Draft
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
2 changes: 1 addition & 1 deletion cron/daily/50-check-virtual-cards-missing-receipts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const processVirtualCard = async (expenses: Array<Expense>) => {
const data = {
expenses: expenses.map(e => ({
...e.info,
url: `${config.host.website}/${collective.slug}/expenses/${e.id}?edit=1`,
url: `${config.host.website}/${collective.slug}/expenses/${e.id}`,
})),
virtualCard,
host: host.info,
Expand Down
23 changes: 0 additions & 23 deletions server/graphql/v1/CollectiveInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { CollectiveType as CollectiveTypeEnum } from '../../constants/collectives';
import FEATURE from '../../constants/feature';
import { PAYMENT_METHOD_SERVICE, PAYMENT_METHOD_TYPE } from '../../constants/paymentMethods';
import PlatformConstants from '../../constants/platform';

Check failure on line 21 in server/graphql/v1/CollectiveInterface.js

View workflow job for this annotation

GitHub Actions / lint

'PlatformConstants' is defined but never used
import roles from '../../constants/roles';
import { hasFeature } from '../../lib/allowed-features';
import { isCollectiveDeletable } from '../../lib/collectivelib';
Expand All @@ -27,7 +27,7 @@
import queries from '../../lib/queries';
import { canSeeLegalName } from '../../lib/user-permissions';
import models, { Op } from '../../models';
import { PayoutMethodTypes } from '../../models/PayoutMethod';

Check failure on line 30 in server/graphql/v1/CollectiveInterface.js

View workflow job for this annotation

GitHub Actions / lint

'PayoutMethodTypes' is defined but never used
import { hostResolver } from '../common/collective';
import { GraphQLCollectiveFeatures } from '../common/CollectiveFeatures';
import { getContextPermission, PERMISSION_TYPE } from '../common/context-permissions';
Expand All @@ -52,7 +52,6 @@
PaginatedPaymentMethodsType,
PaymentMethodBatchInfo,
PaymentMethodType,
PayoutMethodType,
TierType,
UserType,
} from './types';
Expand Down Expand Up @@ -608,10 +607,6 @@
},
},
},
payoutMethods: {
type: new GraphQLList(PayoutMethodType),
description: 'The list of payout methods that this collective can use to get paid',
},
giftCardsBatches: {
type: new GraphQLList(PaymentMethodBatchInfo),
description:
Expand Down Expand Up @@ -1649,24 +1644,6 @@
return paymentMethods.filter(pm => !pm.expiryDate || pm.expiryDate > now);
},
},
payoutMethods: {
type: new GraphQLList(PayoutMethodType),
description: 'The list of payout methods that this collective can use to get paid',
async resolve(collective, _, req) {
if (!req.remoteUser || !req.remoteUser.isAdminOfCollective(collective)) {
return null;
} else {
const payoutMethods = await req.loaders.PayoutMethod.byCollectiveId.load(collective.id);
return payoutMethods.filter(pm => {
if (pm.type === PayoutMethodTypes.STRIPE && collective.id !== PlatformConstants.OfitechCollectiveId) {
return false;
}

return true;
});
}
},
},
giftCardsBatches: {
type: new GraphQLList(PaymentMethodBatchInfo),
description:
Expand Down
44 changes: 1 addition & 43 deletions server/graphql/v1/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import { filterContributors } from '../../lib/contributors';
import { sanitizeStripeError } from '../../lib/stripe';
import twoFactorAuthLib from '../../lib/two-factor-authentication';
import models, { Op, sequelize } from '../../models';
import { PayoutMethodTypes } from '../../models/PayoutMethod';
import { canSeeExpenseAttachments, canSeeExpensePayoutMethodPrivateDetails } from '../common/expenses';
import { canSeeExpenseAttachments } from '../common/expenses';
import { hasSeenLatestChangelogEntry } from '../common/user';
import { Unauthorized } from '../errors';
import { idEncode, IDENTIFIER_TYPES } from '../v2/identifiers';
Expand Down Expand Up @@ -84,36 +83,6 @@ const IsoDateString = new GraphQLScalarType({
},
});

const PayoutMethodTypeEnum = new GraphQLEnumType({
name: 'PayoutMethodTypeEnum',
values: Object.keys(PayoutMethodTypes).reduce((values, key) => {
return { ...values, [key]: { value: PayoutMethodTypes[key] } };
}, {}),
});

// @deprecated Still used in Collective.payoutMethods by `expenseFormPayeeStepCollectivePickerSearchQuery`
export const PayoutMethodType = new GraphQLObjectType({
name: 'PayoutMethod',
description: 'A payout method for expenses',
fields: () => ({
id: {
type: GraphQLInt,
},
type: {
type: PayoutMethodTypeEnum,
},
name: {
type: GraphQLString,
},
isSaved: {
type: GraphQLBoolean,
},
data: {
type: GraphQLJSON,
},
}),
});

export const UserType = new GraphQLObjectType({
name: 'UserDetails',
description: 'This represents the details of a User',
Expand Down Expand Up @@ -798,17 +767,6 @@ export const ExpenseType = new GraphQLObjectType({
return expense.type;
},
},
PayoutMethod: {
type: PayoutMethodType,
deprecationReason: '2024-12-13: Please move to GraphQL v2',
async resolve(expense, _, req) {
if (!expense.PayoutMethodId || !(await canSeeExpensePayoutMethodPrivateDetails(req, expense))) {
return null;
} else {
return expense.payoutMethod || req.loaders.PayoutMethod.byId.load(expense.PayoutMethodId);
}
},
},
privateMessage: {
type: GraphQLString,
async resolve(expense, args, req) {
Expand Down
2 changes: 1 addition & 1 deletion templates/emails/collective.expense.missing.receipt.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For accounting reasons, the Fiscal Host will need a description and receipt. The
<br />

<center>
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}?edit=1" class="btn blue">
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}" class="btn blue">
<div>Submit Receipt</div>
</a>
</center>
Expand Down
4 changes: 2 additions & 2 deletions templates/emails/virtualcard.purchase.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Subject: Virtual Card Purchase
<p>
A card attached to {{collective.name}} was charged {{currency amount currency=currency precision=2}} and we need the responsible admin to input additional information.

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.
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.
</p>

<br />
<br />

<center>
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}?edit=1" class="btn blue">
<a href="{{config.host.website}}/{{collective.slug}}/expenses/{{expense.id}}" class="btn blue">
<div>Submit Receipt</div>
</a>
</center>
Expand Down
2 changes: 1 addition & 1 deletion test/server/paymentProviders/stripe/virtual-cards.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ describe('server/paymentProviders/stripe/virtual-cards', () => {
expect(emailTo).to.equal(collectiveAdmin.email);
expect(subject).to.equal('Virtual Card Purchase');
expect(body).to.contain('A card attached to Open Collective was charged $1.00.');
expect(body).to.contain(`<a href="${config.host.website}/${collective.slug}/expenses/${expense.id}?edit=1"`);
expect(body).to.contain(`<a href="${config.host.website}/${collective.slug}/expenses/${expense.id}"`);
});
});
Loading