Skip to content

Commit

Permalink
feat: added suffix on melidata script import
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniCavallari committed Jun 7, 2022
1 parent 080dd36 commit c1569cd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 3 additions & 4 deletions includes/helpers/class-wc-woomercadopago-helper-links.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
* Class WC_WooMercadoPago_Helper_Links
*/
class WC_WooMercadoPago_Helper_Links {

/**
* Links by country configured in woocommerce.
*/
Expand All @@ -37,7 +36,6 @@ public static function woomercadopago_settings_links() {
);
}


public static function get_mp_devsite_links() {
$link = WC_WooMercadoPago_Module::define_link_country();
$base_link = 'https://www.mercadopago.' . $link['sufix_url'] . 'developers/' . $link['translate'];
Expand Down Expand Up @@ -67,7 +65,8 @@ public static function get_mp_devsite_link( $country ) {
'mpe' => 'https://www.mercadopago.com.pe/developers/es/guides/plugins/woocommerce/testing',
'mlu' => 'https://www.mercadopago.com.uy/developers/es/guides/plugins/woocommerce/testing',
];
$link = array_key_exists($country, $country_links) ? $country_links[$country] : $country_links['mla'];

$link = array_key_exists($country, $country_links) ? $country_links[$country] : $country_links['mla'];

return $link;
}
Expand All @@ -79,7 +78,6 @@ public static function get_mp_devsite_link( $country ) {
* @return string
*/
public static function get_country_link_mp_terms() {

$country_link = [
'mla' => [
'help' => 'ayuda',
Expand Down Expand Up @@ -127,6 +125,7 @@ public static function get_country_link_mp_terms() {

$option_country = WC_WooMercadoPago_Options::get_instance();
$checkout_country = strtolower($option_country->get_checkout_country());

return $country_link[ $checkout_country ];
}

Expand Down
6 changes: 4 additions & 2 deletions includes/module/class-wc-woomercadopago-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,12 @@ public function load_admin_scripts() {
if ( is_admin() ) {
global $woocommerce;

$suffix = $this->get_suffix();
$site_id = get_option( '_site_id_v1' );

wp_enqueue_script(
'mercadopago_melidata',
plugins_url( '../assets/js/melidata/melidata-client.js', plugin_dir_path( __FILE__ ) ),
plugins_url( '../assets/js/melidata/melidata-client' . $suffix . '.js', plugin_dir_path( __FILE__ ) ),
array(),
WC_WooMercadoPago_Constants::VERSION,
true
Expand Down Expand Up @@ -712,11 +713,12 @@ public function load_before_thankyou_scripts( $order_id ) {
public function load_buyer_scripts( $location, $payment_method ) {
global $woocommerce;

$suffix = $this->get_suffix();
$site_id = get_option( '_site_id_v1' );

wp_enqueue_script(
'mercadopago_melidata',
plugins_url( '../assets/js/melidata/melidata-client.js', plugin_dir_path( __FILE__ ) ),
plugins_url( '../assets/js/melidata/melidata-client' . $suffix . '.js', plugin_dir_path( __FILE__ ) ),
array(),
WC_WooMercadoPago_Constants::VERSION,
true
Expand Down

0 comments on commit c1569cd

Please sign in to comment.