Skip to content

Commit

Permalink
Merge pull request #359 from mercadopago/release/7.4.0
Browse files Browse the repository at this point in the history
Release v7.4.0
  • Loading branch information
DouglasCorreiaMeli authored Apr 29, 2024
2 parents 4136508 + 119b59a commit 4bde8a1
Show file tree
Hide file tree
Showing 19 changed files with 604 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [7.4.0] - 2024-04-25
### Added:
- A system has been implemented to collect metrics for new sellers, with the aim of facilitating the onboarding of these first-time users. These metrics will allow us to generate ideas for improving the relationship between the plugin and the seller during the onboarding process.
### Other improvements:
- Updated dependencies (PHP SDK).

## [7.3.5] - 2024-04-17
### Fixed:
- Checked field on checkout now validated.
Expand Down
6 changes: 6 additions & 0 deletions changelog.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
CHANGELOG:
== Changelog ==

= v7.4.0 (25/04/2024) =
* Added:
- A system has been implemented to collect metrics for new sellers, with the aim of facilitating the onboarding of these first-time users. These metrics will allow us to generate ideas for improving the relationship between the plugin and the seller during the onboarding process.
* Other improvements:
- Updated dependencies (PHP SDK).

= v7.3.5 (17/04/2024) =
* Fixed:
- Checked field on checkout now validated.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "woocommerce-mercadopago",
"description": "Woocommerce MercadoPago Payment Gateway",
"version": "7.3.5",
"version": "7.4.0",
"main": "main.js",
"repository": {
"type": "git",
Expand Down
9 changes: 5 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: ecommerce, mercadopago, woocommerce
Requires at least: 6.3
Tested up to: 6.5
Requires PHP: 7.4
Stable tag: 7.3.5
Stable tag: 7.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -136,8 +136,9 @@ Check out our <a href="https://www.mercadopago.com.br/developers/pt/plugins_sdks

== Changelog ==

* Fixed:
- Checked field on checkout now validated.
- Rollback SDK dependency.
* Added:
- A system has been implemented to collect metrics for new sellers, with the aim of facilitating the onboarding of these first-time users. These metrics will allow us to generate ideas for improving the relationship between the plugin and the seller during the onboarding process.
* Other improvements:
- Updated dependencies (PHP SDK).

[See changelog for all versions](https://github.com/mercadopago/cart-woocommerce/blob/main/CHANGELOG.md).
13 changes: 12 additions & 1 deletion src/Admin/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use MercadoPago\Woocommerce\Logs\Logs;
use MercadoPago\Woocommerce\Translations\AdminTranslations;
use MercadoPago\Woocommerce\IO\Downloader;
use MercadoPago\Woocommerce\Funnel\Funnel;

if (!defined('ABSPATH')) {
exit;
Expand Down Expand Up @@ -105,6 +106,11 @@ class Settings
*/
private $downloader;

/**
* @var Funnel
*/
private $funnel;

/**
* Settings constructor
*
Expand All @@ -122,6 +128,7 @@ class Settings
* @param Session $session
* @param Logs $logs
* @param Downloader $downloader
* @param Funnel $funnel
*/
public function __construct(
Admin $admin,
Expand All @@ -137,7 +144,8 @@ public function __construct(
CurrentUser $currentUser,
Session $session,
Logs $logs,
Downloader $downloader
Downloader $downloader,
Funnel $funnel
) {
$this->admin = $admin;
$this->endpoints = $endpoints;
Expand All @@ -153,6 +161,7 @@ public function __construct(
$this->session = $session;
$this->logs = $logs;
$this->downloader = $downloader;
$this->funnel = $funnel;

$this->loadMenu();
$this->loadScriptsAndStyles();
Expand All @@ -161,11 +170,13 @@ public function __construct(
$this->plugin->registerOnPluginCredentialsUpdate(function () {
$this->seller->updatePaymentMethods();
$this->seller->updatePaymentMethodsBySiteId();
$this->funnel->updateStepCredentials();
});

$this->plugin->registerOnPluginTestModeUpdate(function () {
$this->seller->updatePaymentMethods();
$this->seller->updatePaymentMethodsBySiteId();
$this->funnel->updateStepPluginMode();
});
}

Expand Down
27 changes: 27 additions & 0 deletions src/Configs/Seller.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ class Seller
*/
private const TEST_USER = '_test_user_v1';

/**
* @const
*/
private const AUTO_UPDATE_PLUGINS = 'auto_update_plugins';
/**
* @var Cache
*/
Expand Down Expand Up @@ -308,6 +312,15 @@ public function getCredentialsAccessToken(): string
return $this->getCredentialsAccessTokenProd();
}

/**
* @return string
*/
public function getCustIdFromAT()
{
preg_match('/(\d+)$/', $this->getCredentialsAccessToken(), $matches);
return $matches[0];
}

/**
* @param string $gatewayOption
*
Expand Down Expand Up @@ -883,4 +896,18 @@ private function getPaymentMethodsBySiteId(string $siteId): array
];
}
}
/**
* Get auto update mode
*
* @return bool
*/
public function isAutoUpdate()
{
$auto_update_plugins = $this->options->get(self::AUTO_UPDATE_PLUGINS, '');

if (is_array($auto_update_plugins) && in_array('woocommerce-mercadopago/woocommerce-mercadopago.php', $auto_update_plugins)) {
return true;
}
return false;
}
}
63 changes: 63 additions & 0 deletions src/Configs/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ class Store
*/
private const CHECKOUT_EXPIRATION_DATE_PIX = 'expiration_date';

/**
* @const
*/
private const INSTALLATION_ID = '_mp_installation_id';

/**
* @const
*/
private const INSTALLATION_KEY = '_mp_installation_key';

/**
* @const
*/
private const EXECUTE_ACTIVATED_PLUGIN = '_mp_execute_activate';

/**
* @const
*/
Expand Down Expand Up @@ -342,6 +357,54 @@ public function setDismissedSavedCardsNotice(int $dismissedSavedCardsNotice): vo
$this->options->set(self::DISMISSED_SAVED_CARDS_NOTICE, $dismissedSavedCardsNotice);
}

/**
* @return string
*/
public function getInstallationKey(): string
{
return $this->options->get(self::INSTALLATION_KEY, '');
}

/**
* @return string
*/
public function getInstallationId(): string
{
return $this->options->get(self::INSTALLATION_ID, '');
}

/**
* @return bool
*/
public function getExecuteActivate(): bool
{
return $this->options->get(self::EXECUTE_ACTIVATED_PLUGIN, '') === 'yes';
}

/**
* @param string $execute
*/
public function setExecuteActivate(string $execute): void
{
$this->options->set(self::EXECUTE_ACTIVATED_PLUGIN, $execute);
}

/**
* @param string $installationId
*/
public function setInstallationId(string $installationId): void
{
$this->options->set(self::INSTALLATION_ID, $installationId);
}

/**
* @param string $installationKey
*/
public function setInstallationKey(string $installationKey): void
{
$this->options->set(self::INSTALLATION_KEY, $installationKey);
}

/**
* @return string
*/
Expand Down
43 changes: 41 additions & 2 deletions src/Dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use MercadoPago\PP\Sdk\HttpClient\Requester\CurlRequester;
use MercadoPago\Woocommerce\Admin\Settings;
use MercadoPago\Woocommerce\Configs\Metadata;
use MercadoPago\Woocommerce\Funnel\Funnel;
use MercadoPago\Woocommerce\Helpers\Actions;
use MercadoPago\Woocommerce\Helpers\Cart;
use MercadoPago\Woocommerce\Helpers\Images;
Expand All @@ -20,6 +21,7 @@
use MercadoPago\Woocommerce\Helpers\Country;
use MercadoPago\Woocommerce\Helpers\Currency;
use MercadoPago\Woocommerce\Helpers\CurrentUser;
use MercadoPago\Woocommerce\Helpers\Gateways;
use MercadoPago\Woocommerce\Helpers\Links;
use MercadoPago\Woocommerce\Helpers\Nonce;
use MercadoPago\Woocommerce\Helpers\Notices;
Expand Down Expand Up @@ -194,6 +196,11 @@ class Dependencies
*/
public $currentUserHelper;

/**
* @var Gateways
*/
public $gatewaysHelper;

/**
* @var Images
*/
Expand Down Expand Up @@ -280,6 +287,11 @@ class Dependencies
*/
public $downloader;

/**
* @var Funnel
*/
public $funnel;

/**
* Dependencies constructor
*/
Expand Down Expand Up @@ -318,6 +330,8 @@ public function __construct()
$this->scriptsHook = $this->setScripts();
$this->adminTranslations = $this->setAdminTranslations();
$this->storeTranslations = $this->setStoreTranslations();
$this->gatewaysHelper = $this->setGatewaysHelper();
$this->funnel = $this->setFunnel();
$this->gatewayHook = $this->setGateway();
$this->nonceHelper = $this->setNonce();
$this->orderStatus = $this->setOrderStatus();
Expand All @@ -330,6 +344,7 @@ public function __construct()
$this->creditsEnabledHelper = $this->setCreditsEnabled();
$this->checkoutCustomEndpoints = $this->setCustomCheckoutEndpoints();
$this->cartHelper = $this->setCart();
$this->funnel = $this->setFunnel();

$this->hooks = $this->setHooks();
$this->helpers = $this->setHelpers();
Expand Down Expand Up @@ -421,7 +436,8 @@ private function setGateway(): Gateway
$this->storeConfig,
$this->checkoutHook,
$this->storeTranslations,
$this->urlHelper
$this->urlHelper,
$this->funnel
);
}

Expand Down Expand Up @@ -460,6 +476,14 @@ private function setCurrentUser(): CurrentUser
return new CurrentUser($this->logs, $this->storeConfig);
}

