Merge pull request #32662 from woocommerce/update/refactor-and-improve-tests-payments-task
Refactor and improve tests payments task
This commit is contained in:
commit
62de7bae9c
|
@ -23,6 +23,9 @@ export class PaymentsSetup extends BasePage {
|
||||||
|
|
||||||
async possiblyCloseHelpModal(): Promise< void > {
|
async possiblyCloseHelpModal(): Promise< void > {
|
||||||
try {
|
try {
|
||||||
|
await waitForElementByText( 'div', "We're here for help", {
|
||||||
|
timeout: 2000,
|
||||||
|
} );
|
||||||
await this.clickButtonWithText( 'Got it' );
|
await this.clickButtonWithText( 'Got it' );
|
||||||
} catch ( e ) {}
|
} catch ( e ) {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,8 @@ const testAdminPaymentSetupTask = () => {
|
||||||
await paymentsSetup.isDisplayed();
|
await paymentsSetup.isDisplayed();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it.skip( 'Saving valid bank account transfer details enables the payment method', async () => {
|
it( 'Saving valid bank account transfer details enables the payment method', async () => {
|
||||||
await paymentsSetup.showOtherPaymentMethods();
|
await paymentsSetup.showOtherPaymentMethods();
|
||||||
await waitForTimeout( 500 );
|
|
||||||
await paymentsSetup.goToPaymentMethodSetup( 'bacs' );
|
await paymentsSetup.goToPaymentMethodSetup( 'bacs' );
|
||||||
await bankTransferSetup.saveAccountDetails( {
|
await bankTransferSetup.saveAccountDetails( {
|
||||||
accountNumber: '1234',
|
accountNumber: '1234',
|
||||||
|
@ -68,10 +67,9 @@ const testAdminPaymentSetupTask = () => {
|
||||||
expect( await settings.paymentMethodIsEnabled( 'bacs' ) ).toBe(
|
expect( await settings.paymentMethodIsEnabled( 'bacs' ) ).toBe(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
await homeScreen.navigate();
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it.skip( 'Enabling cash on delivery enables the payment method', async () => {
|
it( 'Enabling cash on delivery enables the payment method', async () => {
|
||||||
await settings.cleanPaymentMethods();
|
await settings.cleanPaymentMethods();
|
||||||
await homeScreen.navigate();
|
await homeScreen.navigate();
|
||||||
await homeScreen.isDisplayed();
|
await homeScreen.isDisplayed();
|
||||||
|
@ -80,7 +78,6 @@ const testAdminPaymentSetupTask = () => {
|
||||||
await paymentsSetup.possiblyCloseHelpModal();
|
await paymentsSetup.possiblyCloseHelpModal();
|
||||||
await paymentsSetup.isDisplayed();
|
await paymentsSetup.isDisplayed();
|
||||||
await paymentsSetup.showOtherPaymentMethods();
|
await paymentsSetup.showOtherPaymentMethods();
|
||||||
await waitForTimeout( 500 );
|
|
||||||
await paymentsSetup.enableCashOnDelivery();
|
await paymentsSetup.enableCashOnDelivery();
|
||||||
await waitForTimeout( 1500 );
|
await waitForTimeout( 1500 );
|
||||||
expect( await settings.paymentMethodIsEnabled( 'cod' ) ).toBe(
|
expect( await settings.paymentMethodIsEnabled( 'cod' ) ).toBe(
|
||||||
|
|
|
@ -25,26 +25,17 @@ import { List, Placeholder as ListPlaceholder } from './components/List';
|
||||||
import { Setup, Placeholder as SetupPlaceholder } from './components/Setup';
|
import { Setup, Placeholder as SetupPlaceholder } from './components/Setup';
|
||||||
import { Toggle } from './components/Toggle/Toggle';
|
import { Toggle } from './components/Toggle/Toggle';
|
||||||
import { WCPaySuggestion } from './components/WCPay';
|
import { WCPaySuggestion } from './components/WCPay';
|
||||||
import { getPluginSlug } from '~/utils';
|
|
||||||
import { getCountryCode } from '~/dashboard/utils';
|
import { getCountryCode } from '~/dashboard/utils';
|
||||||
|
import {
|
||||||
|
getEnrichedPaymentGateways,
|
||||||
|
getSplitGateways,
|
||||||
|
getIsWCPayOrOtherCategoryDoneSetup,
|
||||||
|
getIsGatewayWCPay,
|
||||||
|
comparePaymentGatewaysByPriority,
|
||||||
|
} from './utils';
|
||||||
import './plugins/Bacs';
|
import './plugins/Bacs';
|
||||||
import './payment-gateway-suggestions.scss';
|
import './payment-gateway-suggestions.scss';
|
||||||
|
|
||||||
const comparePaymentGatewaysByPriority = ( a, b ) =>
|
|
||||||
a.recommendation_priority - b.recommendation_priority;
|
|
||||||
|
|
||||||
const isGatewayWCPay = ( gateway ) =>
|
|
||||||
gateway.plugins?.length === 1 &&
|
|
||||||
gateway.plugins[ 0 ] === 'woocommerce-payments';
|
|
||||||
|
|
||||||
const isGatewayOtherCategory = ( gateway, countryCode ) =>
|
|
||||||
gateway.category_other &&
|
|
||||||
gateway.category_other.indexOf( countryCode ) !== -1;
|
|
||||||
|
|
||||||
const isGatewayAdditionalCategory = ( gateway, countryCode ) =>
|
|
||||||
gateway.category_additional &&
|
|
||||||
gateway.category_additional.indexOf( countryCode ) !== -1;
|
|
||||||
|
|
||||||
export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
|
export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
|
||||||
const { updatePaymentGateway } = useDispatch( PAYMENT_GATEWAYS_STORE_NAME );
|
const { updatePaymentGateway } = useDispatch( PAYMENT_GATEWAYS_STORE_NAME );
|
||||||
const {
|
const {
|
||||||
|
@ -73,54 +64,14 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
|
||||||
};
|
};
|
||||||
}, [] );
|
}, [] );
|
||||||
|
|
||||||
const getEnrichedPaymentGateways = () => {
|
const paymentGateways = useMemo(
|
||||||
const mappedPaymentGateways = installedPaymentGateways.reduce(
|
() =>
|
||||||
( map, gateway ) => {
|
getEnrichedPaymentGateways(
|
||||||
map[ gateway.id ] = gateway;
|
installedPaymentGateways,
|
||||||
return map;
|
paymentGatewaySuggestions
|
||||||
},
|
),
|
||||||
{}
|
[ installedPaymentGateways, paymentGatewaySuggestions ]
|
||||||
);
|
);
|
||||||
|
|
||||||
return paymentGatewaySuggestions.reduce( ( map, suggestion ) => {
|
|
||||||
// A colon ':' is used sometimes to have multiple configs for the same gateway ex: woocommerce_payments:us.
|
|
||||||
const id = getPluginSlug( suggestion.id );
|
|
||||||
const installedGateway = mappedPaymentGateways[ id ]
|
|
||||||
? mappedPaymentGateways[ id ]
|
|
||||||
: {};
|
|
||||||
|
|
||||||
const enrichedSuggestion = {
|
|
||||||
installed: !! mappedPaymentGateways[ id ],
|
|
||||||
postInstallScripts: installedGateway.post_install_scripts,
|
|
||||||
hasPlugins: !! (
|
|
||||||
suggestion.plugins && suggestion.plugins.length
|
|
||||||
),
|
|
||||||
enabled: installedGateway.enabled || false,
|
|
||||||
needsSetup: installedGateway.needs_setup,
|
|
||||||
settingsUrl: installedGateway.settings_url,
|
|
||||||
connectionUrl: installedGateway.connection_url,
|
|
||||||
setupHelpText: installedGateway.setup_help_text,
|
|
||||||
title: installedGateway.title,
|
|
||||||
requiredSettings: installedGateway.required_settings_keys
|
|
||||||
? installedGateway.required_settings_keys
|
|
||||||
.map(
|
|
||||||
( settingKey ) =>
|
|
||||||
installedGateway.settings[ settingKey ]
|
|
||||||
)
|
|
||||||
.filter( Boolean )
|
|
||||||
: [],
|
|
||||||
...suggestion,
|
|
||||||
};
|
|
||||||
|
|
||||||
map.set( suggestion.id, enrichedSuggestion );
|
|
||||||
return map;
|
|
||||||
}, new Map() );
|
|
||||||
};
|
|
||||||
|
|
||||||
const paymentGateways = useMemo( getEnrichedPaymentGateways, [
|
|
||||||
installedPaymentGateways,
|
|
||||||
paymentGatewaySuggestions,
|
|
||||||
] );
|
|
||||||
|
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
if ( paymentGateways.size ) {
|
if ( paymentGateways.size ) {
|
||||||
|
@ -201,86 +152,30 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
|
||||||
return gateway;
|
return gateway;
|
||||||
}, [ isResolving, query, paymentGateways ] );
|
}, [ isResolving, query, paymentGateways ] );
|
||||||
|
|
||||||
const isWCPayOrOtherCategoryDoneSetup = useMemo( () => {
|
const isWCPayOrOtherCategoryDoneSetup = useMemo(
|
||||||
for ( const [ , gateway ] of paymentGateways.entries() ) {
|
() =>
|
||||||
if ( ! gateway.installed || gateway.needsSetup ) {
|
getIsWCPayOrOtherCategoryDoneSetup( paymentGateways, countryCode ),
|
||||||
continue;
|
[ countryCode, paymentGateways ]
|
||||||
}
|
);
|
||||||
|
|
||||||
if ( isGatewayWCPay( gateway ) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( isGatewayOtherCategory( gateway, countryCode ) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}, [ countryCode, paymentGateways ] );
|
|
||||||
|
|
||||||
const isWCPaySupported =
|
const isWCPaySupported =
|
||||||
Array.from( paymentGateways.values() ).findIndex( isGatewayWCPay ) !==
|
Array.from( paymentGateways.values() ).findIndex(
|
||||||
-1;
|
getIsGatewayWCPay
|
||||||
|
) !== -1;
|
||||||
|
|
||||||
const [ wcPayGateway, offlineGateways, additionalGateways ] = useMemo(
|
const [ wcPayGateway, offlineGateways, additionalGateways ] = useMemo(
|
||||||
() =>
|
() =>
|
||||||
Array.from( paymentGateways.values() )
|
getSplitGateways(
|
||||||
.sort( ( a, b ) => {
|
paymentGateways,
|
||||||
if ( a.hasPlugins === b.hasPlugins ) {
|
countryCode,
|
||||||
return comparePaymentGatewaysByPriority( a, b );
|
isWCPaySupported,
|
||||||
}
|
isWCPayOrOtherCategoryDoneSetup
|
||||||
|
),
|
||||||
// hasPlugins payment first
|
|
||||||
if ( a.hasPlugins ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
} )
|
|
||||||
.reduce(
|
|
||||||
( all, gateway ) => {
|
|
||||||
const [ wcPay, offline, additional ] = all;
|
|
||||||
|
|
||||||
// WCPay is handled separately when not installed and configured
|
|
||||||
if (
|
|
||||||
isGatewayWCPay( gateway ) &&
|
|
||||||
! ( gateway.installed && ! gateway.needsSetup )
|
|
||||||
) {
|
|
||||||
wcPay.push( gateway );
|
|
||||||
} else if ( gateway.is_offline ) {
|
|
||||||
offline.push( gateway );
|
|
||||||
} else if ( gateway.enabled ) {
|
|
||||||
// Enabled gateways should be ignored.
|
|
||||||
} else if ( isWCPayOrOtherCategoryDoneSetup ) {
|
|
||||||
// If WCPay or "other" gateway is enabled in an WCPay-eligible country, only
|
|
||||||
// allow to list "additional" gateways.
|
|
||||||
if (
|
|
||||||
isGatewayAdditionalCategory(
|
|
||||||
gateway,
|
|
||||||
countryCode
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
additional.push( gateway );
|
|
||||||
}
|
|
||||||
} else if ( ! isWCPaySupported ) {
|
|
||||||
// When WCPay-ineligible, just show all gateways.
|
|
||||||
additional.push( gateway );
|
|
||||||
} else if (
|
|
||||||
isGatewayOtherCategory( gateway, countryCode )
|
|
||||||
) {
|
|
||||||
// When nothing is set up and eligible for WCPay, only show "other" gateways.
|
|
||||||
additional.push( gateway );
|
|
||||||
}
|
|
||||||
|
|
||||||
return all;
|
|
||||||
},
|
|
||||||
[ [], [], [] ]
|
|
||||||
),
|
|
||||||
[
|
[
|
||||||
|
paymentGateways,
|
||||||
countryCode,
|
countryCode,
|
||||||
isWCPaySupported,
|
isWCPaySupported,
|
||||||
isWCPayOrOtherCategoryDoneSetup,
|
isWCPayOrOtherCategoryDoneSetup,
|
||||||
paymentGateways,
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { getSplitGateways, getIsWCPayOrOtherCategoryDoneSetup } from '../utils';
|
||||||
|
|
||||||
|
const wcpay = {
|
||||||
|
plugins: [ 'woocommerce-payments' ],
|
||||||
|
installed: false,
|
||||||
|
needsSetup: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const cod = {
|
||||||
|
is_offline: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const bacs = {
|
||||||
|
is_offline: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const paypal = {
|
||||||
|
id: 'paypal',
|
||||||
|
category_other: [ 'CA' ],
|
||||||
|
category_additional: [ 'CA' ],
|
||||||
|
};
|
||||||
|
|
||||||
|
const stripe = {
|
||||||
|
id: 'stripe',
|
||||||
|
category_other: [ 'US' ],
|
||||||
|
category_additional: [ 'US' ],
|
||||||
|
};
|
||||||
|
|
||||||
|
const klarna = {
|
||||||
|
id: 'klarna',
|
||||||
|
category_other: [ '' ],
|
||||||
|
category_additional: [ 'US' ],
|
||||||
|
};
|
||||||
|
|
||||||
|
describe( 'getSplitGateways()', () => {
|
||||||
|
it( 'Returns WCPay gateways', () => {
|
||||||
|
const [ wcpayGateways ] = getSplitGateways( [ wcpay, cod, paypal ] );
|
||||||
|
expect( wcpayGateways ).toEqual( [ wcpay ] );
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( 'Returns offline gateways', () => {
|
||||||
|
const [ , offlineGateways ] = getSplitGateways( [
|
||||||
|
wcpay,
|
||||||
|
cod,
|
||||||
|
bacs,
|
||||||
|
paypal,
|
||||||
|
] );
|
||||||
|
expect( offlineGateways ).toEqual( [ cod, bacs ] );
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( 'Excludes enabled gateways', () => {
|
||||||
|
const [ , , additionalGateways ] = getSplitGateways( [
|
||||||
|
wcpay,
|
||||||
|
cod,
|
||||||
|
bacs,
|
||||||
|
{
|
||||||
|
...paypal,
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
] );
|
||||||
|
expect( additionalGateways ).toEqual( [] );
|
||||||
|
} );
|
||||||
|
|
||||||
|
describe( 'Additional gateways with eligible WCPay', () => {
|
||||||
|
it( 'Returns only "other" category gateways when WCPay or "other" category gateway isnt set up', () => {
|
||||||
|
const [ , , additionalGateways ] = getSplitGateways(
|
||||||
|
[ wcpay, cod, bacs, paypal, stripe, klarna ],
|
||||||
|
'US',
|
||||||
|
true,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
expect( additionalGateways ).toEqual( [ stripe ] );
|
||||||
|
} );
|
||||||
|
it( 'Returns only "additional" category gateways when WCPay or "other" category gateway is set up', () => {
|
||||||
|
const [ , , additionalGateways ] = getSplitGateways(
|
||||||
|
[ wcpay, cod, bacs, paypal, stripe, klarna ],
|
||||||
|
'US',
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
expect( additionalGateways ).toEqual( [ stripe, klarna ] );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
|
describe( 'Additional gateways with ineligible WCPay', () => {
|
||||||
|
it( 'Returns all gateways when "other" gateways isnt set up', () => {
|
||||||
|
const [ , , additionalGateways ] = getSplitGateways(
|
||||||
|
[ wcpay, cod, bacs, paypal, stripe, klarna ],
|
||||||
|
'US',
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
expect( additionalGateways ).toEqual( [ paypal, stripe, klarna ] );
|
||||||
|
} );
|
||||||
|
it( 'Returns only "additional" category gateways when "other" gateways is set up', () => {
|
||||||
|
const [ , , additionalGateways ] = getSplitGateways(
|
||||||
|
[ wcpay, cod, bacs, paypal, stripe, klarna ],
|
||||||
|
'US',
|
||||||
|
false,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
expect( additionalGateways ).toEqual( [ stripe, klarna ] );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
|
describe( 'getIsWCPayOrOtherCategoryDoneSetup()', () => {
|
||||||
|
it( 'False when nothing is set up', () => {
|
||||||
|
expect(
|
||||||
|
getIsWCPayOrOtherCategoryDoneSetup( [ wcpay, cod, paypal ] )
|
||||||
|
).toEqual( false );
|
||||||
|
} );
|
||||||
|
it( 'True when WCPay is set up', () => {
|
||||||
|
expect(
|
||||||
|
getIsWCPayOrOtherCategoryDoneSetup( [
|
||||||
|
{ ...wcpay, installed: true, needsSetup: false },
|
||||||
|
] )
|
||||||
|
).toEqual( true );
|
||||||
|
} );
|
||||||
|
it( 'True when "other" category gateway is set up', () => {
|
||||||
|
expect(
|
||||||
|
getIsWCPayOrOtherCategoryDoneSetup(
|
||||||
|
[ { ...stripe, installed: true, needsSetup: false } ],
|
||||||
|
'US'
|
||||||
|
)
|
||||||
|
).toEqual( true );
|
||||||
|
} );
|
||||||
|
} );
|
|
@ -0,0 +1,140 @@
|
||||||
|
/**
|
||||||
|
* Internal dependencies
|
||||||
|
*/
|
||||||
|
import { getPluginSlug } from '~/utils';
|
||||||
|
|
||||||
|
export const comparePaymentGatewaysByPriority = ( a, b ) =>
|
||||||
|
a.recommendation_priority - b.recommendation_priority;
|
||||||
|
|
||||||
|
export const getIsGatewayWCPay = ( gateway ) =>
|
||||||
|
gateway.plugins?.length === 1 &&
|
||||||
|
gateway.plugins[ 0 ] === 'woocommerce-payments';
|
||||||
|
|
||||||
|
export const getIsGatewayOtherCategory = ( gateway, countryCode ) =>
|
||||||
|
gateway.category_other &&
|
||||||
|
gateway.category_other.indexOf( countryCode ) !== -1;
|
||||||
|
|
||||||
|
export const getIsGatewayAdditionalCategory = ( gateway, countryCode ) =>
|
||||||
|
gateway.category_additional &&
|
||||||
|
gateway.category_additional.indexOf( countryCode ) !== -1;
|
||||||
|
|
||||||
|
export const getEnrichedPaymentGateways = (
|
||||||
|
installedPaymentGateways,
|
||||||
|
paymentGatewaySuggestions
|
||||||
|
) => {
|
||||||
|
const mappedPaymentGateways = installedPaymentGateways.reduce(
|
||||||
|
( map, gateway ) => {
|
||||||
|
map[ gateway.id ] = gateway;
|
||||||
|
return map;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
|
||||||
|
return paymentGatewaySuggestions.reduce( ( map, suggestion ) => {
|
||||||
|
// A colon ':' is used sometimes to have multiple configs for the same gateway ex: woocommerce_payments:us.
|
||||||
|
const id = getPluginSlug( suggestion.id );
|
||||||
|
const installedGateway = mappedPaymentGateways[ id ]
|
||||||
|
? mappedPaymentGateways[ id ]
|
||||||
|
: {};
|
||||||
|
|
||||||
|
const enrichedSuggestion = {
|
||||||
|
installed: !! mappedPaymentGateways[ id ],
|
||||||
|
postInstallScripts: installedGateway.post_install_scripts,
|
||||||
|
hasPlugins: !! ( suggestion.plugins && suggestion.plugins.length ),
|
||||||
|
enabled: installedGateway.enabled || false,
|
||||||
|
needsSetup: installedGateway.needs_setup,
|
||||||
|
settingsUrl: installedGateway.settings_url,
|
||||||
|
connectionUrl: installedGateway.connection_url,
|
||||||
|
setupHelpText: installedGateway.setup_help_text,
|
||||||
|
title: installedGateway.title,
|
||||||
|
requiredSettings: installedGateway.required_settings_keys
|
||||||
|
? installedGateway.required_settings_keys
|
||||||
|
.map(
|
||||||
|
( settingKey ) =>
|
||||||
|
installedGateway.settings[ settingKey ]
|
||||||
|
)
|
||||||
|
.filter( Boolean )
|
||||||
|
: [],
|
||||||
|
...suggestion,
|
||||||
|
};
|
||||||
|
|
||||||
|
map.set( suggestion.id, enrichedSuggestion );
|
||||||
|
return map;
|
||||||
|
}, new Map() );
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getIsWCPayOrOtherCategoryDoneSetup = (
|
||||||
|
paymentGateways,
|
||||||
|
countryCode
|
||||||
|
) => {
|
||||||
|
for ( const [ , gateway ] of paymentGateways.entries() ) {
|
||||||
|
if ( ! gateway.installed || gateway.needsSetup ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getIsGatewayWCPay( gateway ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getIsGatewayOtherCategory( gateway, countryCode ) ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getSplitGateways = (
|
||||||
|
paymentGateways,
|
||||||
|
countryCode,
|
||||||
|
isWCPaySupported,
|
||||||
|
isWCPayOrOtherCategoryDoneSetup
|
||||||
|
) =>
|
||||||
|
Array.from( paymentGateways.values() )
|
||||||
|
.sort( ( a, b ) => {
|
||||||
|
if ( a.hasPlugins === b.hasPlugins ) {
|
||||||
|
return comparePaymentGatewaysByPriority( a, b );
|
||||||
|
}
|
||||||
|
|
||||||
|
// hasPlugins payment first
|
||||||
|
if ( a.hasPlugins ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
} )
|
||||||
|
.reduce(
|
||||||
|
( all, gateway ) => {
|
||||||
|
const [ wcPay, offline, additional ] = all;
|
||||||
|
|
||||||
|
// WCPay is handled separately when not installed and configured
|
||||||
|
if (
|
||||||
|
getIsGatewayWCPay( gateway ) &&
|
||||||
|
! ( gateway.installed && ! gateway.needsSetup )
|
||||||
|
) {
|
||||||
|
wcPay.push( gateway );
|
||||||
|
} else if ( gateway.is_offline ) {
|
||||||
|
offline.push( gateway );
|
||||||
|
} else if ( gateway.enabled ) {
|
||||||
|
// Enabled gateways should be ignored.
|
||||||
|
} else if ( isWCPayOrOtherCategoryDoneSetup ) {
|
||||||
|
// If WCPay or "other" gateway is enabled in an WCPay-eligible country, only
|
||||||
|
// allow to list "additional" gateways.
|
||||||
|
if (
|
||||||
|
getIsGatewayAdditionalCategory( gateway, countryCode )
|
||||||
|
) {
|
||||||
|
additional.push( gateway );
|
||||||
|
}
|
||||||
|
} else if ( ! isWCPaySupported ) {
|
||||||
|
// When WCPay-ineligible, just show all gateways.
|
||||||
|
additional.push( gateway );
|
||||||
|
} else if (
|
||||||
|
getIsGatewayOtherCategory( gateway, countryCode )
|
||||||
|
) {
|
||||||
|
// When nothing is set up and eligible for WCPay, only show "other" gateways.
|
||||||
|
additional.push( gateway );
|
||||||
|
}
|
||||||
|
|
||||||
|
return all;
|
||||||
|
},
|
||||||
|
[ [], [], [] ]
|
||||||
|
);
|
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: tweak
|
||||||
|
|
||||||
|
Refactor and improve tests payments task
|
|
@ -22,17 +22,17 @@ class DefaultPaymentGateways {
|
||||||
public static function get_all() {
|
public static function get_all() {
|
||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'id' => 'payfast',
|
'id' => 'payfast',
|
||||||
'title' => __( 'PayFast', 'woocommerce' ),
|
'title' => __( 'PayFast', 'woocommerce' ),
|
||||||
'content' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africa’s most popular payment gateways. No setup fees or monthly subscription costs. Selecting this extension will configure your store to use South African rands as the selected currency.', 'woocommerce' ),
|
'content' => __( 'The PayFast extension for WooCommerce enables you to accept payments by Credit Card and EFT via one of South Africa’s most popular payment gateways. No setup fees or monthly subscription costs. Selecting this extension will configure your store to use South African rands as the selected currency.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payfast.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payfast.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payfast.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payfast.png',
|
||||||
'plugins' => array( 'woocommerce-payfast-gateway' ),
|
'plugins' => array( 'woocommerce-payfast-gateway' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'ZA', 'GH', 'NG' ) ),
|
self::get_rules_for_countries( array( 'ZA', 'GH', 'NG' ) ),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'ZA', 'GH', 'NG' ),
|
'category_other' => array( 'ZA', 'GH', 'NG' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -49,67 +49,67 @@ class DefaultPaymentGateways {
|
||||||
),
|
),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'AU', 'AT', 'BE', 'BG', 'BR', 'CA', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HK', 'IN', 'IE', 'IT', 'JP', 'LV', 'LT', 'LU', 'MY', 'MT', 'MX', 'NL', 'NZ', 'NO', 'PL', 'PT', 'RO', 'SG', 'SK', 'SI', 'ES', 'SE', 'CH', 'GB', 'US', 'PR', 'HU', 'SL', 'ID', 'MY', 'SI', 'PR' ),
|
'category_other' => array( 'AU', 'AT', 'BE', 'BG', 'BR', 'CA', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HK', 'IN', 'IE', 'IT', 'JP', 'LV', 'LT', 'LU', 'MY', 'MT', 'MX', 'NL', 'NZ', 'NO', 'PL', 'PT', 'RO', 'SG', 'SK', 'SI', 'ES', 'SE', 'CH', 'GB', 'US', 'PR', 'HU', 'SL', 'ID', 'MY', 'SI', 'PR' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
'recommendation_priority' => 3,
|
'recommendation_priority' => 3,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'paystack',
|
'id' => 'paystack',
|
||||||
'title' => __( 'Paystack', 'woocommerce' ),
|
'title' => __( 'Paystack', 'woocommerce' ),
|
||||||
'content' => __( 'Paystack helps African merchants accept one-time and recurring payments online with a modern, safe, and secure payment gateway.', 'woocommerce' ),
|
'content' => __( 'Paystack helps African merchants accept one-time and recurring payments online with a modern, safe, and secure payment gateway.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/paystack.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/paystack.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/paystack.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/paystack.png',
|
||||||
'plugins' => array( 'woo-paystack' ),
|
'plugins' => array( 'woo-paystack' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'ZA', 'GH', 'NG' ) ),
|
self::get_rules_for_countries( array( 'ZA', 'GH', 'NG' ) ),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'ZA', 'GH', 'NG' ),
|
'category_other' => array( 'ZA', 'GH', 'NG' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'kco',
|
'id' => 'kco',
|
||||||
'title' => __( 'Klarna Checkout', 'woocommerce' ),
|
'title' => __( 'Klarna Checkout', 'woocommerce' ),
|
||||||
'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
|
'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/klarna-black.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/klarna-black.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/klarna.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/klarna.png',
|
||||||
'plugins' => array( 'klarna-checkout-for-woocommerce' ),
|
'plugins' => array( 'klarna-checkout-for-woocommerce' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'SE', 'FI', 'NO' ) ),
|
self::get_rules_for_countries( array( 'SE', 'FI', 'NO' ) ),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'SE', 'FI', 'NO' ),
|
'category_other' => array( 'SE', 'FI', 'NO' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'klarna_payments',
|
'id' => 'klarna_payments',
|
||||||
'title' => __( 'Klarna Payments', 'woocommerce' ),
|
'title' => __( 'Klarna Payments', 'woocommerce' ),
|
||||||
'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
|
'content' => __( 'Choose the payment that you want, pay now, pay later or slice it. No credit card numbers, no passwords, no worries.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/klarna-black.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/klarna-black.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/klarna.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/klarna.png',
|
||||||
'plugins' => array( 'klarna-payments-for-woocommerce' ),
|
'plugins' => array( 'klarna-payments-for-woocommerce' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries(
|
self::get_rules_for_countries(
|
||||||
array( 'US', 'CA', 'DK', 'DE', 'AT', 'NL', 'CH', 'BE', 'SP', 'PL', 'FR', 'IT', 'GB', 'ES', 'FI', 'NO', 'SE', 'ES', 'FI', 'NO', 'SE' )
|
array( 'US', 'CA', 'DK', 'DE', 'AT', 'NL', 'CH', 'BE', 'SP', 'PL', 'FR', 'IT', 'GB', 'ES', 'FI', 'NO', 'SE', 'ES', 'FI', 'NO', 'SE' )
|
||||||
),
|
),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array(),
|
'category_other' => array(),
|
||||||
'category_additional' => array( 'US', 'CA', 'DK', 'DE', 'AT', 'NL', 'CH', 'BE', 'SP', 'PL', 'FR', 'IT', 'GB', 'ES', 'FI', 'NO', 'SE', 'ES', 'FI', 'NO', 'SE' ),
|
'category_additional' => array( 'US', 'CA', 'DK', 'DE', 'AT', 'NL', 'CH', 'BE', 'SP', 'PL', 'FR', 'IT', 'GB', 'ES', 'FI', 'NO', 'SE', 'ES', 'FI', 'NO', 'SE' ),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'mollie_wc_gateway_banktransfer',
|
'id' => 'mollie_wc_gateway_banktransfer',
|
||||||
'title' => __( 'Mollie', 'woocommerce' ),
|
'title' => __( 'Mollie', 'woocommerce' ),
|
||||||
'content' => __( 'Effortless payments by Mollie: Offer global and local payment methods, get onboarded in minutes, and supported in your language.', 'woocommerce' ),
|
'content' => __( 'Effortless payments by Mollie: Offer global and local payment methods, get onboarded in minutes, and supported in your language.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mollie.svg',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/mollie.svg',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/mollie.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/mollie.png',
|
||||||
'plugins' => array( 'mollie-payments-for-woocommerce' ),
|
'plugins' => array( 'mollie-payments-for-woocommerce' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries(
|
self::get_rules_for_countries(
|
||||||
array( 'FR', 'DE', 'GB', 'AT', 'CH', 'ES', 'IT', 'PL', 'FI', 'NL', 'BE' )
|
array( 'FR', 'DE', 'GB', 'AT', 'CH', 'ES', 'IT', 'PL', 'FI', 'NL', 'BE' )
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'FR', 'DE', 'GB', 'AT', 'CH', 'ES', 'IT', 'PL', 'FI', 'NL', 'BE' ),
|
'category_other' => array( 'FR', 'DE', 'GB', 'AT', 'CH', 'ES', 'IT', 'PL', 'FI', 'NL', 'BE' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -124,17 +124,17 @@ class DefaultPaymentGateways {
|
||||||
),
|
),
|
||||||
'recommendation_priority' => 2,
|
'recommendation_priority' => 2,
|
||||||
'is_local_partner' => true,
|
'is_local_partner' => true,
|
||||||
'category_other' => array( 'AR', 'BR', 'CL', 'CO', 'MX', 'PE', 'UY' ),
|
'category_other' => array( 'AR', 'BR', 'CL', 'CO', 'MX', 'PE', 'UY' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'ppcp-gateway',
|
'id' => 'ppcp-gateway',
|
||||||
'title' => __( 'PayPal Payments', 'woocommerce' ),
|
'title' => __( 'PayPal Payments', 'woocommerce' ),
|
||||||
'content' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce' ),
|
'content' => __( "Safe and secure payments using credit cards or your customer's PayPal account.", 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/paypal.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/paypal.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/paypal.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/paypal.png',
|
||||||
'plugins' => array( 'woocommerce-paypal-payments' ),
|
'plugins' => array( 'woocommerce-paypal-payments' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
(object) array(
|
(object) array(
|
||||||
'type' => 'base_location_country',
|
'type' => 'base_location_country',
|
||||||
'value' => 'IN',
|
'value' => 'IN',
|
||||||
|
@ -142,30 +142,30 @@ class DefaultPaymentGateways {
|
||||||
),
|
),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'US', 'CA', 'AT', 'BE', 'BG', 'HR', 'CH', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SL', 'SE', 'MX', 'BR', 'AR', 'CL', 'CO', 'EC', 'PE', 'UY', 'VE', 'AU', 'NZ', 'HK', 'JP', 'SG', 'CN', 'ID', 'ZA', 'NG', 'GH' ),
|
'category_other' => array( 'US', 'CA', 'AT', 'BE', 'BG', 'HR', 'CH', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SL', 'SE', 'MX', 'BR', 'AR', 'CL', 'CO', 'EC', 'PE', 'UY', 'VE', 'AU', 'NZ', 'HK', 'JP', 'SG', 'CN', 'ID', 'ZA', 'NG', 'GH' ),
|
||||||
'category_additional' => array( 'US', 'CA', 'AT', 'BE', 'BG', 'HR', 'CH', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SL', 'SE', 'MX', 'BR', 'AR', 'CL', 'CO', 'EC', 'PE', 'UY', 'VE', 'AU', 'NZ', 'HK', 'JP', 'SG', 'CN', 'ID', 'IN', 'ZA', 'NG', 'GH' ),
|
'category_additional' => array( 'US', 'CA', 'AT', 'BE', 'BG', 'HR', 'CH', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR', 'DE', 'GB', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SK', 'SL', 'SE', 'MX', 'BR', 'AR', 'CL', 'CO', 'EC', 'PE', 'UY', 'VE', 'AU', 'NZ', 'HK', 'JP', 'SG', 'CN', 'ID', 'IN', 'ZA', 'NG', 'GH' ),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'cod',
|
'id' => 'cod',
|
||||||
'title' => __( 'Cash on delivery', 'woocommerce' ),
|
'title' => __( 'Cash on delivery', 'woocommerce' ),
|
||||||
'content' => __( 'Take payments in cash upon delivery.', 'woocommerce' ),
|
'content' => __( 'Take payments in cash upon delivery.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/cod.svg',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/cod.svg',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/cod.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/cod.png',
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'is_offline' => true,
|
'is_offline' => true,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'bacs',
|
'id' => 'bacs',
|
||||||
'title' => __( 'Direct bank transfer', 'woocommerce' ),
|
'title' => __( 'Direct bank transfer', 'woocommerce' ),
|
||||||
'content' => __( 'Take payments via bank transfer.', 'woocommerce' ),
|
'content' => __( 'Take payments via bank transfer.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/bacs.svg',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/bacs.svg',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/bacs.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/bacs.png',
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'is_offline' => true,
|
'is_offline' => true,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce_payments',
|
'id' => 'woocommerce_payments',
|
||||||
|
@ -281,13 +281,13 @@ class DefaultPaymentGateways {
|
||||||
'recommendation_priority' => 1,
|
'recommendation_priority' => 1,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'razorpay',
|
'id' => 'razorpay',
|
||||||
'title' => __( 'Razorpay', 'woocommerce' ),
|
'title' => __( 'Razorpay', 'woocommerce' ),
|
||||||
'content' => __( 'The official Razorpay extension for WooCommerce allows you to accept credit cards, debit cards, netbanking, wallet, and UPI payments.', 'woocommerce' ),
|
'content' => __( 'The official Razorpay extension for WooCommerce allows you to accept credit cards, debit cards, netbanking, wallet, and UPI payments.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/razorpay.svg',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/razorpay.svg',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/razorpay.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/razorpay.png',
|
||||||
'plugins' => array( 'woo-razorpay' ),
|
'plugins' => array( 'woo-razorpay' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
(object) array(
|
(object) array(
|
||||||
'type' => 'base_location_country',
|
'type' => 'base_location_country',
|
||||||
'value' => 'IN',
|
'value' => 'IN',
|
||||||
|
@ -295,17 +295,17 @@ class DefaultPaymentGateways {
|
||||||
),
|
),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'IN' ),
|
'category_other' => array( 'IN' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'payubiz',
|
'id' => 'payubiz',
|
||||||
'title' => __( 'PayU for WooCommerce', 'woocommerce' ),
|
'title' => __( 'PayU for WooCommerce', 'woocommerce' ),
|
||||||
'content' => __( 'Enable PayU’s exclusive plugin for WooCommerce to start accepting payments in 100+ payment methods available in India including credit cards, debit cards, UPI, & more!', 'woocommerce' ),
|
'content' => __( 'Enable PayU’s exclusive plugin for WooCommerce to start accepting payments in 100+ payment methods available in India including credit cards, debit cards, UPI, & more!', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/payu.svg',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/payu.svg',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payu.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/payu.png',
|
||||||
'plugins' => array( 'payu-india' ),
|
'plugins' => array( 'payu-india' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
(object) array(
|
(object) array(
|
||||||
'type' => 'base_location_country',
|
'type' => 'base_location_country',
|
||||||
'value' => 'IN',
|
'value' => 'IN',
|
||||||
|
@ -313,31 +313,31 @@ class DefaultPaymentGateways {
|
||||||
),
|
),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'IN' ),
|
'category_other' => array( 'IN' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'eway',
|
'id' => 'eway',
|
||||||
'title' => __( 'Eway', 'woocommerce' ),
|
'title' => __( 'Eway', 'woocommerce' ),
|
||||||
'content' => __( 'The Eway extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
|
'content' => __( 'The Eway extension for WooCommerce allows you to take credit card payments directly on your store without redirecting your customers to a third party site to make payment.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/eway.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/onboarding/eway.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/eway.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/eway.png',
|
||||||
'plugins' => array( 'woocommerce-gateway-eway' ),
|
'plugins' => array( 'woocommerce-gateway-eway' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'AU', 'NZ' ) ),
|
self::get_rules_for_countries( array( 'AU', 'NZ' ) ),
|
||||||
self::get_rules_for_cbd( false ),
|
self::get_rules_for_cbd( false ),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'AU', 'NZ' ),
|
'category_other' => array( 'AU', 'NZ' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'square_credit_card',
|
'id' => 'square_credit_card',
|
||||||
'title' => __( 'Square', 'woocommerce' ),
|
'title' => __( 'Square', 'woocommerce' ),
|
||||||
'content' => __( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place.', 'woocommerce' ),
|
'content' => __( 'Securely accept credit and debit cards with one low rate, no surprise fees (custom rates available). Sell online and in store and track sales and inventory in one place.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/square-black.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/square-black.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/square.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/square.png',
|
||||||
'plugins' => array( 'woocommerce-square' ),
|
'plugins' => array( 'woocommerce-square' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
(object) array(
|
(object) array(
|
||||||
'type' => 'or',
|
'type' => 'or',
|
||||||
'operands' => (object) array(
|
'operands' => (object) array(
|
||||||
|
@ -352,47 +352,47 @@ class DefaultPaymentGateways {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'category_other' => array( 'US', 'CA', 'JP', 'GB', 'AU', 'IE', 'FR', 'ES', 'FI' ),
|
'category_other' => array( 'US', 'CA', 'JP', 'GB', 'AU', 'IE', 'FR', 'ES', 'FI' ),
|
||||||
'category_additional' => array(),
|
'category_additional' => array(),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'afterpay',
|
'id' => 'afterpay',
|
||||||
'title' => __( 'Afterpay', 'woocommerce' ),
|
'title' => __( 'Afterpay', 'woocommerce' ),
|
||||||
'content' => __( 'Afterpay allows customers to receive products immediately and pay for purchases over four installments, always interest-free.', 'woocommerce' ),
|
'content' => __( 'Afterpay allows customers to receive products immediately and pay for purchases over four installments, always interest-free.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/afterpay.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/afterpay.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/afterpay.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/afterpay.png',
|
||||||
'plugins' => array( 'afterpay-gateway-for-woocommerce' ),
|
'plugins' => array( 'afterpay-gateway-for-woocommerce' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'US', 'CA' ) ),
|
self::get_rules_for_countries( array( 'US', 'CA' ) ),
|
||||||
),
|
),
|
||||||
'category_other' => array(),
|
'category_other' => array(),
|
||||||
'category_additional' => array( 'US', 'CA' ),
|
'category_additional' => array( 'US', 'CA' ),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'amazon_payments_advanced',
|
'id' => 'amazon_payments_advanced',
|
||||||
'title' => __( 'Amazon Pay', 'woocommerce' ),
|
'title' => __( 'Amazon Pay', 'woocommerce' ),
|
||||||
'content' => __( 'Enable a familiar, fast checkout for hundreds of millions of active Amazon customers globally.', 'woocommerce' ),
|
'content' => __( 'Enable a familiar, fast checkout for hundreds of millions of active Amazon customers globally.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/amazonpay.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/amazonpay.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/amazonpay.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/amazonpay.png',
|
||||||
'plugins' => array( 'woocommerce-gateway-amazon-payments-advanced' ),
|
'plugins' => array( 'woocommerce-gateway-amazon-payments-advanced' ),
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'US', 'CA' ) ),
|
self::get_rules_for_countries( array( 'US', 'CA' ) ),
|
||||||
),
|
),
|
||||||
'category_other' => array(),
|
'category_other' => array(),
|
||||||
'category_additional' => array( 'US', 'CA' ),
|
'category_additional' => array( 'US', 'CA' ),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'affirm',
|
'id' => 'affirm',
|
||||||
'title' => __( 'Affirm', 'woocommerce' ),
|
'title' => __( 'Affirm', 'woocommerce' ),
|
||||||
'content' => __( 'Affirm’s tailored Buy Now Pay Later programs remove price as a barrier, turning browsers into buyers, increasing average order value, and expanding your customer base.', 'woocommerce' ),
|
'content' => __( 'Affirm’s tailored Buy Now Pay Later programs remove price as a barrier, turning browsers into buyers, increasing average order value, and expanding your customer base.', 'woocommerce' ),
|
||||||
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/affirm.png',
|
'image' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/affirm.png',
|
||||||
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/affirm.png',
|
'image_72x72' => WC_ADMIN_IMAGES_FOLDER_URL . '/payment_methods/72x72/affirm.png',
|
||||||
'plugins' => array(),
|
'plugins' => array(),
|
||||||
'external_link' => 'https://woocommerce.com/products/woocommerce-gateway-affirm',
|
'external_link' => 'https://woocommerce.com/products/woocommerce-gateway-affirm',
|
||||||
'is_visible' => array(
|
'is_visible' => array(
|
||||||
self::get_rules_for_countries( array( 'US', 'CA' ) ),
|
self::get_rules_for_countries( array( 'US', 'CA' ) ),
|
||||||
),
|
),
|
||||||
'category_other' => array(),
|
'category_other' => array(),
|
||||||
'category_additional' => array( 'US', 'CA' ),
|
'category_additional' => array( 'US', 'CA' ),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue