@@ -23,6 +23,7 @@ import { StripePaymentMethodsLabels } from '../../lib/stripe/payment-methods';
2323import { getWebsiteUrl } from '../../lib/utils' ;
2424
2525import CreditCardInactive from '../icons/CreditCardInactive' ;
26+ import { CUSTOM_PAYMEMENT_ICON_MAP } from '../edit-collective/sections/receive-money/constants' ;
2627
2728export const NEW_CREDIT_CARD_KEY = 'newCreditCard' ;
2829export const STRIPE_PAYMENT_ELEMENT_KEY = 'stripe-payment-element' ;
@@ -222,30 +223,68 @@ export const generatePaymentMethodOptions = (
222223 }
223224
224225 // Manual (bank transfer)
226+ // if (
227+ // hostHasManual &&
228+ // stepDetails.interval === INTERVALS.oneTime &&
229+ // !disabledPaymentMethodTypes?.includes(PAYMENT_METHOD_TYPE.MANUAL)
230+ // ) {
231+ // uniquePMs.push({
232+ // key: 'manual',
233+ // title: get(collective, 'host.settings.paymentMethods.manual.title', null) || (
234+ // <FormattedMessage defaultMessage="Bank transfer (manual)" id="ycoJnS" />
235+ // ),
236+ // paymentMethod: {
237+ // service: PAYMENT_METHOD_SERVICE.OPENCOLLECTIVE,
238+ // type: PAYMENT_METHOD_TYPE.MANUAL,
239+ // },
240+ // icon: getPaymentMethodIcon({
241+ // service: PAYMENT_METHOD_SERVICE.OPENCOLLECTIVE,
242+ // type: PAYMENT_METHOD_TYPE.MANUAL,
243+ // }),
244+ // instructions: (
245+ // <FormattedMessage
246+ // id="NewContributionFlow.bankInstructions"
247+ // defaultMessage="Instructions to make a transfer will be given on the next page."
248+ // />
249+ // ),
250+ // });
251+ // }
252+
253+ // Custom payment providers
254+ const customPaymentProviders = get ( collective , 'host.settings.customPaymentProviders' , [ ] ) ;
225255 if (
226- hostHasManual &&
256+ Array . isArray ( customPaymentProviders ) &&
257+ customPaymentProviders . length > 0 &&
227258 stepDetails . interval === INTERVALS . oneTime &&
228259 ! disabledPaymentMethodTypes ?. includes ( PAYMENT_METHOD_TYPE . MANUAL )
229260 ) {
230- uniquePMs . push ( {
231- key : 'manual' ,
232- title : get ( collective , 'host.settings.paymentMethods.manual.title' , null ) || (
233- < FormattedMessage defaultMessage = "Bank transfer (manual)" id = "ycoJnS" />
234- ) ,
235- paymentMethod : {
236- service : PAYMENT_METHOD_SERVICE . OPENCOLLECTIVE ,
237- type : PAYMENT_METHOD_TYPE . MANUAL ,
238- } ,
239- icon : getPaymentMethodIcon ( {
240- service : PAYMENT_METHOD_SERVICE . OPENCOLLECTIVE ,
241- type : PAYMENT_METHOD_TYPE . MANUAL ,
242- } ) ,
243- instructions : (
244- < FormattedMessage
245- id = "NewContributionFlow.bankInstructions"
246- defaultMessage = "Instructions to make a transfer will be given on the next page."
247- />
248- ) ,
261+ customPaymentProviders . forEach ( provider => {
262+ const IconComponent = CUSTOM_PAYMEMENT_ICON_MAP [ provider . icon ] ;
263+ uniquePMs . push ( {
264+ key : `custom-${ provider . id } ` ,
265+ title : provider . name ,
266+ paymentMethod : {
267+ service : PAYMENT_METHOD_SERVICE . OPENCOLLECTIVE ,
268+ type : PAYMENT_METHOD_TYPE . MANUAL ,
269+ data : {
270+ customPaymentProviderId : provider . id ,
271+ } ,
272+ } ,
273+ icon : IconComponent ? (
274+ < IconComponent className = "h-5 w-5" />
275+ ) : (
276+ getPaymentMethodIcon ( {
277+ service : PAYMENT_METHOD_SERVICE . OPENCOLLECTIVE ,
278+ type : PAYMENT_METHOD_TYPE . MANUAL ,
279+ } )
280+ ) ,
281+ subtitle : (
282+ < FormattedMessage
283+ id = "NewContributionFlow.customPaymentInstructions"
284+ defaultMessage = "Instructions to complete payment will be given on the next page."
285+ />
286+ ) ,
287+ } ) ;
249288 } ) ;
250289 }
251290 }
0 commit comments