Bugfix
This commit is contained in:
parent
986fa1d901
commit
2d265c76d2
|
|
@ -70,7 +70,7 @@ class ContactUncontactedCommand extends Command
|
||||||
$io->progressStart(count($phoneNumbersToContact));
|
$io->progressStart(count($phoneNumbersToContact));
|
||||||
|
|
||||||
// 2. Loop through each eligible phone number
|
// 2. Loop through each eligible phone number
|
||||||
foreach ($phoneNumbersToContact as $phoneNumber) {
|
foreach ($phoneNumbersToContact as $phoneContact) {
|
||||||
$io->progressAdvance();
|
$io->progressAdvance();
|
||||||
|
|
||||||
// 3. Contact the HTTP REST API
|
// 3. Contact the HTTP REST API
|
||||||
|
|
@ -79,7 +79,7 @@ class ContactUncontactedCommand extends Command
|
||||||
'query' => [
|
'query' => [
|
||||||
'producttoken' => $this->sms_gateway_api_key,
|
'producttoken' => $this->sms_gateway_api_key,
|
||||||
'body' => 'Bitte starten Sie die Umfrage jetzt: https://umfragetool.ukbonn.de/login?id=QMBEFR_TEST Ihr UKB.',
|
'body' => 'Bitte starten Sie die Umfrage jetzt: https://umfragetool.ukbonn.de/login?id=QMBEFR_TEST Ihr UKB.',
|
||||||
'to' => $phoneNumber,
|
'to' => $phoneContact->getPhoneNumber(),
|
||||||
'from' => 'UKB',
|
'from' => 'UKB',
|
||||||
'reference' => 'Test-Reference'
|
'reference' => 'Test-Reference'
|
||||||
]
|
]
|
||||||
|
|
@ -88,16 +88,16 @@ class ContactUncontactedCommand extends Command
|
||||||
// 4. Check the API response status
|
// 4. Check the API response status
|
||||||
if ($response->getStatusCode() === 200) {
|
if ($response->getStatusCode() === 200) {
|
||||||
// 5. If successful, update the row in the database
|
// 5. If successful, update the row in the database
|
||||||
$phoneNumber->setContacted(true);
|
$phoneContact->setContacted(true);
|
||||||
$phoneNumber->setGatewayResponse(trim($response->getStatusCode() . ' ' . $response->getContent()));
|
$phoneContact->setGatewayResponse(trim($response->getStatusCode() . ' ' . $response->getContent()));
|
||||||
$phoneNumber->setContactedAt(new DateTimeImmutable());
|
$phoneContact->setContactedAt(new DateTimeImmutable());
|
||||||
$this->entityManager->persist($phoneNumber);
|
$this->entityManager->persist($phoneContact);
|
||||||
$io->note(sprintf('Successfully contacted number %s', $phoneNumber->getPhoneNumber()));
|
$io->note(sprintf('Successfully contacted number %s', $phoneContact->getPhoneNumber()));
|
||||||
} else {
|
} else {
|
||||||
$io->warning(sprintf('API call for number %s failed with status code %s', $phoneNumber->getPhoneNumber(), $response->getStatusCode()));
|
$io->warning(sprintf('API call for number %s failed with status code %s', $phoneContact->getPhoneNumber(), $response->getStatusCode()));
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$io->error(sprintf('An error occurred contacting the API for number %s: %s', $phoneNumber->getPhoneNumber(), $e->getMessage()));
|
$io->error(sprintf('An error occurred contacting the API for number %s: %s', $phoneContact->getPhoneNumber(), $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user