Skip to content

Commit

Permalink
adding multiple fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Jan 13, 2025
1 parent 2b37826 commit a7966b3
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/).

## [5.7.1]

### Added

- `prePostParams` filter on Corvus and Paycek integrations.

## [5.7.0]

### Changed
Expand Down Expand Up @@ -911,6 +917,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a

- Initial production release.

[5.7.1]: https://github.com/infinum/eightshift-forms/compare/5.7.0...5.7.1
[5.7.0]: https://github.com/infinum/eightshift-forms/compare/5.6.6...5.7.0
[5.6.6]: https://github.com/infinum/eightshift-forms/compare/5.6.5...5.6.6
[5.6.5]: https://github.com/infinum/eightshift-forms/compare/5.6.4...5.6.5
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"require": {
"php": ">=8.3",
"erusev/parsedown": "^1.7.4",
"infinum/eightshift-forms-utils": "^3.0.14"
"infinum/eightshift-forms-utils": "^3.0.16"
},
"autoload": {
"psr-4": {
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion eightshift-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: Eightshift Forms is a complete form builder plugin that utilizes modern Block editor features with multiple third-party integrations, bringing your project to a new level.
* Author: WordPress team @Infinum
* Author URI: https://eightshift.com/
* Version: 5.7.0
* Version: 5.7.1
* Text Domain: eightshift-forms
*
* @package EightshiftForms
Expand Down
2 changes: 2 additions & 0 deletions src/Hooks/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,12 @@ private static function getPublicFilters(): array
'afterCustomResultOutputProcess',
],
SettingsCorvus::SETTINGS_TYPE_KEY => [
'prePostParams',
'beforeSuccessResponse',
'afterCustomResultOutputProcess',
],
SettingsPaycek::SETTINGS_TYPE_KEY => [
'prePostParams',
'beforeSuccessResponse',
'afterCustomResultOutputProcess',
],
Expand Down
6 changes: 3 additions & 3 deletions src/Integrations/Mailer/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public function fallbackProcessingEmail(
*/
private function getDebugOptions(array $customData, array $formDetails): array
{
$customDebugData['originalParams'] = $formDetails[UtilsConfig::FD_PARAMS_ORIGINAL_DEBUG] ?? '';
$customDebugData['originalParams'] = $formDetails[UtilsConfig::FD_PARAMS_ORIGINAL] ?? '';

return \array_merge(
[
Expand All @@ -273,7 +273,7 @@ private function getDebugOptions(array $customData, array $formDetails): array
'userAgent' => isset($_SERVER['HTTP_USER_AGENT']) ? \sanitize_text_field(\wp_unslash($_SERVER['HTTP_USER_AGENT'])) : '',
'time' => \wp_date('Y-m-d H:i:s'),
'requestUrl' => Helpers::getCurrentUrl(),
'originalParams' => $formDetails[UtilsConfig::FD_PARAMS_ORIGINAL_DEBUG] ?? '',
'originalParams' => $formDetails[UtilsConfig::FD_PARAMS_ORIGINAL] ?? '',
],
$customData
);
Expand Down Expand Up @@ -441,7 +441,7 @@ private function cleanUpFormDetails(array $formDetails): array
UtilsConfig::FD_FIELDS,
UtilsConfig::FD_FIELDS_ONLY,
UtilsConfig::FD_ICON,
UtilsConfig::FD_PARAMS_ORIGINAL_DEBUG,
UtilsConfig::FD_PARAMS_ORIGINAL,
];

return \array_diff_key($formDetails, \array_flip($list));
Expand Down
10 changes: 10 additions & 0 deletions src/Rest/Routes/Integrations/Corvus/FormSubmitCorvusRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use EightshiftFormsVendor\EightshiftFormsUtils\Config\UtilsConfig;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsApiHelper;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsHelper;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsHooksHelper;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsSettingsHelper;

/**
Expand Down Expand Up @@ -94,6 +95,12 @@ protected function submitAction(array $formDetails)

$params = $this->prepareParams($mapParams, $formDetails['paramsRaw'], $formId);

// Filter params.
$filterName = UtilsHooksHelper::getFilterName(['integrations', SettingsCorvus::SETTINGS_TYPE_KEY, 'prePostParams']);
if (\has_filter($filterName)) {
$params = \apply_filters($filterName, $params, $formDetails['paramsRaw'], $mapParams, $formId) ?? [];
}

$reqParams = [
'store_id',
'amount',
Expand All @@ -114,6 +121,8 @@ protected function submitAction(array $formDetails)
);
}

unset($params['time']);

// Add signature.
$params['signature'] = \hash_hmac(
'sha256',
Expand Down Expand Up @@ -191,6 +200,7 @@ private function prepareParams(array $mapParams, array $params, string $formId):
$output['currency'] = UtilsSettingsHelper::getSettingValue(SettingsCorvus::SETTINGS_CORVUS_CURRENCY_KEY, $formId);
$output['order_number'] = "order_{$time}";
$output['cart'] = UtilsSettingsHelper::getSettingValue(SettingsCorvus::SETTINGS_CORVUS_CART_DESC_KEY, $formId);
$output['time'] = $time;

if (UtilsSettingsHelper::isSettingCheckboxChecked(SettingsCorvus::SETTINGS_CORVUS_IBAN_USE_KEY, SettingsCorvus::SETTINGS_CORVUS_IBAN_USE_KEY, $formId)) {
$output['creditor_reference'] = "HR00{$time}";
Expand Down
12 changes: 12 additions & 0 deletions src/Rest/Routes/Integrations/Paycek/FormSubmitPaycekRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use EightshiftFormsVendor\EightshiftFormsUtils\Config\UtilsConfig;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsApiHelper;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsHelper;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsHooksHelper;
use EightshiftFormsVendor\EightshiftFormsUtils\Helpers\UtilsSettingsHelper;

/**
Expand Down Expand Up @@ -94,6 +95,12 @@ protected function submitAction(array $formDetails)

$params = $this->prepareParams($mapParams, $formDetails['paramsRaw'], $formId);

// Filter params.
$filterName = UtilsHooksHelper::getFilterName(['integrations', SettingsPaycek::SETTINGS_TYPE_KEY, 'prePostParams']);
if (\has_filter($filterName)) {
$params = \apply_filters($filterName, $params, $formDetails['paramsRaw'], $mapParams, $formId) ?? [];
}

$reqParams = [
'profileCode',
'secretKey',
Expand All @@ -111,6 +118,8 @@ protected function submitAction(array $formDetails)
);
}

unset($params['time']);

// Set validation submit once.
$this->validator->setValidationSubmitOnce($formId);

Expand Down Expand Up @@ -182,6 +191,8 @@ private function prepareParams(array $mapParams, array $params, string $formId):
$output[$key] = $param;
}

$time = \time();

$output['secretKey'] = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiKeyPaycek(), SettingsPaycek::SETTINGS_PAYCEK_API_KEY_KEY)['value'];
$output['profileCode'] = UtilsSettingsHelper::getSettingsDisabledOutputWithDebugFilter(Variables::getApiProfileKeyPaycek(), SettingsPaycek::SETTINGS_PAYCEK_API_PROFILE_KEY)['value'];
$output['language'] = UtilsSettingsHelper::getSettingValue(SettingsPaycek::SETTINGS_PAYCEK_LANG_KEY, $formId);
Expand All @@ -190,6 +201,7 @@ private function prepareParams(array $mapParams, array $params, string $formId):
$output['urlSuccess'] = UtilsSettingsHelper::getSettingValue(SettingsPaycek::SETTINGS_PAYCEK_URL_SUCCESS, $formId);
$output['urlFail'] = UtilsSettingsHelper::getSettingValue(SettingsPaycek::SETTINGS_PAYCEK_URL_FAIL, $formId);
$output['urlCancel'] = UtilsSettingsHelper::getSettingValue(SettingsPaycek::SETTINGS_PAYCEK_URL_CANCEL, $formId);
$output['time'] = $time;

\ksort($output);

Expand Down

0 comments on commit a7966b3

Please sign in to comment.