/**
* @return Gateways
*/
private function setGatewaysHelper(): Gateways
{
return new Gateways($this->storeConfig);
}

/**
* @return AdminTranslations
*/
Expand Down Expand Up @@ -562,7 +586,8 @@ private function setSettings(): Settings
$this->currentUserHelper,
$this->sessionHelper,
$this->logs,
$this->downloader
$this->downloader,
$this->funnel
);
}

Expand All @@ -578,6 +603,19 @@ private function setCreditsEnabled(): CreditsEnabled
);
}

/**
* @return Funnel
*/
private function setFunnel(): Funnel
{
return new Funnel(
$this->storeConfig,
$this->sellerConfig,
$this->countryHelper,
$this->gatewaysHelper
);
}

/**
* @return CheckoutCustom
*/
Expand Down Expand Up @@ -633,6 +671,7 @@ private function setHelpers(): Helpers
$this->creditsEnabledHelper,
$this->currencyHelper,
$this->currentUserHelper,
$this->gatewaysHelper,
$this->imagesHelper,
$this->linksHelper,
$this->nonceHelper,
Expand Down
5 changes: 5 additions & 0 deletions src/Entities/Metadata/PaymentMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,9 @@ class PaymentMetadata
* @var string
*/
public $blocks_payment;

/**
* @var bool
*/
public $auto_update;
}
Loading

0 comments on commit 4bde8a1

Please sign in to comment.