diff --git a/includes/payments/class-wc-woomercadopago-custom-gateway.php b/includes/payments/class-wc-woomercadopago-custom-gateway.php index afc6a3e6e..c69e91c89 100755 --- a/includes/payments/class-wc-woomercadopago-custom-gateway.php +++ b/includes/payments/class-wc-woomercadopago-custom-gateway.php @@ -593,4 +593,41 @@ public function get_or_create_customer() { public static function get_id() { return self::ID; } + + /** + * Get the Mercado Pago registration URL. + * + * @return string URL. + */ + public function get_registration_url() { + $url = 'https://www.mercadopago.com'; + $country_code = WC()->countries->get_base_country(); + + if ( in_array( $country_code, array( 'AR', 'BR', 'CL', 'CO', 'MX', 'PE', 'UY' ) ) ) { + $country_code = strtolower( $country_code ); + return "${url}.${country_code}/registration-company?confirmation_url=${url}.${country_code}%2Fcomo-cobrar"; + } + + return $url; + } + + /** + * Get help text to display during quick setup. + */ + public function get_setup_help_text() { + return sprintf( + __( 'Mercado Pago can be configured under your store settings. Create your Mercado Pago account here.', 'wc_mercado' ), + $this->get_registration_url(), + admin_url( 'admin.php?page=wc-settings&tab=checkout§ion=' . strtolower( $this->id ) ) + ); + } + + /** + * Check if the gateway still required further setup. + * + * @return bool + */ + public function needs_setup() { + return empty( $this->get_access_token() ) || empty( $this->get_public_key() ); + } }