feat: add Shoppro payment status synchronization service
- Implemented ShopproPaymentStatusSyncService to handle payment status synchronization between Shoppro and Orderpro. - Added methods for resolving watched status codes, finding candidate orders, and syncing individual order payments. - Introduced ShopproStatusMappingRepository for managing status mappings between Shoppro and Orderpro. - Created ShopproStatusSyncService to facilitate synchronization of order statuses from Shoppro to Orderpro.
This commit is contained in:
@@ -111,34 +111,35 @@ final class AllegroIntegrationController
|
||||
|
||||
public function save(Request $request): Response
|
||||
{
|
||||
$csrfError = $this->validateCsrf((string) $request->input('_token', ''));
|
||||
if ($csrfError !== null) {
|
||||
return $csrfError;
|
||||
$redirectTo = $this->resolveRedirectPath((string) $request->input('return_to', '/settings/integrations/allegro'));
|
||||
if (!Csrf::validate((string) $request->input('_token', ''))) {
|
||||
Flash::set('settings_error', $this->translator->get('auth.errors.csrf_expired'));
|
||||
return Response::redirect($redirectTo);
|
||||
}
|
||||
|
||||
$environment = trim((string) $request->input('environment', 'sandbox'));
|
||||
if (!in_array($environment, ['sandbox', 'production'], true)) {
|
||||
Flash::set('settings_error', $this->translator->get('settings.allegro.validation.environment_invalid'));
|
||||
return Response::redirect('/settings/integrations/allegro');
|
||||
return Response::redirect($redirectTo);
|
||||
}
|
||||
|
||||
$clientId = trim((string) $request->input('client_id', ''));
|
||||
if ($clientId !== '' && mb_strlen($clientId) > 128) {
|
||||
Flash::set('settings_error', $this->translator->get('settings.allegro.validation.client_id_too_long'));
|
||||
return Response::redirect('/settings/integrations/allegro');
|
||||
return Response::redirect($redirectTo);
|
||||
}
|
||||
|
||||
$redirectUriInput = trim((string) $request->input('redirect_uri', ''));
|
||||
$redirectUri = $redirectUriInput !== '' ? $redirectUriInput : $this->defaultRedirectUri();
|
||||
if (!$this->isValidHttpUrl($redirectUri)) {
|
||||
Flash::set('settings_error', $this->translator->get('settings.allegro.validation.redirect_uri_invalid'));
|
||||
return Response::redirect('/settings/integrations/allegro');
|
||||
return Response::redirect($redirectTo);
|
||||
}
|
||||
|
||||
$ordersFetchStartDate = trim((string) $request->input('orders_fetch_start_date', ''));
|
||||
if ($ordersFetchStartDate !== '' && !$this->isValidDate($ordersFetchStartDate)) {
|
||||
Flash::set('settings_error', $this->translator->get('settings.allegro.validation.orders_fetch_start_date_invalid'));
|
||||
return Response::redirect('/settings/integrations/allegro');
|
||||
return Response::redirect($redirectTo);
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -159,7 +160,7 @@ final class AllegroIntegrationController
|
||||
);
|
||||
}
|
||||
|
||||
return Response::redirect('/settings/integrations/allegro');
|
||||
return Response::redirect($redirectTo);
|
||||
}
|
||||
|
||||
public function saveImportSettings(Request $request): Response
|
||||
@@ -649,6 +650,19 @@ final class AllegroIntegrationController
|
||||
return Response::redirect('/settings/integrations/allegro');
|
||||
}
|
||||
|
||||
private function resolveRedirectPath(string $candidate): string
|
||||
{
|
||||
$value = trim($candidate);
|
||||
if ($value === '') {
|
||||
return '/settings/integrations/allegro';
|
||||
}
|
||||
if (!str_starts_with($value, '/settings/integrations')) {
|
||||
return '/settings/integrations/allegro';
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user