fix: Exception in dry-run with Gandi Provider

This commit is contained in:
Maël Gangloff
2024-08-06 11:58:41 +02:00
parent a603a2c7a0
commit 21298b07a2
4 changed files with 16 additions and 14 deletions

View File

@@ -118,6 +118,7 @@ export function ConnectorForm({form, onCreate}: { form: FormInstance, onCreate:
label={t`API Terms of Service`}
name={['authData', 'acceptConditions']}
rules={[{required: true, message: t`Required`}]}
style={{marginTop: '3em'}}
>
<Checkbox
required={true}>

View File

@@ -82,7 +82,8 @@ readonly class GandiConnector implements ConnectorInterface
$res = $this->client->request('POST', '/domain/domains', $httpOptions->toArray());
if (Response::HTTP_ACCEPTED !== $res->getStatusCode()) {
if ((!$dryRun && Response::HTTP_ACCEPTED !== $res->getStatusCode())
|| ($dryRun && Response::HTTP_OK !== $res->getStatusCode())) {
throw new \Exception($res->toArray()['message']);
}
}

View File

@@ -63,15 +63,15 @@ final readonly class ProcessDomainTriggerHandler
$isDebug = $this->kernel->isDebug();
if (ConnectorProvider::OVH === $connector->getProvider()) {
$ovh = new OvhConnector($connector->getAuthData());
$ovh->orderDomain($domain, $isDebug);
$provider = new OvhConnector($connector->getAuthData());
} elseif (ConnectorProvider::GANDI === $connector->getProvider()) {
$gandi = new GandiConnector($connector->getAuthData(), $this->client);
$gandi->orderDomain($domain, $isDebug);
$provider = new GandiConnector($connector->getAuthData(), $this->client);
} else {
throw new \Exception('Unknown provider');
}
$provider->orderDomain($domain, $isDebug);
$this->sendEmailDomainOrdered($domain, $connector, $watchList->getUser());
} catch (\Throwable) {
$this->logger->warning('Unable to complete purchase. An error message is sent to user {username}.', [

View File

@@ -25,8 +25,8 @@ msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:89
#: assets/components/tracking/ConnectorForm.tsx:100
#: assets/components/tracking/ConnectorForm.tsx:120
#: assets/components/tracking/ConnectorForm.tsx:133
#: assets/components/tracking/ConnectorForm.tsx:142
#: assets/components/tracking/ConnectorForm.tsx:134
#: assets/components/tracking/ConnectorForm.tsx:143
#: assets/components/tracking/WatchlistForm.tsx:103
msgid "Required"
msgstr ""
@@ -186,12 +186,12 @@ msgid ""
"that may be available soon."
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:153
#: assets/components/tracking/ConnectorForm.tsx:154
#: assets/components/tracking/WatchlistForm.tsx:186
msgid "Create"
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:156
#: assets/components/tracking/ConnectorForm.tsx:157
#: assets/components/tracking/WatchlistForm.tsx:189
msgid "Reset"
msgstr ""
@@ -232,27 +232,27 @@ msgstr ""
msgid "API Terms of Service"
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:125
#: assets/components/tracking/ConnectorForm.tsx:126
msgid ""
"I certify that I have read and accepted the conditions of use of the "
"Provider API, accessible from this hyperlink"
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:131
#: assets/components/tracking/ConnectorForm.tsx:132
msgid "Legal age"
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:136
#: assets/components/tracking/ConnectorForm.tsx:137
msgid ""
"I certify on my honor that I am of the minimum age required to consent to "
"these conditions"
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:140
#: assets/components/tracking/ConnectorForm.tsx:141
msgid "Withdrawal period"
msgstr ""
#: assets/components/tracking/ConnectorForm.tsx:145
#: assets/components/tracking/ConnectorForm.tsx:146
msgid ""
"I expressly waive my right of withdrawal regarding the purchase of domain "
"names via the Provider's API"