Skip to content

Commit

Permalink
Initial changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RadoslavGeorgiev committed Dec 12, 2024
1 parent e1a0ae0 commit d0eb311
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 51 deletions.
86 changes: 43 additions & 43 deletions includes/admin/class-wc-payments-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,49 +144,6 @@ public function __construct(
$this->incentives_service = $incentives_service;
$this->fraud_service = $fraud_service;
$this->database_cache = $database_cache;

$this->admin_child_pages = [
'wc-payments-overview' => [
'id' => 'wc-payments-overview',
'title' => __( 'Overview', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/overview',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 10,
],
],
'wc-payments-deposits' => [
'id' => 'wc-payments-deposits',
'title' => __( 'Payouts', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/payouts',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 20,
],
],
'wc-payments-transactions' => [
'id' => 'wc-payments-transactions',
'title' => __( 'Transactions', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/transactions',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 30,
],
],
'wc-payments-disputes' => [
'id' => 'wc-payments-disputes',
'title' => __( 'Disputes', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/disputes',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 40,
],
],
];
}

/**
Expand Down Expand Up @@ -315,6 +272,49 @@ public function add_payments_menu() {
}
global $submenu;

$this->admin_child_pages = [
'wc-payments-overview' => [
'id' => 'wc-payments-overview',
'title' => __( 'Overview', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/overview',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 10,
],
],
'wc-payments-deposits' => [
'id' => 'wc-payments-deposits',
'title' => __( 'Payouts', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/payouts',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 20,
],
],
'wc-payments-transactions' => [
'id' => 'wc-payments-transactions',
'title' => __( 'Transactions', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/transactions',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 30,
],
],
'wc-payments-disputes' => [
'id' => 'wc-payments-disputes',
'title' => __( 'Disputes', 'woocommerce-payments' ),
'parent' => 'wc-payments',
'path' => '/payments/disputes',
'nav_args' => [
'parent' => 'wc-payments',
'order' => 40,
],
],
];

try {
// Render full payments menu with sub-items only if:
// - we have working WPCOM/Jetpack connection;
Expand Down
4 changes: 4 additions & 0 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ public function __construct(
}

// Define setting fields.
add_action( 'after_setup_theme', function() {
$this->form_fields = [
'enabled' => [
'title' => __( 'Enable/disable', 'woocommerce-payments' ),
Expand Down Expand Up @@ -496,6 +497,7 @@ public function __construct(
],
'platform_checkout_custom_message' => [ 'default' => __( 'By placing this order, you agree to our [terms] and understand our [privacy_policy].', 'woocommerce-payments' ) ],
];
});

// Capabilities have different keys than the payment method ID's,
// so instead of appending '_payments' to the end of the ID, it'll be better
Expand Down Expand Up @@ -4468,6 +4470,8 @@ public function get_theme_icon() {
* @return string
*/
public function get_method_description() {
return 'Some description';

$description = sprintf(
/* translators: %1$s: WooPayments */
__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ trait WC_Payments_Subscriptions_Utilities {
* @return bool Whether subscriptions is enabled or not.
*/
public function is_subscriptions_enabled() {
// Without subs core, this leads to issues.
return false;
if ( $this->is_subscriptions_plugin_active() ) {
return version_compare( $this->get_subscriptions_plugin_version(), '2.2.0', '>=' );
}
Expand Down
2 changes: 1 addition & 1 deletion includes/payment-methods/class-affirm-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Affirm_Payment_Method extends UPE_Payment_Method {
public function __construct( $token_service ) {
parent::__construct( $token_service );
$this->stripe_id = self::PAYMENT_METHOD_STRIPE_ID;
$this->title = __( 'Affirm', 'woocommerce-payments' );
$this->title = 'Affirm';
$this->is_reusable = false;
$this->is_bnpl = true;
$this->icon_url = plugins_url( 'assets/images/payment-methods/affirm-logo.svg', WCPAY_PLUGIN_FILE );
Expand Down
6 changes: 3 additions & 3 deletions includes/payment-methods/class-afterpay-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Afterpay_Payment_Method extends UPE_Payment_Method {
public function __construct( $token_service ) {
parent::__construct( $token_service );
$this->stripe_id = self::PAYMENT_METHOD_STRIPE_ID;
$this->title = __( 'Afterpay', 'woocommerce-payments' );
$this->title = 'Afterpay';
$this->is_reusable = false;
$this->is_bnpl = true;
$this->icon_url = plugins_url( 'assets/images/payment-methods/afterpay-logo.svg', WCPAY_PLUGIN_FILE );
Expand All @@ -48,10 +48,10 @@ public function __construct( $token_service ) {
*/
public function get_title( ?string $account_country = null, $payment_details = false ) {
if ( 'GB' === $account_country ) {
return __( 'Clearpay', 'woocommerce-payments' );
return 'Clearpay';
}

return __( 'Afterpay', 'woocommerce-payments' );
return 'Afterpay';
}

/**
Expand Down
3 changes: 2 additions & 1 deletion includes/payment-methods/class-cc-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class CC_Payment_Method extends UPE_Payment_Method {
public function __construct( $token_service ) {
parent::__construct( $token_service );
$this->stripe_id = self::PAYMENT_METHOD_STRIPE_ID;
$this->title = __( 'Credit card / debit card', 'woocommerce-payments' );
// $this->title = __( 'Credit card / debit card', 'woocommerce-payments' );
$this->title = 'Credit card / debit card';
$this->is_reusable = true;
$this->currencies = [];// All currencies are supported.
$this->icon_url = plugins_url( 'assets/images/payment-methods/generic-card.svg', WCPAY_PLUGIN_FILE );
Expand Down
2 changes: 1 addition & 1 deletion includes/payment-methods/class-klarna-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Klarna_Payment_Method extends UPE_Payment_Method {
public function __construct( $token_service ) {
parent::__construct( $token_service );
$this->stripe_id = self::PAYMENT_METHOD_STRIPE_ID;
$this->title = __( 'Klarna', 'woocommerce-payments' );
$this->title = 'Klarna';
$this->is_reusable = false;
$this->is_bnpl = true;
$this->icon_url = plugins_url( 'assets/images/payment-methods/klarna-pill.svg', WCPAY_PLUGIN_FILE );
Expand Down
2 changes: 1 addition & 1 deletion includes/payment-methods/class-link-payment-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Link_Payment_Method extends UPE_Payment_Method {
public function __construct( $token_service ) {
parent::__construct( $token_service );
$this->stripe_id = self::PAYMENT_METHOD_STRIPE_ID;
$this->title = __( 'Link', 'woocommerce-payments' );
$this->title = 'Link';
$this->is_reusable = true;
$this->currencies = [ Currency_Code::UNITED_STATES_DOLLAR ];
$this->icon_url = plugins_url( 'assets/images/payment-methods/link.svg', WCPAY_PLUGIN_FILE );
Expand Down
3 changes: 2 additions & 1 deletion woocommerce-payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ function wcpay_init_subscriptions_core() {
}

require_once $wcs_core_path . 'includes/class-wc-subscriptions-core-plugin.php';
new WC_Subscriptions_Core_Plugin();
// There are a ton of issues with subs core.
// new WC_Subscriptions_Core_Plugin();
}
}
add_action( 'plugins_loaded', 'wcpay_init_subscriptions_core', 0 );
Expand Down

0 comments on commit d0eb311

Please sign in to comment.