Only fetch remote payment gateway recommendations when opted in (https://github.com/woocommerce/woocommerce-admin/pull/6964)
* Only fetch remote payment specs when marketplace suggestions enabled * Fall back to default specs if remote fetch fails * Change ruleset to object * Add changelog entry
This commit is contained in:
parent
295cd6b2c9
commit
8eb0179df7
|
@ -131,6 +131,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
|
|||
- Tweak: Update WC Payments copy on the task list #6734
|
||||
- Tweak: Add check to see if value for contains is array, show warning if not. #6645
|
||||
- Tweak: Sort the extension task list by completion status and allow toggling visibility. #6792
|
||||
- Tweak: Only fetch remote payment gateway recommendations when opted in #6964
|
||||
- Update: Update choose niche note cta URL #6733
|
||||
- Update: UI updates to Payment Task screen #6766
|
||||
- Update: Adding setup required icon for non-configured payment methods #6811
|
||||
|
|
|
@ -55,8 +55,17 @@ class Init {
|
|||
|
||||
// Fetch specs if they don't yet exist.
|
||||
if ( false === $specs || ! is_array( $specs ) || 0 === count( $specs ) ) {
|
||||
// We are running too early, need to poll data sources first.
|
||||
if ( 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) ) {
|
||||
return self::get_default_specs();
|
||||
}
|
||||
|
||||
$specs = DataSourcePoller::read_specs_from_data_sources();
|
||||
|
||||
// Fall back to default specs if polling failed.
|
||||
if ( ! $specs ) {
|
||||
return self::get_default_specs();
|
||||
}
|
||||
|
||||
$specs = self::localize( $specs );
|
||||
set_transient( self::SPECS_TRANSIENT_NAME, $specs, 7 * DAY_IN_SECONDS );
|
||||
}
|
||||
|
@ -64,6 +73,28 @@ class Init {
|
|||
return $specs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default specs.
|
||||
*
|
||||
* @return array Default specs.
|
||||
*/
|
||||
public static function get_default_specs() {
|
||||
return array(
|
||||
(object) array(
|
||||
'key' => 'payfast',
|
||||
'title' => __( 'PayFast', 'woocommerce-admin' ),
|
||||
'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-admin' ),
|
||||
'image' => __( 'https =>//www.payfast.co.za/assets/images/payfast_logo_colour.svg', 'woocommerce-admin' ),
|
||||
'plugins' => array( 'woocommerce-payfast-gateway' ),
|
||||
'is_visible' => (object) array(
|
||||
'type' => 'base_location_country',
|
||||
'value' => 'ZA',
|
||||
'operation' => '=',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Localize the provided method.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue